@jvs-milkdown/crepe 1.2.39 → 1.2.41

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/lib/cjs/index.js CHANGED
@@ -667,7 +667,7 @@ const borderIcon = `
667
667
  `;
668
668
 
669
669
  const formatPainterIcon = `
670
- <svg viewBox="0 0 1024 1024" version="1.1" width="20" height="20">
670
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" version="1.1" width="32" height="32">
671
671
  <path d="M454.698667 302.506667H323.84q-23.04 0-41.6 13.824-18.517333 13.824-25.130667 35.968l-31.36 104.704q-10.112 33.621333 10.794667 61.738666 11.52 15.445333 27.221333 22.442667 0.853333 46.165333-0.810666 105.6-1.408 51.84-58.368 138.496-23.338667 35.413333-3.413334 72.96 20.053333 37.76 62.677334 37.76h477.994666q39.509333 0 69.077334-26.325333 29.738667-26.453333 34.090666-65.962667 10.24-93.738667 10.24-155.946667 0-57.088-8.618666-103.68 20.949333-6.058667 35.285333-25.344 20.864-28.117333 10.837333-61.738666l-31.36-104.704q-6.656-22.144-25.173333-35.968-18.517333-13.781333-41.6-13.781334h-130.858667V197.802667q0-28.885333-20.437333-49.365334Q622.933333 128 594.090667 128H524.373333q-28.842667 0-49.237333 20.48-20.437333 20.437333-20.437333 49.322667v104.746666z m68.992 41.728q0.682667-3.370667 0.682666-6.784V197.802667h69.717334V337.493333q0 3.413333 0.64 6.826667 0.682667 3.370667 2.005333 6.528 1.28 3.2 3.2 6.058667 1.92 2.816 4.352 5.248 2.389333 2.474667 5.248 4.352 2.901333 1.92 6.058667 3.242666 3.157333 1.322667 6.528 1.962667 3.328 0.682667 6.826666 0.682667h165.674667l31.36 104.746666H292.48l31.36-104.746666h165.717333q3.413333 0 6.826667-0.64 3.328-0.682667 6.528-2.005334 3.157333-1.322667 5.973333-3.242666 2.858667-1.877333 5.290667-4.352 2.432-2.432 4.309333-5.248 1.92-2.901333 3.242667-6.058667 1.322667-3.157333 1.962667-6.570667z m252.501333 202.666666q9.429333 43.648 9.429333 100.864 0 58.368-9.813333 148.352-1.450667 12.757333-11.093333 21.376-9.813333 8.704-22.826667 8.704h-100.309333q22.058667-81.493333 22.058666-174.592h-69.674666q0 94.421333-24.96 174.592h-121.514667q41.941333-81.450667 41.941333-174.592H419.754667q0 94.378667-52.992 174.592H263.808q-0.725333 0-1.109333-0.725333-0.469333-0.981333 0.042666-1.749333 67.968-103.253333 69.888-175.018667 1.536-56.533333 0.938667-101.802667H776.106667z" fill="currentColor" p-id="11997"></path>
672
672
  </svg>
673
673
  `;
@@ -5778,19 +5778,24 @@ const Toolbar = vue.defineComponent({
5778
5778
  vue.watch(
5779
5779
  () => formatPainterState.value,
5780
5780
  (newVal) => {
5781
+ console.log("[FormatPainter] state changed:", newVal);
5781
5782
  if (newVal) {
5782
5783
  let cursorStyleEl = cursorStyleEls.get(ctx);
5784
+ console.log("[FormatPainter] existing style tag:", cursorStyleEl);
5783
5785
  if (!cursorStyleEl) {
5784
5786
  cursorStyleEl = document.createElement("style");
5785
- const encodedSvg = encodeURIComponent(
5786
- formatPainterIcon.replace(/currentColor/g, "#363B4C")
5787
- );
5788
- cursorStyleEl.innerHTML = `.milkdown .ProseMirror, .milkdown .ProseMirror * { cursor: url("data:image/svg+xml;utf8,${encodedSvg}") 0 16, auto !important; }`;
5787
+ let svgWithXmlns = formatPainterIcon.includes("xmlns=") ? formatPainterIcon : formatPainterIcon.replace("<svg ", '<svg xmlns="http://www.w3.org/2000/svg" ');
5788
+ svgWithXmlns = svgWithXmlns.replace(/\s+/g, " ").trim();
5789
+ const cleanSvg = svgWithXmlns.replace(/currentColor/g, "#363B4C");
5790
+ const base64Svg = window.btoa(cleanSvg);
5791
+ cursorStyleEl.innerHTML = `body, body *, .ProseMirror, .ProseMirror * { cursor: url("data:image/svg+xml;base64,${base64Svg}") 0 0, auto !important; }`;
5789
5792
  document.head.appendChild(cursorStyleEl);
5790
5793
  cursorStyleEls.set(ctx, cursorStyleEl);
5794
+ console.log("[FormatPainter] Style tag appended to head:", cursorStyleEl.outerHTML);
5791
5795
  }
5792
5796
  } else {
5793
5797
  const cursorStyleEl = cursorStyleEls.get(ctx);
5798
+ console.log("[FormatPainter] removing style tag:", cursorStyleEl);
5794
5799
  if (cursorStyleEl) {
5795
5800
  cursorStyleEl.remove();
5796
5801
  cursorStyleEls.delete(ctx);