@ones-editor/editor 2.2.10-beta.2 → 2.2.10-beta.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.
package/dist/index.js
CHANGED
|
@@ -2139,7 +2139,6 @@ div.tippy-box[data-theme=editor-tooltip] > .tippy-content {
|
|
|
2139
2139
|
}
|
|
2140
2140
|
.editor-root [data-type=editor-container].root div[data-type=editor-block].list-block [data-type=block-content] {
|
|
2141
2141
|
margin-right: 24px;
|
|
2142
|
-
transition: background-color 0.25s linear;
|
|
2143
2142
|
}
|
|
2144
2143
|
.editor-root [data-type=editor-container].root div[data-type=editor-block].list-block [data-type=block-tools] .editor-mindmap-svg {
|
|
2145
2144
|
position: absolute;
|
|
@@ -2513,6 +2512,7 @@ div.editor-root div.editor-content div[data-block-type=list][data-style-heading=
|
|
|
2513
2512
|
.editor-root:not(.readonly) div[data-type=editor-block].list-block.hover[data-list-type=unchecked] > div[data-type=block-content], .editor-root:not(.readonly) div[data-type=editor-block].list-block.hover[data-list-type=checked] > div.list-container,
|
|
2514
2513
|
.editor-root:not(.readonly) div[data-type=editor-block].list-block.hover[data-list-type=checked] > div[data-type=block-content] {
|
|
2515
2514
|
background-color: #f8f8f8;
|
|
2515
|
+
transition: background-color 0.25s linear;
|
|
2516
2516
|
}
|
|
2517
2517
|
.editor-root:not(.readonly) div[data-type=editor-block].list-block .list-container:hover .list-marker {
|
|
2518
2518
|
cursor: pointer;
|
|
@@ -23787,7 +23787,7 @@ var __publicField = (obj, key, value) => {
|
|
|
23787
23787
|
offset = start;
|
|
23788
23788
|
length = 0;
|
|
23789
23789
|
} else if (isTextBlockContentBoxChild(child)) {
|
|
23790
|
-
offset = start;
|
|
23790
|
+
offset = start + 1;
|
|
23791
23791
|
length = 0;
|
|
23792
23792
|
} else {
|
|
23793
23793
|
assert(logger$3W, child.firstChild instanceof Text, "child is not text");
|
|
@@ -27432,7 +27432,7 @@ var __publicField = (obj, key, value) => {
|
|
|
27432
27432
|
}
|
|
27433
27433
|
const logger$3g = getLogger("table-scroll");
|
|
27434
27434
|
class DomEventHandler {
|
|
27435
|
-
constructor(editor, dom, name, handler, data2) {
|
|
27435
|
+
constructor(editor, dom, name, handler, data2, options) {
|
|
27436
27436
|
__publicField(this, "handleEvent", (event) => {
|
|
27437
27437
|
this.handler(this.editor, event, this.data);
|
|
27438
27438
|
});
|
|
@@ -27441,7 +27441,7 @@ var __publicField = (obj, key, value) => {
|
|
|
27441
27441
|
this.name = name;
|
|
27442
27442
|
this.handler = handler;
|
|
27443
27443
|
this.data = data2;
|
|
27444
|
-
dom.addEventListener(name, this.handleEvent);
|
|
27444
|
+
dom.addEventListener(name, this.handleEvent, options);
|
|
27445
27445
|
}
|
|
27446
27446
|
destroy() {
|
|
27447
27447
|
this.dom.removeEventListener(this.name, this.handleEvent);
|
|
@@ -27458,16 +27458,16 @@ var __publicField = (obj, key, value) => {
|
|
|
27458
27458
|
this.handlers.delete(element);
|
|
27459
27459
|
});
|
|
27460
27460
|
}
|
|
27461
|
-
addEventListener(element, eventName, eventHandler, data2) {
|
|
27461
|
+
addEventListener(element, eventName, eventHandler, data2, options) {
|
|
27462
27462
|
const existsHandlers = this.handlers.get(element);
|
|
27463
27463
|
if (existsHandlers) {
|
|
27464
27464
|
if (existsHandlers.find((handler) => handler.handler === eventHandler && handler.name === eventName)) {
|
|
27465
27465
|
logger$3g.warn(`event has already registered: ${eventName}`);
|
|
27466
27466
|
return;
|
|
27467
27467
|
}
|
|
27468
|
-
existsHandlers.push(new DomEventHandler(this.editor, element, eventName, eventHandler, data2));
|
|
27468
|
+
existsHandlers.push(new DomEventHandler(this.editor, element, eventName, eventHandler, data2, options));
|
|
27469
27469
|
} else {
|
|
27470
|
-
const handler = new DomEventHandler(this.editor, element, eventName, eventHandler, data2);
|
|
27470
|
+
const handler = new DomEventHandler(this.editor, element, eventName, eventHandler, data2, options);
|
|
27471
27471
|
this.handlers.set(element, [handler]);
|
|
27472
27472
|
}
|
|
27473
27473
|
}
|
|
@@ -58425,9 +58425,9 @@ $$${mathData.mathjaxText}$$
|
|
|
58425
58425
|
if (target.hasAttribute("data-editor-overflow-tooltip")) {
|
|
58426
58426
|
if (this.check(target)) {
|
|
58427
58427
|
const title = target.getAttribute("data-editor-overflow-tooltip");
|
|
58428
|
-
target.setAttribute(`data-editor-tooltip-${this.editor.clientId}`, title);
|
|
58428
|
+
target.setAttribute(`data-editor-tooltip-${this.editor.clientId}-dynamic`, title);
|
|
58429
58429
|
} else {
|
|
58430
|
-
target.removeAttribute(`data-editor-tooltip-${this.editor.clientId}`);
|
|
58430
|
+
target.removeAttribute(`data-editor-tooltip-${this.editor.clientId}-dynamic`);
|
|
58431
58431
|
}
|
|
58432
58432
|
}
|
|
58433
58433
|
});
|
|
@@ -63408,14 +63408,14 @@ ${codeText}
|
|
|
63408
63408
|
}
|
|
63409
63409
|
const code = toPlainText(text2);
|
|
63410
63410
|
const codeData = editor.doc.getBlockData(parentBlockPath.containerId, parentBlockPath.blockIndex);
|
|
63411
|
-
const
|
|
63411
|
+
const getPrismGrammar = (language) => {
|
|
63412
63412
|
if (!language) {
|
|
63413
63413
|
return Prism__default.default.languages.plain;
|
|
63414
63414
|
}
|
|
63415
63415
|
const lang = language.replace(/\s/g, "").toLocaleLowerCase();
|
|
63416
63416
|
return Prism__default.default.languages[lang] || Prism__default.default.languages.plain;
|
|
63417
63417
|
};
|
|
63418
|
-
const grammar =
|
|
63418
|
+
const grammar = getPrismGrammar(codeData.language);
|
|
63419
63419
|
const tokens = Prism__default.default.tokenize(code, grammar);
|
|
63420
63420
|
const tokenToText = (token, attributes) => {
|
|
63421
63421
|
assert(logger$1m, token, "no token");
|
|
@@ -67739,7 +67739,7 @@ ${codeText}
|
|
|
67739
67739
|
this.editor.addListener("selectionChanged", this.handleSelectionChanged);
|
|
67740
67740
|
this.editor.addListener("resize", this.handleEditorResize);
|
|
67741
67741
|
this.editor.addListener("docChanged", this.handleDocChanged);
|
|
67742
|
-
this.editor.
|
|
67742
|
+
this.editor.domEvents.addEventListener(this.editor.scrollContainer, "wheel", (ed, e2) => this.handleScroll(e2), { passive: false });
|
|
67743
67743
|
this.items.forEach((item) => item.addListener("resize", this.handleItemResize));
|
|
67744
67744
|
this.groupItemHandlers = new CommentGroupItemHandlers(this, commentsProvider);
|
|
67745
67745
|
document.addEventListener("click", this.handleDocumentClick);
|
|
@@ -67748,7 +67748,6 @@ ${codeText}
|
|
|
67748
67748
|
this.editor.removeListener("selectionChanged", this.handleSelectionChanged);
|
|
67749
67749
|
this.editor.removeListener("resize", this.handleEditorResize);
|
|
67750
67750
|
this.editor.removeListener("docChanged", this.handleDocChanged);
|
|
67751
|
-
this.editor.scrollContainer.removeEventListener("wheel", this.handleScroll);
|
|
67752
67751
|
super.destroy();
|
|
67753
67752
|
this.unbindEvents();
|
|
67754
67753
|
this.removeAllListeners();
|
|
@@ -79566,6 +79565,7 @@ ${content}
|
|
|
79566
79565
|
}
|
|
79567
79566
|
destroy() {
|
|
79568
79567
|
this.editor.doc.unregisterCallback(this);
|
|
79568
|
+
this.removeAllListeners();
|
|
79569
79569
|
}
|
|
79570
79570
|
isHeadingBlock(blockData) {
|
|
79571
79571
|
return !!blockData.heading;
|
|
@@ -80327,22 +80327,22 @@ ${content}
|
|
|
80327
80327
|
const image = createElement("img", ["editor-template-thumb"], imageContaniner);
|
|
80328
80328
|
image.src = imageSrc;
|
|
80329
80329
|
image.style.display = "none";
|
|
80330
|
-
image
|
|
80330
|
+
editor.domEvents.addEventListener(image, "error", () => {
|
|
80331
80331
|
var _a2;
|
|
80332
80332
|
const placeholder2 = (_a2 = options == null ? void 0 : options.placeHolderImageSrc) != null ? _a2 : TEMPLATE_PLACEHOLDER;
|
|
80333
80333
|
if (image.src !== placeholder2) {
|
|
80334
80334
|
image.src = placeholder2;
|
|
80335
80335
|
}
|
|
80336
|
-
};
|
|
80337
|
-
image
|
|
80336
|
+
});
|
|
80337
|
+
editor.domEvents.addEventListener(image, "load", () => {
|
|
80338
80338
|
image.style.display = "";
|
|
80339
|
-
};
|
|
80339
|
+
});
|
|
80340
80340
|
const nameDiv = createElement("div", ["editor-template-name"], card);
|
|
80341
80341
|
const span = createElement("span", [], nameDiv, name);
|
|
80342
80342
|
if (options == null ? void 0 : options.showTemplateTitleAttr) {
|
|
80343
80343
|
span.setAttribute("title", name);
|
|
80344
80344
|
}
|
|
80345
|
-
card
|
|
80345
|
+
editor.domEvents.addEventListener(card, "click", () => clickHandler(card));
|
|
80346
80346
|
return card;
|
|
80347
80347
|
}
|
|
80348
80348
|
function getDocThumbImage(editor, template) {
|
|
@@ -86446,6 +86446,7 @@ ${data2.flowchartText}
|
|
|
86446
86446
|
embeds: [...StandardEmbeds, ...((_c = options.components) == null ? void 0 : _c.embeds) || []],
|
|
86447
86447
|
boxes: [...StandardBoxes, ...((_d = options.components) == null ? void 0 : _d.boxes) || []],
|
|
86448
86448
|
textRenders: [new BlockPaddingRender()],
|
|
86449
|
+
decorators: [new CodeTextDecorator()],
|
|
86449
86450
|
options: { ...options.componentsOptions }
|
|
86450
86451
|
}
|
|
86451
86452
|
});
|
|
@@ -88091,12 +88092,14 @@ ${data2.flowchartText}
|
|
|
88091
88092
|
}
|
|
88092
88093
|
}
|
|
88093
88094
|
const logger$1 = getLogger("editor-to-docx");
|
|
88095
|
+
const ERROR_MESSAGE = "editor-to-docx: read image error";
|
|
88094
88096
|
async function readImage(editor, _appId, _docId, _src) {
|
|
88095
88097
|
try {
|
|
88096
88098
|
const url = editor.doc.buildResourceUrl(_src, { withToken: true });
|
|
88097
88099
|
let file2 = await downloadImageToFile$1(url);
|
|
88098
|
-
if (!file2)
|
|
88099
|
-
|
|
88100
|
+
if (!file2) {
|
|
88101
|
+
throw new Error(ERROR_MESSAGE);
|
|
88102
|
+
}
|
|
88100
88103
|
if (file2.type.indexOf("/svg") !== -1) {
|
|
88101
88104
|
const pngFile = await convertImageFileToPng(file2);
|
|
88102
88105
|
if (pngFile) {
|
|
@@ -88106,7 +88109,7 @@ ${data2.flowchartText}
|
|
|
88106
88109
|
const arrayBuffer = await file2.arrayBuffer();
|
|
88107
88110
|
return [arrayBuffer, url];
|
|
88108
88111
|
} catch (error2) {
|
|
88109
|
-
throw new ExportImageError(error2.message ||
|
|
88112
|
+
throw new ExportImageError(error2.message || ERROR_MESSAGE);
|
|
88110
88113
|
}
|
|
88111
88114
|
}
|
|
88112
88115
|
async function getDocByBlock(editor, doc2, block) {
|
|
@@ -88341,13 +88344,7 @@ ${data2.flowchartText}
|
|
|
88341
88344
|
}
|
|
88342
88345
|
}
|
|
88343
88346
|
});
|
|
88344
|
-
editor.version = "2.2.10-beta.
|
|
88345
|
-
if (Logger$2.level === LogLevel.DEBUG) {
|
|
88346
|
-
window.setReauthFail = (fail) => {
|
|
88347
|
-
window.isReauthError = fail;
|
|
88348
|
-
};
|
|
88349
|
-
window.reConnect = (token) => editor.doc.externalDoc.client.connection.reConnect(token);
|
|
88350
|
-
}
|
|
88347
|
+
editor.version = "2.2.10-beta.4";
|
|
88351
88348
|
return editor;
|
|
88352
88349
|
}
|
|
88353
88350
|
function isDoc(doc2) {
|
|
@@ -88442,7 +88439,7 @@ ${data2.flowchartText}
|
|
|
88442
88439
|
});
|
|
88443
88440
|
editor.addCustom(DOC_RE_AUTH_KEYS, (editor2) => new DocReAuthCallbacks(editor2));
|
|
88444
88441
|
OnesEditorToolbar.register(editor);
|
|
88445
|
-
editor.version = "2.2.10-beta.
|
|
88442
|
+
editor.version = "2.2.10-beta.4";
|
|
88446
88443
|
return editor;
|
|
88447
88444
|
}
|
|
88448
88445
|
async function showDocVersions(editor, options, serverUrl) {
|