diff --git a/src/editor/index.js b/src/editor/index.js index 6fa826e..045a68a 100644 --- a/src/editor/index.js +++ b/src/editor/index.js @@ -37,7 +37,7 @@ const ACTTION = { unordered: 'insertUnorderedList' } -const DEFAULT_TOOLS = [ +const TOOLBAR = [ 'font', 'color', 'bold', @@ -52,7 +52,8 @@ const DEFAULT_TOOLS = [ 'right', 'link', 'image', - 'fullscreen' + 'fullscreen', + 'copy' ] const COLORS = [ @@ -87,18 +88,6 @@ class Editor extends Component { static watches = ['value'] static props = { - toolbar: { - type: String, - default: '', - attribute: false, - observer(v) { - if (v === null) { - this.#toolbar = [...DEFAULT_TOOLS] - } else if (v) { - this.#toolbar = v.split(',').map(it => it.trim()) - } - } - }, readonly: { type: Boolean, observer(v) { @@ -407,7 +396,6 @@ class Editor extends Component { ` ] - #toolbar = [] #value = '' #cache = { bar: 0, y: 0 } #gridx = 0 @@ -794,15 +782,10 @@ class Editor extends Component { } render() { - toolbar = [ - ...(this.#toolbar.length ? this.#toolbar : DEFAULT_TOOLS), - 'copy' - ] - return html`
- ${toolbar.map( + ${TOOLBAR.map( it => html` diff --git a/src/meditor/index.js b/src/meditor/index.js index d4aec4b..661f251 100644 --- a/src/meditor/index.js +++ b/src/meditor/index.js @@ -98,18 +98,8 @@ class MEditor extends Component { } }, value: 'str!', - readonly: { - type: Boolean, - observer(v) { - this.#updateStat() - } - }, - disabled: { - type: Boolean, - observer(v) { - this.#updateStat() - } - } + readonly: false, + disabled: false } static styles = [ @@ -472,18 +462,6 @@ class MEditor extends Component { thumb.style.height = bar + 'px' } - #updateStat() { - if (this.$refs.editor) { - if (this.readOnly || this.disabled) { - this.$refs.editor.removeAttribute('contenteditable') - } else { - this.$refs.editor.setAttribute('contenteditable', '') - } - } else { - nextTick(_ => this.#updateStat()) - } - } - #fetchScroll(moveY) { let { bar } = this.#cache let { outer, thumb, inner } = this.$refs @@ -741,9 +719,15 @@ class MEditor extends Component {