@ones-editor/editor 1.0.2-beta.17 → 1.0.2-beta.19

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
@@ -4818,7 +4818,6 @@ div.editor-root div.editor-content div[data-type=editor-container] div.embed-blo
4818
4818
  }
4819
4819
  .version-list-root .version-list-content .version-item .version-item-author {
4820
4820
  display: flex;
4821
- align-items: center;
4822
4821
  margin-top: 10px;
4823
4822
  color: #606060;
4824
4823
  }
@@ -4831,6 +4830,7 @@ div.editor-root div.editor-content div[data-type=editor-container] div.embed-blo
4831
4830
  border-radius: 3px;
4832
4831
  margin-right: 5px;
4833
4832
  flex-shrink: 0;
4833
+ margin-top: 5px;
4834
4834
  }
4835
4835
  .version-list-root .version-list-content .version-item .version-item-memo {
4836
4836
  font-size: 14px;
@@ -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
- if (currentBlock && isTextKindBlock(editor, currentBlock) && isEmptyTextBlock(editor, currentBlock) && blocks[i].type === "text") {
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.prototype.hasOwnProperty.call(blocks[i], "heading")) {
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
- const markdown = docToMarkdown(editor, doc2);
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" && !listData.level) {
42825
+ if (type === "text-only") {
42802
42826
  return;
42803
42827
  }
42804
42828
  if (type === "checked") {
@@ -65208,16 +65232,24 @@ ${codeText}
65208
65232
  img.src = url;
65209
65233
  img.draggable = false;
65210
65234
  setGraph(embedEl, { src });
65211
- img.onload = () => {
65212
- if (isEmptyImage(img)) {
65235
+ img.onload = (e2) => {
65236
+ const img2 = embedEl.querySelector("img");
65237
+ if (e2.target !== img2 || !img2) {
65238
+ return;
65239
+ }
65240
+ if (isEmptyImage(img2)) {
65213
65241
  addDrawioEmptyStatus(embed);
65214
65242
  } else {
65215
- img.style.width = "100%";
65216
- img.style.height = "100%";
65243
+ img2.style.width = "100%";
65244
+ img2.style.height = "100%";
65217
65245
  removeDrawioEmptyStatus(embed);
65218
65246
  }
65219
65247
  };
65220
- img.onerror = () => {
65248
+ img.onerror = (e2) => {
65249
+ const img2 = embedEl.querySelector("img");
65250
+ if (e2.target !== img2) {
65251
+ return;
65252
+ }
65221
65253
  addDrawioLoadErrorStatus(editor, embed, {
65222
65254
  src
65223
65255
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ones-editor/editor",
3
- "version": "1.0.2-beta.17",
3
+ "version": "1.0.2-beta.19",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",