@@ -31,7 +31,7 @@ const DOCK_TYPE = "dock_tab";
3131
3232export default class PluginSample extends Plugin {
3333
34- private customTab : ( ) => IModel ;
34+ customTab : ( ) => IModel ;
3535 private isMobile : boolean ;
3636 private blockIconEventBindThis = this . blockIconEvent . bind ( this ) ;
3737 private settingUtils : SettingUtils ;
@@ -262,6 +262,28 @@ export default class PluginSample extends Plugin {
262262 }
263263 }
264264 } ) ;
265+ this . settingUtils . addItem ( {
266+ key : "Custom Element" ,
267+ value : "" ,
268+ type : "custom" ,
269+ direction : "row" ,
270+ title : "Custom Element" ,
271+ description : "Custom Element description" ,
272+ //Any custom element must offer the following methods
273+ createElement : ( currentVal : any ) => {
274+ let div = document . createElement ( 'div' ) ;
275+ div . style . border = "1px solid var(--b3-theme-primary)" ;
276+ div . contentEditable = "true" ;
277+ div . textContent = currentVal ;
278+ return div ;
279+ } ,
280+ getEleVal : ( ele : HTMLElement ) => {
281+ return ele . textContent ;
282+ } ,
283+ setEleVal : ( ele : HTMLElement , val : any ) => {
284+ ele . textContent = val ;
285+ }
286+ } ) ;
265287 this . settingUtils . addItem ( {
266288 key : "Hint" ,
267289 value : "" ,
@@ -437,7 +459,7 @@ export default class PluginSample extends Plugin {
437459 title : `SiYuan ${ Constants . SIYUAN_VERSION } ` ,
438460 content : `<div id="helloPanel" class="b3-dialog__content"></div>` ,
439461 width : this . isMobile ? "92vw" : "720px" ,
440- destroyCallback ( options ) {
462+ destroyCallback ( ) {
441463 // hello.$destroy();
442464 } ,
443465 } ) ;
0 commit comments