@ones-editor/editor 1.0.2-beta.16 → 1.0.2-beta.18
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
|
@@ -23466,9 +23466,10 @@ var __publicField = (obj, key, value) => {
|
|
|
23466
23466
|
for (let i = 0; i < blocks.length; i++) {
|
|
23467
23467
|
if (i === 0) {
|
|
23468
23468
|
const currentBlock = editor.getBlockByIndex(containerId, blockIndex2);
|
|
23469
|
-
|
|
23469
|
+
const isTextKindInsert = blocks[i].type === "text" || blocks[i].type === "list";
|
|
23470
|
+
if (currentBlock && isTextKindBlock(editor, currentBlock) && isEmptyTextBlock(editor, currentBlock) && isTextKindInsert) {
|
|
23470
23471
|
editor.insertTextToBlock(block, 0, (_a = blocks[i].text) != null ? _a : []);
|
|
23471
|
-
if (Object.
|
|
23472
|
+
if (Object.keys(blocks[i]).length > 3) {
|
|
23472
23473
|
editor.updateBlockData(currentBlock, blocks[i]);
|
|
23473
23474
|
}
|
|
23474
23475
|
continue;
|
|
@@ -25375,7 +25376,30 @@ var __publicField = (obj, key, value) => {
|
|
|
25375
25376
|
addMetaToDoc(editor, doc2);
|
|
25376
25377
|
const htmlFragment = docToHtmlFragment(editor, doc2);
|
|
25377
25378
|
const html = injectDocToHtmlFragment(htmlFragment, doc2);
|
|
25378
|
-
|
|
25379
|
+
let markdown = "";
|
|
25380
|
+
const lines = [];
|
|
25381
|
+
let hasCodeBlock = false;
|
|
25382
|
+
doc2.blocks.root.forEach((b, index2) => {
|
|
25383
|
+
const parentContainer = editor.getParentContainer(editor.getBlockById(b.id));
|
|
25384
|
+
const parentBlock = getParentBlock(parentContainer);
|
|
25385
|
+
const isCodeTextBlock2 = parentBlock && getBlockType(parentBlock) === "code";
|
|
25386
|
+
if (isCodeTextBlock2) {
|
|
25387
|
+
if (!hasCodeBlock) {
|
|
25388
|
+
const codeBlock2 = parentBlock;
|
|
25389
|
+
const codeBlockData = editor.getBlockData(codeBlock2);
|
|
25390
|
+
const codeText = editor.getSelectedText();
|
|
25391
|
+
lines.push(`\`\`\`${codeBlockData.language}
|
|
25392
|
+
${codeText}
|
|
25393
|
+
\`\`\`
|
|
25394
|
+
`);
|
|
25395
|
+
hasCodeBlock = true;
|
|
25396
|
+
}
|
|
25397
|
+
} else {
|
|
25398
|
+
lines.push(blockToMarkdown(editor, b, doc2, [{ containerId: "root", blockIndex: index2 }]));
|
|
25399
|
+
}
|
|
25400
|
+
});
|
|
25401
|
+
lines[lines.length - 1] = lines[lines.length - 1].trimEnd();
|
|
25402
|
+
markdown = lines.join("\n");
|
|
25379
25403
|
const blob = new Blob([html], {
|
|
25380
25404
|
type: "text/html"
|
|
25381
25405
|
});
|
|
@@ -42798,7 +42822,7 @@ var __publicField = (obj, key, value) => {
|
|
|
42798
42822
|
}
|
|
42799
42823
|
function updateMarker(marker, listData) {
|
|
42800
42824
|
const type = getListType(listData);
|
|
42801
|
-
if (type === "text-only"
|
|
42825
|
+
if (type === "text-only") {
|
|
42802
42826
|
return;
|
|
42803
42827
|
}
|
|
42804
42828
|
if (type === "checked") {
|
|
@@ -57275,15 +57299,15 @@ ${codeText}
|
|
|
57275
57299
|
canSelectBlock = true;
|
|
57276
57300
|
}
|
|
57277
57301
|
if (selection.range.start.isSimple() && selection.range.end.isSimple()) {
|
|
57278
|
-
canSelectBlock = selection.range.start.offset > 0;
|
|
57302
|
+
canSelectBlock = selection.range.start.offset > 0 && selection.range.getSelectedBlocks().length === 1;
|
|
57279
57303
|
}
|
|
57280
|
-
const commandItems = [
|
|
57281
|
-
|
|
57282
|
-
commandItems.push({
|
|
57304
|
+
const commandItems = [
|
|
57305
|
+
{
|
|
57283
57306
|
id: "select-block",
|
|
57284
|
-
name: this.t("contextMenu.selectBlock")
|
|
57285
|
-
|
|
57286
|
-
|
|
57307
|
+
name: this.t("contextMenu.selectBlock"),
|
|
57308
|
+
states: canSelectBlock ? [] : ["disabled"]
|
|
57309
|
+
}
|
|
57310
|
+
];
|
|
57287
57311
|
commandItems.push({
|
|
57288
57312
|
id: "select-all",
|
|
57289
57313
|
name: this.t("contextMenu.selectAll")
|
|
@@ -57309,8 +57333,8 @@ ${codeText}
|
|
|
57309
57333
|
const { x, y } = event;
|
|
57310
57334
|
const nextRange = getBlockNearestRangeFromPoint(this.editor, x, y);
|
|
57311
57335
|
const oldRange = this.editor.selection.range;
|
|
57312
|
-
const
|
|
57313
|
-
if (oldRange.focus.blockId !== (nextRange == null ? void 0 : nextRange.focus.blockId) &&
|
|
57336
|
+
const rangeInSelected = oldRange.getSelectedBlocks().some((selectBlock) => selectBlock.block.id === (nextRange == null ? void 0 : nextRange.focus.blockId));
|
|
57337
|
+
if (oldRange.focus.blockId !== (nextRange == null ? void 0 : nextRange.focus.blockId) && oldRange.focus.isSimple() && !rangeInSelected) {
|
|
57314
57338
|
this.editor.selectionHandler.handleMouseDown(event, { autoScroll: false });
|
|
57315
57339
|
}
|
|
57316
57340
|
});
|
|
@@ -65323,7 +65347,11 @@ ${codeText}
|
|
|
65323
65347
|
}
|
|
65324
65348
|
}
|
|
65325
65349
|
};
|
|
65326
|
-
|
|
65350
|
+
properties.blockCommands = {
|
|
65351
|
+
...properties.blockCommands,
|
|
65352
|
+
...contextMenuProperties.blockCommands
|
|
65353
|
+
};
|
|
65354
|
+
return { ...properties, abstract: i18n$1.t("drawio.abstract") };
|
|
65327
65355
|
}
|
|
65328
65356
|
const enUS$4 = {
|
|
65329
65357
|
drawio: {
|
|
@@ -71064,15 +71092,18 @@ ${codeText}
|
|
|
71064
71092
|
};
|
|
71065
71093
|
}
|
|
71066
71094
|
function getGraphEmbedBlockProperties(editor, block, type, properties) {
|
|
71067
|
-
const
|
|
71095
|
+
const graphBlockContextMenuCommands = getGraphBlockContextMenuCommands(editor, block, type);
|
|
71068
71096
|
const graphEmbedBlockProperties = {
|
|
71069
71097
|
blockCommands: {
|
|
71070
71098
|
"hovering-toolbar": new GraphBlockCommands(editor, block, type, properties)
|
|
71071
71099
|
},
|
|
71072
71100
|
abstract: lodash.exports.capitalize(type)
|
|
71073
71101
|
};
|
|
71074
|
-
if (
|
|
71075
|
-
|
|
71102
|
+
if (graphBlockContextMenuCommands) {
|
|
71103
|
+
graphEmbedBlockProperties.blockCommands = {
|
|
71104
|
+
...graphEmbedBlockProperties.blockCommands,
|
|
71105
|
+
...graphBlockContextMenuCommands.blockCommands
|
|
71106
|
+
};
|
|
71076
71107
|
}
|
|
71077
71108
|
return graphEmbedBlockProperties;
|
|
71078
71109
|
}
|