wysimark-lite 0.25.24 → 0.25.25

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
@@ -1006,7 +1006,7 @@
1006
1006
  border-radius: 8px;
1007
1007
  }
1008
1008
  `;import{Node as Mh}from"slate";function ts(e){return e.children.length===1&&Mh.string(e.children[0]).length===0}import{jsx as Sh}from"react/jsx-runtime";function os({element:e,attributes:t,children:o}){let r=Ch(),n=ts(e);return Sh(es,{...t,className:Ph({"--selected":r,"--empty":n,"--collapsible":!!e.__collapsible}),children:o})}import{jsx as Rh}from"react/jsx-runtime";var ns=v(e=>{let{insertBreak:t}=e;if(e.insertBreak=()=>{let{selection:o}=e;if(o&&o.anchor.path[0]===o.focus.path[0]){let r=[o.anchor.path[0]],n=rs.start(e,r);rs.string(e,{anchor:n,focus:o.anchor}).endsWith(`
1009
- `)?t():e.insertText(`
1009
+ `)?(e.deleteBackward("character"),t()):e.insertText(`
1010
1010
  `)}else t()},e.convertElement.addConvertElementType("paragraph"),e.collapsibleParagraph={convertParagraph:()=>{e.convertElement.convertElements(()=>!1,{type:"paragraph"},!1)}},!e.normalizeAfterDelete)throw new Error("The collapsible-paragraph-plugin has a dependency on the normalize-after-delete plugin. Please add that plugin before this one.");return{name:"collapsible-paragraph",editor:{normalizeNode:f(Zl,e)},editableProps:{renderElement:({element:o,attributes:r,children:n})=>{if(o.type==="paragraph")return Rh(os,{element:o,attributes:r,children:n})},onKeyDown:o=>o.key==="Enter"&&!o.nativeEvent.isComposing&&!o.shiftKey?(o.preventDefault(),e.insertBreak(),!0):H({"super+0":e.collapsibleParagraph.convertParagraph})(o)}}});function is(e,t){Array.isArray(t)?e.convertElement.convertElementTypes.push(...t):e.convertElement.convertElementTypes.push(t)}import{Editor as W,Element as oo,Node as ne,Point as Ge,Range as Lh,Transforms as Re}from"slate";function as(e,t,o){try{let r=W.start(e,o),n=W.end(e,o);if(Ge.isBefore(t,r)||Ge.isAfter(t,n))return-1;let i={anchor:r,focus:t};return W.string(e,i).length}catch{return-1}}function ls(e,t,o){try{let r=ne.get(e,t);if(!oo.isElement(r))return;let n=ne.string(r),i=Math.min(o,n.length),a=W.start(e,t),l=0,m=a.path,s=0;for(let[d,p]of ne.texts(r)){let u=d.text.length;if(l+u>=i){m=[...t,...p],s=i-l;break}l+=u}let c={path:m,offset:s};Re.select(e,{anchor:c,focus:c})}catch{}}function Bh(e){return ne.string(e).includes(`
1011
1011
  `)}function zh(e,t,o,r){let n=ne.string(t),i=n.split(`
1012
1012
  `),a=W.start(e,o),l=W.end(e,o),m=Ge.isBefore(r.anchor,a)?a:Ge.isAfter(r.anchor,l)?l:r.anchor,s=Ge.isBefore(r.focus,a)?a:Ge.isAfter(r.focus,l)?l:r.focus,c=Math.min(W.string(e,{anchor:a,focus:m}).length,n.length),d=Math.min(W.string(e,{anchor:a,focus:s}).length,n.length),p=Math.min(c,d),u=Math.max(c,d),g=0,T=0,S=i.length-1;for(let L=0;L<i.length;L++){let M=g+i[L].length;if(g<=p&&p<=M&&(T=L),g<=u&&u<=M){S=L;break}g=M+1}return{startLineIndex:T,endLineIndex:S}}function Dh(e,t,o,r){let n=ne.string(t);if(!n.includes(`
package/dist/index.mjs CHANGED
@@ -5766,6 +5766,7 @@ var CollapsibleParagraphPlugin = createPlugin((editor) => {
5766
5766
  focus: selection.anchor
5767
5767
  });
5768
5768
  if (textBeforeCursor.endsWith("\n")) {
5769
+ editor.deleteBackward("character");
5769
5770
  insertBreak3();
5770
5771
  } else {
5771
5772
  editor.insertText("\n");