@ones-editor/editor 2.8.20 → 2.8.22
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/index.d.ts +1 -0
- package/@ones-editor/core/src/core/patch.d.ts +1 -0
- package/@ones-editor/graph-embed/src/helper/graph-base.d.ts +3 -0
- package/@ones-editor/graph-embed/src/index.d.ts +2 -1
- package/@ones-editor/tsconfig.tsbuildinfo +1 -1
- package/dist/helper/index.d.ts +1 -0
- package/dist/helper/update-graph-block.d.ts +2 -0
- package/dist/index.js +47 -2
- package/package.json +1 -1
package/dist/helper/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -8951,6 +8951,11 @@ var __publicField = (obj, key, value) => {
|
|
|
8951
8951
|
getCurrentLang
|
|
8952
8952
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
8953
8953
|
const style$f = "";
|
|
8954
|
+
(function() {
|
|
8955
|
+
String.prototype.replaceAll || (String.prototype.replaceAll = function(e2, t2) {
|
|
8956
|
+
return Object.prototype.toString.call(e2).toLowerCase() === "[object regexp]" ? this.replace(e2, t2) : this.replace(new RegExp(e2, "g"), t2);
|
|
8957
|
+
});
|
|
8958
|
+
})();
|
|
8954
8959
|
class OnesEditorCustomDataWrapper {
|
|
8955
8960
|
constructor(editor, data2) {
|
|
8956
8961
|
this.editor = editor;
|
|
@@ -84466,6 +84471,24 @@ ${docStr}
|
|
|
84466
84471
|
EmbedBlockResizer.register(this.editor, blockElement, { maxHeight: GRAPH_MAX_HEIGHT, minHeight: GRAPH_MIN_HEIGHT });
|
|
84467
84472
|
});
|
|
84468
84473
|
}
|
|
84474
|
+
async updateImageSrc(options) {
|
|
84475
|
+
const blockData = this.editor.getBlockData(this.block);
|
|
84476
|
+
const { src, code } = this.getGraphData(blockData);
|
|
84477
|
+
if (!src && !code) {
|
|
84478
|
+
return;
|
|
84479
|
+
}
|
|
84480
|
+
if (src && !(options == null ? void 0 : options.force)) {
|
|
84481
|
+
return;
|
|
84482
|
+
}
|
|
84483
|
+
const codeValue = code;
|
|
84484
|
+
try {
|
|
84485
|
+
const resourceId = await this.code2ResourceId(codeValue);
|
|
84486
|
+
const newData = this.createGraphEmbedData(this.block, { code: codeValue, src: resourceId });
|
|
84487
|
+
this.editor.updateEmbedData(this.block, newData);
|
|
84488
|
+
} catch (err) {
|
|
84489
|
+
logger$l.error(err);
|
|
84490
|
+
}
|
|
84491
|
+
}
|
|
84469
84492
|
async updateEmbedContent(content, block) {
|
|
84470
84493
|
var _a, _b;
|
|
84471
84494
|
const { code, src, view, flex = DEFAULT_FLEX, height } = this.getGraphData(block);
|
|
@@ -92822,6 +92845,27 @@ ${data2.plantumlText}
|
|
|
92822
92845
|
}
|
|
92823
92846
|
return editorBreakTextBlock(editor, block, offset, options);
|
|
92824
92847
|
}
|
|
92848
|
+
function updateGraphBlockSrc(editor, cloneDocResult) {
|
|
92849
|
+
const blockIds = cloneDocResult.blockIdMap.values();
|
|
92850
|
+
Array.from(blockIds).forEach((blockId) => {
|
|
92851
|
+
const block = editor.findBlockById(blockId);
|
|
92852
|
+
if (block && isEmbedBlock(block)) {
|
|
92853
|
+
const blockData = editor.getBlockData(block);
|
|
92854
|
+
const embedType = blockData.embedType;
|
|
92855
|
+
const embedData = blockData.embedData;
|
|
92856
|
+
if (embedData.src) {
|
|
92857
|
+
return;
|
|
92858
|
+
}
|
|
92859
|
+
const types2 = ["mermaid", "flowchart", "plantuml"];
|
|
92860
|
+
if (types2.includes(embedType)) {
|
|
92861
|
+
const instance = editor.findCustom(`${embedType}_${blockId}`);
|
|
92862
|
+
if (instance) {
|
|
92863
|
+
instance.updateImageSrc();
|
|
92864
|
+
}
|
|
92865
|
+
}
|
|
92866
|
+
}
|
|
92867
|
+
});
|
|
92868
|
+
}
|
|
92825
92869
|
const logger = getLogger("create-editor");
|
|
92826
92870
|
function getDefaultOnesEditorOptions(options) {
|
|
92827
92871
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
@@ -93069,7 +93113,7 @@ ${data2.plantumlText}
|
|
|
93069
93113
|
}
|
|
93070
93114
|
}
|
|
93071
93115
|
});
|
|
93072
|
-
editor.version = "2.8.
|
|
93116
|
+
editor.version = "2.8.22";
|
|
93073
93117
|
return editor;
|
|
93074
93118
|
}
|
|
93075
93119
|
function isDoc(doc2) {
|
|
@@ -93182,7 +93226,7 @@ ${data2.plantumlText}
|
|
|
93182
93226
|
}
|
|
93183
93227
|
});
|
|
93184
93228
|
OnesEditorToolbar.register(editor);
|
|
93185
|
-
editor.version = "2.8.
|
|
93229
|
+
editor.version = "2.8.22";
|
|
93186
93230
|
return editor;
|
|
93187
93231
|
}
|
|
93188
93232
|
async function showDocVersions(editor, options, serverUrl) {
|
|
@@ -139764,6 +139808,7 @@ ${data2.plantumlText}
|
|
|
139764
139808
|
exports2.unicodeLength = unicodeLength;
|
|
139765
139809
|
exports2.unicodeSubstr = unicodeSubstr;
|
|
139766
139810
|
exports2.updateBlockSelection = updateBlockSelection;
|
|
139811
|
+
exports2.updateGraphBlockSrc = updateGraphBlockSrc;
|
|
139767
139812
|
exports2.updateOpAttributes = updateOpAttributes;
|
|
139768
139813
|
exports2.updateTextBlockContent = updateTextBlockContent;
|
|
139769
139814
|
exports2.updateUrl = updateUrl;
|