@kaitify/core 0.0.2-beta.4 → 0.0.2-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/kaitify-core.es.js +11 -7
- package/lib/kaitify-core.umd.js +1 -1
- package/lib/model/Editor.d.ts +8 -0
- package/package.json +1 -1
package/lib/kaitify-core.es.js
CHANGED
|
@@ -38332,16 +38332,18 @@ class Editor {
|
|
|
38332
38332
|
*/
|
|
38333
38333
|
destroy() {
|
|
38334
38334
|
this.removeDomObserve();
|
|
38335
|
-
|
|
38336
|
-
|
|
38337
|
-
|
|
38338
|
-
|
|
38339
|
-
|
|
38340
|
-
|
|
38335
|
+
if (this.$el) {
|
|
38336
|
+
data.remove(this.$el, "kaitify-init");
|
|
38337
|
+
this.$el.classList.remove("kaitify");
|
|
38338
|
+
this.$el.removeAttribute("kaitify-placeholder");
|
|
38339
|
+
this.setDark(false);
|
|
38340
|
+
this.setEditable(false);
|
|
38341
|
+
this.$el.innerHTML = "";
|
|
38342
|
+
event.off(this.$el, "beforeinput.kaitify compositionstart.kaitify compositionupdate.kaitify compositionend.kaitify keydown.kaitify keyup.kaitify copy.kaitify focus.kaitify blur.kaitify");
|
|
38343
|
+
}
|
|
38341
38344
|
this.selection = new Selection();
|
|
38342
38345
|
this.history = new History();
|
|
38343
38346
|
event.off(document, `selectionchange.kaitify_${this.guid}`);
|
|
38344
|
-
event.off(this.$el, "beforeinput.kaitify compositionstart.kaitify compositionupdate.kaitify compositionend.kaitify keydown.kaitify keyup.kaitify copy.kaitify focus.kaitify blur.kaitify");
|
|
38345
38347
|
}
|
|
38346
38348
|
/**
|
|
38347
38349
|
* 获取编辑器的纯文本内容,excludeBreak表示是否排除换行符\n,excludeZeroWidthText表示是否排除零宽度空白字符
|
|
@@ -38556,6 +38558,7 @@ class Editor {
|
|
|
38556
38558
|
*/
|
|
38557
38559
|
static async configure(options) {
|
|
38558
38560
|
const editor = new Editor();
|
|
38561
|
+
if (options.onCreate) options.onCreate(editor);
|
|
38559
38562
|
editor.$el = initEditorDom(options.el);
|
|
38560
38563
|
editor.$el.classList.add("kaitify");
|
|
38561
38564
|
if (options.dark) editor.setDark(options.dark);
|
|
@@ -38607,6 +38610,7 @@ class Editor {
|
|
|
38607
38610
|
event.on(editor.$el, "blur.kaitify", onBlur.bind(editor));
|
|
38608
38611
|
event.on(editor.$el, "copy.kaitify", onCopy.bind(editor));
|
|
38609
38612
|
event.on(editor.$el, "cut.kaitify", onCut.bind(editor));
|
|
38613
|
+
if (options.onCreated) options.onCreated(editor);
|
|
38610
38614
|
return editor;
|
|
38611
38615
|
}
|
|
38612
38616
|
}
|