@ones-editor/editor 2.2.14-beta.10 → 2.2.14-beta.12
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
|
@@ -81404,6 +81404,12 @@ ${content}
|
|
|
81404
81404
|
textarea2.style.height = `${textarea2.scrollHeight}px`;
|
|
81405
81405
|
});
|
|
81406
81406
|
};
|
|
81407
|
+
const getCodeEditor = (block) => {
|
|
81408
|
+
const textarea2 = block.querySelector(".embed-code-editor-textarea");
|
|
81409
|
+
assert(logger$m, textarea2, "Can not find textarea in block");
|
|
81410
|
+
assert(logger$m, textarea2 instanceof HTMLTextAreaElement, "Textarea is not HTMLTextAreaElement");
|
|
81411
|
+
return textarea2;
|
|
81412
|
+
};
|
|
81407
81413
|
const logger$l = getLogger("graph-dom/view-select");
|
|
81408
81414
|
var ViewId = /* @__PURE__ */ ((ViewId2) => {
|
|
81409
81415
|
ViewId2["Both"] = "both";
|
|
@@ -81552,6 +81558,42 @@ ${content}
|
|
|
81552
81558
|
return exclusiveBlock2;
|
|
81553
81559
|
}
|
|
81554
81560
|
}
|
|
81561
|
+
class TaskCache {
|
|
81562
|
+
constructor() {
|
|
81563
|
+
__publicField(this, "_cache", []);
|
|
81564
|
+
}
|
|
81565
|
+
checkCache(pro) {
|
|
81566
|
+
const index2 = this._cache.findIndex((p) => p.promise === pro);
|
|
81567
|
+
for (let i = 0; i < index2; i++) {
|
|
81568
|
+
this._cache[i].promiseHelper.isDelayComplete = true;
|
|
81569
|
+
}
|
|
81570
|
+
this._cache.splice(index2, 1);
|
|
81571
|
+
}
|
|
81572
|
+
addCache(pro, promiseHelper) {
|
|
81573
|
+
this._cache.push({ promise: pro, promiseHelper });
|
|
81574
|
+
}
|
|
81575
|
+
static createPromiseHelper() {
|
|
81576
|
+
return {
|
|
81577
|
+
isDelayComplete: false
|
|
81578
|
+
};
|
|
81579
|
+
}
|
|
81580
|
+
}
|
|
81581
|
+
const enhanceAsync = (asyncFunction) => {
|
|
81582
|
+
const taskCache = new TaskCache();
|
|
81583
|
+
return async function(...args) {
|
|
81584
|
+
const promiseHelper = TaskCache.createPromiseHelper();
|
|
81585
|
+
const pro = asyncFunction.apply(this, [promiseHelper, ...args]);
|
|
81586
|
+
taskCache.addCache(pro, promiseHelper);
|
|
81587
|
+
try {
|
|
81588
|
+
const ret = await pro;
|
|
81589
|
+
taskCache.checkCache(pro);
|
|
81590
|
+
return ret;
|
|
81591
|
+
} catch (error2) {
|
|
81592
|
+
taskCache.checkCache(pro);
|
|
81593
|
+
throw error2;
|
|
81594
|
+
}
|
|
81595
|
+
};
|
|
81596
|
+
};
|
|
81555
81597
|
const logger$k = getLogger("graph-embed-base");
|
|
81556
81598
|
class GraphBase {
|
|
81557
81599
|
constructor(editor) {
|
|
@@ -81656,7 +81698,7 @@ ${content}
|
|
|
81656
81698
|
break;
|
|
81657
81699
|
}
|
|
81658
81700
|
});
|
|
81659
|
-
__publicField(this, "updateDraw", async (src, code) => {
|
|
81701
|
+
__publicField(this, "updateDraw", enhanceAsync(async (promiseHelper, src, code) => {
|
|
81660
81702
|
var _a, _b, _c, _d;
|
|
81661
81703
|
if (!src && !code) {
|
|
81662
81704
|
(_a = this.drawHandler) == null ? void 0 : _a.createEmptyContent();
|
|
@@ -81665,8 +81707,14 @@ ${content}
|
|
|
81665
81707
|
if (!src) {
|
|
81666
81708
|
try {
|
|
81667
81709
|
const imgSrc2 = await this.code2ObjectUrl(code);
|
|
81710
|
+
if (promiseHelper.isDelayComplete) {
|
|
81711
|
+
return;
|
|
81712
|
+
}
|
|
81668
81713
|
(_b = this.drawHandler) == null ? void 0 : _b.updateDraw(imgSrc2);
|
|
81669
81714
|
} catch (err) {
|
|
81715
|
+
if (promiseHelper.isDelayComplete) {
|
|
81716
|
+
return;
|
|
81717
|
+
}
|
|
81670
81718
|
(_c = this.drawHandler) == null ? void 0 : _c.createErrorContent();
|
|
81671
81719
|
}
|
|
81672
81720
|
return;
|
|
@@ -81686,7 +81734,7 @@ ${content}
|
|
|
81686
81734
|
}
|
|
81687
81735
|
});
|
|
81688
81736
|
(_d = this.drawHandler) == null ? void 0 : _d.updateDraw(imgSrc);
|
|
81689
|
-
});
|
|
81737
|
+
}));
|
|
81690
81738
|
this.editor = editor;
|
|
81691
81739
|
this.editor.addListener("readonlyChanged", this.handleReadonlyChanged);
|
|
81692
81740
|
GraphExclusiveHandler.get(editor).addListener("onExclusiveBlock", this.handleExclusiveBlock);
|
|
@@ -81728,8 +81776,8 @@ ${content}
|
|
|
81728
81776
|
this.viewSelect.setSelectedView(realView);
|
|
81729
81777
|
this.updateLayout(realView, flex);
|
|
81730
81778
|
this.updateHeight(content, height);
|
|
81779
|
+
this.updateDraw(src, code);
|
|
81731
81780
|
setTimeout(() => {
|
|
81732
|
-
this.updateDraw(src, code);
|
|
81733
81781
|
if (clientType.isMobile) {
|
|
81734
81782
|
return;
|
|
81735
81783
|
}
|
|
@@ -81749,6 +81797,10 @@ ${content}
|
|
|
81749
81797
|
if (((_a = this.viewSelect) == null ? void 0 : _a.selectedView) !== realView) {
|
|
81750
81798
|
(_b = this.viewSelect) == null ? void 0 : _b.setSelectedView(realView);
|
|
81751
81799
|
}
|
|
81800
|
+
if (realView !== ViewId.Draw) {
|
|
81801
|
+
const textarea2 = getCodeEditor(blockElement);
|
|
81802
|
+
textarea2.value = code;
|
|
81803
|
+
}
|
|
81752
81804
|
this.updateLayout(realView, flex);
|
|
81753
81805
|
this.updateDraw(src, code);
|
|
81754
81806
|
this.updateHeight(content, height);
|
|
@@ -88912,7 +88964,7 @@ ${data2.plantumlText}
|
|
|
88912
88964
|
}
|
|
88913
88965
|
}
|
|
88914
88966
|
});
|
|
88915
|
-
editor.version = "2.2.14-beta.
|
|
88967
|
+
editor.version = "2.2.14-beta.12";
|
|
88916
88968
|
return editor;
|
|
88917
88969
|
}
|
|
88918
88970
|
function isDoc(doc2) {
|
|
@@ -89013,7 +89065,7 @@ ${data2.plantumlText}
|
|
|
89013
89065
|
});
|
|
89014
89066
|
editor.addCustom(DOC_RE_AUTH_KEYS, (editor2) => new DocReAuthCallbacks(editor2));
|
|
89015
89067
|
OnesEditorToolbar.register(editor);
|
|
89016
|
-
editor.version = "2.2.14-beta.
|
|
89068
|
+
editor.version = "2.2.14-beta.12";
|
|
89017
89069
|
return editor;
|
|
89018
89070
|
}
|
|
89019
89071
|
async function showDocVersions(editor, options, serverUrl) {
|