jodit-pro
Version:
PRO Version of Jodit Editor
2 lines (1 loc) • 1.53 kB
JavaScript
var a=Object.defineProperty;var u=(s,t)=>a(s,"name",{value:t,configurable:!0});var i,p=function(s,t,o,n){var h=arguments.length,e=h<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,o):n,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")e=Reflect.decorate(s,t,o,n);else for(var c=s.length-1;c>=0;c--)(r=s[c])&&(e=(h<3?r(e):h>3?r(t,o,e):r(t,o))||e);return h>3&&e&&Object.defineProperty(t,o,e),e};import{UIBackupList as d}from"./list.js";import{autobind as m,component as f}from"jodit/esm/core/decorators/index.js";import{UIElement as I}from"jodit/esm/core/ui/element.js";let l=(i=class extends I{className(){return"UIBackupBox"}constructor(t){super(t),this.list=new d(this.j),this.preview=this.j.c.div(this.getFullElName("preview")),this.container.appendChild(this.list.container),this.container.appendChild(this.preview),this.list.container.classList.add(this.getFullElName("list")),t.e.on(this.list,"select",this.onSelectItem).on(this.list,"choose",this.onChooseItem)}build(t){this.preview.innerHTML="",this.list.build(t)}destruct(){return this.j.e.off(this.list,"select",this.onSelectItem),this.list.destruct(),super.destruct()}onSelectItem(t){this.latestSelected=t,this.preview.innerHTML=t.html||`<div class="${this.getFullElName("empty")}">${this.j.i18n("Empty")}</div>`}onChooseItem(t){this.j.e.fire(this,"choose",t)}chooseSelected(){this.onChooseItem(this.latestSelected)}},u(i,"UIBackupBox"),i);p([m],l.prototype,"onSelectItem",null),p([m],l.prototype,"onChooseItem",null),l=p([f],l);export{l as UIBackupBox};