diff --git a/package-lock.json b/package-lock.json index c3bd7a9..82334c2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,15 +1,15 @@ { "name": "ddei-editor", - "version": "1.2.41-114", + "version": "1.2.41-121", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "ddei-editor", - "version": "1.2.41-114", + "version": "1.2.41-121", "license": "Apache License 2.0", "dependencies": { - "ddei-framework": "file:///Users/hoslay/work/ddei/ddei-framework/ddei-framework-1.2.41-114.tgz" + "ddei-framework": "file:///Users/hoslay/work/ddei/ddei-framework/ddei-framework-1.2.41-121.tgz" }, "devDependencies": { "@tsconfig/node18": "^18.2.0", @@ -518,9 +518,9 @@ "integrity": "sha512-tdMuLdcJyreope1BWfnYqTQaIkSIrU/KtY9yX5mNGd+tYeJ0Y99ARHDuYnEABPX/8yh/r0Kl169v5ODg2vr98g==" }, "node_modules/ddei-framework": { - "version": "1.2.41-114", - "resolved": "file:../ddei-framework/ddei-framework-1.2.41-114.tgz", - "integrity": "sha512-NkwtXb+lwp3SbV3f4l9SeDAWelXEw4IKxpYnuZTeCrnxI2zqp9Ug5ApD3yYgJOf/NA0jw482buJ04CInQYWikw==", + "version": "1.2.41-121", + "resolved": "file:../ddei-framework/ddei-framework-1.2.41-121.tgz", + "integrity": "sha512-M7/2QFzEjt1m4HUusaagSL17/G4UUT9ks75Cs4UXB5/SPls9xMqZCRu29Wb1kTQ4M9Z7xlO0ArcOju6dsvY/+w==", "license": "Apache License 2.0", "dependencies": { "ddei-autolink": "^1.1.1", diff --git a/package.json b/package.json index d5a0d52..0a26aa5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ddei-editor", - "version": "1.2.41-114", + "version": "1.2.41-121", "private": false, "type": "module", "author": "hoslay <3697355039@qq.com>", @@ -49,7 +49,7 @@ "type-check": "vue-tsc --noEmit -p tsconfig.app.json --composite false" }, "dependencies": { - "ddei-framework": "file:///Users/hoslay/work/ddei/ddei-framework/ddei-framework-1.2.41-114.tgz" + "ddei-framework": "file:///Users/hoslay/work/ddei/ddei-framework/ddei-framework-1.2.41-121.tgz" }, "devDependencies": { "@tsconfig/node18": "^18.2.0", diff --git a/plugins/core/dialogs/ChooseControlDialog.vue b/plugins/core/dialogs/ChooseControlDialog.vue index 7009bdf..dadfb28 100644 --- a/plugins/core/dialogs/ChooseControlDialog.vue +++ b/plugins/core/dialogs/ChooseControlDialog.vue @@ -2,8 +2,11 @@
-
+
{{ control.name }}
@@ -52,11 +55,33 @@ export default { } }, - ok(control){ + ok(control, evt) { + delete this.isDrag + delete this.dragControl if (this.editor?.tempPopData[this.dialogId]?.callback?.ok) { - this.editor?.tempPopData[this.dialogId]?.callback?.ok(this.group,control); + this.editor?.tempPopData[this.dialogId]?.callback?.ok(this.group, control, evt); } - } + }, + + prepareDrag(control, evt) { + if (this.editor?.tempPopData[this.dialogId]?.callback?.drag) { + this.isDrag = true + this.dragControl = control + } + + }, + + dragMove(evt) { + if (this.isDrag){ + if (this.editor?.tempPopData[this.dialogId]?.callback?.drag) { + + this.editor?.tempPopData[this.dialogId]?.callback?.drag(this.group, this.dragControl, evt); + delete this.isDrag + delete this.dragControl + } + } + }, + } }; diff --git a/plugins/core/hotkeys/actions/key-action-rerevoke.ts b/plugins/core/hotkeys/actions/key-action-rerevoke.ts index 7b4063c..5f318ca 100644 --- a/plugins/core/hotkeys/actions/key-action-rerevoke.ts +++ b/plugins/core/hotkeys/actions/key-action-rerevoke.ts @@ -74,6 +74,7 @@ class DDeiKeyActionReRevoke extends DDeiKeyAction { let jsonData = JSON.parse(hisData?.data) if (jsonData) { let ddInstance = editor?.ddInstance; + ddInstance.stage.destroyRender() let hisFile = DDeiFile.loadFromJSON(jsonData, { currentDdInstance: ddInstance, }); @@ -109,6 +110,7 @@ class DDeiKeyActionReRevoke extends DDeiKeyAction { if (hisData?.data) { let jsonData = JSON.parse(hisData?.data) if (jsonData) { + ddInstance.stage.destroyRender() let tempData = { "currentDdInstance": ddInstance, "currentStage": ddInstance.stage } tempData[ddInstance.stage.id] = ddInstance.stage let layers = []; diff --git a/plugins/core/hotkeys/actions/key-action-revoke.ts b/plugins/core/hotkeys/actions/key-action-revoke.ts index 60ed0c3..a631f5b 100644 --- a/plugins/core/hotkeys/actions/key-action-revoke.ts +++ b/plugins/core/hotkeys/actions/key-action-revoke.ts @@ -75,6 +75,7 @@ class DDeiKeyActionRevoke extends DDeiKeyAction { let jsonData = JSON.parse(hisData?.data) if (jsonData) { let ddInstance = editor?.ddInstance; + ddInstance.stage.destroyRender() let hisFile = DDeiFile.loadFromJSON(jsonData, { currentDdInstance: ddInstance, }); @@ -108,10 +109,12 @@ class DDeiKeyActionRevoke extends DDeiKeyAction { } else if (histype == 'stage') { //修改当前操作控件坐标 if (ddInstance && ddInstance.stage) { + let hisData = ddInstance.stage.revokeHistroyData(); if (hisData?.data) { let jsonData = JSON.parse(hisData?.data) if (jsonData) { + ddInstance.stage.destroyRender() let tempData = { "currentDdInstance": ddInstance, "currentStage": ddInstance.stage } tempData[ddInstance.stage.id] = ddInstance.stage let layers = []; diff --git a/plugins/core/layouts/simple-layout.ts b/plugins/core/layouts/simple-layout.ts index 30e2aad..5bb0d72 100644 --- a/plugins/core/layouts/simple-layout.ts +++ b/plugins/core/layouts/simple-layout.ts @@ -12,7 +12,7 @@ class DDeiCoreSimpleLayout extends DDeiPluginBase{ static defaultIns: DDeiCoreSimpleLayout = new DDeiCoreSimpleLayout(); defaultOptions: object = { - other: ['ddei-core-panel-toolbox-simple'], + other: ['ddei-core-panel-toolbox-simple', 'ddei-core-panel-topmenu-simple'], middle: ['ddei-core-panel-canvasview'], right: [], bottom: ['ddei-core-panel-bottommenu'] diff --git a/plugins/core/panels/common/FileInfo.vue b/plugins/core/panels/common/FileInfo.vue index 3f84bdb..a5602ca 100644 --- a/plugins/core/panels/common/FileInfo.vue +++ b/plugins/core/panels/common/FileInfo.vue @@ -302,7 +302,7 @@ export default { new DDeiSheet({ name: "页面-1", desc: "页面-1", - stage: DDeiStage.initByJSON({ id: "stage_1" }), + stage: DDeiStage.initByJSON({ id: "stage_1" }, { currentDdInstance: ddInstance }), active: DDeiActiveType.ACTIVE, }), ], @@ -321,6 +321,7 @@ export default { this.editor.currentFileIndex = this.editor.files.length - 1; let sheets = file?.sheets; if (file && sheets && ddInstance) { + ddInstance.stage.destroyRender() let stage = sheets[0].stage; stage.ddInstance = ddInstance; //刷新页面 diff --git a/plugins/core/panels/index.ts b/plugins/core/panels/index.ts index 631be50..7d214fe 100644 --- a/plugins/core/panels/index.ts +++ b/plugins/core/panels/index.ts @@ -8,6 +8,7 @@ import DDeiCoreCanvasViewPanel from './canvasview'; import DDeiCoreBottomMenuPanel from './bottommenu'; import DDeiCoreCommonPanels from './common'; import DDeiCoreBottomPanels from './bottom'; +import DDeiCoreSimplePanels from './simple'; class DDeiCorePanels extends DDeiPluginBase{ @@ -18,7 +19,7 @@ class DDeiCorePanels extends DDeiPluginBase{ static defaultIns:DDeiCorePanels = new DDeiCorePanels(null); plugins: object[] = [DDeiCoreTopMenuPanel, DDeiCoreToolboxPanel, DDeiCoreQuickColorViewPanel, DDeiCorePropertyViewPanel, - DDeiCoreOpenFilesViewPanel, DDeiCoreCanvasViewPanel, DDeiCoreBottomMenuPanel, DDeiCoreCommonPanels, DDeiCoreBottomPanels] + DDeiCoreOpenFilesViewPanel, DDeiCoreCanvasViewPanel, DDeiCoreBottomMenuPanel, DDeiCoreCommonPanels, DDeiCoreBottomPanels, DDeiCoreSimplePanels] getPanels(editor){ let panels = [] @@ -61,8 +62,9 @@ export * from './canvasview' export * from './bottommenu' export * from './common' export * from './bottom' +export * from './simple' export { DDeiCorePanels, DDeiCoreTopMenuPanel, DDeiCoreToolboxPanel, DDeiCoreQuickColorViewPanel, DDeiCorePropertyViewPanel, - DDeiCoreOpenFilesViewPanel, DDeiCoreCanvasViewPanel, DDeiCoreBottomMenuPanel, DDeiCoreCommonPanels, DDeiCoreBottomPanels + DDeiCoreOpenFilesViewPanel, DDeiCoreCanvasViewPanel, DDeiCoreBottomMenuPanel, DDeiCoreCommonPanels, DDeiCoreBottomPanels, DDeiCoreSimplePanels } export default DDeiCorePanels \ No newline at end of file diff --git a/plugins/core/panels/toolbox/ToolboxSimple.vue b/plugins/core/panels/simple/ToolboxSimple.vue similarity index 97% rename from plugins/core/panels/toolbox/ToolboxSimple.vue rename to plugins/core/panels/simple/ToolboxSimple.vue index 2c34a8b..b103aa1 100644 --- a/plugins/core/panels/toolbox/ToolboxSimple.vue +++ b/plugins/core/panels/simple/ToolboxSimple.vue @@ -251,7 +251,8 @@ export default { if ((layer.display == 0 && !layer.tempDisplay) || layer.lock) { return; } - DDeiEditorUtil.hiddenDialog(this.editor, "ddei-core-dialog-choosecontrol") + + //创建控件 if(control){ if (editMode != 4){ @@ -307,6 +308,7 @@ export default { this.editor.changeState(DDeiEditorState.DESIGNING); } } + DDeiEditorUtil.hiddenDialog(this.editor, "ddei-core-dialog-choosecontrol") }, @@ -340,7 +342,8 @@ export default { DDeiEditorUtil.showDialog(this.editor, "ddei-core-dialog-choosecontrol", { controlGroup: group, callback: { - ok: this.changeGroupControl + ok: this.changeGroupControl, + drag: this.options?.dragCreate == 1 ? this.dragCreateControlPrepare : null } }, { type: type,hiddenMask: true }, el, true, true) } @@ -349,7 +352,7 @@ export default { }, - changeGroupControl(group,control){ + changeGroupControl(group,control,evt){ this.changeEditMode(group?.editMode) if(group?.editMode == 4){ DDeiEditorUtil.lineInitJSON = { @@ -367,6 +370,19 @@ export default { }); }, + dragCreateControlPrepare(group, control,evt){ + + this.changeEditMode(group?.editMode) + group.currentControl = control + if (this.options?.dragCreate){ + this.createControlPrepare(group,evt) + } + this.forceRefreshGroup = false + this.$nextTick(() => { + this.forceRefreshGroup = true; + }); + }, + /** * 准备拖拽 */ diff --git a/plugins/core/panels/simple/TopMenuSimple.vue b/plugins/core/panels/simple/TopMenuSimple.vue new file mode 100644 index 0000000..9b839be --- /dev/null +++ b/plugins/core/panels/simple/TopMenuSimple.vue @@ -0,0 +1,553 @@ + + + + + diff --git a/plugins/core/panels/simple/index.ts b/plugins/core/panels/simple/index.ts new file mode 100644 index 0000000..df1fbfd --- /dev/null +++ b/plugins/core/panels/simple/index.ts @@ -0,0 +1,51 @@ +import { DDeiPluginBase } from "ddei-framework"; +import DDeiCoreToolboxSimplePanel from './toolbox-simple'; +import DDeiCoreTopMenuSimplePanel from './topmenu-simple'; + +class DDeiCoreSimplePanels extends DDeiPluginBase { + + + type: string = "package" + /** + * 缺省实例 + */ + static defaultIns: DDeiCoreSimplePanels = new DDeiCoreSimplePanels(null); + + plugins: object[] = [DDeiCoreToolboxSimplePanel, DDeiCoreTopMenuSimplePanel] + + getPanels(editor) { + let panels = [] + this.plugins?.forEach(plugin => { + let ls + if (DDeiPluginBase.isSubclass(plugin, DDeiPluginBase)) { + ls = plugin.defaultIns.getPanels(editor); + } else if (plugin instanceof DDeiPluginBase) { + ls = plugin.getPanels(editor); + } + if (ls?.length > 0) { + panels = panels.concat(ls); + } + }) + return panels + } + + + + static configuration(options) { + if (options) { + //解析options,只使用自己相关的 + let panels = new DDeiCoreSimplePanels(options); + for (let i = 0; i < panels.plugins?.length; i++) { + panels.plugins[i] = panels.plugins[i].configuration(options, true) + } + return panels; + } + return DDeiCoreSimplePanels; + } +} + + +export { + DDeiCoreSimplePanels, DDeiCoreToolboxSimplePanel, DDeiCoreTopMenuSimplePanel +} +export default DDeiCoreSimplePanels \ No newline at end of file diff --git a/plugins/core/panels/toolbox/toolbox-simple.ts b/plugins/core/panels/simple/toolbox-simple.ts similarity index 93% rename from plugins/core/panels/toolbox/toolbox-simple.ts rename to plugins/core/panels/simple/toolbox-simple.ts index 106f678..45d86fe 100644 --- a/plugins/core/panels/toolbox/toolbox-simple.ts +++ b/plugins/core/panels/simple/toolbox-simple.ts @@ -7,10 +7,11 @@ class DDeiCoreToolboxSimplePanel extends DDeiPluginBase{ * 缺省实例 */ static defaultIns: DDeiCoreToolboxSimplePanel = new DDeiCoreToolboxSimplePanel({ - direct:2,//方向,1纵向,2横向 - position:1,//位置1-9顺时针,1为左上角,9为中心 + direct:1,//方向,1纵向,2横向 + position:8,//位置1-9顺时针,1为左上角,9为中心 drag:1,//是否允许拖拽位置 chooseCreate:0,//是否在选择控件时创建一个控件 + dragCreate:0,//是否在拖拽时创建控件 groups:[ { editMode: 1, diff --git a/plugins/core/panels/simple/topmenu-simple.ts b/plugins/core/panels/simple/topmenu-simple.ts new file mode 100644 index 0000000..1739ba8 --- /dev/null +++ b/plugins/core/panels/simple/topmenu-simple.ts @@ -0,0 +1,47 @@ +import {DDeiPluginBase} from "ddei-framework"; +import TopMenuSimple from './TopMenuSimple.vue'; + +class DDeiCoreTopMenuSimplePanel extends DDeiPluginBase{ + name: string = TopMenuSimple.name + /** + * 缺省实例 + */ + static defaultIns: DDeiCoreTopMenuSimplePanel = new DDeiCoreTopMenuSimplePanel({ + direct:2,//方向,1纵向,2横向 + position:2,//位置1-9顺时针,1为左上角,9为中心 + drag:1//是否允许拖拽位置 + }); + + plugins: object[] = [TopMenuSimple] + + getPanels(editor){ + return this.plugins; + } + + + + static configuration(options, fullConfig: boolean = false) { + //解析options,只使用自己相关的 + if (options) { + let newOptions = {} + if (fullConfig) { + if (fullConfig) { + if (options[TopMenuSimple.name]) { + for (let i in options[TopMenuSimple.name]) { + newOptions[i] = options[TopMenuSimple.name][i] + } + } + } + } else { + newOptions = options + } + if (newOptions && Object.keys(newOptions).length !== 0) { + let panels = new DDeiCoreTopMenuSimplePanel(newOptions); + return panels; + } + } + return DDeiCoreTopMenuSimplePanel; + } +} + +export default DDeiCoreTopMenuSimplePanel \ No newline at end of file diff --git a/plugins/core/panels/toolbox/index.ts b/plugins/core/panels/toolbox/index.ts index 591642e..eafb844 100644 --- a/plugins/core/panels/toolbox/index.ts +++ b/plugins/core/panels/toolbox/index.ts @@ -1,6 +1,5 @@ import { DDeiPluginBase } from "ddei-framework"; import DDeiCoreToolboxPanel from './toolbox'; -import DDeiCoreToolboxSimplePanel from './toolbox-simple'; class DDeiCoreToolboxPanels extends DDeiPluginBase { @@ -11,7 +10,7 @@ class DDeiCoreToolboxPanels extends DDeiPluginBase { */ static defaultIns: DDeiCoreToolboxPanels = new DDeiCoreToolboxPanels(null); - plugins: object[] = [DDeiCoreToolboxPanel, DDeiCoreToolboxSimplePanel] + plugins: object[] = [DDeiCoreToolboxPanel] getPanels(editor) { let panels = [] @@ -46,6 +45,6 @@ class DDeiCoreToolboxPanels extends DDeiPluginBase { export { - DDeiCoreToolboxPanels, DDeiCoreToolboxPanel, DDeiCoreToolboxSimplePanel + DDeiCoreToolboxPanels, DDeiCoreToolboxPanel } export default DDeiCoreToolboxPanels \ No newline at end of file diff --git a/plugins/quickcontrol/QuickChooseControlDialog.vue b/plugins/quickcontrol/QuickChooseControlDialog.vue index 0794daa..3a726be 100644 --- a/plugins/quickcontrol/QuickChooseControlDialog.vue +++ b/plugins/quickcontrol/QuickChooseControlDialog.vue @@ -2,7 +2,7 @@
+ v-if="customControls || customGroups || group.expand == true || model">
@@ -44,7 +44,8 @@ export default { return { dialogId: 'ddei-ext-dialog-quickchoosecontrol', //分组数据 - groups: [] + groups: [], + model:null }; }, computed: {}, @@ -86,28 +87,54 @@ export default { }); this.groups = newGroups }else{ - DDeiEditorUtil.readRecentlyToolGroups() - let hisGroups = DDeiEditorUtil.recentlyToolGroups; - let gps = [] - if (hisGroups?.length > 0) { + let model = this.editor.tempPopData ? this.editor.tempPopData['ddei-ext-dialog-quickchoosecontrol']?.model : null + if (!model){ + DDeiEditorUtil.readRecentlyToolGroups() + let hisGroups = DDeiEditorUtil.recentlyToolGroups; + let gps = [] + if (hisGroups?.length > 0) { - hisGroups.forEach(hg => { - let group = null; - for (let i = 0; i < groups.length; i++) { - if (groups[i].id == hg.id) { - group = groups[i] + hisGroups.forEach(hg => { + let group = null; + for (let i = 0; i < groups.length; i++) { + if (groups[i].id == hg.id) { + group = groups[i] + break; + } + } + if (group) { + group.expand = hg.expand + gps.push(group) + } + }) + + this.groups = gps; + } + }else{ + let newGroups = [] + + for (let i = 0; i < groups.length; i++) { + let finded = false + for(let c = 0;c < groups[i].controls.length;c++){ + if (groups[i].controls[c].id == model.modelCode) { + finded = true break; } } - if (group) { - group.expand = hg.expand - gps.push(group) + if (finded){ + newGroups.push(groups[i]) + break; } - }) - - this.groups = gps; + } + this.model = model + this.groups = newGroups } } + this.forceRefresh = false + this.$nextTick(() => { + this.forceRefresh = true; + + }); }, quickCreateControl(controlId){ diff --git a/plugins/quickcontrol/QuickControlPanel.vue b/plugins/quickcontrol/QuickControlPanel.vue index c909f87..2f6e82e 100644 --- a/plugins/quickcontrol/QuickControlPanel.vue +++ b/plugins/quickcontrol/QuickControlPanel.vue @@ -121,9 +121,6 @@ export default { mouseEnter(type,el,evt) { if(this.editor.state == 'designing'){ if (this.editor.tempPopData['ddei-ext-dialog-quickcontrol']){ - //显示弹出框 - let elPos = evt.currentTarget.getBoundingClientRect() - // let elPos = DDeiUtil.getDomAbsPosition(evt.currentTarget) //向上区间寻找,是否有控件 let existsControl = null; let model = this.editor.tempPopData['ddei-ext-dialog-quickcontrol'].model @@ -131,22 +128,26 @@ export default { let outRect = DDeiAbstractShape.getOutRectByPV([model]) if (type == 1) { let controls = layer.getSubModels([model.id], 100, { x: outRect.x, y: outRect.y-150, x1: outRect.x1, y1: outRect.y}) - if (this.validControls(controls)){ + controls = this.filtControls(model,controls) + if (controls.length > 0){ existsControl = controls[0]; } } else if (type == 2) { let controls = layer.getSubModels([model.id], 100, { x: outRect.x1, y: outRect.y, x1: outRect.x1+150, y1: outRect.y1 }) - if (this.validControls(controls)) { + controls = this.filtControls(model,controls) + if (controls.length > 0) { existsControl = controls[0]; } } else if (type == 3) { let controls = layer.getSubModels([model.id], 100, { x: outRect.x, y: outRect.y1, x1: outRect.x1, y1: outRect.y1+150 }) - if (this.validControls(controls)) { + controls = this.filtControls(model,controls) + if (controls.length > 0) { existsControl = controls[0]; } } else if (type == 4) { let controls = layer.getSubModels([model.id], 100, { x: outRect.x-150, y: outRect.y, x1: outRect.x, y1: outRect.y1 }) - if (this.validControls(controls)) { + controls = this.filtControls(model,controls) + if (controls.length > 0) { existsControl = controls[0]; } } @@ -279,15 +280,24 @@ export default { } }, - validControls(controls){ + filtControls(model,controls){ + let returnControls = [] if(controls?.length > 0){ for(let i = 0;i < controls.length;i++){ if (controls[i].baseModelType != 'DDeiLine'){ - return true; + let define = DDeiUtil.getControlDefine(controls[i]) + let filterMethod = null + if (define && define.filters && define.filters["LINE_OBI_FILTER"]) { + filterMethod = define.filters["LINE_OBI_FILTER"]; + } + if (!filterMethod || filterMethod(model,{model:controls[i]})) { + returnControls.push(controls[i]); + } } + } } - return false + return returnControls } } }; diff --git a/src/App.vue b/src/App.vue index 3c68305..374bf92 100644 --- a/src/App.vue +++ b/src/App.vue @@ -74,7 +74,7 @@ export default defineComponent({ ] }) const options = markRaw({ - // currentLayout: "ddei-core-layout-simple", + currentLayout: "ddei-core-layout-simple", config: { // "readonly":true, "mark": "水印文本", @@ -85,25 +85,25 @@ export default defineComponent({ "background": {color:"#123456",opacity:0.1}, // "theme": "ddei-core-theme-black", initData: { - controls:[ - { - id: "act_1", - model: "102010", - type: "emp_1", - text: "第一步", - border:{color:"yellow",dash:[10,10,5,5],width:5}, - fill:{color:"grey"}, - }, - { - id: "act_2", - model: "102010", - type: "emp_2", - width: 200, - height: 100, - text: "第二步", - offsetY: -70, - } - ] + // controls:[ + // { + // id: "act_1", + // model: "102010", + // type: "emp_1", + // text: "第一步", + // border:{color:"yellow",dash:[10,10,5,5],width:5}, + // fill:{color:"grey"}, + // }, + // { + // id: "act_2", + // model: "102010", + // type: "emp_2", + // width: 200, + // height: 100, + // text: "第二步", + // offsetY: -70, + // } + // ] } }, //配置扩展插件 diff --git a/src/editor/Editor.vue b/src/editor/Editor.vue index 3f8c551..fbf28e1 100644 --- a/src/editor/Editor.vue +++ b/src/editor/Editor.vue @@ -203,7 +203,7 @@ export default { if (options?.config?.access){ this.editor.setAccessInfo(options.config.access) - } else if (options.config.readonly == true || options.config.readonly == false) { + } else if (options?.config?.readonly == true || options?.config?.readonly == false) { this.editor.setEditable(!options.config.readonly) }