@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/esm/index.js CHANGED
@@ -646,7 +646,7 @@ const borderIcon = `
646
646
  `;
647
647
 
648
648
  const formatPainterIcon = `
649
- <svg viewBox="0 0 1024 1024" version="1.1" width="20" height="20">
649
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" version="1.1" width="32" height="32">
650
650
  <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>
651
651
  </svg>
652
652
  `;
@@ -5757,19 +5757,24 @@ const Toolbar = defineComponent({
5757
5757
  watch(
5758
5758
  () => formatPainterState.value,
5759
5759
  (newVal) => {
5760
+ console.log("[FormatPainter] state changed:", newVal);
5760
5761
  if (newVal) {
5761
5762
  let cursorStyleEl = cursorStyleEls.get(ctx);
5763
+ console.log("[FormatPainter] existing style tag:", cursorStyleEl);
5762
5764
  if (!cursorStyleEl) {
5763
5765
  cursorStyleEl = document.createElement("style");
5764
- const encodedSvg = encodeURIComponent(
5765
- formatPainterIcon.replace(/currentColor/g, "#363B4C")
5766
- );
5767
- cursorStyleEl.innerHTML = `.milkdown .ProseMirror, .milkdown .ProseMirror * { cursor: url("data:image/svg+xml;utf8,${encodedSvg}") 0 16, auto !important; }`;
5766
+ let svgWithXmlns = formatPainterIcon.includes("xmlns=") ? formatPainterIcon : formatPainterIcon.replace("<svg ", '<svg xmlns="http://www.w3.org/2000/svg" ');
5767
+ svgWithXmlns = svgWithXmlns.replace(/\s+/g, " ").trim();
5768
+ const cleanSvg = svgWithXmlns.replace(/currentColor/g, "#363B4C");
5769
+ const base64Svg = window.btoa(cleanSvg);
5770
+ cursorStyleEl.innerHTML = `body, body *, .ProseMirror, .ProseMirror * { cursor: url("data:image/svg+xml;base64,${base64Svg}") 0 0, auto !important; }`;
5768
5771
  document.head.appendChild(cursorStyleEl);
5769
5772
  cursorStyleEls.set(ctx, cursorStyleEl);
5773
+ console.log("[FormatPainter] Style tag appended to head:", cursorStyleEl.outerHTML);
5770
5774
  }
5771
5775
  } else {
5772
5776
  const cursorStyleEl = cursorStyleEls.get(ctx);
5777
+ console.log("[FormatPainter] removing style tag:", cursorStyleEl);
5773
5778
  if (cursorStyleEl) {
5774
5779
  cursorStyleEl.remove();
5775
5780
  cursorStyleEls.delete(ctx);