@ones-editor/editor 2.9.3 → 2.9.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/@ones-editor/core/src/core/selection/range/simple-range.d.ts +2 -2
- package/@ones-editor/core/src/core/types.d.ts +2 -0
- package/@ones-editor/html-to-doc/src/html-to-doc/office-html-to-doc/helper/elem.d.ts +1 -0
- package/@ones-editor/main-toolbar/src/items/comment.d.ts +1 -0
- package/@ones-editor/tsconfig.tsbuildinfo +1 -1
- package/dist/index.js +46 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -26523,6 +26523,9 @@ var __publicField = (obj, key, value) => {
|
|
|
26523
26523
|
}
|
|
26524
26524
|
}
|
|
26525
26525
|
function editorScrollIntoView(editor) {
|
|
26526
|
+
if (!editor.scrollable()) {
|
|
26527
|
+
return;
|
|
26528
|
+
}
|
|
26526
26529
|
if (!isElementVisible(editor.rootContainer)) {
|
|
26527
26530
|
logger$3R.warn("editorScrollIntoView: editor is not visible");
|
|
26528
26531
|
return;
|
|
@@ -31866,6 +31869,7 @@ ${codeText}
|
|
|
31866
31869
|
__publicField(this, "inputHandlers", new EditorInputHandlers(this));
|
|
31867
31870
|
__publicField(this, "settingsProvider");
|
|
31868
31871
|
__publicField(this, "_readonly", false);
|
|
31872
|
+
__publicField(this, "_scrollable", true);
|
|
31869
31873
|
__publicField(this, "getColor", (index2) => {
|
|
31870
31874
|
const colors = this.options.colors;
|
|
31871
31875
|
if (colors.length === 0) {
|
|
@@ -32094,6 +32098,12 @@ ${codeText}
|
|
|
32094
32098
|
return false;
|
|
32095
32099
|
return elem.closest("div.editor-root") === this.rootElement;
|
|
32096
32100
|
}
|
|
32101
|
+
scrollable() {
|
|
32102
|
+
return this._scrollable;
|
|
32103
|
+
}
|
|
32104
|
+
setScrollable(scrollable2) {
|
|
32105
|
+
this._scrollable = scrollable2;
|
|
32106
|
+
}
|
|
32097
32107
|
insertBlock(containerId, blockIndex, blockData, newRange, options) {
|
|
32098
32108
|
const defaultPos = { blockId: blockData.id, offset: 0 };
|
|
32099
32109
|
const defaultRange = { anchor: defaultPos, focus: defaultPos };
|
|
@@ -70392,6 +70402,9 @@ ${codeText}
|
|
|
70392
70402
|
}
|
|
70393
70403
|
});
|
|
70394
70404
|
__publicField(this, "handleSelectionChanged", () => {
|
|
70405
|
+
if (!this.editor.scrollable()) {
|
|
70406
|
+
return;
|
|
70407
|
+
}
|
|
70395
70408
|
setTimeout(() => {
|
|
70396
70409
|
var _a;
|
|
70397
70410
|
if (this.type !== "current") {
|
|
@@ -71006,7 +71019,14 @@ ${codeText}
|
|
|
71006
71019
|
}
|
|
71007
71020
|
onCreateComment(commentId, local) {
|
|
71008
71021
|
const comment = this.commentsProvider.getComment(commentId);
|
|
71009
|
-
|
|
71022
|
+
try {
|
|
71023
|
+
this.editor.setScrollable(false);
|
|
71024
|
+
this.list.handleCreateComment(comment, local);
|
|
71025
|
+
} finally {
|
|
71026
|
+
setTimeout(() => {
|
|
71027
|
+
this.editor.setScrollable(true);
|
|
71028
|
+
}, 1e3);
|
|
71029
|
+
}
|
|
71010
71030
|
this.updateCommentCount();
|
|
71011
71031
|
}
|
|
71012
71032
|
onDeleteComment(commentId, local) {
|
|
@@ -71678,7 +71698,14 @@ ${codeText}
|
|
|
71678
71698
|
const range = createBlockSimpleRange(editor, block, selectedBlock.start.offset, selectedBlock.end.offset);
|
|
71679
71699
|
const command = `comment-${comment.id.toLocaleLowerCase()}`;
|
|
71680
71700
|
const value = comment.id;
|
|
71681
|
-
|
|
71701
|
+
try {
|
|
71702
|
+
editor.setScrollable(false);
|
|
71703
|
+
editorAddTextAttribute(editor, block, range, command, value);
|
|
71704
|
+
} finally {
|
|
71705
|
+
setTimeout(() => {
|
|
71706
|
+
editor.setScrollable(true);
|
|
71707
|
+
}, 1e3);
|
|
71708
|
+
}
|
|
71682
71709
|
}
|
|
71683
71710
|
function addCommentToTextBlocks(editor, range, provider) {
|
|
71684
71711
|
const selectedBlocks = getAllSelectedBlocks(editor, { range });
|
|
@@ -77667,6 +77694,9 @@ ${docStr}
|
|
|
77667
77694
|
function replaceCrLf(text2) {
|
|
77668
77695
|
return text2.replace(/\r\n\s*/g, "").replace(/\n\s*/g, "").replace(/\r\s*/g, "");
|
|
77669
77696
|
}
|
|
77697
|
+
function replaceCrLfWithSpace(text2) {
|
|
77698
|
+
return text2.replace(/\r\n\s*/g, " ").replace(/\n\s*/g, " ").replace(/\r\s*/g, " ");
|
|
77699
|
+
}
|
|
77670
77700
|
function isImageElement(elem) {
|
|
77671
77701
|
if (!elem.tagName) {
|
|
77672
77702
|
return false;
|
|
@@ -78037,7 +78067,7 @@ ${docStr}
|
|
|
78037
78067
|
}
|
|
78038
78068
|
const currentAttributes = addNodeAttributes(node, attributes);
|
|
78039
78069
|
if (node instanceof Text && node.nodeValue || node.nodeName === "BR") {
|
|
78040
|
-
const insert =
|
|
78070
|
+
const insert = replaceCrLfWithSpace((_a = node.nodeValue) != null ? _a : " ");
|
|
78041
78071
|
if (insert) {
|
|
78042
78072
|
ops.push(textNodeToOp(insert, currentAttributes));
|
|
78043
78073
|
}
|
|
@@ -94109,9 +94139,19 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
94109
94139
|
__publicField(this, "id", "comment");
|
|
94110
94140
|
__publicField(this, "name", i18n$1.t("comment.command"));
|
|
94111
94141
|
__publicField(this, "icon", CommentIcon$1);
|
|
94142
|
+
__publicField(this, "adding", false);
|
|
94112
94143
|
}
|
|
94113
94144
|
onClick(editor, item) {
|
|
94114
|
-
|
|
94145
|
+
if (this.adding) {
|
|
94146
|
+
return;
|
|
94147
|
+
}
|
|
94148
|
+
this.adding = true;
|
|
94149
|
+
setTimeout(() => {
|
|
94150
|
+
editorAddComment(editor);
|
|
94151
|
+
setTimeout(() => {
|
|
94152
|
+
this.adding = false;
|
|
94153
|
+
}, 300);
|
|
94154
|
+
}, 300);
|
|
94115
94155
|
}
|
|
94116
94156
|
}
|
|
94117
94157
|
class ColorItem extends TextColorItem {
|
|
@@ -94722,7 +94762,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
94722
94762
|
}
|
|
94723
94763
|
}
|
|
94724
94764
|
});
|
|
94725
|
-
editor.version = "2.9.
|
|
94765
|
+
editor.version = "2.9.5";
|
|
94726
94766
|
return editor;
|
|
94727
94767
|
}
|
|
94728
94768
|
function isDoc(doc2) {
|
|
@@ -94836,7 +94876,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
94836
94876
|
}
|
|
94837
94877
|
});
|
|
94838
94878
|
OnesEditorToolbar.register(editor);
|
|
94839
|
-
editor.version = "2.9.
|
|
94879
|
+
editor.version = "2.9.5";
|
|
94840
94880
|
return editor;
|
|
94841
94881
|
}
|
|
94842
94882
|
async function showDocVersions(editor, options, serverUrl) {
|