@layers-app/editor 0.0.17-editor-01 → 0.0.17-editor-02
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.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{layers.DRxNz4Ly.js → layers.8IsVFZzu.js} +1 -1
- package/dist/{layers.DeX-qf2u.js → layers.BNEO_yBt.js} +2 -2
- package/dist/{layers.EkoxhhD-.js → layers.CXZ1fGx2.js} +1 -1
- package/dist/{layers.BLE7UHt8.js → layers.Ck8c0KB8.js} +3 -3
- package/dist/{layers.Cg-0Gy21.js → layers.DeVO3cbn.js} +1 -1
- package/dist/{layers.Cv0RBArs.js → layers.mZsUCWha.js} +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),s=require("react"),D=require("react-i18next"),t=require("./layers.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),s=require("react"),D=require("react-i18next"),t=require("./layers.BNEO_yBt.js"),E=require("@mantine/core"),U=require("@tabler/icons-react"),F=i=>{const{width:g,height:r,isLoading:l,isError:u,src:f,id:m,altText:p,imageRef:j,maxWidth:v}=i;return n.jsxs("div",{className:"media-wrapper",style:{width:g,height:r,display:"inline-flex",position:"relative"},children:[n.jsx(E.LoadingOverlay,{visible:l,zIndex:1e3,overlayProps:{backgroundOpacity:.5},loaderProps:{size:24,color:"black"}}),n.jsx(E.LoadingOverlay,{visible:u,zIndex:1e3,overlayProps:{backgroundOpacity:.5},loaderProps:{children:n.jsx(E.Flex,{bg:"white",maw:300,justify:"center",children:n.jsx(E.Alert,{variant:"light",color:"red",title:"Ошибка загрузки",icon:n.jsx(U.IconInfoCircle,{}),children:"Попробуйте загрузить заново."})})}}),n.jsx(B,{className:null,src:f,altText:p,imageRef:j,width:"inherit",height:"inherit",maxWidth:v||"auto",id:m})]})};function B({altText:i,className:g,imageRef:r,src:l,width:u,height:f,maxWidth:m,id:p}){return n.jsx("img",{className:g||void 0,src:l,alt:i,ref:r,style:{height:f,maxWidth:m,width:u},draggable:"false","data-id":p})}function G({src:i,altText:g,nodeKey:r,width:l,height:u,maxWidth:f,showCaption:m,caption:p,id:j,create:v,alignment:H}){const W=s.useRef(null),[P,S]=s.useState(!0),[R,M]=s.useState(!1),{isCollabActive:O}=t.l(),[h]=t.u(),[x,b]=s.useState(!0),[d,w]=s.useState({width:0,height:0}),{fetchUploadImage:z,fetchDeleteImage:L}=s.useContext(t.Context),{t:y}=D.useTranslation();s.useEffect(()=>{if(!i||i.startsWith("data:image/")){S(!1);return}const e=new Image;e.src=i,e.onload=()=>S(!1),e.onerror=()=>{S(!1),M(!0)}},[i]);const T=(e,a)=>{h.update(()=>{t.Ft(null);const c=t.Ct(r);t.$isImageNode(c)&&c.setWidthAndHeight(e,a)})},{historyState:k}=t.useSharedHistoryContext(),{settings:{showNestedEditorTreeView:q}}=t.useSettings(),[C,I]=s.useState(!1);function $(e){return e.endsWith(".svg")||e.includes("image/svg+xml")}function _(e){return new Promise((a,c)=>{if($(e)){a(0);return}const o=new Image;o.src=e,o.onload=()=>{a(o.width)},o.onerror=()=>{c(new Error("Failed to load image"))}})}return s.useEffect(()=>{v&&I(!0)},[v]),s.useEffect(()=>{let e=l,a=u,c=100;i&&_(i).then(o=>{typeof e=="number"&&e<c&&o<c?(b(!0),w({width:e,height:a})):o<c?(b(!0),w({width:"auto",height:"auto"})):(w({width:o,height:o}),b(!1))})},[i]),s.useEffect(()=>{d.width&&d.height&&x&&h.update(()=>{const e=t.Ct(r);t.$isImageNode(e)&&e.setWidthAndHeight(d.width,d.height)})},[d.width,d.height,x]),s.useEffect(()=>{const e=document.documentElement;t.toggleLockScroll(C,e)},[C]),i?x?n.jsx(F,{width:d.width,height:d.height,isLoading:P,isError:R,isIcon:x,src:i,id:j,editor:h,nodeKey:r,fetchDeleteImage:L,altText:g,imageRef:W,maxWidth:f,showCaption:m,caption:p,isCollabActive:O,historyState:k,showNestedEditorTreeView:q,t:y}):n.jsx(t.ResizableContainer,{editor:h,isIcon:x,width:typeof l=="string"&&l.includes("%")?parseFloat(l):l,height:typeof u=="string"&&u.includes("%")?parseFloat(u):l,initialWidth:d.width||"",initialHeight:d.height||"",onResizeEnd:T,alignment:H,children:n.jsx(F,{width:"inherit",height:"inherit",isLoading:P,isError:R,isIcon:x,src:i,id:j,editor:h,nodeKey:r,fetchDeleteImage:L,altText:g,imageRef:W,maxWidth:f,showCaption:m,caption:p,isCollabActive:O,historyState:k,showNestedEditorTreeView:q,t:y})}):n.jsx(t.ImagePicker,{uploading:!1,onUpload:e=>{!z||!e.length||(e.forEach((a,c)=>{z(a,(o,A)=>{c===0?h.update(()=>{const N=t.Ct(r);t.$isImageNode(N)&&(N.setSrc(o),N.setId(A))}):h.dispatchCommand(t.INSERT_IMAGE_COMMAND,{altText:"",src:o,id:A})})}),I(!1))},popoverProps:{opened:C,position:"bottom",onChange:I},onChange:e=>{I(!1),h.update(()=>{const a=t.Ct(r);t.$isImageNode(a)&&a.setSrc(e)})},children:n.jsx(t.EmptyNodeButton,{title:y("editor.image.add_photo"),icon:"photo",onClick:()=>I(!C)})})}exports.default=G;
|
|
@@ -12007,7 +12007,7 @@ class DS extends rC {
|
|
|
12007
12007
|
this.shouldConnect = !0, !this.wsconnected && this.ws === null && (TS(this), this.connectBc());
|
|
12008
12008
|
}
|
|
12009
12009
|
}
|
|
12010
|
-
const xD = "0.0.17-editor-
|
|
12010
|
+
const xD = "0.0.17-editor-02", ED = {
|
|
12011
12011
|
version: xD
|
|
12012
12012
|
}, TD = ({ children: n }) => /* @__PURE__ */ m("div", { className: "doc-space-styles-provider", children: n }), DD = /* @__PURE__ */ JSON.parse(`{"placeholder":"Write something, or press '/' for commands...","heading":{"h1":"Heading 1","h2":"Heading 2","h3":"Heading 3","name":"Heading"},"close":"Close","menu":{"heading":{"title":"Headings","hintShowCase":"Your Ideas, Documents, and Plans. United. Welcome to {{projectName}} — this is a connected workspace where work becomes better and faster.","h1":{"subtitle":"Large Heading","hintDescription":"H1 is used to create the main heading of a page or section, which sets the overall theme. It is also used to automatically generate the table of contents for a document.","keywords":{"header1":"header1","headerOne":"headerone","h1":"h1"}},"h2":{"subtitle":"Medium Heading","hintDescription":"H2 is used to create a secondary heading of a page or section, which sets a general theme. It is also used to automatically generate the table of contents for a document.","keywords":{"header2":"header2","headerTwo":"headertwo","h2":"h2"}},"h3":{"subtitle":"Small Heading","hintDescription":"H3 is used to create a subheading of a page or section, which sets a general theme. It is also used to automatically generate the table of contents for a document.","keywords":{"header3":"header3","headerThree":"headerthree","h3":"h3"}}},"lists":{"title":"Lists","numberList":{"name":"Numbered List","subtitle":"A simple numbered list","hint":{"firstItem":"First item","secondItem":"Second item","firstSubItem":"First sub-item","secondSubItem":"Second sub-item","firstSubSubItem":"First sub-sub-item","secondSubSubItem":"Second sub-sub-item","description":"This tool creates a list with items that are automatically numbered when new rows are added."}},"bulletList":{"name":"Bulleted List","subtitle":"Automatically marked list","hint":{"firstItem":"First item","secondItem":"Second item","firstSubItem":"First sub-item","secondSubItem":"Second sub-item","firstSubSubItem":"First sub-sub-item","secondSubSubItem":"Second sub-sub-item","description":"This tool creates a list with items that are automatically marked with bullets when new rows are added."}},"checkList":{"name":"Checklist","subtitle":"Easy task management","hint":{"indeterminate":"Indeterminate","unchecked":"Unchecked","checked":"Checked","description":"Creates a task list with the ability to mark completed items and sub-items."}}},"main":{"title":"Basics","paragraph":{"name":"Paragraph","subtitle":"Simply start typing regular text","hint":{"text":"Your Ideas, Documents, and Plans. United. Welcome to {{projectName}} — this is a connected workspace where work becomes better and faster.","description":"A few lines of text, left-aligned, imitating a text block."}},"quote":{"name":"Quote","subtitle":"Write down a quote","hint":{"text":"/quote Your Ideas, Documents, and Plans. United. Welcome to {{projectName}} — this is a connected workspace where work becomes better and faster. Stay focused, stay aligned, and achieve more with Layers.","description":"Used to insert quotes or highlight important text blocks. It is visually separated from the main text."}},"collapse":{"name":"Collapsible","subtitle":"Hide block content","hint":{"firstItemEmpty":"First item is empty","secondItem":"Second item","firstSubItemEmpty":"First sub-item is empty","secondSubItem":"Second sub-item","firstSubSubItemEmpty":"First sub-sub-item is empty","secondSubSubItem":"Second sub-sub-item","description":"Used to create blocks with content that can be hidden or shown when clicked. Almost any other block can be placed inside such a list."}},"horizontal-rule":{"name":"Divider","subtitle":"Visualizes block dividers","hint":{"topText":"Pressed the slash. Then entered something...","bottomText":"The next day, everything became clearer and more understandable. As if what was unknown yesterday became completely familiar and ordinary today. Take, for example...","description":"Used to visually separate sections or blocks of text on a page."}},"table":{"name":"Table","subtitle":"Add a simple table to your page","hint":{"firstRow":"First cell filled with text","secondRow":"And another cell with text","description":"A tool for creating tables with multiple rows and columns to organize data."}},"grid":{"name":"Grid","subtitle":"Up to 4 columns of blocks","hint":{"firstColumn":"The next day, everything became clearer and more understandable. As if what was unknown yesterday became completely familiar and ordinary today. Take, for example...","secondColumn":"Your Ideas, Documents, and Plans. United. Welcome to {{projectName}} — this is a connected workspace where work becomes better and faster.","description":"A tool for dividing a document into multiple columns, into which any blocks can be placed."}},"code":{"name":"Code","subtitle":"Write a code snippet","copy":"Copy code","exitCommandText":"Shift + Enter to exit code block","collapsible":{"hidden":"Collapse code","expand":"Expand code"},"hint":{"description":"A tool for inserting code snippets with syntax highlighting."}},"callout":{"name":"Callout","subtitle":"Make writing stand out","hint":{"description":"-."}}},"callout":{"title":"Callout","default":{"name":"Default","hint":{"description":"A few lines of text aligned to the left, simulating a text block.","body":"/callout Your Ideas, Documents, and Plans. Unified. Welcome to {{projectName}} — a connected workspace where work gets better and faster. Your Ideas and Plans. Unified. Welcome to {{projectName}} — a connected workspace where work gets better and faster. Your Ideas, Documents, and Plans. Unified. Welcome to {{projectName}} — a connected workspace where work gets better and faster."},"keywords":{"callout":"callout","type":"default"},"subtitle":"Default callout"},"success":{"name":"Success","subtitle":"Successful notification","keywords":{"callout":"callout","type":"success"}},"warning":{"name":"Warning","hint":{"description":"A few lines of text aligned to the left, simulating a text block."},"keywords":{"callout":"callout","type":"warning"},"subtitle":"Important notification"},"alert":{"name":"Alert","hint":{"description":"A few lines of text aligned to the left, simulating a text block."},"keywords":{"callout":"callout","type":"alert"},"subtitle":"Critical notification"}},"media":{"title":"Media","photo":{"name":"Image","hint":{"description":"A tool for adding an image to a page."},"subtitle":"Upload and place via link"},"form":{"name":"Form","subtitle":"Add a form"},"video":{"name":"Video","hint":{"description":"A tool for embedding video on a page."},"subtitle":"Add a video via link"}},"other":{"title":"Other","documents":{"empty":"You have no nested documents","name":"Nested Documents","subtitle":"Displays a list of nested documents"},"emoji":{"name":"Emoji","subtitle":"Add emoji"}},"integrations":{"title":"Integrations"}},"toolbar":{"turnInto":"Turn into","bold":"Bold","italic":"Italic","underline":"Underline","strike":"Strikethrough","superscript":"Superscript","subscript":"Subscript","align":"Alignment","left":"Align Left","center":"Align Center","right":"Align Right","justify":"Justify","indent":"Indent","outdent":"Outdent","color":"Color","code":"Code","link":"Add Link","clear":"Clear Formatting","comment":"Comment"},"contextMenu":{"copy":"Copy","cut":"Cut","paste":"Paste","delete":"Delete","add":"Add","selectAll":"Select All","duplicate":"Duplicate","appearance":"Appearance"},"colors":{"lastTimeUsed":"Last Used","color":"Color","background":"Background","theme":"Theme","colors":{"standard":"Standard","gray":"Gray","brown":"Brown","orange":"Orange","yellow":"Yellow","green":"Green","blue":"Blue","purple":"Purple","pink":"Pink","red":"Red"},"callout":{"success":"Success","alert":"Alert","warning":"Warning"}},"video":{"insert":"Embed","worksWith":"Works with","add_video":"Add Video"},"swagger":{"insert":"Swagger","worksWith":"Works with","add":"Add Swagger"},"image":{"add_photo":"Add Image","preview":"Preview"},"fille":{"add_file":"Add File"},"mention":{"mark":"Mark someone"},"validation":{"link":"Invalid Link"},"table":{"background_one":"Cell Background Color","background_other":"Cells background color","settings":"Settings","menu":{"addColAfter":"Add Column Right","addColBefore":"Add Column Left","addRowAbove":"Add Row Above","addRowBelow":"Add Row Below","deleteCol":"Delete Column","deleteRow":"Delete Row","mergeCells":"Merge Cells","disconnectCells":"Disconnect Cells","splitCell":"Split Cell","deleteTable":"Delete Table","insertRow_one":"Insert row","insertRow_other":"Insert {{count}} rows","deleteRow_one":"Delete row","deleteRow_other":"Delete {{count}} rows","insertCol_one":"Insert column","insertCol_other":"Insert {{count}} columns","deleteCol_one":"Delete column","deleteCol_other":"Delete {{count}} columns","headTable_col":"{{value}} row column","headTable_row":"{{value}} row header","below":"Below","above":"Above","left":"Left","right":"Right","row":"Row","rows":"Rows","column":"Column","columns":"Columns"}},"column":{"name":"Insert Grid","insert":"Insert","columns":"Columns","addRight":"Add a column to the right","addLeft":"Add a column to the left","moveLeft":"Move a column to the left","changeColor":"Change the column color","moveRight":"Move a column to the right","deleteColumn":"Delete a column"},"hoverOptions":{"addNewBlockBelow":"Add block below","addNewBlockAbove":"Add block above","drag":"Drag","click":"Click","clickAction":"To open the menu","dragAction":"To move"},"embed":{"placeholder":"Enter a valid embed URL","insert":"Embed","addEmbed":"Add Embed"},"content":"Content","emoji":{"emojis":"Emoji","icons":"Icons","search":"Search","searchResults":"Search result","searchNoResults":"Emoji not found","remove":"Remove","emojiCategory":{"frequent":"Frequently used","people":"Emotions and people","nature":"Animals and nature","foods":"Food and drinks","activity":"Activities","places":"Travel and Places","objects":"Items","symbols":"Symbols","flags":"Flags"}},"form":{"url":"Enter a valid URL."},"noTitle":"No title","gallery":{"download":"Download","close":"Close","errorFile":"Failed to download file"},"emptyPageOptions":{"heading":"A Heading that will automatically generate an interactive table of contents","grid":"The grid will help structure the page horizontally","list":"Numbered list, for easy outlining of the meeting","code":"Code block with syntax support","callout":"Callout for highlighting","table":"Table, to find dependencies in the data","integrations":"Many integrations from third-party services"},"comments":{"title":"Comments","filter":{"resolved":"Resolved","selectUsers":"Filter by users","searchPlaceholder":"Search users"},"generalComment":"Add general comment","inputEditor":{"uploadFiles":"Upload files","sendMessage":"Send message","editMessage":"Edit message"},"notifications":{"title":"Notify me about:","description":"You will always be notified about mentions","options":{"all":"All comments","replies":"Replies"}},"actionTooltips":{"resolve":"Resolve","reopen":"Re-open","addReaction":"Add reaction","reactionLimit":"You’ve reached the reaction limit","reply":"Reply"},"menuActions":{"edit":"Edit","delete":"Delete"},"deleteModal":{"title":{"thread":"Delete Thread","general":"Delete General Discussion","comment":"Delete Reply"},"description":{"thread":"Are you sure you want to delete this thread and all its replies?","general":"Are you sure you want to delete this general discussion and all its replies?","comment":"Are you sure you want to delete this reply?"},"actions":{"cancel":"Cancel","delete":"Delete"}},"repliesToggle":{"show_one":"Show {{count}} more comment","show_other":"Show {{count}} more comments","hide":"Hide replies"},"emptyState":{"commonTitle":"No open comments","resolveTitle":"No resolved comments"}}}`), ND = {
|
|
12013
12013
|
editor: DD
|
|
@@ -23915,7 +23915,7 @@ class Ml extends so {
|
|
|
23915
23915
|
function Vg(n) {
|
|
23916
23916
|
return new Ml(n);
|
|
23917
23917
|
}
|
|
23918
|
-
const VO = Tb(() => import("./layers.
|
|
23918
|
+
const VO = Tb(() => import("./layers.8IsVFZzu.js"));
|
|
23919
23919
|
function GO(n) {
|
|
23920
23920
|
const e = n;
|
|
23921
23921
|
if (e.src.startsWith("file:///"))
|
|
@@ -24111,7 +24111,7 @@ function _u({
|
|
|
24111
24111
|
function Ev(n) {
|
|
24112
24112
|
return n instanceof ar;
|
|
24113
24113
|
}
|
|
24114
|
-
const ZO = Tb(() => import("./layers.
|
|
24114
|
+
const ZO = Tb(() => import("./layers.mZsUCWha.js"));
|
|
24115
24115
|
function JO(n) {
|
|
24116
24116
|
if (n instanceof HTMLImageElement) {
|
|
24117
24117
|
const { alt: e, src: t, width: r, height: i } = n;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),r=require("react"),t=require("./layers.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),r=require("react"),t=require("./layers.BNEO_yBt.js"),M=require("@mantine/core");function P(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var F=P(function(e){const l=new URLSearchParams;l.append("code",e);for(let a=1;a<arguments.length;a++)l.append("v",arguments[a]);throw Error(`Minified Lexical error #${e}; visit https://lexical.dev/docs/error?${l} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});function R(e){const l=e.transform();return l!==null?new Set([l]):new Set}function K({initialEditor:e,children:l,initialNodes:a,initialTheme:d,skipCollabChecks:i}){const c=r.useRef(!1),o=r.useContext(t.l$1);o==null&&F(9);const[g,{getTheme:S}]=o,_=r.useMemo(()=>{const m=d||S()||void 0,h=t.o(o,m);if(m!==void 0&&(e._config.theme=m),e._parentEditor=g,a)for(let s of a){let w=null,x=null;if(typeof s!="function"){const C=s;s=C.replace,w=C.with,x=C.withKlass||null}const E=e._nodes.get(s.getType());e._nodes.set(s.getType(),{exportDOM:E?E.exportDOM:void 0,klass:s,replace:w,replaceWithKlass:x,transforms:R(s)})}else{const s=e._nodes=new Map(g._nodes);for(const[w,x]of s)e._nodes.set(w,{exportDOM:x.exportDOM,klass:x.klass,replace:x.replace,replaceWithKlass:x.replaceWithKlass,transforms:R(x.klass)})}return e._config.namespace=g._config.namespace,e._editable=g._editable,[e,h]},[]),{isCollabActive:b,yjsDocMap:v}=t.l(),f=i||c.current||v.has(e.getKey());return r.useEffect(()=>{f&&(c.current=!0)},[f]),r.useEffect(()=>g.registerEditableListener(m=>{e.setEditable(m)}),[e,g]),n.jsx(t.l$1.Provider,{value:_,children:!b||f?l:null})}function L({"data-test-id":e,children:l,className:a,onClick:d,disabled:i,small:c,title:o}){return n.jsx(M.Button,{onClick:d,disabled:i,variant:"filled",children:l})}function O({children:e,className:l}){return n.jsx("div",{className:l||"Placeholder__root",children:e})}function $({children:e,label:l,className:a,...d}){return n.jsxs("div",{className:"Input__wrapper",children:[n.jsx("label",{style:{marginTop:"-1em"},className:"Input__label",children:l}),n.jsx("select",{...d,className:a||"select",children:e})]})}function B({label:e,value:l,onChange:a,placeholder:d="","data-test-id":i,type:c="text"}){return n.jsx(M.TextInput,{type:c,placeholder:d,value:l,onChange:o=>{a(o.target.value)},label:e,"data-test-id":i,mb:10})}const y=new Set;function U(e){if(!y.has(e))throw new Promise(l=>{const a=new Image;a.src=e,a.onload=()=>{y.add(e),l(null)}})}function q({altText:e,className:l,imageRef:a,src:d,width:i,height:c,position:o}){return U(d),n.jsx("img",{className:l||void 0,src:d,alt:e,ref:a,"data-position":o,style:{display:"block",height:c,width:i},draggable:"false"})}function T({activeEditor:e,nodeKey:l,onClose:a}){const i=e.getEditorState().read(()=>t.Ct(l)),[c,o]=r.useState(i.getAltText()),[g,S]=r.useState(i.getShowCaption()),[_,b]=r.useState(i.getPosition()),v=h=>{S(h.target.checked)},f=h=>{b(h.target.value)},m=()=>{const h={altText:c,position:_,showCaption:g};i&&e.update(()=>{i.update(h)}),a()};return n.jsxs(n.Fragment,{children:[n.jsx("div",{style:{marginBottom:"1em"},children:n.jsx(B,{label:"Alt-текст",placeholder:"Альтернативный текст",onChange:o,value:c,"data-test-id":"image-modal-alt-text-input"})}),n.jsxs($,{style:{marginBottom:"1em",width:"208px"},value:_,label:"Position",name:"position",id:"position-select",onChange:f,children:[n.jsx("option",{value:"left",children:"Left"}),n.jsx("option",{value:"right",children:"Right"}),n.jsx("option",{value:"full",children:"Full Width"})]}),n.jsxs("div",{className:"Input__wrapper",children:[n.jsx("input",{id:"caption",type:"checkbox",checked:g,onChange:v}),n.jsx("label",{htmlFor:"caption",children:"Show Caption"})]}),n.jsx(L,{"data-test-id":"image-modal-file-upload-btn",onClick:()=>m(),children:"Применить"})]})}function A({src:e,altText:l,nodeKey:a,width:d,height:i,showCaption:c,caption:o,position:g}){const[S,_]=t.useModal(),b=r.useRef(null),v=r.useRef(null),[f,m,h]=t.u$1(a),[s]=t.u(),[w,x]=r.useState(null),E=r.useRef(null),C=r.useCallback(p=>{if(f&&t.wi(t.Ri())){p.preventDefault();const u=t.Ct(a);t.$isInlineImageNode(u)&&u.remove()}return!1},[f,a]),k=r.useCallback(p=>{const j=t.Ri(),u=v.current;if(f&&t.wi(j)&&j.getNodes().length===1){if(c)return t.Ft(null),p.preventDefault(),o.focus(),!0;if(u!==null&&u!==document.activeElement)return p.preventDefault(),u.focus(),!0}return!1},[o,f,c]),N=r.useCallback(p=>E.current===o||v.current===p.target?(t.Ft(null),s.update(()=>{m(!0);const j=s.getRootElement();j!==null&&j.focus()}),!0):!1,[o,s,m]);r.useEffect(()=>{let p=!0;const j=t.N(s.registerUpdateListener(({editorState:u})=>{p&&x(u.read(()=>t.Ri()))}),s.registerCommand(t.t,(u,I)=>(E.current=I,!1),t.Ks),s.registerCommand(t.r,u=>{const I=u;return I.target===b.current?(I.shiftKey?m(!f):(h(),m(!0)),!0):!1},t.Ks),s.registerCommand(t.D,u=>u.target===b.current?(u.preventDefault(),!0):!1,t.Ks),s.registerCommand(t.w,C,t.Ks),s.registerCommand(t.k,C,t.Ks),s.registerCommand(t.C,k,t.Ks),s.registerCommand(t.b,N,t.Ks));return()=>{p=!1,j()}},[h,s,f,a,C,k,N,m]);const D=f;return n.jsxs(r.Suspense,{fallback:null,children:[n.jsxs(n.Fragment,{children:[n.jsxs("div",{draggable:!1,children:[n.jsx("button",{className:"image-edit-button",ref:v,onClick:()=>{_("Update Inline Image",p=>n.jsx(T,{activeEditor:s,nodeKey:a,onClose:p}))},children:"Edit"}),n.jsx(q,{className:D?`focused ${t.wi(w)?"draggable":""}`:null,src:e,altText:l,imageRef:b,width:d,height:i,position:g})]}),c&&n.jsx("div",{className:"image-caption-container",children:n.jsxs(K,{initialEditor:o,children:[n.jsx(t.LinkPlugin,{}),n.jsx(t.FloatingTextFormatToolbarPlugin,{}),n.jsx(t.h,{contentEditable:n.jsx(t.LexicalContentEditable,{className:"InlineImageNode__contentEditable"}),placeholder:n.jsx(O,{className:"InlineImageNode__placeholder",children:"Enter a caption..."}),ErrorBoundary:t.a})]})})]}),S]})}exports.UpdateInlineImageDialog=T;exports.default=A;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as a, jsxs as v, Fragment as j } from "react/jsx-runtime";
|
|
2
2
|
import { useRef as k, useContext as K, useMemo as U, useEffect as P, useState as T, useCallback as y, Suspense as W } from "react";
|
|
3
|
-
import { e as R, o as q, l as z, f as G, g as H, u as J, w as M, h as D, c as A, i as Q, F as $, N as V, j as X, K as w, k as Y, m as Z, n as ee, D as te, r as ne, p as ae, L as le, q as re, s as oe, v as ie, x as se } from "./layers.
|
|
3
|
+
import { e as R, o as q, l as z, f as G, g as H, u as J, w as M, h as D, c as A, i as Q, F as $, N as V, j as X, K as w, k as Y, m as Z, n as ee, D as te, r as ne, p as ae, L as le, q as re, s as oe, v as ie, x as se } from "./layers.Ck8c0KB8.js";
|
|
4
4
|
import { Button as ce, TextInput as ue } from "@mantine/core";
|
|
5
5
|
function de(e) {
|
|
6
6
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@layers-app/editor",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.0.17-editor-
|
|
4
|
+
"version": "0.0.17-editor-02",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"start": "vite --mode full",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"main": "dist/index.js",
|
|
26
26
|
"types": "dist/index.d.ts",
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@layers-app/shared": "^0.0.
|
|
28
|
+
"@layers-app/shared": "^0.0.26",
|
|
29
29
|
"@lexical/headless": "0.21.0",
|
|
30
30
|
"@lexical/markdown": "0.21.0",
|
|
31
31
|
"@lexical/react": "0.21.0",
|