@ones-editor/editor 2.6.3 → 2.6.4
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.
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { OnesEditor, OnesEditorInputHandler, CommandItem, BlockElement } from '../../../../@ones-editor/core';
|
|
2
|
+
import type { CloneBlockResultInfo, DocObject } from '../../../../@ones-editor/core';
|
|
2
3
|
import AutoSuggestMenu from './auto-suggest-menu';
|
|
3
4
|
import EditorAutoSuggestMenu from './editor-auto-suggest-menu';
|
|
4
5
|
export { AutoSuggestMenu };
|
|
@@ -37,10 +38,12 @@ declare class OnesEditorAutoSuggest implements OnesEditorInputHandler {
|
|
|
37
38
|
anchor: AutoSuggestAnchor | null;
|
|
38
39
|
constructor(editor: OnesEditor, options: AutoSuggestOptions);
|
|
39
40
|
handleBeforeKeyDown(editor: OnesEditor, event: KeyboardEvent): boolean;
|
|
41
|
+
handleBeforePasteDoc(editor: OnesEditor, doc: DocObject): Promise<boolean>;
|
|
40
42
|
popup(block: BlockElement, offset: number, leftText: string, trigger: string): void;
|
|
41
43
|
close: () => void;
|
|
42
44
|
triggerPopup(editor: OnesEditor, containerId: string, blockIndex: number, insertOffset: number, text: string): boolean;
|
|
43
45
|
handleAfterInsertText(editor: OnesEditor, containerId: string, blockIndex: number, insertOffset: number, text: string): boolean;
|
|
46
|
+
handleAfterPasteDoc(editor: OnesEditor, doc: DocObject, cloneDocResult: CloneBlockResultInfo): Promise<boolean>;
|
|
44
47
|
private oldCompositingText;
|
|
45
48
|
handleUpdateCompositionText(editor: OnesEditor, containerId: string, blockIndex: number, offset: number, end: boolean): boolean;
|
|
46
49
|
handleSelectionChanged: (editor: OnesEditor) => void;
|
package/dist/index.js
CHANGED
|
@@ -42701,6 +42701,7 @@ ${codeText}
|
|
|
42701
42701
|
this.options.onClickItem(this, item);
|
|
42702
42702
|
}, 300, { leading: true, trailing: false }));
|
|
42703
42703
|
__publicField(this, "handleShow", (menu) => {
|
|
42704
|
+
this.menu.content.classList.add("auto-suggest-menu");
|
|
42704
42705
|
});
|
|
42705
42706
|
__publicField(this, "handleShown", () => {
|
|
42706
42707
|
var _a, _b;
|
|
@@ -43757,6 +43758,32 @@ ${codeText}
|
|
|
43757
43758
|
}
|
|
43758
43759
|
return this.menu.handleKeydown(event);
|
|
43759
43760
|
}
|
|
43761
|
+
async handleBeforePasteDoc(editor, doc2) {
|
|
43762
|
+
var _a;
|
|
43763
|
+
if (!((_a = this.menu) == null ? void 0 : _a.isVisible)) {
|
|
43764
|
+
return false;
|
|
43765
|
+
}
|
|
43766
|
+
const shouldCancelAutoSuggest = () => {
|
|
43767
|
+
var _a2;
|
|
43768
|
+
const blocks = doc2.blocks.root;
|
|
43769
|
+
if (blocks.length !== 1) {
|
|
43770
|
+
return true;
|
|
43771
|
+
}
|
|
43772
|
+
const block = blocks[0];
|
|
43773
|
+
if (((_a2 = editor.editorBlocks.getBlockClass(block.type)) == null ? void 0 : _a2.blockKind) !== "text") {
|
|
43774
|
+
return true;
|
|
43775
|
+
}
|
|
43776
|
+
const text2 = toPlainText(block.text || []);
|
|
43777
|
+
if (text2.length > 50) {
|
|
43778
|
+
return true;
|
|
43779
|
+
}
|
|
43780
|
+
return false;
|
|
43781
|
+
};
|
|
43782
|
+
if (shouldCancelAutoSuggest()) {
|
|
43783
|
+
this.menu.close();
|
|
43784
|
+
}
|
|
43785
|
+
return false;
|
|
43786
|
+
}
|
|
43760
43787
|
popup(block, offset, leftText, trigger) {
|
|
43761
43788
|
this.anchor = {
|
|
43762
43789
|
blockId: getBlockId(block),
|
|
@@ -43812,6 +43839,13 @@ ${codeText}
|
|
|
43812
43839
|
}
|
|
43813
43840
|
return this.triggerPopup(editor, containerId, blockIndex, insertOffset, text2);
|
|
43814
43841
|
}
|
|
43842
|
+
async handleAfterPasteDoc(editor, doc2, cloneDocResult) {
|
|
43843
|
+
var _a;
|
|
43844
|
+
if ((_a = this.menu) == null ? void 0 : _a.isVisible) {
|
|
43845
|
+
this.resetItems();
|
|
43846
|
+
}
|
|
43847
|
+
return false;
|
|
43848
|
+
}
|
|
43815
43849
|
handleUpdateCompositionText(editor, containerId, blockIndex, offset, end) {
|
|
43816
43850
|
var _a;
|
|
43817
43851
|
const start = editor.selection.range.start;
|
|
@@ -73748,6 +73782,16 @@ ${codeText}
|
|
|
73748
73782
|
return false;
|
|
73749
73783
|
}
|
|
73750
73784
|
}
|
|
73785
|
+
const existsAutoSuggest = document.querySelector(".auto-suggest-menu");
|
|
73786
|
+
if (existsAutoSuggest) {
|
|
73787
|
+
const root2 = existsAutoSuggest.closest("[data-tippy-root]");
|
|
73788
|
+
if (root2) {
|
|
73789
|
+
const visibility = window.getComputedStyle(root2).visibility;
|
|
73790
|
+
if (visibility === "visible") {
|
|
73791
|
+
return false;
|
|
73792
|
+
}
|
|
73793
|
+
}
|
|
73794
|
+
}
|
|
73751
73795
|
this.button.clearCheckedState();
|
|
73752
73796
|
this.button.show(docs);
|
|
73753
73797
|
this.event = event;
|
|
@@ -92429,7 +92473,7 @@ ${data2.plantumlText}
|
|
|
92429
92473
|
}
|
|
92430
92474
|
}
|
|
92431
92475
|
});
|
|
92432
|
-
editor.version = "2.6.
|
|
92476
|
+
editor.version = "2.6.4";
|
|
92433
92477
|
return editor;
|
|
92434
92478
|
}
|
|
92435
92479
|
function isDoc(doc2) {
|
|
@@ -92542,7 +92586,7 @@ ${data2.plantumlText}
|
|
|
92542
92586
|
}
|
|
92543
92587
|
});
|
|
92544
92588
|
OnesEditorToolbar.register(editor);
|
|
92545
|
-
editor.version = "2.6.
|
|
92589
|
+
editor.version = "2.6.4";
|
|
92546
92590
|
return editor;
|
|
92547
92591
|
}
|
|
92548
92592
|
async function showDocVersions(editor, options, serverUrl) {
|