diff --git a/index.html b/index.html index 3dd6f39..a33a93c 100644 --- a/index.html +++ b/index.html @@ -399,6 +399,9 @@
+
+ +
diff --git a/src/assets/images/option.svg b/src/assets/images/option.svg new file mode 100644 index 0000000..53b6cae --- /dev/null +++ b/src/assets/images/option.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/main.ts b/src/main.ts index 072bb98..1ae3981 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1035,7 +1035,36 @@ window.onload = function () { instance.command.executePrint() } - // 6. 目录显隐 | 页面模式 | 纸张缩放 | 纸张大小 | 纸张方向 | 页边距 | 全屏 + // 6. 目录显隐 | 页面模式 | 纸张缩放 | 纸张大小 | 纸张方向 | 页边距 | 全屏 | 设置 + const editorOptionDom = + document.querySelector('.editor-option')! + editorOptionDom.onclick = function () { + const options = instance.command.getOptions() + new Dialog({ + title: '编辑器配置', + data: [ + { + type: 'textarea', + name: 'option', + width: 350, + height: 300, + required: true, + value: JSON.stringify(options, null, 2), + placeholder: '请输入编辑器配置' + } + ], + onConfirm: payload => { + const newOptionValue = payload.find(p => p.name === 'option')?.value + if (!newOptionValue) return + const newOption = JSON.parse(newOptionValue) + Object.keys(newOption).forEach(key => { + Reflect.set(options, key, newOption[key]) + }) + instance.command.executeForceUpdate() + } + }) + } + async function updateCatalog() { const catalog = await instance.command.getCatalog() const catalogMainDom = diff --git a/src/style.css b/src/style.css index f32bfac..5f9ef23 100644 --- a/src/style.css +++ b/src/style.css @@ -983,6 +983,10 @@ ul { cursor: pointer; } +.footer .editor-option i { + background-image: url('./assets/images/option.svg'); +} + .footer .page-scale-minus i { background-image: url('./assets/images/page-scale-minus.svg'); }