@yoopta/lists 1.9.0-rc → 1.9.1-rc
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/Lists.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/types.d.ts +6 -6
- package/dist/ui/BulletedList.d.ts +2 -2
- package/dist/ui/ListItem.d.ts +1 -1
- package/dist/ui/NumberedList.d.ts +1 -1
- package/dist/ui/TodoList.d.ts +1 -1
- package/dist/ui/TodoListItem.d.ts +1 -1
- package/package.json +5 -5
package/dist/Lists.d.ts
CHANGED
|
@@ -10,9 +10,9 @@ declare module 'slate' {
|
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
12
|
declare const Lists: {
|
|
13
|
-
NumberedList: import("@yoopta/editor").
|
|
14
|
-
BulletedList: import("@yoopta/editor").
|
|
15
|
-
TodoList: import("@yoopta/editor").
|
|
13
|
+
NumberedList: import("@yoopta/editor").YooptaPlugin<import("./types").ListOptions, NumberedListElement>;
|
|
14
|
+
BulletedList: import("@yoopta/editor").YooptaPlugin<import("./types").ListOptions, BulletedListElement>;
|
|
15
|
+
TodoList: import("@yoopta/editor").YooptaPlugin<import("./types").ListOptions, TodoListElement>;
|
|
16
16
|
};
|
|
17
17
|
export default Lists;
|
|
18
18
|
export { NumberedList, BulletedList, TodoList };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as t}from"react/jsx-runtime";import{createYoptaPlugin as i,generateId as n,getElementByPath as s,cx as r}from"@yoopta/editor";import{Editor as a,Element as l,Transforms as o,Path as d}from"slate";import{ReactEditor as c}from"slate-react";function p(e,t){void 0===t&&(t={});var i=t.insertAt;if(e&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css","top"===i&&n.firstChild?n.insertBefore(s,n.firstChild):n.appendChild(s),s.styleSheet?s.styleSheet.cssText=e:s.appendChild(document.createTextNode(e))}}var h="mfUTTw6O";p(".mfUTTw6O{color:#292929;font-size:16px;letter-spacing:-.003em;line-height:24px;list-style-position:inside;padding-bottom:2px;padding-left:0;padding-top:2px;position:relative}.qvO-1a-q{align-items:center;display:flex;flex-grow:0;flex-shrink:0;justify-content:center;margin-right:2px;min-height:calc(1.5em + 6px);user-select:none;width:24px}.xPshFZ5Y{box-sizing:border-box;color:#000;display:inline;flex-shrink:0;font-size:16px;font-style:normal;font-weight:400;line-height:24px;min-width:28px;padding:0 6px 0 4px;word-break:break-word}");const m=({attributes:t,children:i})=>e("li",Object.assign({className:h,draggable:!1},t,{children:i}));m.displayName="ListItem";const g="list-item",u=i({type:g,renderer:e=>m,shortcut:"-",defineElement:()=>({id:n(),type:"list-item",children:[{text:""}],nodeType:"block"}),placeholder:null,events:{onKeyDown:(e,{hotkeys:t,defaultNode:i})=>r=>{if(!e.selection)return;if(s(e,e.selection.anchor.path,"lowest").type!==g)return;const c=a.above(e,{at:e.selection.anchor,match:e=>l.isElement(e)&&e.type===g});if(!c)return;const{anchor:p}=e.selection,[h,m]=c,[f,v]=a.parent(e,m),y=a.string(e,m),x=a.isEnd(e,p,m),b=a.isStart(e,p,m),k=m.length-1,E=2===k,N=1===k;if(t.isShiftEnter(r))return r.preventDefault(),void e.insertText("\n");if(t.isEnter(r)){if(r.preventDefault(),""===y.trim()){o.unwrapNodes(e,{match:e=>!a.isEditor(e)&&l.isElement(e)&&e.type===f.type,split:!0});const t=k>1?{id:n(),type:g,children:[{text:""}]}:i;return void o.setNodes(e,t,{at:e.selection})}if(!x&&!b)return o.splitNodes(e),void o.setNodes(e,{id:n()});const t=Object.assign(Object.assign({},h),{id:n(),children:[{text:""}]});o.insertNodes(e,t)}else if(t.isBackspace(r)){const[,t]=a.first(e,v),n=0===d.compare(e.selection.anchor.path,t);b&&n&&(r.preventDefault(),o.unwrapNodes(e,{match:e=>l.isElement(e)&&e.type===f.type,split:!0}),o.setNodes(e,i,{at:e.selection}))}else{if(t.isTab(r)){if(r.preventDefault(),E)return;const t=Object.assign(Object.assign({},f),{id:n(),type:f.type,children:[u.getPlugin.defineElement()]});return o.wrapNodes(e,t,{at:m}),void o.setNodes(e,{data:{depth:k+1,skipDrag:!0}},{match:e=>l.isElement(e)&&e.type===f.type})}if(t.isShiftTab(r)){if(r.preventDefault(),N)return;return o.unwrapNodes(e,{match:e=>l.isElement(e)&&e.type===f.type,split:!0}),void o.setNodes(e,{data:{depth:k-1,skipDrag:!0}},{match:e=>l.isElement(e)&&e.type===f.type})}}}},exports:{markdown:{serialize:(e,t)=>`- ${t}`},html:{serialize:(e,t)=>(console.log("children",t),`<li>${t}</li>`),deserialize:{nodeName:"LI"}}}});var f="cN2XzHcO";p(".cN2XzHcO{margin:2px 0;padding-left:18px}");const v=({attributes:t,children:i})=>e("ol",Object.assign({draggable:!1},t,{className:f},{children:i})),y=i({type:"numbered-list",renderer:e=>v,childPlugin:u,shortcut:"1.",defineElement:()=>({id:n(),type:"numbered-list",children:[u.getPlugin.defineElement()],nodeType:"block",data:{depth:1,skipDrag:!0,skipSettings:!0}}),createElement:e=>{var t,i;const n=u.getPlugin.defineElement();o.unwrapNodes(e,{match:e=>{var t;return!a.isEditor(e)&&l.isElement(e)&&"list-item"!==e.type&&"todo-list-item"!==e.type&&(null===(t=e.data)||void 0===t?void 0:t.depth)>=1},split:!0}),o.setNodes(e,n,{at:null===(t=e.selection)||void 0===t?void 0:t.anchor});const s=y.getPlugin.defineElement();o.wrapNodes(e,s,{at:null===(i=e.selection)||void 0===i?void 0:i.anchor})},exports:{markdown:{serialize:(e,t)=>`${t}\n`},html:{serialize:(e,t)=>{var i;return`<ol style="padding-left: ${(null===(i=e.data)||void 0===i?void 0:i.depth)?15*e.data.depth:15}px;">${t}</ol>`},deserialize:{nodeName:"OL"}}}});var x="wVFRrWWa";p(".wVFRrWWa{margin:2px 0;padding-left:18px}");const b=({attributes:t,children:i,element:n})=>e("ul",Object.assign({draggable:!1},t,{className:x},{children:i})),k=i({type:"bulleted-list",renderer:e=>b,shortcut:"-",childPlugin:u,defineElement:()=>({id:n(),type:"bulleted-list",children:[u.getPlugin.defineElement()],nodeType:"block",data:{depth:1,skipDrag:!0,skipSettings:!0}}),createElement:e=>{var t,i;const n=u.getPlugin.defineElement();o.unwrapNodes(e,{match:e=>{var t;return!a.isEditor(e)&&l.isElement(e)&&"list-item"!==e.type&&"todo-list-item"!==e.type&&(null===(t=e.data)||void 0===t?void 0:t.depth)>=1},split:!0}),o.setNodes(e,n,{at:null===(t=e.selection)||void 0===t?void 0:t.anchor});const s=k.getPlugin.defineElement();o.wrapNodes(e,s,{at:null===(i=e.selection)||void 0===i?void 0:i.anchor})},exports:{markdown:{serialize:(e,t)=>`- ${t}`},html:{serialize:(e,t)=>{var i;return`<ul style="padding-left: ${(null===(i=e.data)||void 0===i?void 0:i.depth)?15*e.data.depth:15}px;">${t}</ul>`},deserialize:{nodeName:"UL"}}}});var E="Mzo1TbSt";p(".Mzo1TbSt{padding-left:18px}");var N="zLPFpe0C",w="cJeUAnzK",T="YT2kDg7r",z="GzvUWhTl",D="YiyH9UVU";p('.zLPFpe0C{fill:inherit;align-items:flex-start;color:#292929;color:inherit;display:flex;font-size:16px;letter-spacing:-.003em;line-height:24px;margin-bottom:1px;margin-top:1px;padding-bottom:2px;padding-left:2px;padding-top:2px;width:100%}.cJeUAnzK{text-decoration:line-through}.YT2kDg7r{align-items:center;display:flex;flex-grow:0;flex-shrink:0;justify-content:center;margin-right:2px;min-height:30px;user-select:none;width:24px}.YT2kDg7r+.YT2kDg7r{margin-top:1em}.GzvUWhTl{align-items:center;-webkit-appearance:none;appearance:none;border:.1em solid;color:currentColor;cursor:pointer;display:flex;flex-grow:0;flex-shrink:0;height:1.15em;height:16px;place-content:center;justify-content:center;position:relative;transition:background .2s ease-out 0s;width:1.15em;width:16px}.GzvUWhTl:before{background-color:CanvasText;clip-path:polygon(14% 44%,0 65%,50% 100%,100% 16%,80% 0,43% 62%);color:inherit;content:"";height:.65em;transform:scale(0);transform-origin:bottom left;transition:transform .12s ease-in-out;width:.65em}.GzvUWhTl:checked:before{transform:scale(1)}.YiyH9UVU{caret-color:#37352f;max-width:100%;min-width:1px;opacity:1;padding:3px 2px;text-align:left;white-space:pre-wrap;word-break:break-word}');const O="todo-list-item",j=i({type:O,renderer:i=>function({attributes:n,children:s,element:a}){const d=a.data.checked;return t("div",Object.assign({draggable:!1},n,{className:r(N,{[w]:d})},{children:[e("label",Object.assign({className:T,contentEditable:!1,style:{userSelect:"none"}},{children:e("input",{type:"checkbox",checked:d,className:z,onChange:e=>{const t=c.findPath(i,a);o.setNodes(i,{data:{checked:e.target.checked}},{at:t,match:e=>l.isElement(e)&&e.type===O})}})})),e("span",Object.assign({className:D},{children:s}))]}))},placeholder:null,defineElement:()=>({id:n(),type:"todo-list-item",children:[{text:""}],nodeType:"block",data:{checked:!1}}),events:{onKeyDown:(e,{hotkeys:t,defaultNode:i})=>r=>{var c;if(!e.selection)return;if(s(e,e.selection.anchor.path,"lowest").type!==O)return;const p=a.above(e,{at:null===(c=e.selection)||void 0===c?void 0:c.anchor.path,match:e=>l.isElement(e)&&e.type===O});if(!p)return;const[h,m]=p,[g,u]=a.parent(e,m),f=a.string(e,m),v=a.isEnd(e,e.selection.anchor,m),y=a.isStart(e,e.selection.anchor,m),x=m.length-1,b=2===x,k=1===x;if(t.isShiftEnter(r))return r.preventDefault(),void e.insertText("\n");if(t.isEnter(r)){if(r.preventDefault(),""===f.trim()){o.unwrapNodes(e,{match:e=>l.isElement(e)&&e.type===g.type,split:!0});const t=x>1?{id:n(),type:O,children:[{text:""}],options:{checked:!1}}:i;return void o.setNodes(e,t,{at:e.selection})}if(!v&&!y)return o.splitNodes(e),void o.setNodes(e,{id:n(),data:{checked:!1}},{match:e=>l.isElement(e)&&e.type===O});const t=Object.assign(Object.assign({},h),{id:n(),children:[{text:""}],data:{checked:!1}});o.insertNodes(e,t,{select:!0})}else{if(t.isCmdEnter(r))return r.preventDefault(),void o.setNodes(e,{data:{checked:!h.data.checked}},{at:m,match:e=>l.isElement(e)&&e.type===O});if(t.isBackspace(r)){const[,t]=a.first(e,u),n=0===d.compare(e.selection.anchor.path,t);y&&n&&(r.preventDefault(),o.unwrapNodes(e,{match:e=>l.isElement(e)&&e.type===g.type,split:!0}),o.setNodes(e,i,{at:e.selection}))}else if(t.isTab(r)){if(r.preventDefault(),b)return;const t=Object.assign(Object.assign({},g),{id:n(),type:g.type,children:[j.getPlugin.defineElement()]});o.wrapNodes(e,t,{at:m})}else if(t.isShiftTab(r)){if(r.preventDefault(),k)return;o.unwrapNodes(e,{match:e=>l.isElement(e)&&e.type===g.type,split:!0})}else;}}},options:{checked:!1},exports:{markdown:{serialize:(e,t)=>`[${e.data.checked?"x":" "}] ${t}\n`},html:{serialize:(e,t)=>`<div>[${e.data.checked?"x":" "}] ${t}</div>`}}}),P=({attributes:t,children:i})=>e("div",Object.assign({draggable:!1},t,{className:E},{children:i})),$=i({type:"todo-list",renderer:e=>P,childPlugin:j,shortcut:"[]",defineElement:()=>({id:n(),type:"todo-list",children:[j.getPlugin.defineElement()],nodeType:"block",data:{depth:1,skipDrag:!0,skipSettings:!0}}),extendEditor:e=>e,createElement:e=>{var t,i;const n=j.getPlugin.defineElement();o.unwrapNodes(e,{match:e=>{var t;return!a.isEditor(e)&&l.isElement(e)&&"list-item"!==e.type&&"todo-list-item"!==e.type&&(null===(t=e.data)||void 0===t?void 0:t.depth)>=1},split:!0}),o.setNodes(e,n,{at:null===(t=e.selection)||void 0===t?void 0:t.anchor});const s=$.getPlugin.defineElement();o.wrapNodes(e,s,{at:null===(i=e.selection)||void 0===i?void 0:i.anchor})},exports:{markdown:{serialize:(e,t)=>`${t}`},html:{serialize:(e,t)=>{var i;return`<div style="padding-left: ${(null===(i=e.data)||void 0===i?void 0:i.depth)?15*e.data.depth:15}px;">${t}</div>`}}}}),S={NumberedList:y,BulletedList:k,TodoList:$};export{k as BulletedList,y as NumberedList,$ as TodoList,S as default};
|
|
1
|
+
import{jsx as e,jsxs as t}from"react/jsx-runtime";import{createYooptaPlugin as i,generateId as n,getElementByPath as s,cx as r}from"@yoopta/editor";import{Editor as a,Element as l,Transforms as o,Path as d}from"slate";import{ReactEditor as c}from"slate-react";function p(e,t){void 0===t&&(t={});var i=t.insertAt;if(e&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css","top"===i&&n.firstChild?n.insertBefore(s,n.firstChild):n.appendChild(s),s.styleSheet?s.styleSheet.cssText=e:s.appendChild(document.createTextNode(e))}}var h="mfUTTw6O";p(".mfUTTw6O{color:#292929;font-size:16px;letter-spacing:-.003em;line-height:24px;list-style-position:inside;padding-bottom:2px;padding-left:0;padding-top:2px;position:relative}.qvO-1a-q{align-items:center;display:flex;flex-grow:0;flex-shrink:0;justify-content:center;margin-right:2px;min-height:calc(1.5em + 6px);user-select:none;width:24px}.xPshFZ5Y{box-sizing:border-box;color:#000;display:inline;flex-shrink:0;font-size:16px;font-style:normal;font-weight:400;line-height:24px;min-width:28px;padding:0 6px 0 4px;word-break:break-word}");const m=({attributes:t,children:i})=>e("li",Object.assign({className:h,draggable:!1},t,{children:i}));m.displayName="ListItem";const g="list-item",u=i({type:g,renderer:e=>m,shortcut:"-",defineElement:()=>({id:n(),type:"list-item",children:[{text:""}],nodeType:"block"}),placeholder:null,events:{onKeyDown:(e,{hotkeys:t,defaultNode:i})=>r=>{if(!e.selection)return;if(s(e,e.selection.anchor.path,"lowest").type!==g)return;const c=a.above(e,{at:e.selection.anchor,match:e=>l.isElement(e)&&e.type===g});if(!c)return;const{anchor:p}=e.selection,[h,m]=c,[f,v]=a.parent(e,m),y=a.string(e,m),x=a.isEnd(e,p,m),b=a.isStart(e,p,m),k=m.length-1,E=2===k,N=1===k;if(t.isShiftEnter(r))return r.preventDefault(),void e.insertText("\n");if(t.isEnter(r)){if(r.preventDefault(),""===y.trim()){o.unwrapNodes(e,{match:e=>!a.isEditor(e)&&l.isElement(e)&&e.type===f.type,split:!0});const t=k>1?{id:n(),type:g,children:[{text:""}]}:i;return void o.setNodes(e,t,{at:e.selection})}if(!x&&!b)return o.splitNodes(e),void o.setNodes(e,{id:n()});const t=Object.assign(Object.assign({},h),{id:n(),children:[{text:""}]});o.insertNodes(e,t)}else if(t.isBackspace(r)){const[,t]=a.first(e,v),n=0===d.compare(e.selection.anchor.path,t);b&&n&&(r.preventDefault(),o.unwrapNodes(e,{match:e=>l.isElement(e)&&e.type===f.type,split:!0}),o.setNodes(e,i,{at:e.selection}))}else{if(t.isTab(r)){if(r.preventDefault(),E)return;const t=Object.assign(Object.assign({},f),{id:n(),type:f.type,children:[u.getPlugin.defineElement()]});return o.wrapNodes(e,t,{at:m}),void o.setNodes(e,{data:{depth:k+1,skipDrag:!0}},{match:e=>l.isElement(e)&&e.type===f.type})}if(t.isShiftTab(r)){if(r.preventDefault(),N)return;return o.unwrapNodes(e,{match:e=>l.isElement(e)&&e.type===f.type,split:!0}),void o.setNodes(e,{data:{depth:k-1,skipDrag:!0}},{match:e=>l.isElement(e)&&e.type===f.type})}}}},exports:{markdown:{serialize:(e,t)=>`- ${t}`},html:{serialize:(e,t)=>(console.log("children",t),`<li>${t}</li>`),deserialize:{nodeName:"LI"}}}});var f="cN2XzHcO";p(".cN2XzHcO{margin:2px 0;padding-left:18px}");const v=({attributes:t,children:i})=>e("ol",Object.assign({draggable:!1},t,{className:f},{children:i})),y=i({type:"numbered-list",renderer:e=>v,childPlugin:u,shortcut:"1.",defineElement:()=>({id:n(),type:"numbered-list",children:[u.getPlugin.defineElement()],nodeType:"block",data:{depth:1,skipDrag:!0,skipSettings:!0}}),createElement:e=>{var t,i;const n=u.getPlugin.defineElement();o.unwrapNodes(e,{match:e=>{var t;return!a.isEditor(e)&&l.isElement(e)&&"list-item"!==e.type&&"todo-list-item"!==e.type&&(null===(t=e.data)||void 0===t?void 0:t.depth)>=1},split:!0}),o.setNodes(e,n,{at:null===(t=e.selection)||void 0===t?void 0:t.anchor});const s=y.getPlugin.defineElement();o.wrapNodes(e,s,{at:null===(i=e.selection)||void 0===i?void 0:i.anchor})},exports:{markdown:{serialize:(e,t)=>`${t}\n`},html:{serialize:(e,t)=>{var i;return`<ol style="padding-left: ${(null===(i=e.data)||void 0===i?void 0:i.depth)?15*e.data.depth:15}px;">${t}</ol>`},deserialize:{nodeName:"OL"}}}});var x="wVFRrWWa";p(".wVFRrWWa{margin:2px 0;padding-left:18px}");const b=({attributes:t,children:i,element:n})=>e("ul",Object.assign({draggable:!1},t,{className:x},{children:i})),k=i({type:"bulleted-list",renderer:e=>b,shortcut:"-",childPlugin:u,defineElement:()=>({id:n(),type:"bulleted-list",children:[u.getPlugin.defineElement()],nodeType:"block",data:{depth:1,skipDrag:!0,skipSettings:!0}}),createElement:e=>{var t,i;const n=u.getPlugin.defineElement();o.unwrapNodes(e,{match:e=>{var t;return!a.isEditor(e)&&l.isElement(e)&&"list-item"!==e.type&&"todo-list-item"!==e.type&&(null===(t=e.data)||void 0===t?void 0:t.depth)>=1},split:!0}),o.setNodes(e,n,{at:null===(t=e.selection)||void 0===t?void 0:t.anchor});const s=k.getPlugin.defineElement();o.wrapNodes(e,s,{at:null===(i=e.selection)||void 0===i?void 0:i.anchor})},exports:{markdown:{serialize:(e,t)=>`- ${t}`},html:{serialize:(e,t)=>{var i;return`<ul style="padding-left: ${(null===(i=e.data)||void 0===i?void 0:i.depth)?15*e.data.depth:15}px;">${t}</ul>`},deserialize:{nodeName:"UL"}}}});var E="Mzo1TbSt";p(".Mzo1TbSt{padding-left:18px}");var N="zLPFpe0C",w="cJeUAnzK",T="YT2kDg7r",z="GzvUWhTl",D="YiyH9UVU";p('.zLPFpe0C{fill:inherit;align-items:flex-start;color:#292929;color:inherit;display:flex;font-size:16px;letter-spacing:-.003em;line-height:24px;margin-bottom:1px;margin-top:1px;padding-bottom:2px;padding-left:2px;padding-top:2px;width:100%}.cJeUAnzK{text-decoration:line-through}.YT2kDg7r{align-items:center;display:flex;flex-grow:0;flex-shrink:0;justify-content:center;margin-right:2px;min-height:30px;user-select:none;width:24px}.YT2kDg7r+.YT2kDg7r{margin-top:1em}.GzvUWhTl{align-items:center;-webkit-appearance:none;appearance:none;border:.1em solid;color:currentColor;cursor:pointer;display:flex;flex-grow:0;flex-shrink:0;height:1.15em;height:16px;place-content:center;justify-content:center;position:relative;transition:background .2s ease-out 0s;width:1.15em;width:16px}.GzvUWhTl:before{background-color:CanvasText;clip-path:polygon(14% 44%,0 65%,50% 100%,100% 16%,80% 0,43% 62%);color:inherit;content:"";height:.65em;transform:scale(0);transform-origin:bottom left;transition:transform .12s ease-in-out;width:.65em}.GzvUWhTl:checked:before{transform:scale(1)}.YiyH9UVU{caret-color:#37352f;max-width:100%;min-width:1px;opacity:1;padding:3px 2px;text-align:left;white-space:pre-wrap;word-break:break-word}');const O="todo-list-item",j=i({type:O,renderer:i=>function({attributes:n,children:s,element:a}){const d=a.data.checked;return t("div",Object.assign({draggable:!1},n,{className:r(N,{[w]:d})},{children:[e("label",Object.assign({className:T,contentEditable:!1,style:{userSelect:"none"}},{children:e("input",{type:"checkbox",checked:d,className:z,onChange:e=>{const t=c.findPath(i,a);o.setNodes(i,{data:{checked:e.target.checked}},{at:t,match:e=>l.isElement(e)&&e.type===O})}})})),e("span",Object.assign({className:D},{children:s}))]}))},placeholder:null,defineElement:()=>({id:n(),type:"todo-list-item",children:[{text:""}],nodeType:"block",data:{checked:!1}}),events:{onKeyDown:(e,{hotkeys:t,defaultNode:i})=>r=>{var c;if(!e.selection)return;if(s(e,e.selection.anchor.path,"lowest").type!==O)return;const p=a.above(e,{at:null===(c=e.selection)||void 0===c?void 0:c.anchor.path,match:e=>l.isElement(e)&&e.type===O});if(!p)return;const[h,m]=p,[g,u]=a.parent(e,m),f=a.string(e,m),v=a.isEnd(e,e.selection.anchor,m),y=a.isStart(e,e.selection.anchor,m),x=m.length-1,b=2===x,k=1===x;if(t.isShiftEnter(r))return r.preventDefault(),void e.insertText("\n");if(t.isEnter(r)){if(r.preventDefault(),""===f.trim()){o.unwrapNodes(e,{match:e=>l.isElement(e)&&e.type===g.type,split:!0});const t=x>1?{id:n(),type:O,children:[{text:""}],options:{checked:!1}}:i;return void o.setNodes(e,t,{at:e.selection})}if(!v&&!y)return o.splitNodes(e),void o.setNodes(e,{id:n(),data:{checked:!1}},{match:e=>l.isElement(e)&&e.type===O});const t=Object.assign(Object.assign({},h),{id:n(),children:[{text:""}],data:{checked:!1}});o.insertNodes(e,t,{select:!0})}else{if(t.isCmdEnter(r))return r.preventDefault(),void o.setNodes(e,{data:{checked:!h.data.checked}},{at:m,match:e=>l.isElement(e)&&e.type===O});if(t.isBackspace(r)){const[,t]=a.first(e,u),n=0===d.compare(e.selection.anchor.path,t);y&&n&&(r.preventDefault(),o.unwrapNodes(e,{match:e=>l.isElement(e)&&e.type===g.type,split:!0}),o.setNodes(e,i,{at:e.selection}))}else if(t.isTab(r)){if(r.preventDefault(),b)return;const t=Object.assign(Object.assign({},g),{id:n(),type:g.type,children:[j.getPlugin.defineElement()]});o.wrapNodes(e,t,{at:m})}else if(t.isShiftTab(r)){if(r.preventDefault(),k)return;o.unwrapNodes(e,{match:e=>l.isElement(e)&&e.type===g.type,split:!0})}else;}}},options:{checked:!1},exports:{markdown:{serialize:(e,t)=>`[${e.data.checked?"x":" "}] ${t}\n`},html:{serialize:(e,t)=>`<div>[${e.data.checked?"x":" "}] ${t}</div>`}}}),P=({attributes:t,children:i})=>e("div",Object.assign({draggable:!1},t,{className:E},{children:i})),$=i({type:"todo-list",renderer:e=>P,childPlugin:j,shortcut:"[]",defineElement:()=>({id:n(),type:"todo-list",children:[j.getPlugin.defineElement()],nodeType:"block",data:{depth:1,skipDrag:!0,skipSettings:!0}}),extendEditor:e=>e,createElement:e=>{var t,i;const n=j.getPlugin.defineElement();o.unwrapNodes(e,{match:e=>{var t;return!a.isEditor(e)&&l.isElement(e)&&"list-item"!==e.type&&"todo-list-item"!==e.type&&(null===(t=e.data)||void 0===t?void 0:t.depth)>=1},split:!0}),o.setNodes(e,n,{at:null===(t=e.selection)||void 0===t?void 0:t.anchor});const s=$.getPlugin.defineElement();o.wrapNodes(e,s,{at:null===(i=e.selection)||void 0===i?void 0:i.anchor})},exports:{markdown:{serialize:(e,t)=>`${t}`},html:{serialize:(e,t)=>{var i;return`<div style="padding-left: ${(null===(i=e.data)||void 0===i?void 0:i.depth)?15*e.data.depth:15}px;">${t}</div>`}}}}),S={NumberedList:y,BulletedList:k,TodoList:$};export{k as BulletedList,y as NumberedList,$ as TodoList,S as default};
|
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Modify,
|
|
1
|
+
import { Modify, YooptaBaseElement } from '@yoopta/editor';
|
|
2
2
|
export type ListOptions = {
|
|
3
3
|
depth: number;
|
|
4
4
|
skipDrag: boolean;
|
|
@@ -7,19 +7,19 @@ export type ListOptions = {
|
|
|
7
7
|
export type TodoListItemOptions = {
|
|
8
8
|
checked: boolean;
|
|
9
9
|
};
|
|
10
|
-
export type ListChildItemElement =
|
|
11
|
-
export type TodoListChildItemElement = Modify<
|
|
10
|
+
export type ListChildItemElement = YooptaBaseElement<'list-item'>;
|
|
11
|
+
export type TodoListChildItemElement = Modify<YooptaBaseElement<'todo-list-item'>, {
|
|
12
12
|
data: TodoListItemOptions;
|
|
13
13
|
}>;
|
|
14
|
-
export type TodoList = Modify<
|
|
14
|
+
export type TodoList = Modify<YooptaBaseElement<'todo-list'>, {
|
|
15
15
|
children: TodoListChildItemElement[];
|
|
16
16
|
data: ListOptions;
|
|
17
17
|
}>;
|
|
18
|
-
export type BulletedList = Modify<
|
|
18
|
+
export type BulletedList = Modify<YooptaBaseElement<'bulleted-list'>, {
|
|
19
19
|
children: ListChildItemElement[];
|
|
20
20
|
data: ListOptions;
|
|
21
21
|
}>;
|
|
22
|
-
export type NumberedList = Modify<
|
|
22
|
+
export type NumberedList = Modify<YooptaBaseElement<'numbered-list'>, {
|
|
23
23
|
children: ListChildItemElement[];
|
|
24
24
|
data: ListOptions;
|
|
25
25
|
}>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { YooptaPlugin } from '@yoopta/editor';
|
|
2
2
|
import type { BulletedList, ListOptions } from '../types';
|
|
3
|
-
declare const BulletedList:
|
|
3
|
+
declare const BulletedList: YooptaPlugin<ListOptions, BulletedList>;
|
|
4
4
|
export { BulletedList };
|
package/dist/ui/ListItem.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { ListOptions, NumberedList } from '../types';
|
|
2
|
-
declare const NumberedList: import("@yoopta/editor").
|
|
2
|
+
declare const NumberedList: import("@yoopta/editor").YooptaPlugin<ListOptions, NumberedList>;
|
|
3
3
|
export { NumberedList };
|
package/dist/ui/TodoList.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { TodoListChildItemElement, TodoListItemOptions } from '../types';
|
|
2
|
-
declare const TodoListItem: import("@yoopta/editor").
|
|
2
|
+
declare const TodoListItem: import("@yoopta/editor").YooptaPlugin<TodoListItemOptions, TodoListChildItemElement>;
|
|
3
3
|
export { TodoListItem };
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yoopta/lists",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.1-rc",
|
|
4
4
|
"description": "> TODO: description",
|
|
5
5
|
"author": "Darginec05 <devopsbanda@gmail.com>",
|
|
6
|
-
"homepage": "https://github.com/Darginec05/Editor-
|
|
6
|
+
"homepage": "https://github.com/Darginec05/Editor-Yoopta#readme",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"private": false,
|
|
9
9
|
"type": "module",
|
|
@@ -25,12 +25,12 @@
|
|
|
25
25
|
},
|
|
26
26
|
"repository": {
|
|
27
27
|
"type": "git",
|
|
28
|
-
"url": "git+https://github.com/Darginec05/Editor-
|
|
28
|
+
"url": "git+https://github.com/Darginec05/Editor-Yoopta.git"
|
|
29
29
|
},
|
|
30
30
|
"scripts": {
|
|
31
31
|
"test": "node ./__tests__/yoopta-code.test.js"
|
|
32
32
|
},
|
|
33
33
|
"bugs": {
|
|
34
|
-
"url": "https://github.com/Darginec05/Editor-
|
|
34
|
+
"url": "https://github.com/Darginec05/Editor-Yoopta/issues"
|
|
35
35
|
}
|
|
36
|
-
}
|
|
36
|
+
}
|