@kaitify/core 0.0.2-beta.3 → 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 +12 -8
- 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
|
@@ -37268,7 +37268,7 @@ class Editor {
|
|
|
37268
37268
|
* 是否深色模式
|
|
37269
37269
|
*/
|
|
37270
37270
|
isDark() {
|
|
37271
|
-
return
|
|
37271
|
+
return this.$el.hasAttribute("kaitify-dark");
|
|
37272
37272
|
}
|
|
37273
37273
|
/**
|
|
37274
37274
|
* 判断编辑器是否为空,这里的空指的是编辑器内只有一个段落,并且段落里只有占位符
|
|
@@ -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
|
}
|