@ones-editor/editor 2.8.38 → 2.8.40
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
|
@@ -26314,6 +26314,9 @@ var __publicField = (obj, key, value) => {
|
|
|
26314
26314
|
}
|
|
26315
26315
|
}
|
|
26316
26316
|
function editorScrollIntoView(editor) {
|
|
26317
|
+
if (!editor.scrollable()) {
|
|
26318
|
+
return;
|
|
26319
|
+
}
|
|
26317
26320
|
if (!isElementVisible(editor.rootContainer)) {
|
|
26318
26321
|
logger$3R.warn("editorScrollIntoView: editor is not visible");
|
|
26319
26322
|
return;
|
|
@@ -31657,6 +31660,7 @@ ${codeText}
|
|
|
31657
31660
|
__publicField(this, "inputHandlers", new EditorInputHandlers(this));
|
|
31658
31661
|
__publicField(this, "settingsProvider");
|
|
31659
31662
|
__publicField(this, "_readonly", false);
|
|
31663
|
+
__publicField(this, "_scrollable", true);
|
|
31660
31664
|
__publicField(this, "getColor", (index2) => {
|
|
31661
31665
|
const colors = this.options.colors;
|
|
31662
31666
|
if (colors.length === 0) {
|
|
@@ -31884,6 +31888,12 @@ ${codeText}
|
|
|
31884
31888
|
return false;
|
|
31885
31889
|
return elem.closest("div.editor-root") === this.rootElement;
|
|
31886
31890
|
}
|
|
31891
|
+
scrollable() {
|
|
31892
|
+
return this._scrollable;
|
|
31893
|
+
}
|
|
31894
|
+
setScrollable(scrollable2) {
|
|
31895
|
+
this._scrollable = scrollable2;
|
|
31896
|
+
}
|
|
31887
31897
|
insertBlock(containerId, blockIndex, blockData, newRange, options) {
|
|
31888
31898
|
const defaultPos = { blockId: blockData.id, offset: 0 };
|
|
31889
31899
|
const defaultRange = { anchor: defaultPos, focus: defaultPos };
|
|
@@ -70003,6 +70013,9 @@ ${codeText}
|
|
|
70003
70013
|
}
|
|
70004
70014
|
});
|
|
70005
70015
|
__publicField(this, "handleSelectionChanged", () => {
|
|
70016
|
+
if (!this.editor.scrollable()) {
|
|
70017
|
+
return;
|
|
70018
|
+
}
|
|
70006
70019
|
setTimeout(() => {
|
|
70007
70020
|
var _a;
|
|
70008
70021
|
const commentIds = getCommentsFromSelection(this.editor);
|
|
@@ -70312,7 +70325,14 @@ ${codeText}
|
|
|
70312
70325
|
}
|
|
70313
70326
|
onCreateComment(commentId, local) {
|
|
70314
70327
|
const comment = this.commentsProvider.getComment(commentId);
|
|
70315
|
-
|
|
70328
|
+
try {
|
|
70329
|
+
this.editor.setScrollable(false);
|
|
70330
|
+
this.list.handleCreateComment(comment, local);
|
|
70331
|
+
} finally {
|
|
70332
|
+
setTimeout(() => {
|
|
70333
|
+
this.editor.setScrollable(true);
|
|
70334
|
+
}, 1e3);
|
|
70335
|
+
}
|
|
70316
70336
|
this.updateCommentCount();
|
|
70317
70337
|
}
|
|
70318
70338
|
onDeleteComment(commentId, local) {
|
|
@@ -70879,7 +70899,14 @@ ${codeText}
|
|
|
70879
70899
|
const range = createBlockSimpleRange(editor, block, selectedBlock.start.offset, selectedBlock.end.offset);
|
|
70880
70900
|
const command = `comment-${comment.id.toLocaleLowerCase()}`;
|
|
70881
70901
|
const value = comment.id;
|
|
70882
|
-
|
|
70902
|
+
try {
|
|
70903
|
+
editor.setScrollable(false);
|
|
70904
|
+
editorAddTextAttribute(editor, block, range, command, value);
|
|
70905
|
+
} finally {
|
|
70906
|
+
setTimeout(() => {
|
|
70907
|
+
editor.setScrollable(true);
|
|
70908
|
+
}, 1e3);
|
|
70909
|
+
}
|
|
70883
70910
|
}
|
|
70884
70911
|
function addCommentToTextBlocks(editor, range, provider) {
|
|
70885
70912
|
const selectedBlocks = getAllSelectedBlocks(editor, { range });
|
|
@@ -76848,6 +76875,9 @@ ${docStr}
|
|
|
76848
76875
|
function replaceCrLf(text2) {
|
|
76849
76876
|
return text2.replace(/\r\n\s*/g, "").replace(/\n\s*/g, "").replace(/\r\s*/g, "");
|
|
76850
76877
|
}
|
|
76878
|
+
function replaceCrLfWithSpace(text2) {
|
|
76879
|
+
return text2.replace(/\r\n\s*/g, " ").replace(/\n\s*/g, " ").replace(/\r\s*/g, " ");
|
|
76880
|
+
}
|
|
76851
76881
|
function isImageElement(elem) {
|
|
76852
76882
|
if (!elem.tagName) {
|
|
76853
76883
|
return false;
|
|
@@ -77218,7 +77248,7 @@ ${docStr}
|
|
|
77218
77248
|
}
|
|
77219
77249
|
const currentAttributes = addNodeAttributes(node, attributes);
|
|
77220
77250
|
if (node instanceof Text && node.nodeValue || node.nodeName === "BR") {
|
|
77221
|
-
const insert =
|
|
77251
|
+
const insert = replaceCrLfWithSpace((_a = node.nodeValue) != null ? _a : " ");
|
|
77222
77252
|
if (insert) {
|
|
77223
77253
|
ops.push(textNodeToOp(insert, currentAttributes));
|
|
77224
77254
|
}
|
|
@@ -93270,9 +93300,19 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
93270
93300
|
__publicField(this, "id", "comment");
|
|
93271
93301
|
__publicField(this, "name", i18n$1.t("comment.command"));
|
|
93272
93302
|
__publicField(this, "icon", CommentIcon$1);
|
|
93303
|
+
__publicField(this, "adding", false);
|
|
93273
93304
|
}
|
|
93274
93305
|
onClick(editor, item) {
|
|
93275
|
-
|
|
93306
|
+
if (this.adding) {
|
|
93307
|
+
return;
|
|
93308
|
+
}
|
|
93309
|
+
this.adding = true;
|
|
93310
|
+
setTimeout(() => {
|
|
93311
|
+
editorAddComment(editor);
|
|
93312
|
+
setTimeout(() => {
|
|
93313
|
+
this.adding = false;
|
|
93314
|
+
}, 300);
|
|
93315
|
+
}, 300);
|
|
93276
93316
|
}
|
|
93277
93317
|
}
|
|
93278
93318
|
class ColorItem extends TextColorItem {
|
|
@@ -93882,7 +93922,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
93882
93922
|
}
|
|
93883
93923
|
}
|
|
93884
93924
|
});
|
|
93885
|
-
editor.version = "2.8.
|
|
93925
|
+
editor.version = "2.8.40";
|
|
93886
93926
|
return editor;
|
|
93887
93927
|
}
|
|
93888
93928
|
function isDoc(doc2) {
|
|
@@ -93995,7 +94035,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
93995
94035
|
}
|
|
93996
94036
|
});
|
|
93997
94037
|
OnesEditorToolbar.register(editor);
|
|
93998
|
-
editor.version = "2.8.
|
|
94038
|
+
editor.version = "2.8.40";
|
|
93999
94039
|
return editor;
|
|
94000
94040
|
}
|
|
94001
94041
|
async function showDocVersions(editor, options, serverUrl) {
|