max-length + options for RTE

This commit is contained in:
2021-06-21 13:41:48 +02:00
parent a49df12061
commit f7147972bb
4 changed files with 67 additions and 4 deletions
+10
View File
@@ -41,6 +41,7 @@
import { debounce as _debounce } from 'underscore';
import { Editor, EditorContent, EditorMenuBubble } from 'tiptap';
import EditorMenuBar from './rte.menubar.js';
import { MaxSize } from 'zero/config/rte.extensions.js';
import { Placeholder } from 'tiptap-extensions';
import createConfig from 'zero/config/rte.config.js';
@@ -58,6 +59,10 @@
type: Boolean,
default: false
},
maxLength: {
type: Number,
default: null
},
placeholder: {
type: String,
default: null
@@ -139,6 +144,11 @@
}));
}
if (this.maxLength > 0)
{
this.extensions.push(new MaxSize({ maxSize: this.maxLength }));
}
this.editor = new Editor({
editable: !this.disabled,
extensions: this.extensions,