From 9f1da23216513870ea6d5f862f28dda33b84af62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=87=E5=A4=A9?= Date: Thu, 27 May 2021 13:44:57 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=AF=8C=E6=96=87=E6=9C=AC?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E5=99=A8readonly/disabled=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E6=97=A0=E6=95=88=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/editor/index.wc | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/editor/index.wc b/src/editor/index.wc index 6760041..15a292a 100644 --- a/src/editor/index.wc +++ b/src/editor/index.wc @@ -148,6 +148,14 @@ wc-scroll { opacity: 0.8; } } +:host([readonly]), +:host([disabled]) { + .toolbar { + span:hover { + background: none; + } + } +} :host(:focus-within) { box-shadow: 0 0 0 2px var(--color-plain-a); @@ -334,7 +342,7 @@ export default class Editor { return } - if ((type === name && val) || type !== 'boolean') { + if ((type === 'boolean' && val) || type !== 'boolean') { this.props[name] = true this.setAttribute(name, '') this.__EDITOR__.removeAttribute('contenteditable') @@ -639,11 +647,9 @@ export default class Editor { if (k === 'readonly') { k = 'readOnly' } + console.log(k, val) this[k] = val !== null break - - default: - break } } }