@ones-editor/editor 2.8.20 → 2.8.21
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/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 +42 -2
- package/package.json +1 -1
package/dist/helper/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -84466,6 +84466,24 @@ ${docStr}
|
|
|
84466
84466
|
EmbedBlockResizer.register(this.editor, blockElement, { maxHeight: GRAPH_MAX_HEIGHT, minHeight: GRAPH_MIN_HEIGHT });
|
|
84467
84467
|
});
|
|
84468
84468
|
}
|
|
84469
|
+
async updateImageSrc(options) {
|
|
84470
|
+
const blockData = this.editor.getBlockData(this.block);
|
|
84471
|
+
const { src, code } = this.getGraphData(blockData);
|
|
84472
|
+
if (!src && !code) {
|
|
84473
|
+
return;
|
|
84474
|
+
}
|
|
84475
|
+
if (src && !(options == null ? void 0 : options.force)) {
|
|
84476
|
+
return;
|
|
84477
|
+
}
|
|
84478
|
+
const codeValue = code;
|
|
84479
|
+
try {
|
|
84480
|
+
const resourceId = await this.code2ResourceId(codeValue);
|
|
84481
|
+
const newData = this.createGraphEmbedData(this.block, { code: codeValue, src: resourceId });
|
|
84482
|
+
this.editor.updateEmbedData(this.block, newData);
|
|
84483
|
+
} catch (err) {
|
|
84484
|
+
logger$l.error(err);
|
|
84485
|
+
}
|
|
84486
|
+
}
|
|
84469
84487
|
async updateEmbedContent(content, block) {
|
|
84470
84488
|
var _a, _b;
|
|
84471
84489
|
const { code, src, view, flex = DEFAULT_FLEX, height } = this.getGraphData(block);
|
|
@@ -92822,6 +92840,27 @@ ${data2.plantumlText}
|
|
|
92822
92840
|
}
|
|
92823
92841
|
return editorBreakTextBlock(editor, block, offset, options);
|
|
92824
92842
|
}
|
|
92843
|
+
function updateGraphBlockSrc(editor, cloneDocResult) {
|
|
92844
|
+
const blockIds = cloneDocResult.blockIdMap.values();
|
|
92845
|
+
Array.from(blockIds).forEach((blockId) => {
|
|
92846
|
+
const block = editor.findBlockById(blockId);
|
|
92847
|
+
if (block && isEmbedBlock(block)) {
|
|
92848
|
+
const blockData = editor.getBlockData(block);
|
|
92849
|
+
const embedType = blockData.embedType;
|
|
92850
|
+
const embedData = blockData.embedData;
|
|
92851
|
+
if (embedData.src) {
|
|
92852
|
+
return;
|
|
92853
|
+
}
|
|
92854
|
+
const types2 = ["mermaid", "flowchart", "plantuml"];
|
|
92855
|
+
if (types2.includes(embedType)) {
|
|
92856
|
+
const instance = editor.findCustom(`${embedType}_${blockId}`);
|
|
92857
|
+
if (instance) {
|
|
92858
|
+
instance.updateImageSrc();
|
|
92859
|
+
}
|
|
92860
|
+
}
|
|
92861
|
+
}
|
|
92862
|
+
});
|
|
92863
|
+
}
|
|
92825
92864
|
const logger = getLogger("create-editor");
|
|
92826
92865
|
function getDefaultOnesEditorOptions(options) {
|
|
92827
92866
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
@@ -93069,7 +93108,7 @@ ${data2.plantumlText}
|
|
|
93069
93108
|
}
|
|
93070
93109
|
}
|
|
93071
93110
|
});
|
|
93072
|
-
editor.version = "2.8.
|
|
93111
|
+
editor.version = "2.8.21";
|
|
93073
93112
|
return editor;
|
|
93074
93113
|
}
|
|
93075
93114
|
function isDoc(doc2) {
|
|
@@ -93182,7 +93221,7 @@ ${data2.plantumlText}
|
|
|
93182
93221
|
}
|
|
93183
93222
|
});
|
|
93184
93223
|
OnesEditorToolbar.register(editor);
|
|
93185
|
-
editor.version = "2.8.
|
|
93224
|
+
editor.version = "2.8.21";
|
|
93186
93225
|
return editor;
|
|
93187
93226
|
}
|
|
93188
93227
|
async function showDocVersions(editor, options, serverUrl) {
|
|
@@ -139764,6 +139803,7 @@ ${data2.plantumlText}
|
|
|
139764
139803
|
exports2.unicodeLength = unicodeLength;
|
|
139765
139804
|
exports2.unicodeSubstr = unicodeSubstr;
|
|
139766
139805
|
exports2.updateBlockSelection = updateBlockSelection;
|
|
139806
|
+
exports2.updateGraphBlockSrc = updateGraphBlockSrc;
|
|
139767
139807
|
exports2.updateOpAttributes = updateOpAttributes;
|
|
139768
139808
|
exports2.updateTextBlockContent = updateTextBlockContent;
|
|
139769
139809
|
exports2.updateUrl = updateUrl;
|