| 
									
										
										
										
											2023-08-21 04:17:16 -04:00
										 |  |  | <!DOCTYPE html> | 
					
						
							|  |  |  | <html lang="en"> | 
					
						
							|  |  |  | <head> | 
					
						
							|  |  |  |     <meta charset="utf-8"> | 
					
						
							|  |  |  |     <title>JSDoc: Source: widgets/right_panel_widget.js</title> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     <script src="scripts/prettify/prettify.js"> </script> | 
					
						
							|  |  |  |     <script src="scripts/prettify/lang-css.js"> </script> | 
					
						
							|  |  |  |     <!--[if lt IE 9]>
 | 
					
						
							|  |  |  |       <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> | 
					
						
							|  |  |  |     <![endif]--> | 
					
						
							|  |  |  |     <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> | 
					
						
							|  |  |  |     <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> | 
					
						
							|  |  |  | </head> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <body> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <div id="main"> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     <h1 class="page-title">Source: widgets/right_panel_widget.js</h1> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |      | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |      | 
					
						
							|  |  |  |     <section> | 
					
						
							|  |  |  |         <article> | 
					
						
							|  |  |  |             <pre class="prettyprint source linenums"><code>import NoteContextAwareWidget from "./note_context_aware_widget.js"; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | const WIDGET_TPL = ` | 
					
						
							|  |  |  | <div class="card widget"> | 
					
						
							| 
									
										
										
										
											2023-11-03 12:23:14 +01:00
										 |  |  |     <div class="card-header"> | 
					
						
							|  |  |  |         <div class="card-header-title"></div> | 
					
						
							|  |  |  |         <div class="card-header-buttons"></div> | 
					
						
							|  |  |  |     </div> | 
					
						
							| 
									
										
										
										
											2023-08-21 04:17:16 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  |     <div id="[to be set]" class="body-wrapper"> | 
					
						
							|  |  |  |         <div class="card-body"></div> | 
					
						
							|  |  |  |     </div> | 
					
						
							|  |  |  | </div>`; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /** | 
					
						
							|  |  |  |  * This widget manages rendering panels in the right-hand pane. | 
					
						
							|  |  |  |  * @extends {NoteContextAwareWidget} | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | class RightPanelWidget extends NoteContextAwareWidget { | 
					
						
							|  |  |  |     /** Title to show in the panel. */ | 
					
						
							|  |  |  |     get widgetTitle() { return "Untitled widget"; } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-11-03 12:23:14 +01:00
										 |  |  |     get widgetButtons() { return []; } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-21 04:17:16 -04:00
										 |  |  |     get help() { return {}; } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-11-03 12:23:14 +01:00
										 |  |  |     constructor() { | 
					
						
							|  |  |  |         super(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         this.child(...this.widgetButtons); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-21 04:17:16 -04:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2023-11-03 12:23:14 +01:00
										 |  |  |      * Do not override this method unless you know what you're doing. | 
					
						
							| 
									
										
										
										
											2023-08-21 04:17:16 -04:00
										 |  |  |      * Do not override this method unless you know what you're doing. | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     doRender() { | 
					
						
							|  |  |  |         this.$widget = $(WIDGET_TPL); | 
					
						
							|  |  |  |         this.contentSized(); | 
					
						
							|  |  |  |         this.$widget.find('[data-target]').attr('data-target', `#${this.componentId}`); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         this.$bodyWrapper = this.$widget.find('.body-wrapper'); | 
					
						
							|  |  |  |         this.$bodyWrapper.attr('id', this.componentId); // for toggle to work we need id | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         this.$body = this.$bodyWrapper.find('.card-body'); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-11-03 12:23:14 +01:00
										 |  |  |         this.$title = this.$widget.find('.card-header .card-header-title'); | 
					
						
							| 
									
										
										
										
											2023-08-21 04:17:16 -04:00
										 |  |  |         this.$title.text(this.widgetTitle); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-11-03 12:23:14 +01:00
										 |  |  |         this.$buttons = this.$widget.find('.card-header .card-header-buttons'); | 
					
						
							|  |  |  |         this.$buttons.empty(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         for (const buttonWidget of this.children) { | 
					
						
							|  |  |  |             this.$buttons.append(buttonWidget.render()); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-21 04:17:16 -04:00
										 |  |  |         this.initialized = this.doRenderBody(); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							| 
									
										
										
										
											2023-11-03 12:23:14 +01:00
										 |  |  |      * Method used for rendering the body of the widget (via existing this.$body) | 
					
						
							|  |  |  |      * | 
					
						
							| 
									
										
										
										
											2023-08-21 04:17:16 -04:00
										 |  |  |      * Your class should override this method. | 
					
						
							| 
									
										
										
										
											2023-11-03 12:23:14 +01:00
										 |  |  |      * @returns {Promise|undefined} if widget needs async operation to initialize, it can return a Promise | 
					
						
							| 
									
										
										
										
											2023-08-21 04:17:16 -04:00
										 |  |  |      */ | 
					
						
							|  |  |  |     async doRenderBody() {} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-11-03 12:23:14 +01:00
										 |  |  | export default RightPanelWidget; | 
					
						
							|  |  |  | </code></pre> | 
					
						
							| 
									
										
										
										
											2023-08-21 04:17:16 -04:00
										 |  |  |         </article> | 
					
						
							|  |  |  |     </section> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | </div> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <nav> | 
					
						
							| 
									
										
										
										
											2023-09-25 23:11:24 +02:00
										 |  |  |     <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="BasicWidget.html">BasicWidget</a></li><li><a href="FAttachment.html">FAttachment</a></li><li><a href="FAttribute.html">FAttribute</a></li><li><a href="FBranch.html">FBranch</a></li><li><a href="FNote.html">FNote</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li><li><a href="NoteContextAwareWidget.html">NoteContextAwareWidget</a></li><li><a href="RightPanelWidget.html">RightPanelWidget</a></li></ul><h3>Global</h3><ul><li><a href="global.html#api">api</a></li><li><a href="global.html#getJsonContent">getJsonContent</a></li><li><a href="global.html#getJsonContentSafely">getJsonContentSafely</a></li></ul> | 
					
						
							| 
									
										
										
										
											2023-08-21 04:17:16 -04:00
										 |  |  | </nav> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <br class="clear"> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <footer> | 
					
						
							|  |  |  |     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.2</a> | 
					
						
							|  |  |  | </footer> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <script> prettyPrint(); </script> | 
					
						
							|  |  |  | <script src="scripts/linenumber.js"> </script> | 
					
						
							|  |  |  | </body> | 
					
						
							|  |  |  | </html> |