From f76af9ff8f3f5ce35223ff4ee7d54d9d91237a2e Mon Sep 17 00:00:00 2001 From: yutent Date: Wed, 28 Aug 2024 16:20:00 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BC=96=E8=BE=91=E5=99=A8=E5=A2=9E=E5=8A=A0to?= =?UTF-8?q?olbar=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/editor/editor.js | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/editor/editor.js b/src/editor/editor.js index 32d1200..0af5762 100644 --- a/src/editor/editor.js +++ b/src/editor/editor.js @@ -96,6 +96,21 @@ class Editor extends Component { observer(v) { this.#updateStat() } + }, + toolbar: { + type: String, + default: null, + attribute: false, + observer(v) { + if (v === null) { + this.#toolbar = [...TOOLBAR] + } else { + this.#toolbar = v + .split(',') + .filter(it => it) + .map(it => it.trim()) + } + } } } @@ -373,6 +388,8 @@ class Editor extends Component { #gridx = 0 #gridy = 0 + #toolbar = [...TOOLBAR] + #select = null get value() { @@ -653,7 +670,7 @@ class Editor extends Component { return html`
- ${TOOLBAR.map( + ${this.#toolbar.map( it => html`