presentation.js.html 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>JSDoc: Source: presentation.js</title>
  6. <script src="scripts/prettify/prettify.js"> </script>
  7. <script src="scripts/prettify/lang-css.js"> </script>
  8. <!--[if lt IE 9]>
  9. <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
  10. <![endif]-->
  11. <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
  12. <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
  13. </head>
  14. <body>
  15. <div id="main">
  16. <h1 class="page-title">Source: presentation.js</h1>
  17. <section>
  18. <article>
  19. <pre class="prettyprint source linenums"><code>/**
  20. * An object for managing the blob of text at the top of a problem describing it.
  21. * This isn't a very busy component.
  22. *
  23. * TODO: Isn't most of this redundant now?
  24. *
  25. * @constructor
  26. * @this {BlockPyEditor}
  27. * @param {Object} main - The main BlockPy instance
  28. * @param {HTMLElement} tag - The HTML object this is attached to.
  29. */
  30. function BlockPyPresentation(main, tag) {
  31. this.main = main;
  32. this.tag = tag;
  33. var presentationEditor = this;
  34. //this.main.model.settings.instructor.subscribe(function() {presentationEditor.setVisible()});
  35. }
  36. /**
  37. * Removes the editor when it's not in use.
  38. * DEPRECATED
  39. */
  40. BlockPyPresentation.prototype.closeEditor = function() {
  41. this.tag.destroy();
  42. };
  43. /**
  44. * Updates the contents of the presentation blob, possibly updating the
  45. * editor's size too.
  46. *
  47. * @param {String} content - The new text of the presentation blob.
  48. */
  49. BlockPyPresentation.prototype.setBody = function(content) {
  50. this.main.model.assignment.introduction(content);
  51. this.main.components.editor.blockly.resize();
  52. };
  53. /**
  54. * Makes the editor available or not.
  55. * DEPRECATED.
  56. */
  57. BlockPyPresentation.prototype.setVisible = function() {
  58. if (this.main.model.settings.instructor()) {
  59. this.startEditor();
  60. } else {
  61. this.closeEditor();
  62. }
  63. }
  64. /**
  65. * Creates the Summer Note editor for the presentation blob.
  66. * DEPRECATED.
  67. */
  68. BlockPyPresentation.prototype.startEditor = function() {
  69. var presentationEditor = this;
  70. this.tag.summernote({
  71. codemirror: { // codemirror options
  72. theme: 'monokai'
  73. },
  74. onChange: function(content) {presentationEditor.setBody(content)},
  75. toolbar: [
  76. ['style', ['bold', 'italic', 'underline', 'clear']],
  77. ['font', ['fontname', 'fontsize']],
  78. ['insert', ['link', 'table', 'ul', 'ol']],
  79. ['misc', ['codeview', 'help']]
  80. ]
  81. });
  82. this.tag.code(this.main.model.assignment.introduction());
  83. //this.name.tag();
  84. };</code></pre>
  85. </article>
  86. </section>
  87. </div>
  88. <nav>
  89. <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="BlockPy.html">BlockPy</a></li><li><a href="BlockPyCorgis.html">BlockPyCorgis</a></li><li><a href="BlockPyDialog.html">BlockPyDialog</a></li><li><a href="BlockPyEditor.html">BlockPyEditor</a></li><li><a href="BlockPyEngine.html">BlockPyEngine</a></li><li><a href="BlockPyEnglish.html">BlockPyEnglish</a></li><li><a href="BlockPyFeedback.html">BlockPyFeedback</a></li><li><a href="BlockPyHistory.html">BlockPyHistory</a></li><li><a href="BlockPyPresentation.html">BlockPyPresentation</a></li><li><a href="BlockPyPrinter.html">BlockPyPrinter</a></li><li><a href="BlockPyServer.html">BlockPyServer</a></li><li><a href="BlockPyToolbar.html">BlockPyToolbar</a></li><li><a href="LocalStorageWrapper.html">LocalStorageWrapper</a></li><li><a href="PythonToBlocks.html">PythonToBlocks</a></li></ul><h3>Global</h3><ul><li><a href="global.html#BlockPyInterface">BlockPyInterface</a></li><li><a href="global.html#cloneNode">cloneNode</a></li><li><a href="global.html#encodeHTML">encodeHTML</a></li><li><a href="global.html#expandArray">expandArray</a></li><li><a href="global.html#EXTENDED_ERROR_EXPLANATION">EXTENDED_ERROR_EXPLANATION</a></li><li><a href="global.html#indent">indent</a></li><li><a href="global.html#instructor_module">instructor_module</a></li><li><a href="global.html#prettyPrintDateTime">prettyPrintDateTime</a></li><li><a href="global.html#randomInteger">randomInteger</a></li><li><a href="global.html#set_button_loaded">set_button_loaded</a></li><li><a href="global.html#timerGuard">timerGuard</a></li></ul>
  90. </nav>
  91. <br class="clear">
  92. <footer>
  93. Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Sun Mar 26 2017 09:45:03 GMT-0400 (Eastern Daylight Time)
  94. </footer>
  95. <script> prettyPrint(); </script>
  96. <script src="scripts/linenumber.js"> </script>
  97. </body>
  98. </html>