@ones-editor/editor 5.0.2 → 5.0.3-beta.ONES22301663.1

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
@@ -87533,15 +87533,23 @@ ${docStr}
87533
87533
  throw err;
87534
87534
  }
87535
87535
  const domParser = new DOMParser();
87536
- const xml = domParser.parseFromString(svgCode, "image/svg+xml");
87537
- const xmlSvg = xml.firstChild;
87538
- const maxWidth = xmlSvg.style.maxWidth;
87536
+ const html = domParser.parseFromString(svgCode, "text/html");
87537
+ const svg = html.querySelector("svg");
87538
+ if (!(svg instanceof SVGSVGElement)) {
87539
+ throw new Error("Mermaid render result does not contain an SVG root element");
87540
+ }
87541
+ const maxWidth = svg.style.maxWidth;
87539
87542
  if (maxWidth) {
87540
- xmlSvg.setAttribute("width", maxWidth);
87543
+ svg.setAttribute("width", maxWidth);
87541
87544
  }
87542
87545
  const xmlSerializer = new XMLSerializer();
87543
- const xmlSvgStr = xmlSerializer.serializeToString(xmlSvg);
87544
- return xmlSvgStr;
87546
+ const svgCodeForXml = xmlSerializer.serializeToString(svg);
87547
+ const xml = domParser.parseFromString(svgCodeForXml, "image/svg+xml");
87548
+ const xmlSvg = xml.documentElement;
87549
+ if (xml.querySelector("parsererror") || xmlSvg.localName !== "svg" || xmlSvg.namespaceURI !== "http://www.w3.org/2000/svg") {
87550
+ throw new Error("Mermaid render result is not a valid SVG document");
87551
+ }
87552
+ return xmlSerializer.serializeToString(xmlSvg);
87545
87553
  }
87546
87554
  async function mermaidCodeToObjectUrl(editor, code) {
87547
87555
  const svg = await mermaidCodeToSvg(editor, code);
@@ -97522,7 +97530,7 @@ ${JSON.stringify(error2, null, 2)}`);
97522
97530
  }
97523
97531
  }
97524
97532
  });
97525
- editor.version = "5.0.2";
97533
+ editor.version = "5.0.3-beta.ONES22301663.1";
97526
97534
  return editor;
97527
97535
  }
97528
97536
  function isDoc(doc2) {
@@ -97658,7 +97666,7 @@ ${JSON.stringify(error2, null, 2)}`);
97658
97666
  OnesEditorDropTarget.register(editor);
97659
97667
  OnesEditorTocProvider.register(editor);
97660
97668
  OnesEditorExclusiveBlock.register(editor);
97661
- editor.version = "5.0.2";
97669
+ editor.version = "5.0.3-beta.ONES22301663.1";
97662
97670
  return editor;
97663
97671
  } catch (error2) {
97664
97672
  try {
@@ -97801,7 +97809,7 @@ ${JSON.stringify(error2, null, 2)}`);
97801
97809
  }
97802
97810
  }
97803
97811
  });
97804
- editor.version = "5.0.2";
97812
+ editor.version = "5.0.3-beta.ONES22301663.1";
97805
97813
  return editor;
97806
97814
  }
97807
97815
  const emojis$1 = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ones-editor/editor",
3
- "version": "5.0.2",
3
+ "version": "5.0.3-beta.ONES22301663.1",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "dependencies": {