UNPKG

jodit-pro

Version:

PRO Version of Jodit Editor

7 lines (6 loc) 3.01 kB
var g=Object.defineProperty;var r=(d,t)=>g(d,"name",{value:t,configurable:!0});var a,c=function(d,t,e,i){var l=arguments.length,s=l<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(d,t,e,i);else for(var o=d.length-1;o>=0;o--)(n=d[o])&&(s=(l<3?n(s):l>3?n(t,e,s):n(t,e))||s);return l>3&&s&&Object.defineProperty(t,e,s),s};import{UIDialogSettings as u}from"./dialog-settings.js";import{UIGlobalSettings as p}from"./global-settings.js";import{component as m,hook as v,watch as _}from"jodit/esm/core/decorators/index.js";import{UIElement as S}from"jodit/esm/core/ui/index.js";let h=(a=class extends S{className(){return"UISettingsPopup"}constructor(t,e,i,l,s){super(t),this.state=e,this.options=i,this.getConversation=l,this.updateConversation=s,this.globalSettings=null,this.dialogSettings=null}async onChangeTheme(){var t,e,i;const l=!((t=this.state)===null||t===void 0)&&t.theme&&((e=this.state)===null||e===void 0?void 0:e.theme)!=="parent"?(i=this.state)===null||i===void 0?void 0:i.theme:this.j.o.theme;this.container.classList.remove("jodit_theme_dark","jodit_theme_light"),this.container.classList.add("jodit_theme_"+l)}update(){var t,e;return(t=this.dialogSettings)===null||t===void 0||t.update(),(e=this.globalSettings)===null||e===void 0||e.update(),this.updateContent(),super.update()}setParentView(t){var e,i;return(e=this.globalSettings)===null||e===void 0||e.setParentView(t),(i=this.dialogSettings)===null||i===void 0||i.setParentView(t),super.setParentView(t)}render(){return`<div class="&__container"> <div class="&__header"> <h3 class="&__title">~Settings~</h3> </div> <div class="&__content"></div> </div>`}async updateContent(){const t=this.getElm("content");if(!t)return;t.innerHTML="";const e=this.options,i=e.allowEditDisplayMode||e.allowEditPanelWidth||e.allowEditTheme,l=e.allowEditDialogSettings;if(i){const n=document.createElement("div");n.className=this.getFullElName("section");const o=document.createElement("h4");o.className=this.getFullElName("section-title"),o.textContent=this.j.i18n("General Settings"),n.appendChild(o),this.globalSettings=new p(this.j,this.state,this.options),n.appendChild(this.globalSettings.container),t.appendChild(n)}const s=this.getConversation();if(l&&s){const n=document.createElement("div");n.className=this.getFullElName("section");const o=document.createElement("h4");o.className=this.getFullElName("section-title"),o.textContent=this.j.i18n("Conversation Settings"),n.appendChild(o),this.dialogSettings=new u(this.j,()=>this.getConversation(),this.updateConversation,this.state,this.options),n.appendChild(this.dialogSettings.container),t.appendChild(n)}}destruct(){var t,e;(t=this.globalSettings)===null||t===void 0||t.destruct(),(e=this.dialogSettings)===null||e===void 0||e.destruct(),super.destruct()}},r(a,"UISettingsPopup"),a);c([_("state.theme"),v("ready")],h.prototype,"onChangeTheme",null),h=c([m],h);export{h as UISettingsPopup};