@ones-editor/editor 3.0.4-beta.1 → 3.0.4-beta.2

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
@@ -25193,20 +25193,20 @@ var __publicField = (obj, key, value) => {
25193
25193
  function textBlockToMarkdown(editor, blockData, doc2) {
25194
25194
  const richText2 = blockData.text || [];
25195
25195
  const text2 = textToMarkdownText(editor, richText2, doc2);
25196
- let markdown = text2;
25196
+ let markdown2 = text2;
25197
25197
  if (blockData.heading) {
25198
25198
  const heading = blockData.heading;
25199
25199
  const prefix = "#".repeat(heading);
25200
- markdown = `${prefix} ${markdown}`;
25200
+ markdown2 = `${prefix} ${markdown2}`;
25201
25201
  }
25202
25202
  if (blockData.quoted) {
25203
- markdown = `> ${markdown}`;
25203
+ markdown2 = `> ${markdown2}`;
25204
25204
  }
25205
25205
  if (blockData.type === "text") {
25206
- markdown = `${markdown}
25206
+ markdown2 = `${markdown2}
25207
25207
  `;
25208
25208
  }
25209
- return markdown;
25209
+ return markdown2;
25210
25210
  }
25211
25211
  function styleColorToColor$1(color) {
25212
25212
  switch (color) {
@@ -26870,8 +26870,8 @@ var __publicField = (obj, key, value) => {
26870
26870
  function docToMarkdown(editor, doc2) {
26871
26871
  const lines = doc2.blocks.root.map((b, index2) => blockToMarkdown(editor, b, doc2, [{ containerId: "root", blockIndex: index2 }]));
26872
26872
  lines[lines.length - 1] = lines[lines.length - 1].trimEnd();
26873
- const markdown = lines.join("\n");
26874
- return markdown;
26873
+ const markdown2 = lines.join("\n");
26874
+ return markdown2;
26875
26875
  }
26876
26876
  const logger$3O = getLogger("get-text-position");
26877
26877
  function editorGetTextPosition(editor, insertPos) {
@@ -29868,13 +29868,13 @@ ${codeText}
29868
29868
  addMetaToDoc(editor, doc2);
29869
29869
  const htmlFragment = docToHtmlFragment(editor, doc2);
29870
29870
  injectDocToHtmlFragment(htmlFragment, doc2);
29871
- let markdown = "";
29871
+ let markdown2 = "";
29872
29872
  if (isSelectedCodeTextBlock(editor)) {
29873
29873
  const selectBlock = editor.selection.range.getSelectedBlocks()[0];
29874
29874
  const container = getParentContainer(selectBlock.block);
29875
29875
  const codeBlock2 = getParentBlock(container);
29876
29876
  if (codeBlock2) {
29877
- markdown = getSelectedCodeBlockMarkdown(editor, docToText(editor, doc2));
29877
+ markdown2 = getSelectedCodeBlockMarkdown(editor, docToText(editor, doc2));
29878
29878
  }
29879
29879
  } else {
29880
29880
  const lines = [];
@@ -29882,11 +29882,11 @@ ${codeText}
29882
29882
  lines.push(blockToMarkdown(editor, b, doc2, [{ containerId: "root", blockIndex: index2 }]));
29883
29883
  });
29884
29884
  lines[lines.length - 1] = lines[lines.length - 1].trimEnd();
29885
- markdown = lines.join("\n");
29885
+ markdown2 = lines.join("\n");
29886
29886
  }
29887
29887
  setClipboardData([{
29888
29888
  type: "text/plain",
29889
- data: new Blob([markdown], { type: "text/plain" })
29889
+ data: new Blob([markdown2], { type: "text/plain" })
29890
29890
  }]);
29891
29891
  return true;
29892
29892
  }
@@ -69559,8 +69559,8 @@ ${codeText}
69559
69559
  return images.map((image) => `<img data-embed-type="image" data-uuid="image:${image.src}" src="${editor.doc.buildResourceUrl(image.src, { withToken: true })}">`).join("");
69560
69560
  }
69561
69561
  if (type === "markdown") {
69562
- const markdown = images.map((image) => `![img](${editor.doc.buildResourceUrl(image.src, { withToken: true })})`).join("\n");
69563
- return `${markdown}
69562
+ const markdown2 = images.map((image) => `![img](${editor.doc.buildResourceUrl(image.src, { withToken: true })})`).join("\n");
69563
+ return `${markdown2}
69564
69564
  `;
69565
69565
  }
69566
69566
  return "";
@@ -74939,8 +74939,8 @@ ${codeText}
74939
74939
  }
74940
74940
  lines.push(rowText);
74941
74941
  }
74942
- const markdown = lines.join("\n");
74943
- return `${markdown}
74942
+ const markdown2 = lines.join("\n");
74943
+ return `${markdown2}
74944
74944
  `;
74945
74945
  }
74946
74946
  if (type === "html") {
@@ -75942,6 +75942,11 @@ ${codeText}
75942
75942
  }
75943
75943
  const logger$S = getLogger("custom-tag-to-text");
75944
75944
  function customTagToText(token, attributes, options) {
75945
+ var _a;
75946
+ const processed = (_a = options.customTagProcess) == null ? void 0 : _a.call(options, token, attributes);
75947
+ if (processed) {
75948
+ return processed;
75949
+ }
75945
75950
  const content = token.content;
75946
75951
  try {
75947
75952
  const base64 = content;
@@ -76149,7 +76154,7 @@ ${codeText}
76149
76154
  return createTextWithReplaceSoftReturn(htmlDecode(token.text), attributes);
76150
76155
  }
76151
76156
  if (token.type === "custom-tag") {
76152
- return customTagToText(token, attributes);
76157
+ return customTagToText(token, attributes, options);
76153
76158
  }
76154
76159
  if (token.type === "latex") {
76155
76160
  return [{
@@ -76586,9 +76591,9 @@ ${codeText}
76586
76591
  mangle: false
76587
76592
  });
76588
76593
  marked.marked.use(extendedCustomTag());
76589
- function markdownToDoc(markdown, options) {
76594
+ function markdownToDoc(markdown2, options) {
76590
76595
  const lexer = new marked.marked.Lexer();
76591
- const tokens = lexer.lex(markdown);
76596
+ const tokens = lexer.lex(markdown2);
76592
76597
  const doc2 = {
76593
76598
  blocks: {
76594
76599
  root: []
@@ -76603,7 +76608,8 @@ ${codeText}
76603
76608
  tokensToBlocks,
76604
76609
  tokensToTextWithChildren,
76605
76610
  htmlToDoc: options == null ? void 0 : options.htmlToDoc,
76606
- listLevel: 1
76611
+ listLevel: 1,
76612
+ customTagProcess: options == null ? void 0 : options.customTagProcess
76607
76613
  };
76608
76614
  const rootBlocks = tokensToBlocks(tokens, tokenToBlockOptions);
76609
76615
  if (rootBlocks.length === 0) {
@@ -76616,6 +76622,13 @@ ${codeText}
76616
76622
  doc2.blocks.root.push(...rootBlocks);
76617
76623
  return doc2;
76618
76624
  }
76625
+ const markdown = `
76626
+ [[cursor]]
76627
+ `;
76628
+ setTimeout(() => {
76629
+ const doc2 = markdownToDoc(markdown);
76630
+ console.log(doc2);
76631
+ }, 100);
76619
76632
  function extend(destination) {
76620
76633
  for (let i = 1; i < arguments.length; i++) {
76621
76634
  const source = arguments[i];
@@ -78167,9 +78180,9 @@ ${docStr}
78167
78180
  htmlFragment = html.substring(start + "<!--StartFragment-->".length, end);
78168
78181
  }
78169
78182
  }
78170
- const markdown = turndownService.turndown(htmlFragment);
78171
- logger$P.debug(markdown);
78172
- return markdownToDoc(markdown, {
78183
+ const markdown2 = turndownService.turndown(htmlFragment);
78184
+ logger$P.debug(markdown2);
78185
+ return markdownToDoc(markdown2, {
78173
78186
  htmlToDoc: (html2) => {
78174
78187
  const doc2 = htmlToDocByMarkdown(html2, options);
78175
78188
  return doc2;
@@ -96056,7 +96069,7 @@ ${JSON.stringify(error2, null, 2)}`);
96056
96069
  }
96057
96070
  }
96058
96071
  });
96059
- editor.version = "3.0.4-beta.1";
96072
+ editor.version = "3.0.4-beta.2";
96060
96073
  return editor;
96061
96074
  }
96062
96075
  function isDoc(doc2) {
@@ -96190,7 +96203,7 @@ ${JSON.stringify(error2, null, 2)}`);
96190
96203
  OnesEditorDropTarget.register(editor);
96191
96204
  OnesEditorTocProvider.register(editor);
96192
96205
  OnesEditorExclusiveBlock.register(editor);
96193
- editor.version = "3.0.4-beta.1";
96206
+ editor.version = "3.0.4-beta.2";
96194
96207
  return editor;
96195
96208
  }
96196
96209
  async function showDocVersions(editor, options, serverUrl) {
@@ -96325,7 +96338,7 @@ ${JSON.stringify(error2, null, 2)}`);
96325
96338
  }
96326
96339
  }
96327
96340
  });
96328
- editor.version = "3.0.4-beta.1";
96341
+ editor.version = "3.0.4-beta.2";
96329
96342
  return editor;
96330
96343
  }
96331
96344
  const emojis$1 = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ones-editor/editor",
3
- "version": "3.0.4-beta.1",
3
+ "version": "3.0.4-beta.2",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "dependencies": {