This repository has been archived on 2023-08-30. You can view files and clone it, but cannot push or open issues/pull-requests.
bytedo
/
wcui
Archived
1
0
Fork 0

优化富文本编辑器readonly/disabled设置无效的bug

old
宇天 2021-05-27 13:44:57 +08:00
parent 53b48cabff
commit 9f1da23216
1 changed files with 10 additions and 4 deletions

View File

@ -148,6 +148,14 @@ wc-scroll {
opacity: 0.8; opacity: 0.8;
} }
} }
:host([readonly]),
:host([disabled]) {
.toolbar {
span:hover {
background: none;
}
}
}
:host(:focus-within) { :host(:focus-within) {
box-shadow: 0 0 0 2px var(--color-plain-a); box-shadow: 0 0 0 2px var(--color-plain-a);
@ -334,7 +342,7 @@ export default class Editor {
return return
} }
if ((type === name && val) || type !== 'boolean') { if ((type === 'boolean' && val) || type !== 'boolean') {
this.props[name] = true this.props[name] = true
this.setAttribute(name, '') this.setAttribute(name, '')
this.__EDITOR__.removeAttribute('contenteditable') this.__EDITOR__.removeAttribute('contenteditable')
@ -639,11 +647,9 @@ export default class Editor {
if (k === 'readonly') { if (k === 'readonly') {
k = 'readOnly' k = 'readOnly'
} }
console.log(k, val)
this[k] = val !== null this[k] = val !== null
break break
default:
break
} }
} }
} }