@yoopta/editor 1.9.8-rc → 1.9.9-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.
@@ -7,7 +7,7 @@ export type HoveredElement = YooptaBaseElement<string> | null;
7
7
  export type YooptaContextReturnValues = {
8
8
  marks: MarksMap;
9
9
  elements: ElementsMap;
10
- tools: YooptaTools;
10
+ tools?: YooptaTools;
11
11
  };
12
12
  export type YooptaContextHandlers = {};
13
13
  export type YooptaContextType = YooptaContextReturnValues;
@@ -15,7 +15,7 @@ type YooptaContextProps = {
15
15
  children: ReactNode;
16
16
  plugins: YooptaPlugin<any, any>[];
17
17
  marks?: YooptaMark[];
18
- tools: YooptaTools;
18
+ tools?: YooptaTools;
19
19
  };
20
20
  export type ToggleOptions = {
21
21
  shouldDeleteText: boolean;
@@ -40,5 +40,5 @@ declare const YooptaContextProvider: ({ children, plugins: pluginList, marks: ma
40
40
  declare const useYoopta: () => YooptaContextReturnValues;
41
41
  declare const useMarks: () => MarksMap;
42
42
  declare const useElements: () => ElementsMap;
43
- declare const useTools: () => YooptaTools;
43
+ declare const useTools: () => YooptaTools | undefined;
44
44
  export { YooptaContextProvider, useYoopta, useMarks, useElements, useTools };
package/dist/index.js CHANGED
@@ -10,4 +10,4 @@ be={get exports(){return we},set exports(e){we=e}},function(){var e={}.hasOwnPro
10
10
  *
11
11
  * Copyright (c) 2014-2017, Jon Schlinkert.
12
12
  * Released under the MIT License.
13
- */function Ft(e){return"[object Object]"===Object.prototype.toString.call(e)}function Ht(e){var t,n;return!1!==Ft(e)&&(void 0===(t=e.constructor)||!1!==Ft(n=t.prototype)&&!1!==n.hasOwnProperty("isPrototypeOf"))}var zt={isHistory:e=>Ht(e)&&Array.isArray(e.redos)&&Array.isArray(e.undos)&&(0===e.redos.length||x.isOperationList(e.redos[0]))&&(0===e.undos.length||x.isOperationList(e.undos[0]))},It=new WeakMap,Rt=new WeakMap,Wt={isHistoryEditor:e=>zt.isHistory(e.history)&&m.isEditor(e),isMerging:e=>Rt.get(e),isSaving:e=>It.get(e),redo(e){e.redo()},undo(e){e.undo()},withoutMerging(e,t){var n=Wt.isMerging(e);Rt.set(e,!1),t(),Rt.set(e,n)},withoutSaving(e,t){var n=Wt.isSaving(e);It.set(e,!1),t(),It.set(e,n)}},Ut=(e,t)=>"set_selection"===e.type||(!(!t||"insert_text"!==e.type||"insert_text"!==t.type||e.offset!==t.offset+t.text.length||!b.equals(e.path,t.path))||!(!t||"remove_text"!==e.type||"remove_text"!==t.type||e.offset+e.text.length!==t.offset||!b.equals(e.path,t.path))),Vt=(e,t)=>"set_selection"!==e.type||null!=e.properties&&null!=e.newProperties,Zt=(e,t)=>!(!t||"set_selection"!==e.type||"set_selection"!==t.type),$t=e=>"set_selection"!==e.type;function qt(e){return!!Array.isArray(e)&&0!==e.length}const Kt="yoopta-content";var Gt="u-OdDyDx";xe(".u-OdDyDx:after{color:#aaa;content:attr(data-placeholder);font-size:75%;font-style:inherit;font-weight:inherit;padding-left:5px;position:absolute;text-indent:2px;top:50%;transform:translateY(-50%);user-select:none}");const Jt={margin:"1px 0",whiteSpace:"pre-wrap",wordBreak:"break-word",color:"inherit",fontSize:"inherit",lineHeight:"inherit",fontWeight:"inherit"},Xt=l((({attributes:e,children:n,placeholder:r,leaf:o})=>{const i=h();return t("span",Object.assign({},e,{"data-placeholder":r,style:Jt,className:_e({[Gt]:o.withPlaceholder&&r&&i})},{children:n}))}));Xt.displayName="TextLeaf";var Qt;function Yt(){return Yt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Yt.apply(this,arguments)}var en,tn=function(e){return n.createElement("svg",Yt({viewBox:"0 0 10 10",fill:"currentColor",style:{width:14,height:14,display:"block",flexShrink:0,backfaceVisibility:"hidden"}},e),Qt||(Qt=n.createElement("path",{d:"M3 2a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm0 4a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm0 4a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm4-8a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm0 4a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm0 4a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"})))};function nn(){return nn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},nn.apply(this,arguments)}var rn=function(e){return n.createElement("svg",nn({viewBox:"0 0 16 16",fill:"currentColor",style:{width:16,height:16,display:"block",flexShrink:0,backfaceVisibility:"hidden"}},e),en||(en=n.createElement("path",{d:"M7.977 14.963c.407 0 .747-.324.747-.723V8.72h5.362c.399 0 .74-.34.74-.747a.746.746 0 0 0-.74-.738H8.724V1.706c0-.398-.34-.722-.747-.722a.732.732 0 0 0-.739.722v5.529h-5.37a.746.746 0 0 0-.74.738c0 .407.341.747.74.747h5.37v5.52c0 .399.332.723.739.723z"})))},on="yCQ-VdE5",an="b--398nS",sn="_6VhqH6wy",ln="k9i48GWd",cn="TNeDy6y5",dn="jVfkavqE",un="_87oFW01f";xe('.yCQ-VdE5{display:flex;left:-50px;opacity:0;position:absolute;top:2px;transition:opacity .18s ease-in}.b--398nS{opacity:1}._6VhqH6wy{all:unset;align-items:center;background-color:inherit;background-color:transparent;border-radius:6px;color:rgba(55,53,47,.35);cursor:pointer;display:flex;height:24px;justify-content:center;margin:0 1px;padding:0;position:relative;transition:background-color .18s cubic-bezier(.4,0,.2,1);width:auto;width:18px}._6VhqH6wy:active,._6VhqH6wy:focus,._6VhqH6wy:hover{background-color:rgba(55,54,47,.08)}.k9i48GWd{width:24px}.TNeDy6y5{position:relative;transition:opacity .18s cubic-bezier(.4,0,.2,1)}.jVfkavqE:after{background-color:#007aff;bottom:-7px;content:"";height:3px;left:50%;position:absolute;transform:translateX(-50%);width:100%}._87oFW01f:before{top:-5px}._87oFW01f:after,._87oFW01f:before{background-color:inherit;content:"";height:3px;left:50%;position:absolute;transform:translateX(-50%);width:100%}._87oFW01f:after{bottom:-7px}');const fn=({element:n,editor:r,values:o,handlers:i})=>{const a=c(null),{hoveredElement:s,isElementOptionsOpen:l,nodeSettingsPos:d}=o,{onDragEnd:u,onDragStart:p,openNodeSettings:h,closeNodeSettings:v,triggerPlusButton:g}=i,y=e=>{e.stopPropagation();const t=a.current,o=document.querySelector(`[data-element-id="${null==n?void 0:n.id}"]`),i=f.findPath(r,n),s=m.parent(r,i);_.isElement(n)&&(null==t||t.setAttribute("draggable","false"),o&&(o.setAttribute("draggable","true"),o.ondragstart=e=>{const t={path:i,element:{id:n.id,type:n.type},parent:s};p(e,t)},o.ondragend=u))},b=(null==s?void 0:s.id)===n.id;return e("div",Object.assign({contentEditable:!1,className:_e(on,{[an]:b},"yoopta-element-actions")},{children:[b&&l&&t(_t,{element:n,style:d||void 0,onClose:v}),t("button",Object.assign({type:"button",onMouseDown:y,className:_e(sn,ln,"yoopta-element-actions-plus"),onClick:()=>g(n)},{children:t(rn,{})})),t("button",Object.assign({type:"button",onMouseDown:y,className:_e(sn,"yoopta-element-actions-drag"),onClick:()=>h(a,n),ref:a},{children:t(tn,{})}))]}))},pn=({children:n,element:r,attributes:o,nodeType:i,render:a,HTMLAttributes:l})=>{var c;const d=p(),[u,f]=ht(),h="inline"===i,{hoverIn:v,onDrop:g}=f,{dndState:y,DRAG_MAP:m}=u,b=s((()=>{var e,t;if(null===y.from.element||null===y.to.element)return{isDragging:!1,isDragOver:!1,isDragSelf:!1};const n=(null===(e=u.dndState.from.element)||void 0===e?void 0:e.id)===r.id,o=(null===(t=u.dndState.to.element)||void 0===t?void 0:t.id)===r.id;return{isDragging:n,isDragOver:o,isDragSelf:n&&o}}),[u.dndState.from,u.dndState.to]),w=null===(c=r.data)||void 0===c?void 0:c.skipSettings,{isDragging:_,isDragOver:x,isDragSelf:O}=b,j={opacity:_?.7:1};return m.set(r.id,r),h?a({attributes:o,element:r,children:n,HTMLAttributes:l}):e("div",Object.assign({"data-element-id":r.id,"data-element-type":r.type,onMouseEnter:e=>{w||v(e,r)},onDrop:g,className:_e(cn,{[dn]:x,[un]:O}),style:j},o,{children:[w?null:t(fn,{editor:d,element:r,handlers:f,values:u}),a({attributes:o,element:r,children:n,HTMLAttributes:l})]}))};pn.displayName="ElementWrapper";const hn={bold:"mod+b",italic:"mod+i",compose:["down","left","right","up","backspace","enter"],arrowLeft:"left",arrowUp:"up",arrowDown:"down",arrowRight:"right",ctrlLeft:"ctrl+left",escape:"esc",ctrlRight:"ctrl+right",deleteBackward:"shift?+backspace",backspace:"backspace",deleteForward:"shift?+delete",extendBackward:"shift+left",extendForward:"shift+right",shiftEnter:"shift+enter",enter:"enter",space:"space",undo:"mod+z",select:"mod+a",shiftTab:"shift+tab",tab:"tab",cmd:"mod",cmdEnter:"mod+enter",kekCeburek:"mod+enter"},vn={moveLineBackward:"opt+up",moveLineForward:"opt+down",ctrlLeft:"opt+left",ctrlRight:"opt+right",deleteBackward:["ctrl+backspace","ctrl+h"],deleteForward:["ctrl+delete","ctrl+d"],deleteLineBackward:"cmd+shift?+backspace",deleteLineForward:["cmd+shift?+delete","ctrl+k"],deleteWordBackward:"opt+shift?+backspace",deleteWordForward:"opt+shift?+delete",extendLineBackward:"opt+shift+up",extendLineForward:"opt+shift+down",redo:"cmd+shift+z",transposeCharacter:"ctrl+t"},gn={deleteWordBackward:"ctrl+shift?+backspace",deleteWordForward:"ctrl+shift?+delete",redo:["ctrl+y","ctrl+shift+z"]},yn=e=>{const t=hn[e],n=vn[e],r=gn[e],o=t&&Bt(t),i=n&&Bt(n),a=r&&Bt(r);return e=>!(!o||!o(e))||(!(!i||!i(e))||!(!a||!a(e)))},mn={isBold:yn("bold"),isCompose:yn("compose"),isArrowLeft:yn("arrowLeft"),isArrowRight:yn("arrowRight"),isArrowUp:yn("arrowUp"),isArrowDown:yn("arrowDown"),isDeleteBackward:yn("deleteBackward"),isDeleteForward:yn("deleteForward"),isDeleteLineBackward:yn("deleteLineBackward"),isDeleteLineForward:yn("deleteLineForward"),isDeleteWordBackward:yn("deleteWordBackward"),isDeleteWordForward:yn("deleteWordForward"),isExtendBackward:yn("extendBackward"),isExtendForward:yn("extendForward"),isExtendLineBackward:yn("extendLineBackward"),isExtendLineForward:yn("extendLineForward"),isItalic:yn("italic"),isMoveLineBackward:yn("moveLineBackward"),isMoveLineForward:yn("moveLineForward"),isCtrlLeft:yn("ctrlLeft"),isCtrlRight:yn("ctrlRight"),isRedo:yn("redo"),isShiftEnter:yn("shiftEnter"),isEnter:yn("enter"),isTransposeCharacter:yn("transposeCharacter"),isUndo:yn("undo"),isSpace:yn("space"),isSelect:yn("select"),isTab:yn("tab"),isShiftTab:yn("shiftTab"),isBackspace:yn("backspace"),isCmdEnter:yn("cmdEnter"),isCmd:yn("cmd"),isEscape:yn("escape"),isKekceburek:yn("kekCeburek")},bn=(e,t)=>!!((e,t)=>{const{selection:n}=e;if(!n)return!1;const[r]=Array.from(m.nodes(e,{at:m.unhangRange(e,n),match:e=>!m.isEditor(e)&&_.isElement(e)&&e.type===t}));return r})(e,t),wn=(e,t,n="lowest")=>{var r;const o=Array.from(m.nodes(e,{match:t=>m.isEditor(e)&&_.isElement(t),at:t||(null===(r=e.selection)||void 0===r?void 0:r.anchor.path),mode:n}))[0];return o?o[0]:e.children[0]};function _n(e,t){var n,r;if(O.isText(e))return function(e){const t={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#039;"};return e.replace(/[&<>"']/g,(e=>t[e]))}(e.text);const o=e.children.map((e=>_n(e,t))).join(""),i=t[e.type];return"function"==typeof(null===(r=null===(n=i.exports)||void 0===n?void 0:n.html)||void 0===r?void 0:r.serialize)?i.exports.html.serialize(e,o):o}function xn(e,t){return e.map((e=>_n(e,t))).join("")}const On={hotkeys:mn,defaultNode:ct(Ze())},jn=({editor:n,placeholder:o,marks:a,readOnly:l,plugins:u,className:p,PLUGINS_MAP:h,tools:g})=>{i((()=>{const e=window.location.hash.length>0?window.location.hash.replace("#",""):null;if(e){const t=document.getElementById(e)||document.querySelector(`[data-element-id="${e}"]`);t&&window.scrollTo({top:t.offsetTop,behavior:"smooth"})}}),[]);const y=c(null),[{disableWhileDrag:x},{changeHoveredNode:O}]=ht(),E=x||l,k=s((()=>e=>{var r;const o=h[e.element.type];if(!o)return null;const i=function(e){return"function"==typeof e.renderer?e.renderer:e.renderer.editor}(o)(n,o);return t(pn,Object.assign({element:e.element,attributes:e.attributes,nodeType:e.element.nodeType,render:i,HTMLAttributes:null===(r=o.options)||void 0===r?void 0:r.HTMLAttributes},{children:e.children}))}),[u,n]),N=s((()=>e=>{const t=[],[r,o]=e;return u.forEach((o=>{const i=o.decorator;"function"==typeof i&&_.isElement(r)&&r.type===o.type&&t.push(...i(n)(e))})),n.selection&&!m.isEditor(r)&&""===m.string(n,[o[0]])&&j.includes(n.selection,o)&&j.isCollapsed(n.selection)&&t.push(Object.assign(Object.assign({},n.selection),{withPlaceholder:!0})),t}),[u,n]),S=s((()=>e=>{var r;const i=Object.assign({},e);let s;u.forEach((e=>{if(e.leaf){const t=e.leaf(n)(i);t&&(i.children=t)}})),null==a||a.forEach((e=>{i.leaf[e.type]&&(i.children=e.render(i))}));const l=null===(r=i.children.props)||void 0===r?void 0:r.parent;if(!function(e){var t,n;return 1!==(null===(t=null==e?void 0:e.children)||void 0===t?void 0:t.length)||0!==(null===(n=null==e?void 0:e.children[0])||void 0===n?void 0:n.text.length)}(l)){const e=h[null==l?void 0:l.type];s=null===(null==e?void 0:e.placeholder)?null:(null==e?void 0:e.placeholder)||o}return t(Xt,Object.assign({},i,{placeholder:s}))}),[u,n]),D=s((()=>{const e=u.map((e=>Object.keys(e.events||{}))).flat().filter(((e,t,n)=>n.indexOf(e)===t)),t={};return e.forEach((e=>{t[e]=function(t){u.forEach((r=>{var o;if(null===(o=r.events)||void 0===o?void 0:o[e]){r.events[e](n,On)(t)}}))}})),t}),[u,n]),P=d((e=>{m.withoutNormalizing(n,(()=>{var t;if(!n.selection)return;const r=ct(Ze());null==a||a.forEach((t=>{t.hotkey&&Bt(t.hotkey)(e)&&(e.preventDefault(),dt(n,t.type,!1))})),null===(t=D.onKeyDown)||void 0===t||t.call(D,e);const o=m.above(n,{match:e=>!m.isEditor(e),mode:"lowest"});if(mn.isEnter(e)){if(e.isDefaultPrevented())return;e.preventDefault();const t=Object.keys(m.marks(n)||{});t.length>0&&t.forEach((e=>m.removeMark(n,e)));const i=b.parent(n.selection.anchor.path),a=m.string(n,i),s=o&&o[0].type!==r.type;if(s&&0===a.length)return void w.setNodes(n,r,{at:i});if(m.isStart(n,n.selection.anchor,n.selection.anchor.path)&&s){const[e]=o;return w.setNodes(n,r,{at:i}),w.delete(n,{unit:"block"}),w.insertNodes(n,Ie(e),{at:b.next(i)}),void w.select(n,{path:[b.next(n.selection.anchor.path)[0]+1,0],offset:0})}return w.splitNodes(n,{always:!0}),w.setNodes(n,r),void O(r)}if(mn.isShiftEnter(e)){if(e.isDefaultPrevented())return;e.preventDefault(),n.insertText("\n")}if(mn.isSelect(e)){if(e.isDefaultPrevented())return;e.preventDefault();const t=m.above(n,{at:n.selection.anchor.path,match:e=>!m.isEditor(e)&&_.isElement(e)});if(!t)return;const r=m.string(n,t[1]);return j.isExpanded(n.selection)||0===r.length?void w.select(n,[]):void w.select(n,t[1])}}))}),[]),C=s((()=>{const e=g||{};return Object.keys(e).length>0?Object.keys(e).map((t=>{const n=e[t];return r.isValidElement(e[t])?r.cloneElement(n,Object.assign({key:t},null==n?void 0:n.props)):null})):null}),[g]);return e("div",Object.assign({id:"yoopta-editor",className:p,ref:y,onMouseDown:e=>{l||(e.preventDefault(),e.currentTarget===e.target&&n.selection&&m.withoutNormalizing(n,(()=>{const e=[n.children.length-1,0],t=wn(n,e,"highest"),r=m.string(n,e);console.log("lastNode",t),console.log("lastNodeText",r);const o={anchor:{path:e,offset:0},focus:{path:e,offset:0}};if("paragraph"===t.type&&0===r.length)return w.select(n,{path:o.anchor.path,offset:0}),O(t),f.focus(n);const i=ct(Ze());O(i),w.insertNodes(n,i,{at:[n.children.length],select:!0}),f.focus(n)})))}},{children:[C,t(v,Object.assign({id:"yoopta-contenteditable",renderLeaf:S,renderElement:k,readOnly:E,decorate:N,onCopy:e=>{if(e.preventDefault(),!n.selection)return;const t=xn(m.fragment(n,n.selection),n.plugins);return e.clipboardData.setData("text/html",t),e.clipboardData},autoFocus:!0,spellCheck:!0},D,{onKeyDown:P,onMouseDown:e=>{var t;null===(t=D.onMouseDown)||void 0===t||t.call(D,e),(e=>{e.stopPropagation(),e.nativeEvent.stopImmediatePropagation()})(e)}}))]}))};function En(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var kn=new WeakMap,Nn=new WeakMap;class Sn{}class Dn extends Sn{constructor(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super();var{offset:t,path:n}=e;this.offset=t,this.path=n}}class Pn extends Sn{constructor(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super();var{offset:t,path:n}=e;this.offset=t,this.path=n}}var Cn=e=>Nn.get(e);function An(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Tn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?An(Object(n),!0).forEach((function(t){En(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):An(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var Ln=new WeakSet,Bn=e=>{var t=[],n=e=>{if(null!=e){var r=t[t.length-1];if("string"==typeof e){var o={text:e};Ln.add(o),e=o}if(O.isText(e)){var i=e;O.isText(r)&&Ln.has(r)&&Ln.has(i)&&O.equals(r,i,{loose:!0})?r.text+=i.text:t.push(i)}else if(_.isElement(e))t.push(e);else{if(!(e instanceof Sn))throw new Error("Unexpected hyperscript child object: ".concat(e));var a=t[t.length-1];O.isText(a)||(n(""),a=t[t.length-1]),e instanceof Dn?((e,t)=>{var n=e.text.length;kn.set(e,[n,t])})(a,e):e instanceof Pn&&((e,t)=>{var n=e.text.length;Nn.set(e,[n,t])})(a,e)}}};for(var r of e.flat(1/0))n(r);return t};function Mn(e,t,n){return Tn(Tn({},t),{},{children:Bn(n)})}function Fn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Hn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Fn(Object(n),!0).forEach((function(t){En(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Fn(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var zn,In={anchor:function(e,t,n){return new Dn(t)},cursor:function(e,t,n){return[new Dn(t),new Pn(t)]},editor:(zn=k,(e,t,n)=>{var r,o=[];for(var i of n)j.isRange(i)?r=i:o.push(i);var a,s=Bn(o),l={},c=zn();for(var[d,u]of(Object.assign(c,t),c.children=s,E.texts(c))){var f=(a=d,kn.get(a)),p=Cn(d);if(null!=f){var[h]=f;l.anchor={path:u,offset:h}}if(null!=p){var[v]=p;l.focus={path:u,offset:v}}}if(l.anchor&&!l.focus)throw new Error("Slate hyperscript ranges must have both `<anchor />` and `<focus />` defined if one is defined, but you only defined `<anchor />`. For collapsed selections, use `<cursor />` instead.");if(!l.anchor&&l.focus)throw new Error("Slate hyperscript ranges must have both `<anchor />` and `<focus />` defined if one is defined, but you only defined `<focus />`. For collapsed selections, use `<cursor />` instead.");return null!=r?c.selection=r:j.isRange(l)&&(c.selection=l),c}),element:Mn,focus:function(e,t,n){return new Pn(t)},fragment:function(e,t,n){return Bn(n)},selection:function(e,t,n){var r=n.find((e=>e instanceof Dn)),o=n.find((e=>e instanceof Pn));if(!r||null==r.offset||null==r.path)throw new Error("The <selection> hyperscript tag must have an <anchor> tag as a child with `path` and `offset` attributes defined.");if(!o||null==o.offset||null==o.path)throw new Error("The <selection> hyperscript tag must have a <focus> tag as a child with `path` and `offset` attributes defined.");return Tn({anchor:{offset:r.offset,path:r.path},focus:{offset:o.offset,path:o.path}},t)},text:function(e,t,n){var r=Bn(n);if(r.length>1)throw new Error("The <text> hyperscript tag must only contain a single node's worth of children.");var[o]=r;if(null==o&&(o={text:""}),!O.isText(o))throw new Error("\n The <text> hyperscript tag can only contain text content as children.");return Ln.delete(o),Object.assign(o,t),o}},Rn=e=>function(t,n){for(var r=arguments.length,o=new Array(r>2?r-2:0),i=2;i<r;i++)o[i-2]=arguments[i];var a=e[t];if(!a)throw new Error("No hyperscript creator found for tag: <".concat(t,">"));return null==n&&(n={}),Ht(n)||(o=[n].concat(o),n={}),a(t,n,o=o.filter((e=>Boolean(e))).flat())},Wn=e=>{var t={},n=function(n){var r=e[n];if("object"!=typeof r)throw new Error("Properties specified for a hyperscript shorthand should be an object, but for the custom element <".concat(n,"> tag you passed: ").concat(r));t[n]=(e,t,n)=>Mn(0,Hn(Hn({},r),t),n)};for(var r in e)n(r);return t},Un=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{elements:t={}}=e,n=Wn(t),r=Hn(Hn(Hn({},In),n),e.creators);return Rn(r)}();const Vn={DEL:()=>({strikethrough:!0}),EM:()=>({italic:!0}),I:()=>({italic:!0}),S:()=>({strikethrough:!0}),STRONG:()=>({bold:!0}),U:()=>({underline:!0})},Zn=(e,t)=>{var n,r,o,i;if(3===e.nodeType)return e.textContent;if(1!==e.nodeType)return null;if("BR"===e.nodeName)return"\n";const{nodeName:a}=e;let s=e,l=Array.from(s.childNodes).map((e=>Zn(e,t))).flat();if(0===l.length&&(l=[{text:""}]),"BODY"===e.nodeName)return Un("fragment",{},l);if(t[a]){const s=t[a];if(s){let t=s.defineElement();if("function"==typeof(null===(r=null===(n=s.exports)||void 0===n?void 0:n.html.deserialize)||void 0===r?void 0:r.parse)){const n=null===(i=null===(o=s.exports)||void 0===o?void 0:o.html.deserialize)||void 0===i?void 0:i.parse(e);t=Object.assign(Object.assign({},t),{data:n})}return Un("element",t,l)}}if(O.isTextList(l))return Un("element",t.P.defineElement(),l);if(Vn[a]){const t=Vn[a](e);return l.map((e=>O.isText(e)?Un("text",t,e):e))}return l};function $n(e,t){const n=function(e){const t={};return Object.keys(e).forEach((n=>{var r,o,i,a,s,l,c,d;const u=e[n];if(null===(o=null===(r=u.exports)||void 0===r?void 0:r.html.deserialize)||void 0===o?void 0:o.nodeName){if(Array.isArray(null===(a=null===(i=u.exports)||void 0===i?void 0:i.html.deserialize)||void 0===a?void 0:a.nodeName))return void(null===(l=null===(s=u.exports)||void 0===s?void 0:s.html.deserialize)||void 0===l||l.nodeName.forEach((e=>{t[e]=u})));t[null===(d=null===(c=u.exports)||void 0===c?void 0:c.html.deserialize)||void 0===d?void 0:d.nodeName]=u}})),t}(t),r=(new DOMParser).parseFromString(e,"text/html");return Zn(r.body,n)}const qn=r.createContext({marks:{},elements:{},tools:{}}),Kn=({children:e,plugins:n,marks:r,tools:o})=>{const i=p(),a=s((()=>{const e=me(n),t={};return e.forEach((e=>{const{createElement:n,defineElement:r,type:o,hasParent:a}=e;a||(t[e.type]={create:n,define:r,toggle:t=>((e,t)=>{m.withoutNormalizing(i,(()=>{var n;if(!i.selection)return;const{offset:r,path:o}=i.selection.anchor,{shouldDeleteText:a}=t||{};a&&w.delete(i,{at:{anchor:{path:o,offset:0},focus:{path:o,offset:r}}});const s=m.above(i,{at:i.selection,mode:"highest",match:e=>!m.isEditor(e)&&_.isElement(e)}),[l,c]=m.parent(i,b.parent(i.selection.anchor.path)),[d]=s||[];(null==d?void 0:d.type)!==e.type?(_.isElement(l)&&!m.isEditor(l)&&w.unwrapNodes(i,{at:c,match:e=>!m.isEditor(e)&&!O.isText(e)&&_.isElement(l)&&e.type===l.type}),null===(n=e.createElement)||void 0===n||n.call(e,i)):w.setNodes(i,ct(Ze()),{mode:"highest",match:e=>!m.isEditor(e)&&_.isElement(e)})}))})(e,t),type:o})})),t}),[n,i.selection]),l=e=>{const t=m.marks(i);return!!(null==t?void 0:t[e])},c=s((()=>{const e={};return null==r||r.forEach((t=>{e[t.type]={toggle:e=>((e,t=!1)=>{t&&Object.keys(m.marks(i)||{}).forEach((e=>{m.removeMark(i,e)})),l(e)?m.removeMark(i,e):m.addMark(i,e,!0)})(t.type,null==e?void 0:e.only),isActive:l(t.type)}})),e}),[r,i.selection]),d=s((()=>o),[o]),u=s((()=>({elements:a,marks:c,tools:d})),[i.selection,c,a]);return t(qn.Provider,Object.assign({value:u},{children:e}))},Gn=()=>a(qn),Jn=()=>a(qn).marks,Xn=()=>a(qn).elements,Qn=()=>a(qn).tools,Yn=({key:e,value:n,plugins:r,marks:a,readOnly:l,onChange:c,placeholder:u,autoFocus:p=!0,offline:h,className:v,tools:N})=>{const S=function(e){return"string"==typeof e?e:Kt}(h),[D,P]=o((()=>function(e,t,n){const r=[{id:Ze(),type:"paragraph",children:[{text:""}]}],o=qt(n)?n:r;if(!t)return localStorage.removeItem(e),o;try{const t=JSON.parse(localStorage.getItem(e)||"[]");return qt(t)?t:o}catch(t){return localStorage.removeItem(e),r}}(S,h,n))),C=d((e=>{if(c(e),P(e),!h)return;if(B.operations.some((e=>"set_selection"!==e.type)))try{const t=JSON.stringify(e);localStorage.setItem(S,t)}catch(e){}}),[h]),A=s((()=>{const e=me(r),t=function(e){const t={};return e.forEach((e=>t[e.type]=e)),t}(e);return{yooptaPlugins:e,PLUGINS_MAP:t}}),[r]),{yooptaPlugins:T,PLUGINS_MAP:L}=A,B=s((()=>{let e=(e=>{const{insertData:t}=e;return e.insertData=n=>{if(e.selection&&j.isExpanded(e.selection))return;const r=n.getData("text/html");if(r){const t=$n(r,e.plugins);w.insertFragment(e,t)}else t(n)},e})((e=>{const{deleteFragment:t}=e;return e.deleteFragment=()=>{const{selection:n}=e;if(!n)return;const[,r]=m.first(e,[0]),[,o]=m.last(e,[e.children.length-1]),i=m.range(e,r,o),a=j.equals(n,i);if(console.log({isAllNodesSelected:a,fullRange:i}),a)return w.removeNodes(e,{mode:"highest",hanging:!0}),void w.select(e,[0]);t()},e})((e=>{const{normalizeNode:t}=e;return e.normalizeNode=n=>{const[r]=n;if(m.isEditor(r)&&0===e.children.length){const t=ct(Ze());w.insertNodes(e,t,{at:[0]})}else t(n)},e})((e=>{const{insertBreak:t,deleteBackward:n}=e;return e.insertBreak=()=>{if(!e.selection||!j.isCollapsed(e.selection))return t();const n=b.parent(e.selection.anchor.path),r=E.get(e,n);_.isElement(r)&&m.isVoid(e,r)?m.insertNode(e,{id:Ze(),type:"paragraph",children:[{text:""}],nodeType:"block"}):t()},e.deleteBackward=t=>{if(!e.selection||!j.isCollapsed(e.selection)||0!==e.selection.anchor.offset)return n(t);const r=b.parent(e.selection.anchor.path),o=E.get(e,r);if(0===E.string(o).length&&b.hasPrevious(r)){const t=b.previous(r),n=E.get(e,t);if(_.isElement(n)&&m.isVoid(e,n))return w.removeNodes(e),w.select(e,t)}n(t)},e})((e=>{var t=e,{apply:n}=t;return t.history={undos:[],redos:[]},t.redo=()=>{var{history:e}=t,{redos:n}=e;if(n.length>0){var r=n[n.length-1];Wt.withoutSaving(t,(()=>{m.withoutNormalizing(t,(()=>{for(var e of r)t.apply(e)}))})),e.redos.pop(),e.undos.push(r)}},t.undo=()=>{var{history:e}=t,{undos:n}=e;if(n.length>0){var r=n[n.length-1];Wt.withoutSaving(t,(()=>{m.withoutNormalizing(t,(()=>{var e=r.map(x.inverse).reverse();for(var n of e)t.apply(n)}))})),e.redos.push(r),e.undos.pop()}},t.apply=e=>{var{operations:r,history:o}=t,{undos:i}=o,a=i[i.length-1],s=a&&a[a.length-1],l=Zt(e,s),c=Wt.isSaving(t),d=Wt.isMerging(t);if(null==c&&(c=Vt(e)),c){if(null==d&&(d=null!=a&&(0!==r.length||Ut(e,s)||l)),a&&d)l&&a.pop(),a.push(e);else{var u=[e];i.push(u)}for(;i.length>100;)i.shift();$t(e)&&(o.redos=[])}n(e)},t})((e=>{const{insertText:t}=e;return e.insertText=n=>{var r,o;const{selection:i}=e;if(" "===n&&i&&j.isCollapsed(i)){const{anchor:a}=i,s=m.above(e,{match:t=>_.isElement(t)&&m.isBlock(e,t),mode:"lowest"});if(!s)return;const[,l]=s,c=m.parent(e,l),[d]=c;if(_.isElement(d)&&!O.isText(d.children[0]))return t(n);const u=s?l:[],f={anchor:a,focus:m.start(e,u)},p=m.string(e,f),h=null===(r=e.shortcuts)||void 0===r?void 0:r[p];if(h)return w.select(e,f),w.delete(e),void(null===(o=h.createElement)||void 0===o||o.call(h,e))}t(n)},e})(g(k())))))));e.plugins=L;const t={};return T.forEach((n=>{var r;n.shortcut&&(Array.isArray(n.shortcut)?n.shortcut.forEach((e=>t[e]=n)):t[n.shortcut]=n),e=(null===(r=n.extendEditor)||void 0===r?void 0:r.call(n,e))||e})),e.shortcuts=t,e}),[T]);return i((()=>{if(p)try{const[,e]=m.first(B,[0]);w.select(B,{anchor:{path:e,offset:0},focus:{path:e,offset:0}}),f.focus(B)}catch(e){}}),[p,B]),t(y,Object.assign({editor:B,value:D,onChange:C},{children:t(Kn,Object.assign({plugins:r,marks:a,tools:N},{children:t(pt,{children:t(jn,{editor:B,readOnly:l,placeholder:u,plugins:T,tools:N,marks:a,PLUGINS_MAP:L,className:v})})}))}),e)},er=e=>t(Mt,{children:t(Yn,Object.assign({},e,{value:e.value,onChange:e.onChange}))});function tr({type:e,hotkey:n,className:r}){return{type:e,hotkey:n,render:e=>t("span",Object.assign({},e.attributes,{className:r},{children:e.children}))}}function nr(e){const{element:t,HTMLAttributes:n,className:r}=e;return`yoopta-${t.type} ${(null==n?void 0:n.className)||""} ${r}`}const rr={ElementOptions:_t,Overlay:Se};export{mn as HOTKEYS,rr as UI_HELPERS,ge as YooptaPlugin,tr as createYooptaMark,ye as createYooptaPlugin,_e as cx,Ie as deepClone,er as default,Ze as generateId,wn as getElementByPath,nr as getElementClassname,Lt as isCodeHotkey,bn as isElementActive,Tt as isHotkey,Bt as isKeyHotkey,qt as isValidYooptaNodes,me as mergePlugins,ht as useElementSettings,Xn as useElements,Jn as useMarks,Qn as useTools,Gn as useYoopta};
13
+ */function Ft(e){return"[object Object]"===Object.prototype.toString.call(e)}function Ht(e){var t,n;return!1!==Ft(e)&&(void 0===(t=e.constructor)||!1!==Ft(n=t.prototype)&&!1!==n.hasOwnProperty("isPrototypeOf"))}var zt={isHistory:e=>Ht(e)&&Array.isArray(e.redos)&&Array.isArray(e.undos)&&(0===e.redos.length||x.isOperationList(e.redos[0]))&&(0===e.undos.length||x.isOperationList(e.undos[0]))},It=new WeakMap,Rt=new WeakMap,Wt={isHistoryEditor:e=>zt.isHistory(e.history)&&m.isEditor(e),isMerging:e=>Rt.get(e),isSaving:e=>It.get(e),redo(e){e.redo()},undo(e){e.undo()},withoutMerging(e,t){var n=Wt.isMerging(e);Rt.set(e,!1),t(),Rt.set(e,n)},withoutSaving(e,t){var n=Wt.isSaving(e);It.set(e,!1),t(),It.set(e,n)}},Ut=(e,t)=>"set_selection"===e.type||(!(!t||"insert_text"!==e.type||"insert_text"!==t.type||e.offset!==t.offset+t.text.length||!b.equals(e.path,t.path))||!(!t||"remove_text"!==e.type||"remove_text"!==t.type||e.offset+e.text.length!==t.offset||!b.equals(e.path,t.path))),Vt=(e,t)=>"set_selection"!==e.type||null!=e.properties&&null!=e.newProperties,Zt=(e,t)=>!(!t||"set_selection"!==e.type||"set_selection"!==t.type),$t=e=>"set_selection"!==e.type;function qt(e){return!!Array.isArray(e)&&0!==e.length}const Kt="yoopta-content";var Gt="u-OdDyDx";xe(".u-OdDyDx:after{color:#aaa;content:attr(data-placeholder);font-size:75%;font-style:inherit;font-weight:inherit;padding-left:5px;position:absolute;text-indent:2px;top:50%;transform:translateY(-50%);user-select:none}");const Jt={margin:"1px 0",whiteSpace:"pre-wrap",wordBreak:"break-word",color:"inherit",fontSize:"inherit",lineHeight:"inherit",fontWeight:"inherit"},Xt=l((({attributes:e,children:n,placeholder:r,leaf:o})=>{const i=h();return t("span",Object.assign({},e,{"data-placeholder":r,style:Jt,className:_e({[Gt]:o.withPlaceholder&&r&&i})},{children:n}))}));Xt.displayName="TextLeaf";var Qt;function Yt(){return Yt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Yt.apply(this,arguments)}var en,tn=function(e){return n.createElement("svg",Yt({viewBox:"0 0 10 10",fill:"currentColor",style:{width:14,height:14,display:"block",flexShrink:0,backfaceVisibility:"hidden"}},e),Qt||(Qt=n.createElement("path",{d:"M3 2a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm0 4a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm0 4a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm4-8a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm0 4a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm0 4a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"})))};function nn(){return nn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},nn.apply(this,arguments)}var rn=function(e){return n.createElement("svg",nn({viewBox:"0 0 16 16",fill:"currentColor",style:{width:16,height:16,display:"block",flexShrink:0,backfaceVisibility:"hidden"}},e),en||(en=n.createElement("path",{d:"M7.977 14.963c.407 0 .747-.324.747-.723V8.72h5.362c.399 0 .74-.34.74-.747a.746.746 0 0 0-.74-.738H8.724V1.706c0-.398-.34-.722-.747-.722a.732.732 0 0 0-.739.722v5.529h-5.37a.746.746 0 0 0-.74.738c0 .407.341.747.74.747h5.37v5.52c0 .399.332.723.739.723z"})))},on="yCQ-VdE5",an="b--398nS",sn="_6VhqH6wy",ln="k9i48GWd",cn="TNeDy6y5",dn="jVfkavqE",un="_87oFW01f";xe('.yCQ-VdE5{display:flex;left:-50px;opacity:0;position:absolute;top:2px;transition:opacity .18s ease-in}.b--398nS{opacity:1}._6VhqH6wy{all:unset;align-items:center;background-color:inherit;background-color:transparent;border-radius:6px;color:rgba(55,53,47,.35);cursor:pointer;display:flex;height:24px;justify-content:center;margin:0 1px;padding:0;position:relative;transition:background-color .18s cubic-bezier(.4,0,.2,1);width:auto;width:18px}._6VhqH6wy:active,._6VhqH6wy:focus,._6VhqH6wy:hover{background-color:rgba(55,54,47,.08)}.k9i48GWd{width:24px}.TNeDy6y5{position:relative;transition:opacity .18s cubic-bezier(.4,0,.2,1)}.jVfkavqE:after{background-color:#007aff;bottom:-7px;content:"";height:3px;left:50%;position:absolute;transform:translateX(-50%);width:100%}._87oFW01f:before{top:-5px}._87oFW01f:after,._87oFW01f:before{background-color:inherit;content:"";height:3px;left:50%;position:absolute;transform:translateX(-50%);width:100%}._87oFW01f:after{bottom:-7px}');const fn=({element:n,editor:r,values:o,handlers:i})=>{const a=c(null),{hoveredElement:s,isElementOptionsOpen:l,nodeSettingsPos:d}=o,{onDragEnd:u,onDragStart:p,openNodeSettings:h,closeNodeSettings:v,triggerPlusButton:g}=i,y=e=>{e.stopPropagation();const t=a.current,o=document.querySelector(`[data-element-id="${null==n?void 0:n.id}"]`),i=f.findPath(r,n),s=m.parent(r,i);_.isElement(n)&&(null==t||t.setAttribute("draggable","false"),o&&(o.setAttribute("draggable","true"),o.ondragstart=e=>{const t={path:i,element:{id:n.id,type:n.type},parent:s};p(e,t)},o.ondragend=u))},b=(null==s?void 0:s.id)===n.id;return e("div",Object.assign({contentEditable:!1,className:_e(on,{[an]:b},"yoopta-element-actions")},{children:[b&&l&&t(_t,{element:n,style:d||void 0,onClose:v}),t("button",Object.assign({type:"button",onMouseDown:y,className:_e(sn,ln,"yoopta-element-actions-plus"),onClick:()=>g(n)},{children:t(rn,{})})),t("button",Object.assign({type:"button",onMouseDown:y,className:_e(sn,"yoopta-element-actions-drag"),onClick:()=>h(a,n),ref:a},{children:t(tn,{})}))]}))},pn=({children:n,element:r,attributes:o,nodeType:i,render:a,HTMLAttributes:l})=>{var c;const d=p(),[u,f]=ht(),h="inline"===i,{hoverIn:v,onDrop:g}=f,{dndState:y,DRAG_MAP:m}=u,b=s((()=>{var e,t;if(null===y.from.element||null===y.to.element)return{isDragging:!1,isDragOver:!1,isDragSelf:!1};const n=(null===(e=u.dndState.from.element)||void 0===e?void 0:e.id)===r.id,o=(null===(t=u.dndState.to.element)||void 0===t?void 0:t.id)===r.id;return{isDragging:n,isDragOver:o,isDragSelf:n&&o}}),[u.dndState.from,u.dndState.to]),w=null===(c=r.data)||void 0===c?void 0:c.skipSettings,{isDragging:_,isDragOver:x,isDragSelf:O}=b,j={opacity:_?.7:1};return m.set(r.id,r),h?a({attributes:o,element:r,children:n,HTMLAttributes:l}):e("div",Object.assign({"data-element-id":r.id,"data-element-type":r.type,onMouseEnter:e=>{w||v(e,r)},onDrop:g,className:_e(cn,{[dn]:x,[un]:O}),style:j},o,{children:[w?null:t(fn,{editor:d,element:r,handlers:f,values:u}),a({attributes:o,element:r,children:n,HTMLAttributes:l})]}))};pn.displayName="ElementWrapper";const hn={bold:"mod+b",italic:"mod+i",compose:["down","left","right","up","backspace","enter"],arrowLeft:"left",arrowUp:"up",arrowDown:"down",arrowRight:"right",ctrlLeft:"ctrl+left",escape:"esc",ctrlRight:"ctrl+right",deleteBackward:"shift?+backspace",backspace:"backspace",deleteForward:"shift?+delete",extendBackward:"shift+left",extendForward:"shift+right",shiftEnter:"shift+enter",enter:"enter",space:"space",undo:"mod+z",select:"mod+a",shiftTab:"shift+tab",tab:"tab",cmd:"mod",cmdEnter:"mod+enter",kekCeburek:"mod+enter"},vn={moveLineBackward:"opt+up",moveLineForward:"opt+down",ctrlLeft:"opt+left",ctrlRight:"opt+right",deleteBackward:["ctrl+backspace","ctrl+h"],deleteForward:["ctrl+delete","ctrl+d"],deleteLineBackward:"cmd+shift?+backspace",deleteLineForward:["cmd+shift?+delete","ctrl+k"],deleteWordBackward:"opt+shift?+backspace",deleteWordForward:"opt+shift?+delete",extendLineBackward:"opt+shift+up",extendLineForward:"opt+shift+down",redo:"cmd+shift+z",transposeCharacter:"ctrl+t"},gn={deleteWordBackward:"ctrl+shift?+backspace",deleteWordForward:"ctrl+shift?+delete",redo:["ctrl+y","ctrl+shift+z"]},yn=e=>{const t=hn[e],n=vn[e],r=gn[e],o=t&&Bt(t),i=n&&Bt(n),a=r&&Bt(r);return e=>!(!o||!o(e))||(!(!i||!i(e))||!(!a||!a(e)))},mn={isBold:yn("bold"),isCompose:yn("compose"),isArrowLeft:yn("arrowLeft"),isArrowRight:yn("arrowRight"),isArrowUp:yn("arrowUp"),isArrowDown:yn("arrowDown"),isDeleteBackward:yn("deleteBackward"),isDeleteForward:yn("deleteForward"),isDeleteLineBackward:yn("deleteLineBackward"),isDeleteLineForward:yn("deleteLineForward"),isDeleteWordBackward:yn("deleteWordBackward"),isDeleteWordForward:yn("deleteWordForward"),isExtendBackward:yn("extendBackward"),isExtendForward:yn("extendForward"),isExtendLineBackward:yn("extendLineBackward"),isExtendLineForward:yn("extendLineForward"),isItalic:yn("italic"),isMoveLineBackward:yn("moveLineBackward"),isMoveLineForward:yn("moveLineForward"),isCtrlLeft:yn("ctrlLeft"),isCtrlRight:yn("ctrlRight"),isRedo:yn("redo"),isShiftEnter:yn("shiftEnter"),isEnter:yn("enter"),isTransposeCharacter:yn("transposeCharacter"),isUndo:yn("undo"),isSpace:yn("space"),isSelect:yn("select"),isTab:yn("tab"),isShiftTab:yn("shiftTab"),isBackspace:yn("backspace"),isCmdEnter:yn("cmdEnter"),isCmd:yn("cmd"),isEscape:yn("escape"),isKekceburek:yn("kekCeburek")},bn=(e,t)=>!!((e,t)=>{const{selection:n}=e;if(!n)return!1;const[r]=Array.from(m.nodes(e,{at:m.unhangRange(e,n),match:e=>!m.isEditor(e)&&_.isElement(e)&&e.type===t}));return r})(e,t),wn=(e,t,n="lowest")=>{var r;const o=Array.from(m.nodes(e,{match:t=>m.isEditor(e)&&_.isElement(t),at:t||(null===(r=e.selection)||void 0===r?void 0:r.anchor.path),mode:n}))[0];return o?o[0]:e.children[0]};function _n(e,t){var n,r;if(O.isText(e))return function(e){const t={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#039;"};return e.replace(/[&<>"']/g,(e=>t[e]))}(e.text);const o=e.children.map((e=>_n(e,t))).join(""),i=t[e.type];return"function"==typeof(null===(r=null===(n=i.exports)||void 0===n?void 0:n.html)||void 0===r?void 0:r.serialize)?i.exports.html.serialize(e,o):o}function xn(e,t){return e.map((e=>_n(e,t))).join("")}const On={hotkeys:mn,defaultNode:ct(Ze())},jn=({editor:n,placeholder:o,marks:a,readOnly:l,plugins:u,className:p,PLUGINS_MAP:h,tools:g})=>{i((()=>{const e=window.location.hash.length>0?window.location.hash.replace("#",""):null;if(e){const t=document.getElementById(e)||document.querySelector(`[data-element-id="${e}"]`);t&&window.scrollTo({top:t.offsetTop,behavior:"smooth"})}}),[]);const y=c(null),[{disableWhileDrag:x},{changeHoveredNode:O}]=ht(),E=x||l,k=s((()=>e=>{var r;const o=h[e.element.type];if(!o)return null;const i=function(e){return"function"==typeof e.renderer?e.renderer:e.renderer.editor}(o)(n,o);return t(pn,Object.assign({element:e.element,attributes:e.attributes,nodeType:e.element.nodeType,render:i,HTMLAttributes:null===(r=o.options)||void 0===r?void 0:r.HTMLAttributes},{children:e.children}))}),[u,n]),N=s((()=>e=>{const t=[],[r,o]=e;return u.forEach((o=>{const i=o.decorator;"function"==typeof i&&_.isElement(r)&&r.type===o.type&&t.push(...i(n)(e))})),n.selection&&!m.isEditor(r)&&""===m.string(n,[o[0]])&&j.includes(n.selection,o)&&j.isCollapsed(n.selection)&&t.push(Object.assign(Object.assign({},n.selection),{withPlaceholder:!0})),t}),[u,n]),S=s((()=>e=>{var r;const i=Object.assign({},e);let s;u.forEach((e=>{if(e.leaf){const t=e.leaf(n)(i);t&&(i.children=t)}})),null==a||a.forEach((e=>{i.leaf[e.type]&&(i.children=e.render(i))}));const l=null===(r=i.children.props)||void 0===r?void 0:r.parent;if(!function(e){var t,n;return 1!==(null===(t=null==e?void 0:e.children)||void 0===t?void 0:t.length)||0!==(null===(n=null==e?void 0:e.children[0])||void 0===n?void 0:n.text.length)}(l)){const e=h[null==l?void 0:l.type];s=null===(null==e?void 0:e.placeholder)?null:(null==e?void 0:e.placeholder)||o}return t(Xt,Object.assign({},i,{placeholder:s}))}),[u,n]),D=s((()=>{const e=u.map((e=>Object.keys(e.events||{}))).flat().filter(((e,t,n)=>n.indexOf(e)===t)),t={};return e.forEach((e=>{t[e]=function(t){u.forEach((r=>{var o;if(null===(o=r.events)||void 0===o?void 0:o[e]){r.events[e](n,On)(t)}}))}})),t}),[u,n]),P=d((e=>{m.withoutNormalizing(n,(()=>{var t;if(!n.selection)return;const r=ct(Ze());null==a||a.forEach((t=>{t.hotkey&&Bt(t.hotkey)(e)&&(e.preventDefault(),dt(n,t.type,!1))})),null===(t=D.onKeyDown)||void 0===t||t.call(D,e);const o=m.above(n,{match:e=>!m.isEditor(e),mode:"lowest"});if(mn.isEnter(e)){if(e.isDefaultPrevented())return;e.preventDefault();const t=Object.keys(m.marks(n)||{});t.length>0&&t.forEach((e=>m.removeMark(n,e)));const i=b.parent(n.selection.anchor.path),a=m.string(n,i),s=o&&o[0].type!==r.type;if(s&&0===a.length)return void w.setNodes(n,r,{at:i});if(m.isStart(n,n.selection.anchor,n.selection.anchor.path)&&s){const[e]=o;return w.setNodes(n,r,{at:i}),w.delete(n,{unit:"block"}),w.insertNodes(n,Ie(e),{at:b.next(i)}),void w.select(n,{path:[b.next(n.selection.anchor.path)[0]+1,0],offset:0})}return w.splitNodes(n,{always:!0}),w.setNodes(n,r),void O(r)}if(mn.isShiftEnter(e)){if(e.isDefaultPrevented())return;e.preventDefault(),n.insertText("\n")}if(mn.isSelect(e)){if(e.isDefaultPrevented())return;e.preventDefault();const t=m.above(n,{at:n.selection.anchor.path,match:e=>!m.isEditor(e)&&_.isElement(e)});if(!t)return;const r=m.string(n,t[1]);return j.isExpanded(n.selection)||0===r.length?void w.select(n,[]):void w.select(n,t[1])}}))}),[]),C=s((()=>{if(!g)return null;return Object.keys(g).length>0?Object.keys(g).map((e=>{const t=g[e];return r.isValidElement(g[e])?r.cloneElement(t,Object.assign({key:e,plugins:u},null==t?void 0:t.props)):null})):null}),[g]);return e("div",Object.assign({id:"yoopta-editor",className:p,ref:y,onMouseDown:e=>{l||(e.preventDefault(),e.currentTarget===e.target&&n.selection&&m.withoutNormalizing(n,(()=>{const e=[n.children.length-1,0],t=wn(n,e,"highest"),r=m.string(n,e),o={anchor:{path:e,offset:0},focus:{path:e,offset:0}};if("paragraph"===t.type&&0===r.length)return w.select(n,{path:o.anchor.path,offset:0}),O(t),f.focus(n);const i=ct(Ze());O(i),w.insertNodes(n,i,{at:[n.children.length],select:!0}),f.focus(n)})))}},{children:[C,t(v,Object.assign({id:"yoopta-contenteditable",renderLeaf:S,renderElement:k,readOnly:E,decorate:N,onCopy:e=>{if(e.preventDefault(),!n.selection)return;const t=xn(m.fragment(n,n.selection),n.plugins);return e.clipboardData.setData("text/html",t),e.clipboardData},autoFocus:!0,spellCheck:!0},D,{onKeyDown:P,onMouseDown:e=>{var t;null===(t=D.onMouseDown)||void 0===t||t.call(D,e),(e=>{e.stopPropagation(),e.nativeEvent.stopImmediatePropagation()})(e)}}))]}))};function En(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var kn=new WeakMap,Nn=new WeakMap;class Sn{}class Dn extends Sn{constructor(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super();var{offset:t,path:n}=e;this.offset=t,this.path=n}}class Pn extends Sn{constructor(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super();var{offset:t,path:n}=e;this.offset=t,this.path=n}}var Cn=e=>Nn.get(e);function An(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Tn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?An(Object(n),!0).forEach((function(t){En(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):An(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var Ln=new WeakSet,Bn=e=>{var t=[],n=e=>{if(null!=e){var r=t[t.length-1];if("string"==typeof e){var o={text:e};Ln.add(o),e=o}if(O.isText(e)){var i=e;O.isText(r)&&Ln.has(r)&&Ln.has(i)&&O.equals(r,i,{loose:!0})?r.text+=i.text:t.push(i)}else if(_.isElement(e))t.push(e);else{if(!(e instanceof Sn))throw new Error("Unexpected hyperscript child object: ".concat(e));var a=t[t.length-1];O.isText(a)||(n(""),a=t[t.length-1]),e instanceof Dn?((e,t)=>{var n=e.text.length;kn.set(e,[n,t])})(a,e):e instanceof Pn&&((e,t)=>{var n=e.text.length;Nn.set(e,[n,t])})(a,e)}}};for(var r of e.flat(1/0))n(r);return t};function Mn(e,t,n){return Tn(Tn({},t),{},{children:Bn(n)})}function Fn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Hn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Fn(Object(n),!0).forEach((function(t){En(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Fn(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var zn,In={anchor:function(e,t,n){return new Dn(t)},cursor:function(e,t,n){return[new Dn(t),new Pn(t)]},editor:(zn=k,(e,t,n)=>{var r,o=[];for(var i of n)j.isRange(i)?r=i:o.push(i);var a,s=Bn(o),l={},c=zn();for(var[d,u]of(Object.assign(c,t),c.children=s,E.texts(c))){var f=(a=d,kn.get(a)),p=Cn(d);if(null!=f){var[h]=f;l.anchor={path:u,offset:h}}if(null!=p){var[v]=p;l.focus={path:u,offset:v}}}if(l.anchor&&!l.focus)throw new Error("Slate hyperscript ranges must have both `<anchor />` and `<focus />` defined if one is defined, but you only defined `<anchor />`. For collapsed selections, use `<cursor />` instead.");if(!l.anchor&&l.focus)throw new Error("Slate hyperscript ranges must have both `<anchor />` and `<focus />` defined if one is defined, but you only defined `<focus />`. For collapsed selections, use `<cursor />` instead.");return null!=r?c.selection=r:j.isRange(l)&&(c.selection=l),c}),element:Mn,focus:function(e,t,n){return new Pn(t)},fragment:function(e,t,n){return Bn(n)},selection:function(e,t,n){var r=n.find((e=>e instanceof Dn)),o=n.find((e=>e instanceof Pn));if(!r||null==r.offset||null==r.path)throw new Error("The <selection> hyperscript tag must have an <anchor> tag as a child with `path` and `offset` attributes defined.");if(!o||null==o.offset||null==o.path)throw new Error("The <selection> hyperscript tag must have a <focus> tag as a child with `path` and `offset` attributes defined.");return Tn({anchor:{offset:r.offset,path:r.path},focus:{offset:o.offset,path:o.path}},t)},text:function(e,t,n){var r=Bn(n);if(r.length>1)throw new Error("The <text> hyperscript tag must only contain a single node's worth of children.");var[o]=r;if(null==o&&(o={text:""}),!O.isText(o))throw new Error("\n The <text> hyperscript tag can only contain text content as children.");return Ln.delete(o),Object.assign(o,t),o}},Rn=e=>function(t,n){for(var r=arguments.length,o=new Array(r>2?r-2:0),i=2;i<r;i++)o[i-2]=arguments[i];var a=e[t];if(!a)throw new Error("No hyperscript creator found for tag: <".concat(t,">"));return null==n&&(n={}),Ht(n)||(o=[n].concat(o),n={}),a(t,n,o=o.filter((e=>Boolean(e))).flat())},Wn=e=>{var t={},n=function(n){var r=e[n];if("object"!=typeof r)throw new Error("Properties specified for a hyperscript shorthand should be an object, but for the custom element <".concat(n,"> tag you passed: ").concat(r));t[n]=(e,t,n)=>Mn(0,Hn(Hn({},r),t),n)};for(var r in e)n(r);return t},Un=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{elements:t={}}=e,n=Wn(t),r=Hn(Hn(Hn({},In),n),e.creators);return Rn(r)}();const Vn={DEL:()=>({strikethrough:!0}),EM:()=>({italic:!0}),I:()=>({italic:!0}),S:()=>({strikethrough:!0}),STRONG:()=>({bold:!0}),U:()=>({underline:!0})},Zn=(e,t)=>{var n,r,o,i;if(3===e.nodeType)return e.textContent;if(1!==e.nodeType)return null;if("BR"===e.nodeName)return"\n";const{nodeName:a}=e;let s=e,l=Array.from(s.childNodes).map((e=>Zn(e,t))).flat();if(0===l.length&&(l=[{text:""}]),"BODY"===e.nodeName)return Un("fragment",{},l);if(t[a]){const s=t[a];if(s){let t=s.defineElement();if("function"==typeof(null===(r=null===(n=s.exports)||void 0===n?void 0:n.html.deserialize)||void 0===r?void 0:r.parse)){const n=null===(i=null===(o=s.exports)||void 0===o?void 0:o.html.deserialize)||void 0===i?void 0:i.parse(e);t=Object.assign(Object.assign({},t),{data:n})}return Un("element",t,l)}}if(O.isTextList(l))return Un("element",t.P.defineElement(),l);if(Vn[a]){const t=Vn[a](e);return l.map((e=>O.isText(e)?Un("text",t,e):e))}return l};function $n(e,t){const n=function(e){const t={};return Object.keys(e).forEach((n=>{var r,o,i,a,s,l,c,d;const u=e[n];if(null===(o=null===(r=u.exports)||void 0===r?void 0:r.html.deserialize)||void 0===o?void 0:o.nodeName){if(Array.isArray(null===(a=null===(i=u.exports)||void 0===i?void 0:i.html.deserialize)||void 0===a?void 0:a.nodeName))return void(null===(l=null===(s=u.exports)||void 0===s?void 0:s.html.deserialize)||void 0===l||l.nodeName.forEach((e=>{t[e]=u})));t[null===(d=null===(c=u.exports)||void 0===c?void 0:c.html.deserialize)||void 0===d?void 0:d.nodeName]=u}})),t}(t),r=(new DOMParser).parseFromString(e,"text/html");return Zn(r.body,n)}const qn=r.createContext({marks:{},elements:{},tools:{}}),Kn=({children:e,plugins:n,marks:r,tools:o})=>{const i=p(),a=s((()=>{const e=me(n),t={};return e.forEach((e=>{const{createElement:n,defineElement:r,type:o,hasParent:a}=e;a||(t[e.type]={create:n,define:r,toggle:t=>((e,t)=>{m.withoutNormalizing(i,(()=>{var n;if(!i.selection)return;const{offset:r,path:o}=i.selection.anchor,{shouldDeleteText:a}=t||{};a&&w.delete(i,{at:{anchor:{path:o,offset:0},focus:{path:o,offset:r}}});const s=m.above(i,{at:i.selection,mode:"highest",match:e=>!m.isEditor(e)&&_.isElement(e)}),[l,c]=m.parent(i,b.parent(i.selection.anchor.path)),[d]=s||[];(null==d?void 0:d.type)!==e.type?(_.isElement(l)&&!m.isEditor(l)&&w.unwrapNodes(i,{at:c,match:e=>!m.isEditor(e)&&!O.isText(e)&&_.isElement(l)&&e.type===l.type}),null===(n=e.createElement)||void 0===n||n.call(e,i)):w.setNodes(i,ct(Ze()),{mode:"highest",match:e=>!m.isEditor(e)&&_.isElement(e)})}))})(e,t),type:o})})),t}),[n,i.selection]),l=e=>{const t=m.marks(i);return!!(null==t?void 0:t[e])},c=s((()=>{const e={};return null==r||r.forEach((t=>{e[t.type]={toggle:e=>((e,t=!1)=>{t&&Object.keys(m.marks(i)||{}).forEach((e=>{m.removeMark(i,e)})),l(e)?m.removeMark(i,e):m.addMark(i,e,!0)})(t.type,null==e?void 0:e.only),isActive:l(t.type)}})),e}),[r,i.selection]),d=s((()=>o),[o]),u=s((()=>({elements:a,marks:c,tools:d})),[i.selection,c,a]);return t(qn.Provider,Object.assign({value:u},{children:e}))},Gn=()=>a(qn),Jn=()=>a(qn).marks,Xn=()=>a(qn).elements,Qn=()=>a(qn).tools,Yn=({key:e,value:n,plugins:r,marks:a,readOnly:l,onChange:c,placeholder:u,autoFocus:p=!0,offline:h,className:v,tools:N})=>{const S=function(e){return"string"==typeof e?e:Kt}(h),[D,P]=o((()=>function(e,t,n){const r=[{id:Ze(),type:"paragraph",children:[{text:""}]}],o=qt(n)?n:r;if(!t)return localStorage.removeItem(e),o;try{const t=JSON.parse(localStorage.getItem(e)||"[]");return qt(t)?t:o}catch(t){return localStorage.removeItem(e),r}}(S,h,n))),C=d((e=>{if(c(e),P(e),!h)return;if(B.operations.some((e=>"set_selection"!==e.type)))try{const t=JSON.stringify(e);localStorage.setItem(S,t)}catch(e){}}),[h]),A=s((()=>{const e=me(r),t=function(e){const t={};return e.forEach((e=>t[e.type]=e)),t}(e);return{yooptaPlugins:e,PLUGINS_MAP:t}}),[r]),{yooptaPlugins:T,PLUGINS_MAP:L}=A,B=s((()=>{let e=(e=>{const{insertData:t}=e;return e.insertData=n=>{if(e.selection&&j.isExpanded(e.selection))return;const r=n.getData("text/html");if(r){const t=$n(r,e.plugins);w.insertFragment(e,t)}else t(n)},e})((e=>{const{deleteFragment:t}=e;return e.deleteFragment=()=>{const{selection:n}=e;if(!n)return;const[,r]=m.first(e,[0]),[,o]=m.last(e,[e.children.length-1]),i=m.range(e,r,o),a=j.equals(n,i);if(console.log({isAllNodesSelected:a,fullRange:i}),a)return w.removeNodes(e,{mode:"highest",hanging:!0}),void w.select(e,[0]);t()},e})((e=>{const{normalizeNode:t}=e;return e.normalizeNode=n=>{const[r]=n;if(m.isEditor(r)&&0===e.children.length){const t=ct(Ze());w.insertNodes(e,t,{at:[0]})}else t(n)},e})((e=>{const{insertBreak:t,deleteBackward:n}=e;return e.insertBreak=()=>{if(!e.selection||!j.isCollapsed(e.selection))return t();const n=b.parent(e.selection.anchor.path),r=E.get(e,n);_.isElement(r)&&m.isVoid(e,r)?m.insertNode(e,{id:Ze(),type:"paragraph",children:[{text:""}],nodeType:"block"}):t()},e.deleteBackward=t=>{if(!e.selection||!j.isCollapsed(e.selection)||0!==e.selection.anchor.offset)return n(t);const r=b.parent(e.selection.anchor.path),o=E.get(e,r);if(0===E.string(o).length&&b.hasPrevious(r)){const t=b.previous(r),n=E.get(e,t);if(_.isElement(n)&&m.isVoid(e,n))return w.removeNodes(e),w.select(e,t)}n(t)},e})((e=>{var t=e,{apply:n}=t;return t.history={undos:[],redos:[]},t.redo=()=>{var{history:e}=t,{redos:n}=e;if(n.length>0){var r=n[n.length-1];Wt.withoutSaving(t,(()=>{m.withoutNormalizing(t,(()=>{for(var e of r)t.apply(e)}))})),e.redos.pop(),e.undos.push(r)}},t.undo=()=>{var{history:e}=t,{undos:n}=e;if(n.length>0){var r=n[n.length-1];Wt.withoutSaving(t,(()=>{m.withoutNormalizing(t,(()=>{var e=r.map(x.inverse).reverse();for(var n of e)t.apply(n)}))})),e.redos.push(r),e.undos.pop()}},t.apply=e=>{var{operations:r,history:o}=t,{undos:i}=o,a=i[i.length-1],s=a&&a[a.length-1],l=Zt(e,s),c=Wt.isSaving(t),d=Wt.isMerging(t);if(null==c&&(c=Vt(e)),c){if(null==d&&(d=null!=a&&(0!==r.length||Ut(e,s)||l)),a&&d)l&&a.pop(),a.push(e);else{var u=[e];i.push(u)}for(;i.length>100;)i.shift();$t(e)&&(o.redos=[])}n(e)},t})((e=>{const{insertText:t}=e;return e.insertText=n=>{var r,o;const{selection:i}=e;if(" "===n&&i&&j.isCollapsed(i)){const{anchor:a}=i,s=m.above(e,{match:t=>_.isElement(t)&&m.isBlock(e,t),mode:"lowest"});if(!s)return;const[,l]=s,c=m.parent(e,l),[d]=c;if(_.isElement(d)&&!O.isText(d.children[0]))return t(n);const u=s?l:[],f={anchor:a,focus:m.start(e,u)},p=m.string(e,f),h=null===(r=e.shortcuts)||void 0===r?void 0:r[p];if(h)return w.select(e,f),w.delete(e),void(null===(o=h.createElement)||void 0===o||o.call(h,e))}t(n)},e})(g(k())))))));e.plugins=L;const t={};return T.forEach((n=>{var r;n.shortcut&&(Array.isArray(n.shortcut)?n.shortcut.forEach((e=>t[e]=n)):t[n.shortcut]=n),e=(null===(r=n.extendEditor)||void 0===r?void 0:r.call(n,e))||e})),e.shortcuts=t,e}),[T]);return i((()=>{if(p)try{const[,e]=m.first(B,[0]);w.select(B,{anchor:{path:e,offset:0},focus:{path:e,offset:0}}),f.focus(B)}catch(e){}}),[p,B]),t(y,Object.assign({editor:B,value:D,onChange:C},{children:t(Kn,Object.assign({plugins:r,marks:a,tools:N},{children:t(pt,{children:t(jn,{editor:B,readOnly:l,placeholder:u,plugins:T,tools:N,marks:a,PLUGINS_MAP:L,className:v})})}))}),e)},er=e=>t(Mt,{children:t(Yn,Object.assign({},e,{value:e.value,onChange:e.onChange}))});function tr({type:e,hotkey:n,className:r}){return{type:e,hotkey:n,render:e=>t("span",Object.assign({},e.attributes,{className:r},{children:e.children}))}}function nr(e){const{element:t,HTMLAttributes:n,className:r}=e;return`yoopta-${t.type} ${(null==n?void 0:n.className)||""} ${r}`}const rr={ElementOptions:_t,Overlay:Se};export{mn as HOTKEYS,rr as UI_HELPERS,ge as YooptaPlugin,tr as createYooptaMark,ye as createYooptaPlugin,_e as cx,Ie as deepClone,er as default,Ze as generateId,wn as getElementByPath,nr as getElementClassname,Lt as isCodeHotkey,bn as isElementActive,Tt as isHotkey,Bt as isKeyHotkey,qt as isValidYooptaNodes,me as mergePlugins,ht as useElementSettings,Xn as useElements,Jn as useMarks,Qn as useTools,Gn as useYoopta};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yoopta/editor",
3
- "version": "1.9.8-rc",
3
+ "version": "1.9.9-rc",
4
4
  "license": "MIT",
5
5
  "private": false,
6
6
  "type": "module",
@@ -71,4 +71,4 @@
71
71
  "url": "https://github.com/Darginec05/Yoopta-Editor/issues"
72
72
  },
73
73
  "homepage": "https://github.com/Darginec05/Yoopta-Editor#readme"
74
- }
74
+ }