@ones-editor/editor 2.6.2 → 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
|
@@ -25650,9 +25650,6 @@ var __publicField = (obj, key, value) => {
|
|
|
25650
25650
|
if (key === "inline-style-background-color") {
|
|
25651
25651
|
newStyles.backgroundColor = value;
|
|
25652
25652
|
}
|
|
25653
|
-
if (key === "inline-style-font-size") {
|
|
25654
|
-
newStyles.fontSize = value;
|
|
25655
|
-
}
|
|
25656
25653
|
}
|
|
25657
25654
|
});
|
|
25658
25655
|
return { classes, attributes: newAttributes, styles: newStyles };
|
|
@@ -42704,6 +42701,7 @@ ${codeText}
|
|
|
42704
42701
|
this.options.onClickItem(this, item);
|
|
42705
42702
|
}, 300, { leading: true, trailing: false }));
|
|
42706
42703
|
__publicField(this, "handleShow", (menu) => {
|
|
42704
|
+
this.menu.content.classList.add("auto-suggest-menu");
|
|
42707
42705
|
});
|
|
42708
42706
|
__publicField(this, "handleShown", () => {
|
|
42709
42707
|
var _a, _b;
|
|
@@ -43760,6 +43758,32 @@ ${codeText}
|
|
|
43760
43758
|
}
|
|
43761
43759
|
return this.menu.handleKeydown(event);
|
|
43762
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
|
+
}
|
|
43763
43787
|
popup(block, offset, leftText, trigger) {
|
|
43764
43788
|
this.anchor = {
|
|
43765
43789
|
blockId: getBlockId(block),
|
|
@@ -43815,6 +43839,13 @@ ${codeText}
|
|
|
43815
43839
|
}
|
|
43816
43840
|
return this.triggerPopup(editor, containerId, blockIndex, insertOffset, text2);
|
|
43817
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
|
+
}
|
|
43818
43849
|
handleUpdateCompositionText(editor, containerId, blockIndex, offset, end) {
|
|
43819
43850
|
var _a;
|
|
43820
43851
|
const start = editor.selection.range.start;
|
|
@@ -73751,6 +73782,16 @@ ${codeText}
|
|
|
73751
73782
|
return false;
|
|
73752
73783
|
}
|
|
73753
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
|
+
}
|
|
73754
73795
|
this.button.clearCheckedState();
|
|
73755
73796
|
this.button.show(docs);
|
|
73756
73797
|
this.event = event;
|
|
@@ -92432,7 +92473,7 @@ ${data2.plantumlText}
|
|
|
92432
92473
|
}
|
|
92433
92474
|
}
|
|
92434
92475
|
});
|
|
92435
|
-
editor.version = "2.6.
|
|
92476
|
+
editor.version = "2.6.4";
|
|
92436
92477
|
return editor;
|
|
92437
92478
|
}
|
|
92438
92479
|
function isDoc(doc2) {
|
|
@@ -92545,7 +92586,7 @@ ${data2.plantumlText}
|
|
|
92545
92586
|
}
|
|
92546
92587
|
});
|
|
92547
92588
|
OnesEditorToolbar.register(editor);
|
|
92548
|
-
editor.version = "2.6.
|
|
92589
|
+
editor.version = "2.6.4";
|
|
92549
92590
|
return editor;
|
|
92550
92591
|
}
|
|
92551
92592
|
async function showDocVersions(editor, options, serverUrl) {
|