@jpmorganchase/mosaic-content-editor-plugin 0.1.0-beta.42 → 0.1.0-beta.44
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/.turbo/turbo-build.log +2 -2
- package/CHANGELOG.md +18 -0
- package/dist/{chunk-SYL4AGHI.js → chunk-23CWTC65.js} +1 -1
- package/dist/{chunk-MZJ4JT73.js → chunk-5KRV6UWE.js} +1 -1
- package/dist/chunk-E2MDU6JD.js +1 -0
- package/dist/{chunk-EMHRWY75.js → chunk-FDQTXNTN.js} +1 -1
- package/dist/{chunk-BINIAABY.js → chunk-IVMPDIDZ.js} +1 -1
- package/dist/chunk-SOMQOHNT.js +1 -0
- package/dist/chunk-TVGVMAJS.js +1 -0
- package/dist/chunk-V6H2L7PK.js +1 -0
- package/dist/components/Editor.js +1 -1
- package/dist/components/PersistEditDialog/index.js +1 -1
- package/dist/components/Toolbar/InsertImage.js +1 -1
- package/dist/components/Toolbar/InsertLink.js +1 -1
- package/dist/components/Toolbar/TextFormatTooltray.css.js +1 -1
- package/dist/components/Toolbar/TextFormatTooltray.js +1 -1
- package/dist/components/Toolbar/Toolbar.js +1 -1
- package/dist/index.js +1 -1
- package/dist/plugins/FloatingToolbarPlugin.js +1 -1
- package/dist/plugins/MarkdownLinkPlugin.js +1 -1
- package/dist/plugins/PreviewPlugin.js +1 -1
- package/package.json +8 -8
- package/src/components/PersistEditDialog/index.tsx +10 -4
- package/src/components/Toolbar/InsertImage.tsx +5 -3
- package/src/components/Toolbar/InsertLink.tsx +10 -4
- package/dist/chunk-B6MFPF7L.js +0 -1
- package/dist/chunk-FNNLNVQZ.js +0 -1
- package/dist/chunk-UBWAGWSM.js +0 -1
- package/dist/chunk-WCOTJ6JY.js +0 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
@jpmorganchase/mosaic-content-editor-plugin:build: cache hit, replaying output
|
|
1
|
+
@jpmorganchase/mosaic-content-editor-plugin:build: cache hit, replaying output 32bd63038cc0fbef
|
|
2
2
|
@jpmorganchase/mosaic-content-editor-plugin:build: $ npm-run-all --parallel build:*
|
|
3
|
-
@jpmorganchase/mosaic-content-editor-plugin:build: $ tsc
|
|
4
3
|
@jpmorganchase/mosaic-content-editor-plugin:build: $ node ../../scripts/bundle.js
|
|
4
|
+
@jpmorganchase/mosaic-content-editor-plugin:build: $ tsc
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @jpmorganchase/mosaic-content-editor-plugin
|
|
2
2
|
|
|
3
|
+
## 0.1.0-beta.44
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [cc5183e]
|
|
8
|
+
- Updated dependencies [36896ac]
|
|
9
|
+
- @jpmorganchase/mosaic-components@0.1.0-beta.44
|
|
10
|
+
- @jpmorganchase/mosaic-theme@0.1.0-beta.44
|
|
11
|
+
|
|
12
|
+
## 0.1.0-beta.43
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Updated dependencies [0dc621d]
|
|
17
|
+
- Updated dependencies [4e69178]
|
|
18
|
+
- @jpmorganchase/mosaic-components@0.1.0-beta.43
|
|
19
|
+
- @jpmorganchase/mosaic-theme@0.1.0-beta.43
|
|
20
|
+
|
|
3
21
|
## 0.1.0-beta.42
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as h}from"./chunk-
|
|
1
|
+
import{a as h}from"./chunk-IVMPDIDZ.js";import{a as k}from"./chunk-TVGVMAJS.js";import{a as f}from"./chunk-UWF3FV3R.js";import{a as T}from"./chunk-QHE4U3WR.js";import{a}from"./chunk-M4ISRNFD.js";import{b as w}from"./chunk-YBFKG74H.js";import{a as L}from"./chunk-ROQUYURQ.js";import{a as y}from"./chunk-3FJGHVH5.js";import{a as x}from"./chunk-QKOQTH4L.js";import{a as P}from"./chunk-RO6ARCLZ.js";import{a as M}from"./chunk-FDQTXNTN.js";import{b as S,d as E}from"./chunk-V6H2L7PK.js";import{a as C,d as v,f as l}from"./chunk-G57W376H.js";import{a as b}from"./chunk-FKL4ZGDB.js";import{a as g}from"./chunk-PXUVNH4P.js";import{a as n}from"./chunk-NXV7KCC5.js";import oo from"react";import{$convertToMarkdownString as ro}from"@lexical/markdown";import{OnChangePlugin as to}from"@lexical/react/LexicalOnChangePlugin";import eo from"lodash/debounce";import o,{useRef as B,useState as H}from"react";import I from"clsx";import j from"gray-matter";import{LexicalComposer as A}from"@lexical/react/LexicalComposer";import{ListPlugin as J}from"@lexical/react/LexicalListPlugin";import{TablePlugin as W}from"@lexical/react/LexicalTablePlugin";import{LinkPlugin as X}from"@lexical/react/LexicalLinkPlugin";import{HistoryPlugin as q}from"@lexical/react/LexicalHistoryPlugin";import{MarkdownShortcutPlugin as G}from"@lexical/react/LexicalMarkdownShortcutPlugin";import K from"react-split";import{$convertFromMarkdownString as Q}from"@lexical/markdown";function V(r){console.error(r)}var Y={namespace:"mosaic-content-editor",onError:V,nodes:P,theme:y},Z=()=>{let r=document.createElement("div");return r.className=n.gutter,r},_=({components:r,content:e,persistUrl:m,PreviewComponent:i,previewUrl:s,source:p,user:t})=>{let N=C()||p,{setUser:U}=v(),[u,c]=H(!1),z=B(null),{data:d,content:$}=j(e),D=()=>{c(!0),U(t)},O=()=>{c(!1)};return o.createElement(A,{initialConfig:{...Y,editorState:()=>Q($,a)}},o.createElement("div",{className:n.root,onFocus:D,onBlur:O},o.createElement("div",{className:n.toolbarContainer},o.createElement(h,null),o.createElement(k,{meta:d,persistUrl:m}),o.createElement(x,null)),o.createElement("div",{className:n.editorRoot},o.createElement(K,{className:n.splitter,cursor:"col-resize",direction:"horizontal",dragInterval:1,expandToMin:!1,gutter:Z,gutterAlign:"center",minSize:100,sizes:[50,50],snapOffset:30},o.createElement(f,{className:I({[n.focused]:u,[n.unfocused]:!u}),ref:z},o.createElement(g,null)),o.createElement(f,null,i&&o.createElement(i,{source:N,meta:d,components:r}))),o.createElement(q,null),o.createElement(J,null),o.createElement(W,null),o.createElement(X,null),o.createElement(G,{transformers:a}),s?o.createElement(F,{previewUrl:s}):null,o.createElement(w,null),o.createElement(S,null),o.createElement(T,null),o.createElement(b,null),o.createElement(M,null),o.createElement(L,null),o.createElement(E,null))))},R=_;async function no(r,e){return await(await fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:"markdown",text:e})})).json()}function io(r){let e=eo(r,250,{maxWait:500});return{onChange:i=>{i.read(()=>{let s=ro(a);s&&e(s)})}}}var F=({previewUrl:r})=>{let{setErrorMessage:e,setPreviewContent:m}=l(),i=async p=>{try{if(p){let t=await no(r,p);!t.error&&t?.source?m(t.source):e(`${t.error?.toUpperCase()}: ${t?.exception}`)}}catch(t){t instanceof Error&&e(`MDX Error: ${t.message}`)}},{onChange:s}=io(i);return oo.createElement(to,{onChange:s,ignoreSelectionChange:!0})};export{F as a,R as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
1
|
+
import{a}from"./chunk-SOMQOHNT.js";import{a as g}from"./chunk-U7COOUR6.js";import{a as d}from"./chunk-GYUEXLD6.js";import{a as m}from"./chunk-3QIETKQW.js";import o,{useCallback as F,useEffect as C,useState as n}from"react";import T from"clsx";import{FORMAT_TEXT_COMMAND as k,SELECTION_CHANGE_COMMAND as A,COMMAND_PRIORITY_CRITICAL as _,$getSelection as x,$isRangeSelection as D}from"lexical";import{useLexicalComposerContext as $}from"@lexical/react/LexicalComposerContext";import{$isListNode as K,ListNode as S}from"@lexical/list";import{$getNearestNodeOfType as w}from"@lexical/utils";import{$isHeadingNode as H}from"@lexical/rich-text";import{$isCodeNode as G}from"@lexical/code";import{Icon as N}from"@jpmorganchase/mosaic-components";function to({floating:I=!1}){let[c]=$(),[s,u]=n(c),[b,h]=n(!1),[B,L]=n(!1),[O,f]=n(!1),[E,y]=n("paragraph"),p=e=>{s.dispatchCommand(k,e)},l=F(()=>{let e=x();if(D(e)){h(e.hasFormat("bold")),L(e.hasFormat("italic")),f(e.hasFormat("code"));let r=e.anchor.getNode(),t=r.getKey()==="root"?r:r.getTopLevelElementOrThrow(),M=t.getKey();if(s.getElementByKey(M)!==null)if(K(t)){let i=w(r,S),v=i?i.getListType():t.getListType();y(v)}else{let i=H(t)?t.getTag():t.getType();i&&y(i),G(t)&&f(!0)}}},[s]);return C(()=>s.registerUpdateListener(({editorState:e})=>{e.read(()=>{l()})}),[s,l]),C(()=>c.registerCommand(A,(e,r)=>(l(),u(r),!1),_),[c,l]),o.createElement(o.Fragment,null,!I&&o.createElement(d,null,o.createElement(g,{editor:s,type:E})),o.createElement(d,null,o.createElement(m,{active:b,onClick:()=>p("bold"),label:"Bold"},o.createElement("span",{className:T(a.icon,a.bold)},"B")),o.createElement(m,{active:B,onClick:()=>p("italic"),label:"Italic"},o.createElement("span",{className:T(a.icon,a.italic)},"I")),o.createElement(m,{active:O,onClick:()=>p("code"),label:"Inline Code"},o.createElement("span",{className:T(a.code)},o.createElement(N,{name:"chevronLeft"}),o.createElement(N,{name:"chevronRight"})))))}export{to as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as v}from"./chunk-KZXCNQER.js";import{a as c}from"./chunk-YBFKG74H.js";import{a as g}from"./chunk-3QIETKQW.js";import{a as h}from"./chunk-XSZUCLBY.js";import e,{useState as s}from"react";import{useLexicalComposerContext as O}from"@lexical/react/LexicalComposerContext";import{Button as I,Icon as T}from"@jpmorganchase/mosaic-components";import{string as b,object as x}from"yup";import{ButtonBar as M,DialogTitle as P,DialogContent as V,DialogActions as q,FormField as C,Input as S}from"@salt-ds/lab";var D=x({alt:b().required("Alternative Information is a required field").max(100,"Alternative Information must be fewer than 100 characters"),url:b().required("Url is required").url("Must be a valid Url")}),w={url:"https://"},J=()=>{let[y]=O(),[u,i]=s(!1),[t,F]=s(w),[n,m]=s(),A=r=>{i(r)},B=()=>i(!0),d=()=>i(!1),f=r=>{let o=r.inner.reduce((a,{path:l,message:E})=>({...a,[l]:E}),{});m(o)},p=(r,o)=>{let{name:a}=r.target,l={...t,[a]:o};D.validateAt(a,l,{abortEarly:!1}).then(()=>{m({...n,[a]:void 0})},f),F(l)};return e.createElement(e.Fragment,null,e.createElement(g,{active:u,onClick:B,label:"Insert Image"},e.createElement(T,{name:"addDocument"})),e.createElement(h,{onOpenChange:A,open:u},e.createElement("form",{onSubmit:async r=>{r.preventDefault(),D.validate(t,{abortEarly:!1}).then(()=>{let o={alt:t&&t.alt!==void 0?t.alt:null,url:t&&t.url!==void 0?t.url:null};y.dispatchCommand(c,o),d()},f)},noValidate:!0},e.createElement(P,null,"Insert Image"),e.createElement(V,null,e.createElement("div",{className:v.fullWidth},e.createElement(C,{label:"Url for image",validationStatus:n?.url?"error":void 0,helperText:n?.url},e.createElement(S,{value:t?.url,inputProps:{name:"url"},onChange:p})),e.createElement(C,{label:"Alternative Information (alt)",validationStatus:n?.alt?"error":void 0,helperText:n?.alt||"Provides alternative information for the image if for some reason it cannot be viewed"},e.createElement(S,{value:t?.alt,inputProps:{name:"alt"},onChange:p})))),e.createElement(q,null,e.createElement(M,null,e.createElement(I,{onClick:d},"Cancel"),e.createElement(I,{variant:"cta",type:"submit"},"Insert"))))))};export{J as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as f}from"./chunk-
|
|
1
|
+
import{a as f}from"./chunk-5KRV6UWE.js";import{c as b}from"./chunk-V6H2L7PK.js";import{a as u}from"./chunk-YIFLQ5MW.js";import{a as y}from"./chunk-7JRJTNUG.js";import{a as c}from"./chunk-GYUEXLD6.js";import{a as d}from"./chunk-TSWYSURQ.js";import o,{useCallback as U,useEffect as h,useState as T}from"react";import{useLexicalComposerContext as L}from"@lexical/react/LexicalComposerContext";import{mergeRegister as A}from"@lexical/utils";import{$getSelection as B,$isRangeSelection as M,COMMAND_PRIORITY_LOW as R,SELECTION_CHANGE_COMMAND as _}from"lexical";import{flip as k,inline as w,useInteractions as D,useDismiss as $}from"@floating-ui/react";import{useFloatingUI as v}from"@salt-ds/core";function tt(){let[e]=L(),[t,i]=T(null),[m,r]=T(!1),C=t?{middleware:[w(t),k({fallbackPlacements:["bottom-start","top-start"]})]}:{placement:"bottom-start",strategy:"absolute"},{context:P,floating:x,reference:p,strategy:F}=v({placement:"bottom-start",open:m,onOpenChange:r,strategy:"absolute",...C}),{getFloatingProps:I}=D([$(P,{ancestorScroll:!0})]),n=U(()=>{let l=B(),s=window.getSelection(),g=s?.anchorNode?.parentElement;if(M(l)&&g&&!s?.isCollapsed){p(g);let S=s.getRangeAt(0),{x:E,y:O,height:N}=S.getBoundingClientRect();i({x:E,y:O+N}),r(!0)}else i(null),r(!1)},[p]);h(()=>A(e.registerUpdateListener(({editorState:l})=>{l.read(()=>{n()})}),e.registerCommand(_,()=>(n(),!1),R)),[e,n]);let a={position:F};return t&&(a={...a,top:t.y,left:t.x}),o.createElement(u,{ref:x,open:m,style:a,...I({})},o.createElement(y,{"aria-label":"page editing toolbar",className:d.toolbar},o.createElement(f,{floating:!0}),o.createElement(c,{"aria-label":"text format tooltray"},o.createElement(b,null))))}export{tt as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as l}from"./chunk-4B2NDAA2.js";import{a as s}from"./chunk-DLRFTDUZ.js";import{a as d}from"./chunk-
|
|
1
|
+
import{a as l}from"./chunk-4B2NDAA2.js";import{a as s}from"./chunk-DLRFTDUZ.js";import{a as d}from"./chunk-E2MDU6JD.js";import{a as b}from"./chunk-DXTVYP7D.js";import{a as n}from"./chunk-PC66Q33O.js";import{a as m}from"./chunk-FW7CHFWO.js";import{a as e}from"./chunk-5KRV6UWE.js";import{c as p}from"./chunk-V6H2L7PK.js";import{a as T}from"./chunk-7JRJTNUG.js";import{a as r}from"./chunk-GYUEXLD6.js";import{a as t}from"./chunk-3QIETKQW.js";import{c as i}from"./chunk-G57W376H.js";import o from"react";import{Icon as a}from"@jpmorganchase/mosaic-components";var I=()=>{let{canRedo:f,canUndo:y,redoEdit:u,undoEdit:g}=m(),{setPageState:B}=i();return o.createElement(T,{"aria-label":"page editing toolbar"},o.createElement(r,{"aria-label":"history tooltray"},o.createElement(t,{label:"Undo",disabled:!y,onClick:g},o.createElement(a,{name:"undo"})),o.createElement(t,{label:"Redo",disabled:!f,onClick:u},o.createElement(a,{name:"redo"})),o.createElement(l,null)),o.createElement(e,null),o.createElement(r,{"aria-label":"text format tooltray"},o.createElement(p,null),o.createElement(b,null),o.createElement(d,null),o.createElement(s,null),o.createElement(l,null)),o.createElement(r,{"aria-label":"stop editing tooltray",align:"right"},o.createElement(t,{label:"Cancel Editing",onClick:()=>B("VIEW")},o.createElement(a,{name:"delete"})),o.createElement(l,null)),o.createElement(r,{"aria-label":"copy tooltray"},o.createElement(n,null)))},W=I;export{W as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var q={icon:"u64up60",bold:"u64up61",italic:"u64up62",code:"_1lf47lk0 fxs0xn ueedq71k ueedq71l ueedq71m ueedq71n ueedq71o ueedq71p ueedq71q ueedq71r ueedq77c ueedq784 ueedq78 ueedq79 ueedq7a ueedq7b ueedq7c ueedq7d ueedq7e ueedq7f byd2vli byd2vln byd2vl2 byd2vl9 u64up63"};export{q as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as y}from"./chunk-6EO5B7QP.js";import{a as S}from"./chunk-R2MEEU32.js";import{a as h}from"./chunk-M4ISRNFD.js";import{c as P,d as C}from"./chunk-G57W376H.js";import{a as b}from"./chunk-Z6W7GDHE.js";import{a as D}from"./chunk-XSZUCLBY.js";import e,{useState as p}from"react";import{useLexicalComposerContext as L}from"@lexical/react/LexicalComposerContext";import{$convertToMarkdownString as N}from"@lexical/markdown";import{Link as F,P2 as k,Button as w}from"@jpmorganchase/mosaic-components";import{ButtonBar as G,DialogTitle as j,DialogContent as M,DialogActions as O}from"@salt-ds/lab";var V=({isRaising:g,prHref:i,error:c})=>!g&&!i&&!c?e.createElement(e.Fragment,null,e.createElement(k,null,"The content of this page resides in a Git repository and to update it requires a Pull Request which will be reviewed by the content owners."),e.createElement("br",null),e.createElement(k,null,"Should you decide to stop editing before creating the Pull Request then all changes will be lost.")):null,ee=({meta:g,persistUrl:i})=>{let{pageState:c,setPageState:B}=P(),{user:m}=C(),[q]=L(),[t,r]=p(!1),[o,s]=p(null),[u,f]=p(null),x=c==="SAVING",I=o!==null?"success":"info",d=n=>{r(n),n||(B("EDIT"),s(null))},T=()=>{d(!1)},v=()=>{r(!0),s(null),f(null);try{q.update(async()=>{let n=N(h);if(n&&m&&i){let{sid:A,displayName:H,email:E}=m,l=await b({sid:A,name:H,email:E},g.route,n,i);if(l.ok){let a=await l.json();a.error?(f(a.error),s(null),r(!1)):(s(a?.links?.self[0]?.href),r(!1))}if(l.status===500||l.status===404){let a=await l.text();f(a),s(null),r(!1)}}})}catch{f("Sorry - an unexpected error has occurred"),s(null),r(!1)}};return e.createElement(D,{onOpenChange:d,open:x,status:u?"error":I},e.createElement(j,{className:S.title},o?"Pull Request Created Successfully":"Save Changes"),e.createElement(M,null,(t||u)&&!o&&e.createElement(y,{isRaising:t,error:u}),e.createElement(V,{isRaising:t,prHref:o,error:u}),!t&&o&&e.createElement(F,{href:o,target:"_blank"},"A Pull Request for your changes has been created")),e.createElement(O,null,e.createElement(G,null,e.createElement(w,{disabled:t,onClick:T},o?"Done":"Cancel"),e.createElement(w,{disabled:i===void 0||t||o!==null,onClick:v,variant:"cta"},"Raise Pull Request"))))};export{ee as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as C}from"./chunk-WZYDYWT3.js";import{a as L}from"./chunk-3QIETKQW.js";import{e as f}from"./chunk-G57W376H.js";import{a as k}from"./chunk-XSZUCLBY.js";import{$createLinkNode as V,TOGGLE_LINK_COMMAND as q}from"@lexical/link";import{useLexicalComposerContext as W}from"@lexical/react/LexicalComposerContext";import{$wrapNodes as G}from"@lexical/selection";import{$createParagraphNode as U,$createTextNode as j,$getSelection as Y,$isRangeSelection as z,$isTextNode as H,COMMAND_PRIORITY_EDITOR as J,createCommand as Q}from"lexical";import X,{useCallback as Z,useEffect as R}from"react";import t,{useEffect as F,useState as h}from"react";import{useLexicalComposerContext as M}from"@lexical/react/LexicalComposerContext";import{Button as N,Icon as P}from"@jpmorganchase/mosaic-components";import{string as S,object as O}from"yup";import{FormField as D,Input as T,ButtonBar as B,DialogTitle as _,DialogContent as A,DialogActions as $}from"@salt-ds/lab";import{$getSelection as w,$isRangeSelection as K}from"lexical";var b=O({url:S().required("Url is required"),text:S().required("Text is required").max(10,"Text must be fewer than 100 characters")}),pt=()=>{let{isInsertingLink:e,setIsInsertingLink:r}=f();return t.createElement(L,{active:e,onClick:()=>r(!0),label:"Insert Link"},t.createElement(P,{name:"linked"}))},y={url:"https://"},E=()=>{let[e]=M(),{isInsertingLink:r,setIsInsertingLink:a}=f(),[o,i]=h(y),[s,m]=h(),u=n=>{a(n),n||(m(void 0),i(y))},g=()=>{u(!1)};F(()=>{e.getEditorState().read(()=>{if(r){let n=w();if(K(n)){let l=n.getTextContent();i(d=>({...d,text:l}))}}})},[e,r]);let x=n=>{let l=n.inner.reduce((d,{path:c,message:v})=>({...d,[c]:v}),{});m(l)},I=(n,l)=>{let{name:d}=n.target,c={...o,[d]:l};b.validateAt(d,c,{abortEarly:!1}).then(()=>{m({...s,[d]:void 0})},x),i(c)};return t.createElement(k,{onOpenChange:u,open:r},t.createElement("form",{onSubmit:async n=>{n.preventDefault(),b.validate(o,{abortEarly:!1}).then(()=>{let l={url:o?.url,text:o?.text};e.dispatchCommand(p,l),g()},x)},noValidate:!0},t.createElement(_,null,"Insert Link"),t.createElement(A,null,t.createElement("div",{className:C.fullWidth},t.createElement(D,{label:"Image URL text",validationStatus:s?.url?"error":void 0,helperText:s?.url},t.createElement(T,{value:o?.url,inputProps:{name:"url"},onChange:I})),t.createElement(D,{label:"Link text",validationStatus:s?.text?"error":void 0,helperText:s?.text},t.createElement(T,{value:o?.text,inputProps:{name:"text"},onChange:I})))),t.createElement($,null,t.createElement(B,null,t.createElement(N,{onClick:g},"Cancel"),t.createElement(N,{variant:"cta",type:"submit"},"Insert")))))};var p=Q();function tt(){let[e]=W(),r=Z(({url:a,text:o})=>{e.update(()=>{let i=Y();if(z(i)&&a!==void 0&&o!==void 0){let s=i.focus.getNode();if(H(s))e.dispatchCommand(q,a);else{let m=V(a),u=j(o);u.setFormat(i.focus.getNode().getFormat()),m.append(u),G(i,()=>m,U())}}})},[e]);R(()=>e.registerCommand(p,a=>(r(a),!0),J),[e,r])}function St(){return tt(),X.createElement(E,null)}export{p as a,St as b,pt as c,E as d};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as a}from"../chunk-
|
|
1
|
+
import{b as a}from"../chunk-23CWTC65.js";import"../chunk-IVMPDIDZ.js";import"../chunk-4B2NDAA2.js";import"../chunk-4LQ77YZW.js";import"../chunk-DLRFTDUZ.js";import"../chunk-E2MDU6JD.js";import"../chunk-KZXCNQER.js";import"../chunk-DXTVYP7D.js";import"../chunk-NFA3MZOC.js";import"../chunk-TVGVMAJS.js";import"../chunk-6EO5B7QP.js";import"../chunk-R2MEEU32.js";import"../chunk-UWF3FV3R.js";import"../chunk-KQ2ZCDYD.js";import"../chunk-QHE4U3WR.js";import"../chunk-BFF3MNBV.js";import"../chunk-5YCBSSDA.js";import"../chunk-NFSXCTUU.js";import"../chunk-6TM3EYFS.js";import"../chunk-M4ISRNFD.js";import"../chunk-ESJNOEFD.js";import"../chunk-WNTJMWYJ.js";import"../chunk-RT5CJ7T5.js";import"../chunk-G4LBXKDE.js";import"../chunk-YBFKG74H.js";import"../chunk-ROQUYURQ.js";import"../chunk-ESKW4XF6.js";import"../chunk-6YPAVQF4.js";import"../chunk-3FJGHVH5.js";import"../chunk-JQUDHJIQ.js";import"../chunk-ZHZ4E2MI.js";import"../chunk-PC66Q33O.js";import"../chunk-QKOQTH4L.js";import"../chunk-FW7CHFWO.js";import"../chunk-RO6ARCLZ.js";import"../chunk-FDQTXNTN.js";import"../chunk-5KRV6UWE.js";import"../chunk-SOMQOHNT.js";import"../chunk-U7COOUR6.js";import"../chunk-V6H2L7PK.js";import"../chunk-WZYDYWT3.js";import"../chunk-YIFLQ5MW.js";import"../chunk-XP37MJCS.js";import"../chunk-P5OBPOC4.js";import"../chunk-7JRJTNUG.js";import"../chunk-GYUEXLD6.js";import"../chunk-FH2LMMJT.js";import"../chunk-7LK4O57W.js";import"../chunk-3QIETKQW.js";import"../chunk-Y2A2ULLZ.js";import"../chunk-G57W376H.js";import"../chunk-TSWYSURQ.js";import"../chunk-FKL4ZGDB.js";import"../chunk-Z6W7GDHE.js";import"../chunk-PXUVNH4P.js";import"../chunk-XSZUCLBY.js";import"../chunk-OW5SK4AJ.js";import"../chunk-NXV7KCC5.js";import"../chunk-6X665P47.js";export{a as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../../chunk-
|
|
1
|
+
import{a}from"../../chunk-TVGVMAJS.js";import"../../chunk-6EO5B7QP.js";import"../../chunk-R2MEEU32.js";import"../../chunk-6TM3EYFS.js";import"../../chunk-M4ISRNFD.js";import"../../chunk-ESJNOEFD.js";import"../../chunk-WNTJMWYJ.js";import"../../chunk-RT5CJ7T5.js";import"../../chunk-G57W376H.js";import"../../chunk-Z6W7GDHE.js";import"../../chunk-XSZUCLBY.js";import"../../chunk-OW5SK4AJ.js";export{a as PersistDialog};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../../chunk-
|
|
1
|
+
import{a}from"../../chunk-E2MDU6JD.js";import"../../chunk-KZXCNQER.js";import"../../chunk-YBFKG74H.js";import"../../chunk-3QIETKQW.js";import"../../chunk-Y2A2ULLZ.js";import"../../chunk-XSZUCLBY.js";import"../../chunk-OW5SK4AJ.js";export{a as InsertImage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as a,d as b}from"../../chunk-
|
|
1
|
+
import{c as a,d as b}from"../../chunk-V6H2L7PK.js";import"../../chunk-WZYDYWT3.js";import"../../chunk-3QIETKQW.js";import"../../chunk-Y2A2ULLZ.js";import"../../chunk-G57W376H.js";import"../../chunk-XSZUCLBY.js";import"../../chunk-OW5SK4AJ.js";export{a as InsertLinkButton,b as InsertLinkDialog};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../../chunk-
|
|
1
|
+
import{a}from"../../chunk-SOMQOHNT.js";export{a as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../../chunk-
|
|
1
|
+
import{a}from"../../chunk-5KRV6UWE.js";import"../../chunk-SOMQOHNT.js";import"../../chunk-U7COOUR6.js";import"../../chunk-GYUEXLD6.js";import"../../chunk-FH2LMMJT.js";import"../../chunk-3QIETKQW.js";import"../../chunk-Y2A2ULLZ.js";export{a as TextFormatTooltray};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../../chunk-
|
|
1
|
+
import{a}from"../../chunk-IVMPDIDZ.js";import"../../chunk-4B2NDAA2.js";import"../../chunk-4LQ77YZW.js";import"../../chunk-DLRFTDUZ.js";import"../../chunk-E2MDU6JD.js";import"../../chunk-KZXCNQER.js";import"../../chunk-DXTVYP7D.js";import"../../chunk-NFA3MZOC.js";import"../../chunk-YBFKG74H.js";import"../../chunk-PC66Q33O.js";import"../../chunk-FW7CHFWO.js";import"../../chunk-5KRV6UWE.js";import"../../chunk-SOMQOHNT.js";import"../../chunk-U7COOUR6.js";import"../../chunk-V6H2L7PK.js";import"../../chunk-WZYDYWT3.js";import"../../chunk-YIFLQ5MW.js";import"../../chunk-XP37MJCS.js";import"../../chunk-P5OBPOC4.js";import"../../chunk-7JRJTNUG.js";import"../../chunk-GYUEXLD6.js";import"../../chunk-FH2LMMJT.js";import"../../chunk-7LK4O57W.js";import"../../chunk-3QIETKQW.js";import"../../chunk-Y2A2ULLZ.js";import"../../chunk-G57W376H.js";import"../../chunk-XSZUCLBY.js";import"../../chunk-OW5SK4AJ.js";export{a as default};
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as c}from"./chunk-
|
|
1
|
+
import{b as c}from"./chunk-23CWTC65.js";import"./chunk-IVMPDIDZ.js";import"./chunk-4B2NDAA2.js";import"./chunk-4LQ77YZW.js";import"./chunk-DLRFTDUZ.js";import"./chunk-E2MDU6JD.js";import"./chunk-KZXCNQER.js";import"./chunk-DXTVYP7D.js";import"./chunk-NFA3MZOC.js";import"./chunk-TVGVMAJS.js";import"./chunk-6EO5B7QP.js";import"./chunk-R2MEEU32.js";import"./chunk-UWF3FV3R.js";import"./chunk-KQ2ZCDYD.js";import"./chunk-QHE4U3WR.js";import"./chunk-BFF3MNBV.js";import"./chunk-5YCBSSDA.js";import"./chunk-NFSXCTUU.js";import"./chunk-6TM3EYFS.js";import"./chunk-M4ISRNFD.js";import"./chunk-ESJNOEFD.js";import"./chunk-WNTJMWYJ.js";import"./chunk-RT5CJ7T5.js";import"./chunk-G4LBXKDE.js";import"./chunk-YBFKG74H.js";import"./chunk-ROQUYURQ.js";import"./chunk-ESKW4XF6.js";import"./chunk-6YPAVQF4.js";import"./chunk-3FJGHVH5.js";import"./chunk-JQUDHJIQ.js";import{a as d}from"./chunk-ZHZ4E2MI.js";import"./chunk-PC66Q33O.js";import"./chunk-QKOQTH4L.js";import"./chunk-FW7CHFWO.js";import"./chunk-RO6ARCLZ.js";import"./chunk-FDQTXNTN.js";import"./chunk-5KRV6UWE.js";import"./chunk-SOMQOHNT.js";import"./chunk-U7COOUR6.js";import"./chunk-V6H2L7PK.js";import"./chunk-WZYDYWT3.js";import"./chunk-YIFLQ5MW.js";import"./chunk-XP37MJCS.js";import"./chunk-P5OBPOC4.js";import"./chunk-7JRJTNUG.js";import"./chunk-GYUEXLD6.js";import"./chunk-FH2LMMJT.js";import"./chunk-7LK4O57W.js";import"./chunk-3QIETKQW.js";import"./chunk-Y2A2ULLZ.js";import{c as a,f as b}from"./chunk-G57W376H.js";import"./chunk-TSWYSURQ.js";import"./chunk-FKL4ZGDB.js";import"./chunk-Z6W7GDHE.js";import"./chunk-PXUVNH4P.js";import"./chunk-XSZUCLBY.js";import"./chunk-OW5SK4AJ.js";import"./chunk-NXV7KCC5.js";import"./chunk-6X665P47.js";export{c as Editor,d as EditorControls,b as useContentEditor,a as usePageState};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-FDQTXNTN.js";import"../chunk-5KRV6UWE.js";import"../chunk-SOMQOHNT.js";import"../chunk-U7COOUR6.js";import"../chunk-V6H2L7PK.js";import"../chunk-WZYDYWT3.js";import"../chunk-YIFLQ5MW.js";import"../chunk-XP37MJCS.js";import"../chunk-P5OBPOC4.js";import"../chunk-7JRJTNUG.js";import"../chunk-GYUEXLD6.js";import"../chunk-FH2LMMJT.js";import"../chunk-7LK4O57W.js";import"../chunk-3QIETKQW.js";import"../chunk-Y2A2ULLZ.js";import"../chunk-G57W376H.js";import"../chunk-TSWYSURQ.js";import"../chunk-XSZUCLBY.js";import"../chunk-OW5SK4AJ.js";export{a as FloatingToolbarPlugin};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b}from"../chunk-
|
|
1
|
+
import{a,b}from"../chunk-V6H2L7PK.js";import"../chunk-WZYDYWT3.js";import"../chunk-3QIETKQW.js";import"../chunk-Y2A2ULLZ.js";import"../chunk-G57W376H.js";import"../chunk-XSZUCLBY.js";import"../chunk-OW5SK4AJ.js";export{a as INSERT_MARKDOWN_LINK_COMMAND,b as MarkdownLinkPlugin};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-23CWTC65.js";import"../chunk-IVMPDIDZ.js";import"../chunk-4B2NDAA2.js";import"../chunk-4LQ77YZW.js";import"../chunk-DLRFTDUZ.js";import"../chunk-E2MDU6JD.js";import"../chunk-KZXCNQER.js";import"../chunk-DXTVYP7D.js";import"../chunk-NFA3MZOC.js";import"../chunk-TVGVMAJS.js";import"../chunk-6EO5B7QP.js";import"../chunk-R2MEEU32.js";import"../chunk-UWF3FV3R.js";import"../chunk-KQ2ZCDYD.js";import"../chunk-QHE4U3WR.js";import"../chunk-BFF3MNBV.js";import"../chunk-5YCBSSDA.js";import"../chunk-NFSXCTUU.js";import"../chunk-6TM3EYFS.js";import"../chunk-M4ISRNFD.js";import"../chunk-ESJNOEFD.js";import"../chunk-WNTJMWYJ.js";import"../chunk-RT5CJ7T5.js";import"../chunk-G4LBXKDE.js";import"../chunk-YBFKG74H.js";import"../chunk-ROQUYURQ.js";import"../chunk-ESKW4XF6.js";import"../chunk-6YPAVQF4.js";import"../chunk-3FJGHVH5.js";import"../chunk-JQUDHJIQ.js";import"../chunk-ZHZ4E2MI.js";import"../chunk-PC66Q33O.js";import"../chunk-QKOQTH4L.js";import"../chunk-FW7CHFWO.js";import"../chunk-RO6ARCLZ.js";import"../chunk-FDQTXNTN.js";import"../chunk-5KRV6UWE.js";import"../chunk-SOMQOHNT.js";import"../chunk-U7COOUR6.js";import"../chunk-V6H2L7PK.js";import"../chunk-WZYDYWT3.js";import"../chunk-YIFLQ5MW.js";import"../chunk-XP37MJCS.js";import"../chunk-P5OBPOC4.js";import"../chunk-7JRJTNUG.js";import"../chunk-GYUEXLD6.js";import"../chunk-FH2LMMJT.js";import"../chunk-7LK4O57W.js";import"../chunk-3QIETKQW.js";import"../chunk-Y2A2ULLZ.js";import"../chunk-G57W376H.js";import"../chunk-TSWYSURQ.js";import"../chunk-FKL4ZGDB.js";import"../chunk-Z6W7GDHE.js";import"../chunk-PXUVNH4P.js";import"../chunk-XSZUCLBY.js";import"../chunk-OW5SK4AJ.js";import"../chunk-NXV7KCC5.js";import"../chunk-6X665P47.js";export{a as PreviewPlugin};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jpmorganchase/mosaic-content-editor-plugin",
|
|
3
3
|
"description": "Mosaic - In Browser content editing plugin",
|
|
4
|
-
"version": "0.1.0-beta.
|
|
4
|
+
"version": "0.1.0-beta.44",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "",
|
|
7
7
|
"repository": {
|
|
@@ -38,12 +38,12 @@
|
|
|
38
38
|
"typescript": "^4.8.3"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@jpmorganchase/mosaic-components": "^0.1.0-beta.
|
|
42
|
-
"@jpmorganchase/mosaic-theme": "^0.1.0-beta.
|
|
43
|
-
"@salt-ds/core": "^1.8.
|
|
44
|
-
"@salt-ds/icons": "^1.
|
|
45
|
-
"@salt-ds/lab": "1.0.0-alpha.
|
|
46
|
-
"@salt-ds/theme": "^1.
|
|
41
|
+
"@jpmorganchase/mosaic-components": "^0.1.0-beta.44",
|
|
42
|
+
"@jpmorganchase/mosaic-theme": "^0.1.0-beta.44",
|
|
43
|
+
"@salt-ds/core": "^1.8.1",
|
|
44
|
+
"@salt-ds/icons": "^1.6.0",
|
|
45
|
+
"@salt-ds/lab": "1.0.0-alpha.16",
|
|
46
|
+
"@salt-ds/theme": "^1.8.0",
|
|
47
47
|
"@floating-ui/react": "^0.23.0",
|
|
48
48
|
"@lexical/code": "^0.11.1",
|
|
49
49
|
"@lexical/link": "^0.11.1",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"@lexical/utils": "^0.11.1",
|
|
56
56
|
"@lexical/markdown": "^0.11.1",
|
|
57
57
|
"@vanilla-extract/css": "^1.6.0",
|
|
58
|
-
"clsx": "^
|
|
58
|
+
"clsx": "^2.0.0",
|
|
59
59
|
"gray-matter": "^4.0.3",
|
|
60
60
|
"lexical": "^0.11.1",
|
|
61
61
|
"react-split": "^2.0.14",
|
|
@@ -48,10 +48,16 @@ export const PersistDialog = ({ meta, persistUrl }: PersistDialogProps) => {
|
|
|
48
48
|
const open = pageState === 'SAVING';
|
|
49
49
|
const state = prHref !== null ? 'success' : 'info';
|
|
50
50
|
|
|
51
|
+
const handleOpenChange = (newOpen: boolean) => {
|
|
52
|
+
setIsRaising(newOpen);
|
|
53
|
+
if (!newOpen) {
|
|
54
|
+
setPageState('EDIT');
|
|
55
|
+
setPrHref(null);
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
|
|
51
59
|
const handleClose = () => {
|
|
52
|
-
|
|
53
|
-
setPrHref(null);
|
|
54
|
-
setIsRaising(false);
|
|
60
|
+
handleOpenChange(false);
|
|
55
61
|
};
|
|
56
62
|
|
|
57
63
|
const handleRaisePr = () => {
|
|
@@ -98,7 +104,7 @@ export const PersistDialog = ({ meta, persistUrl }: PersistDialogProps) => {
|
|
|
98
104
|
};
|
|
99
105
|
|
|
100
106
|
return (
|
|
101
|
-
<Dialog
|
|
107
|
+
<Dialog onOpenChange={handleOpenChange} open={open} status={error ? 'error' : state}>
|
|
102
108
|
<DialogTitle className={style.title}>
|
|
103
109
|
{!prHref ? 'Save Changes' : 'Pull Request Created Successfully'}
|
|
104
110
|
</DialogTitle>
|
|
@@ -50,12 +50,14 @@ export const InsertImage = () => {
|
|
|
50
50
|
const [values, setValues] = useState<FormValueState>(initialState);
|
|
51
51
|
const [errors, setErrors] = useState<FormErrorState>();
|
|
52
52
|
|
|
53
|
-
const
|
|
54
|
-
setIsOpen(
|
|
53
|
+
const handleOpenChange = (open: boolean) => {
|
|
54
|
+
setIsOpen(open);
|
|
55
55
|
};
|
|
56
56
|
|
|
57
57
|
const handleOpen = () => setIsOpen(true);
|
|
58
58
|
|
|
59
|
+
const handleClose = () => setIsOpen(false);
|
|
60
|
+
|
|
59
61
|
const processErrors = validationErrors => {
|
|
60
62
|
const newErrors = validationErrors.inner.reduce(
|
|
61
63
|
(acc, { path, message }) => ({
|
|
@@ -94,7 +96,7 @@ export const InsertImage = () => {
|
|
|
94
96
|
<Icon name="addDocument" />
|
|
95
97
|
</ToolbarButton>
|
|
96
98
|
|
|
97
|
-
<Dialog
|
|
99
|
+
<Dialog onOpenChange={handleOpenChange} open={isOpen}>
|
|
98
100
|
<form onSubmit={handleSubmit} noValidate>
|
|
99
101
|
<DialogTitle>Insert Image</DialogTitle>
|
|
100
102
|
<DialogContent>
|
|
@@ -60,10 +60,16 @@ export const InsertLinkDialog = () => {
|
|
|
60
60
|
const [values, setValues] = useState<FormValueState>(initialState);
|
|
61
61
|
const [errors, setErrors] = useState<FormErrorState>();
|
|
62
62
|
|
|
63
|
+
const handleOpenChange = (open: boolean) => {
|
|
64
|
+
setIsInsertingLink(open);
|
|
65
|
+
if (!open) {
|
|
66
|
+
setErrors(undefined);
|
|
67
|
+
setValues(initialState);
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
|
|
63
71
|
const handleClose = () => {
|
|
64
|
-
|
|
65
|
-
setErrors(undefined);
|
|
66
|
-
setValues(initialState);
|
|
72
|
+
handleOpenChange(false);
|
|
67
73
|
};
|
|
68
74
|
|
|
69
75
|
useEffect(() => {
|
|
@@ -111,7 +117,7 @@ export const InsertLinkDialog = () => {
|
|
|
111
117
|
};
|
|
112
118
|
|
|
113
119
|
return (
|
|
114
|
-
<Dialog
|
|
120
|
+
<Dialog onOpenChange={handleOpenChange} open={isInsertingLink}>
|
|
115
121
|
<form onSubmit={handleSubmit} noValidate>
|
|
116
122
|
<DialogTitle>Insert Link</DialogTitle>
|
|
117
123
|
<DialogContent>
|
package/dist/chunk-B6MFPF7L.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var p={icon:"u64up60",bold:"u64up61",italic:"u64up62",code:"_1lf47lk0 byd2vlk byd2vlp byd2vl2 byd2vl9 u64up63"};export{p as a};
|
package/dist/chunk-FNNLNVQZ.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as S}from"./chunk-6EO5B7QP.js";import{a as b}from"./chunk-R2MEEU32.js";import{a as P}from"./chunk-M4ISRNFD.js";import{c as h,d as C}from"./chunk-G57W376H.js";import{a as y}from"./chunk-Z6W7GDHE.js";import{a as D}from"./chunk-XSZUCLBY.js";import e,{useState as m}from"react";import{useLexicalComposerContext as E}from"@lexical/react/LexicalComposerContext";import{$convertToMarkdownString as L}from"@lexical/markdown";import{Link as N,P2 as w,Button as k}from"@jpmorganchase/mosaic-components";import{ButtonBar as F,DialogTitle as G,DialogContent as j,DialogActions as M}from"@salt-ds/lab";var V=({isRaising:f,prHref:n,error:c})=>!f&&!n&&!c?e.createElement(e.Fragment,null,e.createElement(w,null,"The content of this page resides in a Git repository and to update it requires a Pull Request which will be reviewed by the content owners."),e.createElement("br",null),e.createElement(w,null,"Should you decide to stop editing before creating the Pull Request then all changes will be lost.")):null,R=({meta:f,persistUrl:n})=>{let{pageState:c,setPageState:B}=h(),{user:p}=C(),[q]=E(),[t,r]=m(!1),[o,s]=m(null),[a,u]=m(null),x=c==="SAVING",I=o!==null?"success":"info",d=()=>{B("EDIT"),s(null),r(!1)},T=()=>{r(!0),s(null),u(null);try{q.update(async()=>{let g=L(P);if(g&&p&&n){let{sid:v,displayName:A,email:H}=p,i=await y({sid:v,name:A,email:H},f.route,g,n);if(i.ok){let l=await i.json();l.error?(u(l.error),s(null),r(!1)):(s(l?.links?.self[0]?.href),r(!1))}if(i.status===500||i.status===404){let l=await i.text();u(l),s(null),r(!1)}}})}catch{u("Sorry - an unexpected error has occurred"),s(null),r(!1)}};return e.createElement(D,{onClose:d,open:x,status:a?"error":I},e.createElement(G,{className:b.title},o?"Pull Request Created Successfully":"Save Changes"),e.createElement(j,null,(t||a)&&!o&&e.createElement(S,{isRaising:t,error:a}),e.createElement(V,{isRaising:t,prHref:o,error:a}),!t&&o&&e.createElement(N,{href:o,target:"_blank"},"A Pull Request for your changes has been created")),e.createElement(M,null,e.createElement(F,null,e.createElement(k,{disabled:t,onClick:d},o?"Done":"Cancel"),e.createElement(k,{disabled:n===void 0||t||o!==null,onClick:T,variant:"cta"},"Raise Pull Request"))))};export{R as a};
|
package/dist/chunk-UBWAGWSM.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as v}from"./chunk-KZXCNQER.js";import{a as h}from"./chunk-YBFKG74H.js";import{a as g}from"./chunk-3QIETKQW.js";import{a as c}from"./chunk-XSZUCLBY.js";import t,{useState as s}from"react";import{useLexicalComposerContext as E}from"@lexical/react/LexicalComposerContext";import{Button as I,Icon as T}from"@jpmorganchase/mosaic-components";import{string as b,object as x}from"yup";import{ButtonBar as w,DialogTitle as M,DialogContent as O,DialogActions as P,FormField as C,Input as S}from"@salt-ds/lab";var D=x({alt:b().required("Alternative Information is a required field").max(100,"Alternative Information must be fewer than 100 characters"),url:b().required("Url is required").url("Must be a valid Url")}),V={url:"https://"},H=()=>{let[y]=E(),[u,m]=s(!1),[e,F]=s(V),[r,d]=s(),i=()=>{m(!1)},A=()=>m(!0),f=o=>{let n=o.inner.reduce((a,{path:l,message:B})=>({...a,[l]:B}),{});d(n)},p=(o,n)=>{let{name:a}=o.target,l={...e,[a]:n};D.validateAt(a,l,{abortEarly:!1}).then(()=>{d({...r,[a]:void 0})},f),F(l)};return t.createElement(t.Fragment,null,t.createElement(g,{active:u,onClick:A,label:"Insert Image"},t.createElement(T,{name:"addDocument"})),t.createElement(c,{onClose:i,open:u,width:600},t.createElement("form",{onSubmit:async o=>{o.preventDefault(),D.validate(e,{abortEarly:!1}).then(()=>{let n={alt:e&&e.alt!==void 0?e.alt:null,url:e&&e.url!==void 0?e.url:null};y.dispatchCommand(h,n),i()},f)},noValidate:!0},t.createElement(M,null,"Insert Image"),t.createElement(O,null,t.createElement("div",{className:v.fullWidth},t.createElement(C,{label:"Url for image",validationStatus:r?.url?"error":void 0,helperText:r?.url},t.createElement(S,{value:e?.url,inputProps:{name:"url"},onChange:p})),t.createElement(C,{label:"Alternative Information (alt)",validationStatus:r?.alt?"error":void 0,helperText:r?.alt||"Provides alternative information for the image if for some reason it cannot be viewed"},t.createElement(S,{value:e?.alt,inputProps:{name:"alt"},onChange:p})))),t.createElement(P,null,t.createElement(w,null,t.createElement(I,{onClick:i},"Cancel"),t.createElement(I,{variant:"cta",type:"submit"},"Insert"))))))};export{H as a};
|
package/dist/chunk-WCOTJ6JY.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as k}from"./chunk-WZYDYWT3.js";import{a as I}from"./chunk-3QIETKQW.js";import{e as f}from"./chunk-G57W376H.js";import{a as L}from"./chunk-XSZUCLBY.js";import{$createLinkNode as K,TOGGLE_LINK_COMMAND as V}from"@lexical/link";import{useLexicalComposerContext as q}from"@lexical/react/LexicalComposerContext";import{$wrapNodes as W}from"@lexical/selection";import{$createParagraphNode as G,$createTextNode as U,$getSelection as j,$isRangeSelection as Y,$isTextNode as z,COMMAND_PRIORITY_EDITOR as H,createCommand as J}from"lexical";import Q,{useCallback as X,useEffect as Z}from"react";import t,{useEffect as v,useState as C}from"react";import{useLexicalComposerContext as F}from"@lexical/react/LexicalComposerContext";import{Button as N,Icon as M}from"@jpmorganchase/mosaic-components";import{string as h,object as P}from"yup";import{FormField as S,Input as D,ButtonBar as B,DialogTitle as _,DialogContent as A,DialogActions as O}from"@salt-ds/lab";import{$getSelection as $,$isRangeSelection as w}from"lexical";var T=P({url:h().required("Url is required"),text:h().required("Text is required").max(10,"Text must be fewer than 100 characters")}),ft=()=>{let{isInsertingLink:e,setIsInsertingLink:o}=f();return t.createElement(I,{active:e,onClick:()=>o(!0),label:"Insert Link"},t.createElement(M,{name:"linked"}))},b={url:"https://"},y=()=>{let[e]=F(),{isInsertingLink:o,setIsInsertingLink:s}=f(),[n,r]=C(b),[a,m]=C(),u=()=>{s(!1),m(void 0),r(b)};v(()=>{e.getEditorState().read(()=>{if(o){let i=$();if(w(i)){let l=i.getTextContent();r(d=>({...d,text:l}))}}})},[e,o]);let g=i=>{let l=i.inner.reduce((d,{path:c,message:E})=>({...d,[c]:E}),{});m(l)},x=(i,l)=>{let{name:d}=i.target,c={...n,[d]:l};T.validateAt(d,c,{abortEarly:!1}).then(()=>{m({...a,[d]:void 0})},g),r(c)};return t.createElement(L,{onClose:u,open:o,width:600},t.createElement("form",{onSubmit:async i=>{i.preventDefault(),T.validate(n,{abortEarly:!1}).then(()=>{let l={url:n?.url,text:n?.text};e.dispatchCommand(p,l),u()},g)},noValidate:!0},t.createElement(_,null,"Insert Link"),t.createElement(A,null,t.createElement("div",{className:k.fullWidth},t.createElement(S,{label:"Image URL text",validationStatus:a?.url?"error":void 0,helperText:a?.url},t.createElement(D,{value:n?.url,inputProps:{name:"url"},onChange:x})),t.createElement(S,{label:"Link text",validationStatus:a?.text?"error":void 0,helperText:a?.text},t.createElement(D,{value:n?.text,inputProps:{name:"text"},onChange:x})))),t.createElement(O,null,t.createElement(B,null,t.createElement(N,{onClick:u},"Cancel"),t.createElement(N,{variant:"cta",type:"submit"},"Insert")))))};var p=J();function R(){let[e]=q(),o=X(({url:s,text:n})=>{e.update(()=>{let r=j();if(Y(r)&&s!==void 0&&n!==void 0){let a=r.focus.getNode();if(z(a))e.dispatchCommand(V,s);else{let m=K(s),u=U(n);u.setFormat(r.focus.getNode().getFormat()),m.append(u),W(r,()=>m,G())}}})},[e]);Z(()=>e.registerCommand(p,s=>(o(s),!0),H),[e,o])}function ht(){return R(),Q.createElement(y,null)}export{p as a,ht as b,ft as c,y as d};
|