widgets_collapsible_widget.js.html 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>JSDoc: Source: widgets/collapsible_widget.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: widgets/collapsible_widget.js</h1>
  17. <section>
  18. <article>
  19. <pre class="prettyprint source linenums"><code>import NoteContextAwareWidget from "./note_context_aware_widget.js";
  20. const WIDGET_TPL = `
  21. &lt;div class="card widget">
  22. &lt;div class="card-header">&lt;/div>
  23. &lt;div id="[to be set]" class="body-wrapper">
  24. &lt;div class="card-body">&lt;/div>
  25. &lt;/div>
  26. &lt;/div>`;
  27. export default class CollapsibleWidget extends NoteContextAwareWidget {
  28. get widgetTitle() { return "Untitled widget"; }
  29. get help() { return {}; }
  30. doRender() {
  31. this.$widget = $(WIDGET_TPL);
  32. this.contentSized();
  33. this.$widget.find('[data-target]').attr('data-target', "#" + this.componentId);
  34. this.$bodyWrapper = this.$widget.find('.body-wrapper');
  35. this.$bodyWrapper.attr('id', this.componentId); // for toggle to work we need id
  36. this.$body = this.$bodyWrapper.find('.card-body');
  37. this.$title = this.$widget.find('.card-header');
  38. this.$title.text(this.widgetTitle);
  39. this.initialized = this.doRenderBody();
  40. }
  41. /** for overriding */
  42. async doRenderBody() {}
  43. isExpanded() {
  44. return this.$bodyWrapper.hasClass("show");
  45. }
  46. }
  47. </code></pre>
  48. </article>
  49. </section>
  50. </div>
  51. <nav>
  52. <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Attribute.html">Attribute</a></li><li><a href="Branch.html">Branch</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li><li><a href="NoteComplement.html">NoteComplement</a></li><li><a href="NoteShort.html">NoteShort</a></li></ul><h3>Global</h3><ul><li><a href="global.html#doRenderBody">doRenderBody</a></li></ul>
  53. </nav>
  54. <br class="clear">
  55. <footer>
  56. Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a>
  57. </footer>
  58. <script> prettyPrint(); </script>
  59. <script src="scripts/linenumber.js"> </script>
  60. </body>
  61. </html>