wysimark-lite 0.14.0 → 0.14.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/README.md CHANGED
@@ -6,6 +6,11 @@ wysimark ( https://github.com/portive/wysimark ) is a modern and clean rich text
6
6
 
7
7
  Thanks to the original author of wysimark, portive m(_ _)m
8
8
 
9
+ ## Demo
10
+
11
+ You can try out the editor using storybook in the following link:
12
+ https://takeshy.github.io/wysimark-lite
13
+
9
14
  ## Usage
10
15
 
11
16
  ### As React Component
package/dist/index.js CHANGED
@@ -901,8 +901,8 @@ Error generating stack: `+n.message+`
901
901
  }
902
902
  border-radius: 8px;
903
903
  }
904
- `;function $B(e){return e.children.length===1&&Y.string(e.children[0]).length===0}var YB=O(N());function GB({element:e,attributes:t,children:n}){let r=Pn(),i=$B(e);return(0,YB.jsx)(VB,{...t,className:ct({"--selected":r,"--empty":i,"--collapsible":!!e.__collapsible}),children:n})}var QB=O(N()),KB=xe(e=>{let{insertBreak:t}=e;if(e.insertBreak=()=>{let{selection:n}=e;n&&n.anchor.path[0]===n.focus.path[0]?d.string(e,[n.anchor.path[0]]).match(/\n$/)?t():e.insertText(`
905
- `):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:ee(qB,e)},editableProps:{renderElement:({element:n,attributes:r,children:i})=>{switch(n.type){case"paragraph":return(0,QB.jsx)(GB,{element:n,attributes:r,children:i})}},onKeyDown:zt({"super+0":e.collapsibleParagraph.convertParagraph})}}});function XB(e,t){Array.isArray(t)?e.convertElement.convertElementTypes.push(...t):e.convertElement.convertElementTypes.push(t)}function WB(e,t,n,r){let i=Array.from(d.nodes(e,{match:o=>X.isElement(o)&&e.convertElement.isConvertibleElement(o)}));return i.length===0?!1:(r&&i.every(o=>t(o[0]))?d.withoutNormalizing(e,()=>{for(let o of i)Us(e,{type:"paragraph"},o[1])}):d.withoutNormalizing(e,()=>{for(let o of i)Us(e,n,o[1])}),!0)}function ZB(e,t){return e.convertElement.convertElementTypes.includes(t.type)}function JB(e){return{convertElementTypes:[],addConvertElementType:ee(XB,e),isConvertibleElement:ee(ZB,e),convertElements:ee(WB,e)}}var e3=xe(e=>(e.convertElement=JB(e),{name:"convert-element"}));function t3(e){let t=be(e,"heading");if(!t||!e.selection||R.isExpanded(e.selection)||!d.isEnd(e,e.selection.anchor,t[1]))return!1;let n=A.next(t[1]);return k.insertNodes(e,{type:"paragraph",children:[{text:""}]},{at:n}),k.select(e,{anchor:d.start(e,n),focus:d.start(e,n)}),!0}function qN(e,t,n){e.convertElement.convertElements(r=>r.type==="heading"&&r.level==t,{type:"heading",level:t},n)}function VN(e,t){let[n]=d.nodes(e,{match:r=>"type"in r&&"level"in r&&r.type==="heading"&&r.level===t});return!!n}function n3(e){return{convertHeading:ee(qN,e),isHeadingActive:ee(VN,e)}}var Fu=np`
904
+ `;function $B(e){return e.children.length===1&&Y.string(e.children[0]).length===0}var YB=O(N());function GB({element:e,attributes:t,children:n}){let r=Pn(),i=$B(e);return(0,YB.jsx)(VB,{...t,className:ct({"--selected":r,"--empty":i,"--collapsible":!!e.__collapsible}),children:n})}var QB=O(N()),KB=xe(e=>{let{insertBreak:t}=e;if(e.insertBreak=()=>{let{selection:n}=e;if(n&&n.anchor.path[0]===n.focus.path[0]){let r=d.string(e,[n.anchor.path[0]]);r.match(/\n$/)||r.match(/\n\n/)?t():e.insertText(`
905
+ `)}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:ee(qB,e)},editableProps:{renderElement:({element:n,attributes:r,children:i})=>{switch(n.type){case"paragraph":return(0,QB.jsx)(GB,{element:n,attributes:r,children:i})}},onKeyDown:zt({"super+0":e.collapsibleParagraph.convertParagraph})}}});function XB(e,t){Array.isArray(t)?e.convertElement.convertElementTypes.push(...t):e.convertElement.convertElementTypes.push(t)}function WB(e,t,n,r){let i=Array.from(d.nodes(e,{match:o=>X.isElement(o)&&e.convertElement.isConvertibleElement(o)}));return i.length===0?!1:(r&&i.every(o=>t(o[0]))?d.withoutNormalizing(e,()=>{for(let o of i)Us(e,{type:"paragraph"},o[1])}):d.withoutNormalizing(e,()=>{for(let o of i)Us(e,n,o[1])}),!0)}function ZB(e,t){return e.convertElement.convertElementTypes.includes(t.type)}function JB(e){return{convertElementTypes:[],addConvertElementType:ee(XB,e),isConvertibleElement:ee(ZB,e),convertElements:ee(WB,e)}}var e3=xe(e=>(e.convertElement=JB(e),{name:"convert-element"}));function t3(e){let t=be(e,"heading");if(!t||!e.selection||R.isExpanded(e.selection)||!d.isEnd(e,e.selection.anchor,t[1]))return!1;let n=A.next(t[1]);return k.insertNodes(e,{type:"paragraph",children:[{text:""}]},{at:n}),k.select(e,{anchor:d.start(e,n),focus:d.start(e,n)}),!0}function qN(e,t,n){e.convertElement.convertElements(r=>r.type==="heading"&&r.level==t,{type:"heading",level:t},n)}function VN(e,t){let[n]=d.nodes(e,{match:r=>"type"in r&&"level"in r&&r.type==="heading"&&r.level===t});return!!n}function n3(e){return{convertHeading:ee(qN,e),isHeadingActive:ee(VN,e)}}var Fu=np`
906
906
  margin-top: 1em;
907
907
  &:first-child {
908
908
  margin-top: 0;
package/dist/index.mjs CHANGED
@@ -4625,7 +4625,7 @@ var CollapsibleParagraphPlugin = createPlugin((editor) => {
4625
4625
  const { selection } = editor;
4626
4626
  if (selection && selection.anchor.path[0] === selection.focus.path[0]) {
4627
4627
  const text = Editor27.string(editor, [selection.anchor.path[0]]);
4628
- if (text.match(/\n$/)) {
4628
+ if (text.match(/\n$/) || text.match(/\n\n/)) {
4629
4629
  insertBreak3();
4630
4630
  } else {
4631
4631
  editor.insertText("\n");