trilium/docs/frontend_api/widgets_collapsible_widget.js.html

90 lines
2.5 KiB
HTML
Raw Normal View History

2020-04-22 05:14:55 +08:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Source: widgets/collapsible_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/collapsible_widget.js</h1>
<section>
<article>
2021-09-30 18:26:13 +08:00
<pre class="prettyprint source linenums"><code>import NoteContextAwareWidget from "./note_context_aware_widget.js";
2020-04-22 05:14:55 +08:00
const WIDGET_TPL = `
&lt;div class="card widget">
2021-09-30 18:26:13 +08:00
&lt;div class="card-header">&lt;/div>
2020-04-22 05:14:55 +08:00
2021-09-30 18:26:13 +08:00
&lt;div id="[to be set]" class="body-wrapper">
2020-04-22 05:14:55 +08:00
&lt;div class="card-body">&lt;/div>
&lt;/div>
&lt;/div>`;
/**
* TODO: rename, it's not collapsible anymore
*/
2021-09-30 18:26:13 +08:00
export default class CollapsibleWidget extends NoteContextAwareWidget {
2020-04-22 05:14:55 +08:00
get widgetTitle() { return "Untitled widget"; }
get help() { return {}; }
doRender() {
this.$widget = $(WIDGET_TPL);
2020-10-01 04:48:30 +08:00
this.contentSized();
2022-12-22 21:57:00 +08:00
this.$widget.find('[data-target]').attr('data-target', `#${this.componentId}`);
2020-04-22 05:14:55 +08:00
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');
2021-09-30 18:26:13 +08:00
this.$title = this.$widget.find('.card-header');
2020-04-22 05:14:55 +08:00
this.$title.text(this.widgetTitle);
this.initialized = this.doRenderBody();
}
/** for overriding */
async doRenderBody() {}
2020-10-01 04:48:30 +08:00
}
</code></pre>
2020-04-22 05:14:55 +08:00
</article>
</section>
</div>
<nav>
2022-11-08 04:26:13 +08:00
<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><li><a href="module.exports.html">exports</a></li></ul><h3>Global</h3><ul><li><a href="global.html#doRenderBody">doRenderBody</a></li></ul>
2020-04-22 05:14:55 +08:00
</nav>
<br class="clear">
<footer>
2022-11-08 04:26:13 +08:00
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.0</a>
2020-04-22 05:14:55 +08:00
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>