@ones-editor/editor 2.1.7-beta.32 → 2.1.7-beta.34

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
@@ -73528,7 +73528,7 @@ ${content}
73528
73528
  }
73529
73529
  node.childNodes.forEach(replaceBrToTextNode);
73530
73530
  }
73531
- function textToCodeBlock(text2, lang) {
73531
+ function textToCodeBlock(text2, language) {
73532
73532
  const codeBlocks = text2.split("\n").map((line) => {
73533
73533
  const block = {
73534
73534
  type: "text",
@@ -73543,7 +73543,7 @@ ${content}
73543
73543
  root: [{
73544
73544
  id: genId(),
73545
73545
  type: "code",
73546
- lang,
73546
+ language,
73547
73547
  children: [containerId]
73548
73548
  }],
73549
73549
  [containerId]: codeBlocks
@@ -73618,8 +73618,15 @@ ${content}
73618
73618
  return node.nodeName === "PRE" && ((_a = node.firstChild) == null ? void 0 : _a.nodeName) === "CODE";
73619
73619
  },
73620
73620
  replacement: (content, node, options) => {
73621
+ var _a;
73621
73622
  replaceBrToTextNode(node);
73622
- return "\n\n" + options.fence + "\n" + nodeToCodeBlock(node, "") + "\n" + options.fence + "\n\n";
73623
+ const classes = Array.from(((_a = node.firstElementChild) == null ? void 0 : _a.classList) || []);
73624
+ const langClass = classes.find((c) => c.startsWith("lang-"));
73625
+ let lang = "";
73626
+ if (langClass) {
73627
+ lang = langClass.substring("lang-".length);
73628
+ }
73629
+ return "\n\n" + options.fence + "\n" + nodeToCodeBlock(node, lang) + "\n" + options.fence + "\n\n";
73623
73630
  }
73624
73631
  });
73625
73632
  }
@@ -74043,6 +74050,39 @@ ${content}
74043
74050
  }
74044
74051
  });
74045
74052
  }
74053
+ function figcaptionToTextBlock(ts) {
74054
+ ts.addRule("figcaption", {
74055
+ filter: (node) => {
74056
+ return node.nodeName === "FIGCAPTION";
74057
+ },
74058
+ replacement: (content, node, options) => {
74059
+ var _a;
74060
+ const text2 = (_a = node.textContent) != null ? _a : "";
74061
+ const richText2 = createRichText(text2, {
74062
+ "style-color-6": true,
74063
+ "style-italic": true
74064
+ });
74065
+ const doc2 = {
74066
+ blocks: {
74067
+ root: [{
74068
+ id: genId(),
74069
+ type: "text",
74070
+ text: richText2
74071
+ }]
74072
+ },
74073
+ meta: {},
74074
+ comments: {}
74075
+ };
74076
+ const docStr = toBase64URL(JSON.stringify(doc2));
74077
+ return `
74078
+
74079
+ \`\`\`
74080
+ ${docStr}
74081
+ \`\`\`
74082
+ `;
74083
+ }
74084
+ });
74085
+ }
74046
74086
  const logger$K = getLogger("html-to-doc");
74047
74087
  const turndownService = new TurndownService();
74048
74088
  turndownService.use(codeListToCode);
@@ -74055,6 +74095,7 @@ ${content}
74055
74095
  turndownService.use(wechatMessageTimeToBlockQuote);
74056
74096
  turndownService.use(turndownPluginGfm.gfm);
74057
74097
  turndownService.use(underline);
74098
+ turndownService.use(figcaptionToTextBlock);
74058
74099
  function htmlToBlocks$1(html, options) {
74059
74100
  const subDoc = processedHtmlToDocByMarkdown(html, options);
74060
74101
  if (!subDoc) {
@@ -89225,7 +89266,7 @@ ${data2.flowchartText}
89225
89266
  }
89226
89267
  }
89227
89268
  });
89228
- editor.version = "2.1.7-beta.32";
89269
+ editor.version = "2.1.7-beta.34";
89229
89270
  return editor;
89230
89271
  }
89231
89272
  function isDoc(doc2) {
@@ -89339,7 +89380,7 @@ ${data2.flowchartText}
89339
89380
  }
89340
89381
  }
89341
89382
  OnesEditorToolbar.register(editor);
89342
- editor.version = "2.1.7-beta.32";
89383
+ editor.version = "2.1.7-beta.34";
89343
89384
  return editor;
89344
89385
  }
89345
89386
  async function showDocVersions(editor, options, serverUrl) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ones-editor/editor",
3
- "version": "2.1.7-beta.32",
3
+ "version": "2.1.7-beta.34",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",