@forgedevstack/ink 1.1.2 → 1.1.3
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/CHANGELOG.md +10 -1
- package/README.md +1 -1
- package/dist/components/InkEditor/InkEditor.cjs +1 -1
- package/dist/components/InkEditor/InkEditor.d.ts.map +1 -1
- package/dist/components/InkEditor/InkEditor.js +171 -167
- package/dist/components/InkEditor/components/SignPad/SignPad.cjs +1 -1
- package/dist/components/InkEditor/components/SignPad/SignPad.const.cjs +1 -1
- package/dist/components/InkEditor/components/SignPad/SignPad.const.d.ts +7 -0
- package/dist/components/InkEditor/components/SignPad/SignPad.const.d.ts.map +1 -1
- package/dist/components/InkEditor/components/SignPad/SignPad.const.js +15 -17
- package/dist/components/InkEditor/components/SignPad/SignPad.d.ts.map +1 -1
- package/dist/components/InkEditor/components/SignPad/SignPad.js +34 -31
- package/dist/components/InkEditor/components/SignPad/SignPad.utils.cjs +1 -1
- package/dist/components/InkEditor/components/SignPad/SignPad.utils.d.ts.map +1 -1
- package/dist/components/InkEditor/components/SignPad/SignPad.utils.js +5 -14
- package/dist/constants/generals.const.cjs +1 -1
- package/dist/constants/generals.const.d.ts +1 -0
- package/dist/constants/generals.const.d.ts.map +1 -1
- package/dist/constants/generals.const.js +4 -3
- package/dist/constants/numbers.cjs +1 -1
- package/dist/constants/numbers.d.ts +2 -0
- package/dist/constants/numbers.d.ts.map +1 -1
- package/dist/constants/numbers.js +10 -12
- package/dist/utils/memory.utils.cjs +1 -1
- package/dist/utils/memory.utils.d.ts.map +1 -1
- package/dist/utils/memory.utils.js +17 -5
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## Unreleased — 1.1.
|
|
3
|
+
## Unreleased — 1.1.3
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
- `keepInMemory` restores drafts on mount in controlled mode via `onChange`
|
|
7
|
+
- SignPad clears drawing state when closed; Insert relies on stroke state only
|
|
8
|
+
- `canvasHasInk` ignores white fill (RGB), not alpha alone
|
|
9
|
+
- localStorage read/write/clear wrapped in try/catch
|
|
10
|
+
- Default memory key moved to `DEFAULT_MEMORY_KEY` const
|
|
11
|
+
|
|
12
|
+
## 1.1.2 — 2026-08-04
|
|
4
13
|
|
|
5
14
|
### Added
|
|
6
15
|
- Sign pad toolbar (`signature`) — canvas draw → insert PNG image
|
package/README.md
CHANGED
|
@@ -113,7 +113,7 @@ export function ContractEditor() {
|
|
|
113
113
|
2. Click the **✍** toolbar button.
|
|
114
114
|
3. Draw with mouse/touch on the canvas.
|
|
115
115
|
4. Click **Insert** — a PNG image is inserted into the document.
|
|
116
|
-
5. Refresh with `keepInMemory` + `memoryKey` — draft HTML restores.
|
|
116
|
+
5. Refresh with `keepInMemory` + `memoryKey` — draft HTML restores (memory wins on mount for controlled `value` / `onChange` too).
|
|
117
117
|
|
|
118
118
|
### Find and replace
|
|
119
119
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),u=require("react"),ee=require("../../constants/numbers.cjs"),O=require("../../constants/toolbar.const.cjs"),f=require("../../constants/defaults.const.cjs"),Pe=require("../../constants/premium.const.cjs"),qt=require("../../utils/cn.utils.cjs"),Kt=require("../../utils/typo.utils.cjs"),ve=require("../../utils/id.utils.cjs"),Vt=require("../../utils/table.utils.cjs"),q=require("../../utils/blocks.utils.cjs"),b=require("../../utils/trackChanges.utils.cjs"),te=require("../../utils/comments.utils.cjs"),je=require("../../utils/history.utils.cjs"),Fe=require("../../utils/slash.utils.cjs"),L=require("../../utils/premium.utils.cjs"),ne=require("../../utils/paste.utils.cjs"),Ue=require("../../utils/memory.utils.cjs"),Gt=require("../../utils/findReplace.utils.cjs"),a=require("./helpers/format.utils.cjs"),C=require("./components/ToolbarButton/ToolbarButton.cjs"),Wt=require("./components/ToolbarDropdown/ToolbarDropdown.cjs"),Me=require("./components/ToolbarColorPicker/ToolbarColorPicker.cjs"),$t=require("./components/CommentsPanel/CommentsPanel.cjs"),zt=require("./components/AiPanel/AiPanel.cjs"),Xt=require("./components/BlockHandles/BlockHandles.cjs"),Zt=require("./components/SlashMenu/SlashMenu.cjs"),Qt=require("./components/TrackChangesBar/TrackChangesBar.cjs"),Yt=require("./components/SignPad/SignPad.cjs"),Jt=require("./components/FindReplace/FindReplace.cjs"),re=()=>{const N=window.getSelection();if(!N||N.rangeCount===0)return"";const T=N.getRangeAt(0),y=document.createElement("div");return y.appendChild(T.cloneContents()),y.innerHTML},en=N=>{var Be;const{value:T,defaultValue:y="",onChange:S,placeholder:oe=f.INK_PLACEHOLDER_DEFAULT,disabled:c=!1,readOnly:i=!1,minHeight:K=ee.INK_MIN_HEIGHT,maxHeight:V,toolbar:De=f.INK_DEFAULT_TOOLBAR,className:qe="",testId:Ke,allowImagePaste:se=!0,showCharCount:ce=!1,charCountMax:ae,typoAutoFix:Ve=!0,variant:Ge=f.INK_DEFAULT_VARIANT,features:We,author:x=f.INK_DEFAULT_AUTHOR,trackChanges:w,onTrackChangesChange:G,trackChangesEnabled:F,onTrackChangesEnabledChange:W,comments:R,onCommentsChange:$,showCommentsPanel:E,onShowCommentsPanelChange:z,ai:h,slashCommands:$e,tableRows:ze=f.INK_TABLE_DEFAULT_ROWS,tableCols:Xe=f.INK_TABLE_DEFAULT_COLS,premium:Ze,theme:Qe,icons:ie,pasteMode:Ye="plain",onImageUpload:le,wysiwyg:Je=!1,keepInMemory:ue=!1,memoryKey:de,style:et,...tt}=N,m={...f.INK_DEFAULT_FEATURES,...We},A=L.resolveInkPremium(Ze),nt=L.hasInkPremiumFeature(A,"icons"),rt=L.hasInkPremiumFeature(A,"theme"),ot=L.hasInkPremiumFeature(A,"richPaste"),st=L.hasInkPremiumFeature(A,"imageUpload"),ct=L.hasInkPremiumFeature(A,"wysiwyg")&&Je,p=nt&&ie?{...Pe.INK_DEFAULT_ICONS,...ie}:Pe.INK_DEFAULT_ICONS,at=rt?L.themeTokensToStyle(Qe):{},it=ot&&Ye==="rich",r=u.useRef(null),U=u.useRef(new je.InkHistoryStack(T??y)),[lt,ut]=u.useState(new Set),[dt,me]=u.useState("p"),[mt,ft]=u.useState(0),[ht,pt]=u.useState(ee.INK_DEFAULT_TEXT_COLOR),[gt,Ct]=u.useState(ee.INK_DEFAULT_HIGHLIGHT_COLOR),[H,fe]=u.useState(F??!1),[Tt,he]=u.useState(w??[]),[kt,pe]=u.useState(R??[]),[It,ge]=u.useState(E??!1),[Ce,X]=u.useState(!!(h!=null&&h.enabled&&h.openOnInit)),[Te,bt]=u.useState(""),[_t,Lt]=u.useState(0),[St,ke]=u.useState(!1),[xt,M]=u.useState([]),[Ie,At]=u.useState({top:0,left:0}),[be,_e]=u.useState(!1),[Le,Se]=u.useState(!1),k=w??Tt,B=R??kt,Z=E??It,xe=$e??m.slash;u.useEffect(()=>{F!==void 0&&fe(F)},[F]),u.useEffect(()=>{w&&he(w)},[w]),u.useEffect(()=>{R&&pe(R)},[R]),u.useEffect(()=>{E!==void 0&&ge(E)},[E]),u.useEffect(()=>{!r.current||T===void 0||r.current.innerHTML!==T&&(r.current.innerHTML=T)},[T]),u.useEffect(()=>{if(!r.current||T!==void 0)return;const t=(ue?Ue.readInkMemory(de):"")||y;t&&(r.current.innerHTML=t,U.current=new je.InkHistoryStack(t),S==null||S(t))},[]);const Q=e=>{var t;U.current.push(e),S==null||S(e),ue&&Ue.writeInkMemory(e,de),ce&&r.current&&ft(((t=r.current.textContent)==null?void 0:t.length)??0)},_=e=>{r.current&&(r.current.innerHTML=e,Q(e))},P=e=>{he(e),G==null||G(e)},Y=e=>{pe(e),$==null||$(e)},J=e=>{ge(e),z==null||z(e)},Ht=e=>{fe(e),W==null||W(e)},D=()=>{ut(a.getActiveFormats());const e=a.queryCommandValue("formatBlock");if(e&&me(e.toLowerCase().replace(/[<>]/g,"")),bt(re()),!r.current||!m.blocks)return;const t=window.getSelection(),n=(t==null?void 0:t.anchorNode)??null,o=q.getBlockElement(n,r.current);if(q.markActiveBlock(r.current,o),o){const l=r.current.getBoundingClientRect(),g=o.getBoundingClientRect();Lt(g.top-l.top+r.current.scrollTop),ke(!0)}else ke(!1)},d=()=>{var t,n,o;if(!r.current)return;let e=r.current.innerHTML;if(H&&m.trackChanges){const l=window.getSelection();if(l&&!l.isCollapsed){const g=re();if(g){const I=b.createTrackChange("delete",g,x);P([...k,I]),Ot(I.id),e=r.current.innerHTML}}}if(Q(e),D(),xe&&r.current){const l=((n=(t=window.getSelection())==null?void 0:t.anchorNode)==null?void 0:n.textContent)??"",g=Fe.extractSlashQuery(l);if(g!==null){M(Fe.filterSlashCommands(g));const I=(o=window.getSelection())==null?void 0:o.getRangeAt(0);if(I&&r.current){const v=I.getBoundingClientRect(),j=r.current.getBoundingClientRect();At({top:v.bottom-j.top+8,left:v.left-j.left})}}else M([])}},Ot=e=>{const t=window.getSelection();if(!t||t.rangeCount===0)return;const n=re();n&&a.insertHTML(b.wrapDeleteHtml(n,e))},Nt=()=>{if(!r.current||!Ve||!m.typoAutoFix||c||i)return;const e=r.current.innerHTML,t=Kt.applyTypoAutoFix(e);t.html!==e&&(r.current.innerHTML=t.html,Q(t.html))},yt=e=>{var n;if(c||i)return;(n=r.current)==null||n.focus();const t=f.INK_BUTTON_CONFIG[e];t&&(t.value?a.execCommand(t.command,t.value):a.execCommand(t.command),d())},wt=e=>{var t;c||i||((t=r.current)==null||t.focus(),a.execCommand("formatBlock",e),me(e),d())},Rt=()=>{var t;if(c||i)return;const e=window.prompt("Enter URL:","https://");e&&((t=r.current)==null||t.focus(),a.insertLink(e),d())},Ae=async e=>st&&le?le(e):a.fileToDataUrl(e),Et=async()=>{if(c||i)return;const e=document.createElement("input");e.type="file",e.accept="image/*",e.onchange=async()=>{var o,l;const t=(o=e.files)==null?void 0:o[0];if(!t)return;const n=await Ae(t);(l=r.current)==null||l.focus(),a.insertImage(n,t.name),d()},e.click()},He=()=>{var t;if(c||i||!m.table)return;(t=r.current)==null||t.focus();const e=Vt.buildTableHtml(ze,Xe);if(H&&m.trackChanges){const n=b.createTrackChange("insert",e,x);P([...k,n]),a.insertHTML(b.wrapInsertHtml(e,n.id))}else a.insertHTML(e);d()},Oe=()=>{const e=U.current.undo();if(e===null||!r.current){a.execCommand("undo"),d();return}_(e)},Ne=()=>{const e=U.current.redo();if(e===null||!r.current){a.execCommand("redo"),d();return}_(e)},Bt=()=>{var l;if(c||i||!m.comments)return;const e=window.prompt("Comment:");if(!(e!=null&&e.trim()))return;const t=ve.createInkId("hl");if((l=r.current)==null||l.focus(),!te.wrapSelectionAsComment(t))return;const o=te.createCommentThread(x,e.trim(),t);Y([o,...B]),J(!0),d()},ye=e=>{if(!r.current)return;const t=b.acceptTrackChangeInHtml(r.current.innerHTML,e);_(t),P(k.map(n=>n.id===e?{...n,accepted:!0}:n))},we=e=>{if(!r.current)return;const t=b.rejectTrackChangeInHtml(r.current.innerHTML,e);_(t),P(k.map(n=>n.id===e?{...n,rejected:!0}:n))},Re=async e=>{const t=await Ae(e),n=`<img src="${t}" alt="" style="max-width:100%;height:auto;" />`;if(H&&m.trackChanges){const o=b.createTrackChange("insert",n,x);P([...k,o]),a.insertHTML(b.wrapInsertHtml(n,o.id))}else a.insertImage(t);d()},Pt=async e=>{if(c||i)return;const t=e.clipboardData;if(!t)return;if(it){const o=ne.extractClipboardHtml(t);if(o){e.preventDefault();const g=ne.sanitizePastedHtml(o);g&&(a.insertHTML(g),d());const I=t.items;if(se&&I)for(const v of Array.from(I)){if(!v.type.startsWith("image/"))continue;const j=v.getAsFile();j&&await Re(j)}return}const l=ne.extractClipboardText(t);if(l){e.preventDefault(),a.insertHTML(l.replace(/\n/g,"<br />")),d();return}}if(!se)return;const n=t.items;if(n)for(const o of Array.from(n)){if(!o.type.startsWith("image/"))continue;e.preventDefault();const l=o.getAsFile();l&&await Re(l)}},vt=e=>{e.key==="Escape"&&M([]),(e.metaKey||e.ctrlKey)&&e.key==="z"&&(e.preventDefault(),e.shiftKey?Ne():Oe())},jt=e=>{var n,o;(n=r.current)==null||n.focus();const t=window.getSelection();if((o=t==null?void 0:t.anchorNode)!=null&&o.textContent){const g=t.anchorNode.textContent.replace(/(?:^|\s)\/[^\s]*$/," ");t.anchorNode.nodeType===Node.TEXT_NODE&&(t.anchorNode.textContent=g)}switch(M([]),e.insert){case"heading1":a.execCommand("formatBlock","h1");break;case"heading2":a.execCommand("formatBlock","h2");break;case"bulletList":a.execCommand("insertUnorderedList");break;case"orderedList":a.execCommand("insertOrderedList");break;case"table":He();return;case"ai":X(!0);break}d()},Ee=e=>{if(!r.current)return;const t=window.getSelection(),n=q.getBlockElement((t==null?void 0:t.anchorNode)??null,r.current);n&&q.moveBlock(n,e)&&(d(),D())},Ft=(e,t)=>{if(e==="divider")return s.jsx("span",{className:f.INK_CLASS_DIVIDER},`divider-${t}`);if(e==="headingDropdown")return s.jsx(Wt.ToolbarDropdown,{title:"Heading",options:f.INK_HEADING_OPTIONS,value:dt||"p",disabled:c||i,onChange:wt},"heading");if(e==="textColor")return s.jsx(Me.ToolbarColorPicker,{title:"Text color",type:"text",value:ht,disabled:c||i,onChange:o=>{var l;(l=r.current)==null||l.focus(),a.setTextColor(o),pt(o),d()}},"textColor");if(e==="highlightColor")return s.jsx(Me.ToolbarColorPicker,{title:"Highlight color",type:"highlight",value:gt,disabled:c||i,onChange:o=>{var l;(l=r.current)==null||l.focus(),a.setHighlightColor(o),Ct(o),d()}},"highlightColor");if(e==="link")return s.jsx(C.ToolbarButton,{icon:p.link,title:"Insert link",disabled:c||i,onClick:Rt},"link");if(e==="image")return s.jsx(C.ToolbarButton,{icon:p.image,title:"Insert image",disabled:c||i,onClick:()=>{Et()}},"image");if(e==="table")return m.table?s.jsx(C.ToolbarButton,{icon:p.table,title:"Insert table",disabled:c||i,onClick:He},"table"):null;if(e===O.TOOLBAR_OPTION_SIGNATURE)return m.signature?s.jsx(C.ToolbarButton,{icon:p.signature,title:"Sign pad",active:be,disabled:c||i,onClick:()=>_e(!0)},O.TOOLBAR_OPTION_SIGNATURE):null;if(e===O.TOOLBAR_OPTION_FIND_REPLACE)return m.findReplace?s.jsx(C.ToolbarButton,{icon:p.findReplace,title:"Find and replace",active:Le,disabled:c||i,onClick:()=>Se(o=>!o)},O.TOOLBAR_OPTION_FIND_REPLACE):null;if(e===O.TOOLBAR_OPTION_HORIZONTAL_RULE)return m.horizontalRule?s.jsx(C.ToolbarButton,{icon:p.horizontalRule,title:"Horizontal rule",disabled:c||i,onClick:()=>{var o;(o=r.current)==null||o.focus(),a.insertHTML("<hr />"),d()}},O.TOOLBAR_OPTION_HORIZONTAL_RULE):null;if(e==="undo")return s.jsx(C.ToolbarButton,{icon:p.undo,title:"Undo",disabled:c||i,onClick:Oe},"undo");if(e==="redo")return s.jsx(C.ToolbarButton,{icon:p.redo,title:"Redo",disabled:c||i,onClick:Ne},"redo");if(e==="trackChanges")return m.trackChanges?s.jsx(C.ToolbarButton,{icon:p.trackChanges,title:"Track changes",active:H,disabled:c||i,onClick:()=>Ht(!H)},"trackChanges"):null;if(e==="comments")return m.comments?s.jsx(C.ToolbarButton,{icon:p.comments,title:"Comments",active:Z,disabled:c||i,onClick:()=>{Z?J(!1):Bt()}},"comments"):null;if(e==="ai")return!m.ai||!(h!=null&&h.enabled)?null:s.jsx(C.ToolbarButton,{icon:p.ai,title:"Ink AI",active:Ce,disabled:c||i,onClick:()=>X(o=>!o)},"ai");const n=f.INK_BUTTON_CONFIG[e];return n?s.jsx(C.ToolbarButton,{icon:p[e]??e.slice(0,1).toUpperCase(),title:n.title,active:lt.has(e),disabled:c||i,onClick:()=>yt(e)},e):null},Ut=typeof K=="number"?`${K}px`:K,Mt=typeof V=="number"?`${V}px`:V,Dt=!!(h!=null&&h.enabled&&Ce);return s.jsxs("div",{className:qt.cn(f.INK_CLASS_ROOT,qe),"data-testid":Ke,"data-disabled":c||void 0,"data-variant":Ge,"data-premium":A.active||void 0,"data-wysiwyg":ct||void 0,style:{...at,...et},...tt,children:[s.jsx("div",{className:f.INK_CLASS_TOOLBAR,role:"toolbar","aria-label":"Ink formatting toolbar",children:De.map(Ft)}),s.jsx(Yt.SignPad,{open:be,onClose:()=>_e(!1),onConfirm:e=>{var t;(t=r.current)==null||t.focus(),a.insertImage(e),d()}}),s.jsx(Jt.FindReplace,{open:Le,onClose:()=>Se(!1),onReplace:(e,t,n)=>{if(!r.current)return;const o=Gt.replaceInHtml(r.current.innerHTML,e,t,n);_(o)}}),H&&m.trackChanges?s.jsx(Qt.TrackChangesBar,{changes:k,onAccept:ye,onReject:we,onAcceptAll:()=>k.forEach(e=>ye(e.id)),onRejectAll:()=>k.forEach(e=>we(e.id))}):null,s.jsxs("div",{className:f.INK_CLASS_SHELL,children:[s.jsxs("div",{className:f.INK_CLASS_BODY,children:[m.blocks?s.jsx(Xt.BlockHandles,{visible:St&&!c&&!i,top:_t,onMoveUp:()=>Ee("up"),onMoveDown:()=>Ee("down")}):null,s.jsx("div",{ref:r,className:f.INK_CLASS_CONTENT,contentEditable:!c&&!i,role:"textbox","aria-multiline":"true","aria-placeholder":oe,"data-placeholder":oe,suppressContentEditableWarning:!0,style:{minHeight:Ut,maxHeight:Mt},onInput:d,onBlur:Nt,onKeyUp:D,onKeyDown:vt,onMouseUp:D,onPaste:e=>{Pt(e)}}),xe?s.jsx(Zt.SlashMenu,{items:xt,top:Ie.top,left:Ie.left,onSelect:jt}):null]}),Z&&m.comments?s.jsx($t.CommentsPanel,{comments:B,author:x,onClose:()=>J(!1),onResolve:e=>{const t=B.find(n=>n.id===e);Y(B.map(n=>n.id===e?{...n,resolved:!0}:n)),t&&r.current&&_(te.removeCommentMark(r.current.innerHTML,t.highlightId))},onAddReply:(e,t)=>{Y(B.map(n=>n.id===e?{...n,replies:[...n.replies,{id:ve.createInkId("reply"),author:x,body:t,timestamp:Date.now()}]}:n))}}):null,Dt&&h?s.jsx(zt.AiPanel,{config:h,documentHtml:((Be=r.current)==null?void 0:Be.innerHTML)??T??"",selectionHtml:Te,onClose:()=>X(!1),onApplyHtml:e=>{var t;if((t=r.current)==null||t.focus(),Te)a.insertHTML(e);else{_(e);return}d()}}):null]}),ce?s.jsxs("div",{className:f.INK_CLASS_FOOTER,children:[mt,ae?` / ${ae}`:""]}):null]})};exports.InkEditor=en;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),u=require("react"),ee=require("../../constants/numbers.cjs"),y=require("../../constants/toolbar.const.cjs"),f=require("../../constants/defaults.const.cjs"),ve=require("../../constants/premium.const.cjs"),qt=require("../../utils/cn.utils.cjs"),Kt=require("../../utils/typo.utils.cjs"),je=require("../../utils/id.utils.cjs"),Vt=require("../../utils/table.utils.cjs"),q=require("../../utils/blocks.utils.cjs"),L=require("../../utils/trackChanges.utils.cjs"),te=require("../../utils/comments.utils.cjs"),ne=require("../../utils/history.utils.cjs"),Fe=require("../../utils/slash.utils.cjs"),x=require("../../utils/premium.utils.cjs"),re=require("../../utils/paste.utils.cjs"),Me=require("../../utils/memory.utils.cjs"),Gt=require("../../utils/findReplace.utils.cjs"),a=require("./helpers/format.utils.cjs"),C=require("./components/ToolbarButton/ToolbarButton.cjs"),Wt=require("./components/ToolbarDropdown/ToolbarDropdown.cjs"),Ue=require("./components/ToolbarColorPicker/ToolbarColorPicker.cjs"),$t=require("./components/CommentsPanel/CommentsPanel.cjs"),zt=require("./components/AiPanel/AiPanel.cjs"),Xt=require("./components/BlockHandles/BlockHandles.cjs"),Zt=require("./components/SlashMenu/SlashMenu.cjs"),Qt=require("./components/TrackChangesBar/TrackChangesBar.cjs"),Yt=require("./components/SignPad/SignPad.cjs"),Jt=require("./components/FindReplace/FindReplace.cjs"),oe=()=>{const N=window.getSelection();if(!N||N.rangeCount===0)return"";const T=N.getRangeAt(0),I=document.createElement("div");return I.appendChild(T.cloneContents()),I.innerHTML},en=N=>{var Pe;const{value:T,defaultValue:I="",onChange:k,placeholder:se=f.INK_PLACEHOLDER_DEFAULT,disabled:c=!1,readOnly:i=!1,minHeight:K=ee.INK_MIN_HEIGHT,maxHeight:V,toolbar:De=f.INK_DEFAULT_TOOLBAR,className:qe="",testId:Ke,allowImagePaste:ce=!0,showCharCount:ae=!1,charCountMax:ie,typoAutoFix:Ve=!0,variant:Ge=f.INK_DEFAULT_VARIANT,features:We,author:A=f.INK_DEFAULT_AUTHOR,trackChanges:w,onTrackChangesChange:G,trackChangesEnabled:M,onTrackChangesEnabledChange:W,comments:R,onCommentsChange:$,showCommentsPanel:E,onShowCommentsPanelChange:z,ai:h,slashCommands:$e,tableRows:ze=f.INK_TABLE_DEFAULT_ROWS,tableCols:Xe=f.INK_TABLE_DEFAULT_COLS,premium:Ze,theme:Qe,icons:le,pasteMode:Ye="plain",onImageUpload:ue,wysiwyg:Je=!1,keepInMemory:de=!1,memoryKey:me,style:et,...tt}=N,m={...f.INK_DEFAULT_FEATURES,...We},H=x.resolveInkPremium(Ze),nt=x.hasInkPremiumFeature(H,"icons"),rt=x.hasInkPremiumFeature(H,"theme"),ot=x.hasInkPremiumFeature(H,"richPaste"),st=x.hasInkPremiumFeature(H,"imageUpload"),ct=x.hasInkPremiumFeature(H,"wysiwyg")&&Je,p=nt&&le?{...ve.INK_DEFAULT_ICONS,...le}:ve.INK_DEFAULT_ICONS,at=rt?x.themeTokensToStyle(Qe):{},it=ot&&Ye==="rich",r=u.useRef(null),B=u.useRef(new ne.InkHistoryStack(T??I)),[lt,ut]=u.useState(new Set),[dt,fe]=u.useState("p"),[mt,ft]=u.useState(0),[ht,pt]=u.useState(ee.INK_DEFAULT_TEXT_COLOR),[gt,Ct]=u.useState(ee.INK_DEFAULT_HIGHLIGHT_COLOR),[O,he]=u.useState(M??!1),[Tt,pe]=u.useState(w??[]),[kt,ge]=u.useState(R??[]),[It,Ce]=u.useState(E??!1),[Te,X]=u.useState(!!(h!=null&&h.enabled&&h.openOnInit)),[ke,bt]=u.useState(""),[_t,Lt]=u.useState(0),[St,Ie]=u.useState(!1),[xt,U]=u.useState([]),[be,At]=u.useState({top:0,left:0}),[_e,Le]=u.useState(!1),[Se,xe]=u.useState(!1),b=w??Tt,P=R??kt,Z=E??It,Ae=$e??m.slash;u.useEffect(()=>{M!==void 0&&he(M)},[M]),u.useEffect(()=>{w&&pe(w)},[w]),u.useEffect(()=>{R&&ge(R)},[R]),u.useEffect(()=>{E!==void 0&&Ce(E)},[E]),u.useEffect(()=>{!r.current||T===void 0||r.current.innerHTML!==T&&(r.current.innerHTML=T)},[T]),u.useEffect(()=>{if(!r.current)return;const e=de?Me.readInkMemory(me):"";if(e){r.current.innerHTML=e,B.current=new ne.InkHistoryStack(e),k==null||k(e);return}T===void 0&&I&&(r.current.innerHTML=I,B.current=new ne.InkHistoryStack(I),k==null||k(I))},[]);const Q=e=>{var t;B.current.push(e),k==null||k(e),de&&Me.writeInkMemory(e,me),ae&&r.current&&ft(((t=r.current.textContent)==null?void 0:t.length)??0)},S=e=>{r.current&&(r.current.innerHTML=e,Q(e))},v=e=>{pe(e),G==null||G(e)},Y=e=>{ge(e),$==null||$(e)},J=e=>{Ce(e),z==null||z(e)},Ht=e=>{he(e),W==null||W(e)},D=()=>{ut(a.getActiveFormats());const e=a.queryCommandValue("formatBlock");if(e&&fe(e.toLowerCase().replace(/[<>]/g,"")),bt(oe()),!r.current||!m.blocks)return;const t=window.getSelection(),n=(t==null?void 0:t.anchorNode)??null,o=q.getBlockElement(n,r.current);if(q.markActiveBlock(r.current,o),o){const l=r.current.getBoundingClientRect(),g=o.getBoundingClientRect();Lt(g.top-l.top+r.current.scrollTop),Ie(!0)}else Ie(!1)},d=()=>{var t,n,o;if(!r.current)return;let e=r.current.innerHTML;if(O&&m.trackChanges){const l=window.getSelection();if(l&&!l.isCollapsed){const g=oe();if(g){const _=L.createTrackChange("delete",g,A);v([...b,_]),Ot(_.id),e=r.current.innerHTML}}}if(Q(e),D(),Ae&&r.current){const l=((n=(t=window.getSelection())==null?void 0:t.anchorNode)==null?void 0:n.textContent)??"",g=Fe.extractSlashQuery(l);if(g!==null){U(Fe.filterSlashCommands(g));const _=(o=window.getSelection())==null?void 0:o.getRangeAt(0);if(_&&r.current){const j=_.getBoundingClientRect(),F=r.current.getBoundingClientRect();At({top:j.bottom-F.top+8,left:j.left-F.left})}}else U([])}},Ot=e=>{const t=window.getSelection();if(!t||t.rangeCount===0)return;const n=oe();n&&a.insertHTML(L.wrapDeleteHtml(n,e))},yt=()=>{if(!r.current||!Ve||!m.typoAutoFix||c||i)return;const e=r.current.innerHTML,t=Kt.applyTypoAutoFix(e);t.html!==e&&(r.current.innerHTML=t.html,Q(t.html))},Nt=e=>{var n;if(c||i)return;(n=r.current)==null||n.focus();const t=f.INK_BUTTON_CONFIG[e];t&&(t.value?a.execCommand(t.command,t.value):a.execCommand(t.command),d())},wt=e=>{var t;c||i||((t=r.current)==null||t.focus(),a.execCommand("formatBlock",e),fe(e),d())},Rt=()=>{var t;if(c||i)return;const e=window.prompt("Enter URL:","https://");e&&((t=r.current)==null||t.focus(),a.insertLink(e),d())},He=async e=>st&&ue?ue(e):a.fileToDataUrl(e),Et=async()=>{if(c||i)return;const e=document.createElement("input");e.type="file",e.accept="image/*",e.onchange=async()=>{var o,l;const t=(o=e.files)==null?void 0:o[0];if(!t)return;const n=await He(t);(l=r.current)==null||l.focus(),a.insertImage(n,t.name),d()},e.click()},Oe=()=>{var t;if(c||i||!m.table)return;(t=r.current)==null||t.focus();const e=Vt.buildTableHtml(ze,Xe);if(O&&m.trackChanges){const n=L.createTrackChange("insert",e,A);v([...b,n]),a.insertHTML(L.wrapInsertHtml(e,n.id))}else a.insertHTML(e);d()},ye=()=>{const e=B.current.undo();if(e===null||!r.current){a.execCommand("undo"),d();return}S(e)},Ne=()=>{const e=B.current.redo();if(e===null||!r.current){a.execCommand("redo"),d();return}S(e)},Bt=()=>{var l;if(c||i||!m.comments)return;const e=window.prompt("Comment:");if(!(e!=null&&e.trim()))return;const t=je.createInkId("hl");if((l=r.current)==null||l.focus(),!te.wrapSelectionAsComment(t))return;const o=te.createCommentThread(A,e.trim(),t);Y([o,...P]),J(!0),d()},we=e=>{if(!r.current)return;const t=L.acceptTrackChangeInHtml(r.current.innerHTML,e);S(t),v(b.map(n=>n.id===e?{...n,accepted:!0}:n))},Re=e=>{if(!r.current)return;const t=L.rejectTrackChangeInHtml(r.current.innerHTML,e);S(t),v(b.map(n=>n.id===e?{...n,rejected:!0}:n))},Ee=async e=>{const t=await He(e),n=`<img src="${t}" alt="" style="max-width:100%;height:auto;" />`;if(O&&m.trackChanges){const o=L.createTrackChange("insert",n,A);v([...b,o]),a.insertHTML(L.wrapInsertHtml(n,o.id))}else a.insertImage(t);d()},Pt=async e=>{if(c||i)return;const t=e.clipboardData;if(!t)return;if(it){const o=re.extractClipboardHtml(t);if(o){e.preventDefault();const g=re.sanitizePastedHtml(o);g&&(a.insertHTML(g),d());const _=t.items;if(ce&&_)for(const j of Array.from(_)){if(!j.type.startsWith("image/"))continue;const F=j.getAsFile();F&&await Ee(F)}return}const l=re.extractClipboardText(t);if(l){e.preventDefault(),a.insertHTML(l.replace(/\n/g,"<br />")),d();return}}if(!ce)return;const n=t.items;if(n)for(const o of Array.from(n)){if(!o.type.startsWith("image/"))continue;e.preventDefault();const l=o.getAsFile();l&&await Ee(l)}},vt=e=>{e.key==="Escape"&&U([]),(e.metaKey||e.ctrlKey)&&e.key==="z"&&(e.preventDefault(),e.shiftKey?Ne():ye())},jt=e=>{var n,o;(n=r.current)==null||n.focus();const t=window.getSelection();if((o=t==null?void 0:t.anchorNode)!=null&&o.textContent){const g=t.anchorNode.textContent.replace(/(?:^|\s)\/[^\s]*$/," ");t.anchorNode.nodeType===Node.TEXT_NODE&&(t.anchorNode.textContent=g)}switch(U([]),e.insert){case"heading1":a.execCommand("formatBlock","h1");break;case"heading2":a.execCommand("formatBlock","h2");break;case"bulletList":a.execCommand("insertUnorderedList");break;case"orderedList":a.execCommand("insertOrderedList");break;case"table":Oe();return;case"ai":X(!0);break}d()},Be=e=>{if(!r.current)return;const t=window.getSelection(),n=q.getBlockElement((t==null?void 0:t.anchorNode)??null,r.current);n&&q.moveBlock(n,e)&&(d(),D())},Ft=(e,t)=>{if(e==="divider")return s.jsx("span",{className:f.INK_CLASS_DIVIDER},`divider-${t}`);if(e==="headingDropdown")return s.jsx(Wt.ToolbarDropdown,{title:"Heading",options:f.INK_HEADING_OPTIONS,value:dt||"p",disabled:c||i,onChange:wt},"heading");if(e==="textColor")return s.jsx(Ue.ToolbarColorPicker,{title:"Text color",type:"text",value:ht,disabled:c||i,onChange:o=>{var l;(l=r.current)==null||l.focus(),a.setTextColor(o),pt(o),d()}},"textColor");if(e==="highlightColor")return s.jsx(Ue.ToolbarColorPicker,{title:"Highlight color",type:"highlight",value:gt,disabled:c||i,onChange:o=>{var l;(l=r.current)==null||l.focus(),a.setHighlightColor(o),Ct(o),d()}},"highlightColor");if(e==="link")return s.jsx(C.ToolbarButton,{icon:p.link,title:"Insert link",disabled:c||i,onClick:Rt},"link");if(e==="image")return s.jsx(C.ToolbarButton,{icon:p.image,title:"Insert image",disabled:c||i,onClick:()=>{Et()}},"image");if(e==="table")return m.table?s.jsx(C.ToolbarButton,{icon:p.table,title:"Insert table",disabled:c||i,onClick:Oe},"table"):null;if(e===y.TOOLBAR_OPTION_SIGNATURE)return m.signature?s.jsx(C.ToolbarButton,{icon:p.signature,title:"Sign pad",active:_e,disabled:c||i,onClick:()=>Le(!0)},y.TOOLBAR_OPTION_SIGNATURE):null;if(e===y.TOOLBAR_OPTION_FIND_REPLACE)return m.findReplace?s.jsx(C.ToolbarButton,{icon:p.findReplace,title:"Find and replace",active:Se,disabled:c||i,onClick:()=>xe(o=>!o)},y.TOOLBAR_OPTION_FIND_REPLACE):null;if(e===y.TOOLBAR_OPTION_HORIZONTAL_RULE)return m.horizontalRule?s.jsx(C.ToolbarButton,{icon:p.horizontalRule,title:"Horizontal rule",disabled:c||i,onClick:()=>{var o;(o=r.current)==null||o.focus(),a.insertHTML("<hr />"),d()}},y.TOOLBAR_OPTION_HORIZONTAL_RULE):null;if(e==="undo")return s.jsx(C.ToolbarButton,{icon:p.undo,title:"Undo",disabled:c||i,onClick:ye},"undo");if(e==="redo")return s.jsx(C.ToolbarButton,{icon:p.redo,title:"Redo",disabled:c||i,onClick:Ne},"redo");if(e==="trackChanges")return m.trackChanges?s.jsx(C.ToolbarButton,{icon:p.trackChanges,title:"Track changes",active:O,disabled:c||i,onClick:()=>Ht(!O)},"trackChanges"):null;if(e==="comments")return m.comments?s.jsx(C.ToolbarButton,{icon:p.comments,title:"Comments",active:Z,disabled:c||i,onClick:()=>{Z?J(!1):Bt()}},"comments"):null;if(e==="ai")return!m.ai||!(h!=null&&h.enabled)?null:s.jsx(C.ToolbarButton,{icon:p.ai,title:"Ink AI",active:Te,disabled:c||i,onClick:()=>X(o=>!o)},"ai");const n=f.INK_BUTTON_CONFIG[e];return n?s.jsx(C.ToolbarButton,{icon:p[e]??e.slice(0,1).toUpperCase(),title:n.title,active:lt.has(e),disabled:c||i,onClick:()=>Nt(e)},e):null},Mt=typeof K=="number"?`${K}px`:K,Ut=typeof V=="number"?`${V}px`:V,Dt=!!(h!=null&&h.enabled&&Te);return s.jsxs("div",{className:qt.cn(f.INK_CLASS_ROOT,qe),"data-testid":Ke,"data-disabled":c||void 0,"data-variant":Ge,"data-premium":H.active||void 0,"data-wysiwyg":ct||void 0,style:{...at,...et},...tt,children:[s.jsx("div",{className:f.INK_CLASS_TOOLBAR,role:"toolbar","aria-label":"Ink formatting toolbar",children:De.map(Ft)}),s.jsx(Yt.SignPad,{open:_e,onClose:()=>Le(!1),onConfirm:e=>{var t;(t=r.current)==null||t.focus(),a.insertImage(e),d()}}),s.jsx(Jt.FindReplace,{open:Se,onClose:()=>xe(!1),onReplace:(e,t,n)=>{if(!r.current)return;const o=Gt.replaceInHtml(r.current.innerHTML,e,t,n);S(o)}}),O&&m.trackChanges?s.jsx(Qt.TrackChangesBar,{changes:b,onAccept:we,onReject:Re,onAcceptAll:()=>b.forEach(e=>we(e.id)),onRejectAll:()=>b.forEach(e=>Re(e.id))}):null,s.jsxs("div",{className:f.INK_CLASS_SHELL,children:[s.jsxs("div",{className:f.INK_CLASS_BODY,children:[m.blocks?s.jsx(Xt.BlockHandles,{visible:St&&!c&&!i,top:_t,onMoveUp:()=>Be("up"),onMoveDown:()=>Be("down")}):null,s.jsx("div",{ref:r,className:f.INK_CLASS_CONTENT,contentEditable:!c&&!i,role:"textbox","aria-multiline":"true","aria-placeholder":se,"data-placeholder":se,suppressContentEditableWarning:!0,style:{minHeight:Mt,maxHeight:Ut},onInput:d,onBlur:yt,onKeyUp:D,onKeyDown:vt,onMouseUp:D,onPaste:e=>{Pt(e)}}),Ae?s.jsx(Zt.SlashMenu,{items:xt,top:be.top,left:be.left,onSelect:jt}):null]}),Z&&m.comments?s.jsx($t.CommentsPanel,{comments:P,author:A,onClose:()=>J(!1),onResolve:e=>{const t=P.find(n=>n.id===e);Y(P.map(n=>n.id===e?{...n,resolved:!0}:n)),t&&r.current&&S(te.removeCommentMark(r.current.innerHTML,t.highlightId))},onAddReply:(e,t)=>{Y(P.map(n=>n.id===e?{...n,replies:[...n.replies,{id:je.createInkId("reply"),author:A,body:t,timestamp:Date.now()}]}:n))}}):null,Dt&&h?s.jsx(zt.AiPanel,{config:h,documentHtml:((Pe=r.current)==null?void 0:Pe.innerHTML)??T??"",selectionHtml:ke,onClose:()=>X(!1),onApplyHtml:e=>{var t;if((t=r.current)==null||t.focus(),ke)a.insertHTML(e);else{S(e);return}d()}}):null]}),ae?s.jsxs("div",{className:f.INK_CLASS_FOOTER,children:[mt,ie?` / ${ie}`:""]}):null]})};exports.InkEditor=en;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InkEditor.d.ts","sourceRoot":"","sources":["../../../src/components/InkEditor/InkEditor.tsx"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,EAAE,EAIR,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAEV,cAAc,EAIf,MAAM,aAAa,CAAC;AAwFrB,eAAO,MAAM,SAAS,EAAE,EAAE,CAAC,cAAc,
|
|
1
|
+
{"version":3,"file":"InkEditor.d.ts","sourceRoot":"","sources":["../../../src/components/InkEditor/InkEditor.tsx"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,EAAE,EAIR,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAEV,cAAc,EAIf,MAAM,aAAa,CAAC;AAwFrB,eAAO,MAAM,SAAS,EAAE,EAAE,CAAC,cAAc,CAkzBxC,CAAC"}
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import { jsxs as M, jsx as a } from "react/jsx-runtime";
|
|
2
|
-
import { useRef as
|
|
2
|
+
import { useRef as Pe, useState as m, useEffect as _ } from "react";
|
|
3
3
|
import { INK_MIN_HEIGHT as Wt, INK_DEFAULT_TEXT_COLOR as $t, INK_DEFAULT_HIGHLIGHT_COLOR as zt } from "../../constants/numbers.js";
|
|
4
|
-
import { TOOLBAR_OPTION_SIGNATURE as
|
|
5
|
-
import { INK_PLACEHOLDER_DEFAULT as qt, INK_DEFAULT_TOOLBAR as Xt, INK_DEFAULT_VARIANT as Qt, INK_DEFAULT_AUTHOR as Yt, INK_TABLE_DEFAULT_ROWS as Zt, INK_TABLE_DEFAULT_COLS as Jt, INK_DEFAULT_FEATURES as en, INK_CLASS_TOOLBAR as tn, INK_CLASS_SHELL as nn, INK_CLASS_BODY as rn, INK_CLASS_CONTENT as on, INK_CLASS_FOOTER as cn, INK_CLASS_DIVIDER as sn, INK_HEADING_OPTIONS as an, INK_BUTTON_CONFIG as
|
|
6
|
-
import { INK_DEFAULT_ICONS as
|
|
4
|
+
import { TOOLBAR_OPTION_SIGNATURE as xe, TOOLBAR_OPTION_FIND_REPLACE as Be, TOOLBAR_OPTION_HORIZONTAL_RULE as Ue } from "../../constants/toolbar.const.js";
|
|
5
|
+
import { INK_PLACEHOLDER_DEFAULT as qt, INK_DEFAULT_TOOLBAR as Xt, INK_DEFAULT_VARIANT as Qt, INK_DEFAULT_AUTHOR as Yt, INK_TABLE_DEFAULT_ROWS as Zt, INK_TABLE_DEFAULT_COLS as Jt, INK_DEFAULT_FEATURES as en, INK_CLASS_TOOLBAR as tn, INK_CLASS_SHELL as nn, INK_CLASS_BODY as rn, INK_CLASS_CONTENT as on, INK_CLASS_FOOTER as cn, INK_CLASS_DIVIDER as sn, INK_HEADING_OPTIONS as an, INK_BUTTON_CONFIG as De, INK_CLASS_ROOT as ln } from "../../constants/defaults.const.js";
|
|
6
|
+
import { INK_DEFAULT_ICONS as Fe } from "../../constants/premium.const.js";
|
|
7
7
|
import { cn as un } from "../../utils/cn.utils.js";
|
|
8
8
|
import { applyTypoAutoFix as mn } from "../../utils/typo.utils.js";
|
|
9
|
-
import { createInkId as
|
|
9
|
+
import { createInkId as Ke } from "../../utils/id.utils.js";
|
|
10
10
|
import { buildTableHtml as dn } from "../../utils/table.utils.js";
|
|
11
|
-
import { getBlockElement as
|
|
12
|
-
import { createTrackChange as J, rejectTrackChangeInHtml as hn, acceptTrackChangeInHtml as gn, wrapInsertHtml as
|
|
11
|
+
import { getBlockElement as Me, moveBlock as fn, markActiveBlock as pn } from "../../utils/blocks.utils.js";
|
|
12
|
+
import { createTrackChange as J, rejectTrackChangeInHtml as hn, acceptTrackChangeInHtml as gn, wrapInsertHtml as Ve, wrapDeleteHtml as Cn } from "../../utils/trackChanges.utils.js";
|
|
13
13
|
import { removeCommentMark as kn, wrapSelectionAsComment as Tn, createCommentThread as In } from "../../utils/comments.utils.js";
|
|
14
|
-
import { InkHistoryStack as
|
|
14
|
+
import { InkHistoryStack as ee } from "../../utils/history.utils.js";
|
|
15
15
|
import { extractSlashQuery as bn, filterSlashCommands as An } from "../../utils/slash.utils.js";
|
|
16
|
-
import { resolveInkPremium as Ln, hasInkPremiumFeature as
|
|
17
|
-
import { extractClipboardHtml as
|
|
16
|
+
import { resolveInkPremium as Ln, hasInkPremiumFeature as U, themeTokensToStyle as wn } from "../../utils/premium.utils.js";
|
|
17
|
+
import { extractClipboardHtml as Hn, sanitizePastedHtml as yn, extractClipboardText as _n } from "../../utils/paste.utils.js";
|
|
18
18
|
import { readInkMemory as Nn, writeInkMemory as Sn } from "../../utils/memory.utils.js";
|
|
19
19
|
import { replaceInHtml as Rn } from "../../utils/findReplace.utils.js";
|
|
20
|
-
import { insertImage as
|
|
20
|
+
import { insertImage as te, insertHTML as A, setTextColor as vn, setHighlightColor as On, getActiveFormats as En, queryCommandValue as Pn, execCommand as k, insertLink as xn, fileToDataUrl as Bn } from "./helpers/format.utils.js";
|
|
21
21
|
import { ToolbarButton as h } from "./components/ToolbarButton/ToolbarButton.js";
|
|
22
22
|
import { ToolbarDropdown as Un } from "./components/ToolbarDropdown/ToolbarDropdown.js";
|
|
23
23
|
import { ToolbarColorPicker as je } from "./components/ToolbarColorPicker/ToolbarColorPicker.js";
|
|
@@ -28,18 +28,18 @@ import { SlashMenu as Mn } from "./components/SlashMenu/SlashMenu.js";
|
|
|
28
28
|
import { TrackChangesBar as Vn } from "./components/TrackChangesBar/TrackChangesBar.js";
|
|
29
29
|
import { SignPad as jn } from "./components/SignPad/SignPad.js";
|
|
30
30
|
import { FindReplace as Gn } from "./components/FindReplace/FindReplace.js";
|
|
31
|
-
const
|
|
32
|
-
const
|
|
33
|
-
if (!
|
|
34
|
-
const g =
|
|
35
|
-
return
|
|
36
|
-
}, br = (
|
|
37
|
-
var
|
|
31
|
+
const ne = () => {
|
|
32
|
+
const N = window.getSelection();
|
|
33
|
+
if (!N || N.rangeCount === 0) return "";
|
|
34
|
+
const g = N.getRangeAt(0), T = document.createElement("div");
|
|
35
|
+
return T.appendChild(g.cloneContents()), T.innerHTML;
|
|
36
|
+
}, br = (N) => {
|
|
37
|
+
var Ee;
|
|
38
38
|
const {
|
|
39
39
|
value: g,
|
|
40
|
-
defaultValue:
|
|
41
|
-
onChange:
|
|
42
|
-
placeholder:
|
|
40
|
+
defaultValue: T = "",
|
|
41
|
+
onChange: C,
|
|
42
|
+
placeholder: re = qt,
|
|
43
43
|
disabled: c = !1,
|
|
44
44
|
readOnly: i = !1,
|
|
45
45
|
minHeight: V = Wt,
|
|
@@ -47,16 +47,16 @@ const te = () => {
|
|
|
47
47
|
toolbar: Ge = Xt,
|
|
48
48
|
className: We = "",
|
|
49
49
|
testId: $e,
|
|
50
|
-
allowImagePaste:
|
|
51
|
-
showCharCount:
|
|
52
|
-
charCountMax:
|
|
50
|
+
allowImagePaste: oe = !0,
|
|
51
|
+
showCharCount: ce = !1,
|
|
52
|
+
charCountMax: ie,
|
|
53
53
|
typoAutoFix: ze = !0,
|
|
54
54
|
variant: qe = Qt,
|
|
55
55
|
features: Xe,
|
|
56
|
-
author:
|
|
56
|
+
author: w = Yt,
|
|
57
57
|
trackChanges: S,
|
|
58
58
|
onTrackChangesChange: G,
|
|
59
|
-
trackChangesEnabled:
|
|
59
|
+
trackChangesEnabled: D,
|
|
60
60
|
onTrackChangesEnabledChange: W,
|
|
61
61
|
comments: R,
|
|
62
62
|
onCommentsChange: $,
|
|
@@ -68,53 +68,57 @@ const te = () => {
|
|
|
68
68
|
tableCols: Ze = Jt,
|
|
69
69
|
premium: Je,
|
|
70
70
|
theme: et,
|
|
71
|
-
icons:
|
|
71
|
+
icons: se,
|
|
72
72
|
pasteMode: tt = "plain",
|
|
73
|
-
onImageUpload:
|
|
73
|
+
onImageUpload: ae,
|
|
74
74
|
wysiwyg: nt = !1,
|
|
75
|
-
keepInMemory:
|
|
76
|
-
memoryKey:
|
|
75
|
+
keepInMemory: le = !1,
|
|
76
|
+
memoryKey: ue,
|
|
77
77
|
style: rt,
|
|
78
78
|
...ot
|
|
79
|
-
} =
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}, [
|
|
83
|
-
S &&
|
|
84
|
-
}, [S]),
|
|
85
|
-
R &&
|
|
86
|
-
}, [R]),
|
|
87
|
-
v !== void 0 &&
|
|
88
|
-
}, [v]),
|
|
79
|
+
} = N, u = { ...en, ...Xe }, H = Ln(Je), ct = U(H, "icons"), it = U(H, "theme"), st = U(H, "richPaste"), at = U(H, "imageUpload"), lt = U(H, "wysiwyg") && nt, f = ct && se ? { ...Fe, ...se } : Fe, ut = it ? wn(et) : {}, mt = st && tt === "rich", r = Pe(null), O = Pe(new ee(g ?? T)), [dt, ft] = m(/* @__PURE__ */ new Set()), [pt, me] = m("p"), [ht, gt] = m(0), [Ct, kt] = m($t), [Tt, It] = m(zt), [y, de] = m(D ?? !1), [bt, fe] = m(S ?? []), [At, pe] = m(R ?? []), [Lt, he] = m(v ?? !1), [ge, q] = m(!!(d != null && d.enabled && d.openOnInit)), [Ce, wt] = m(""), [Ht, yt] = m(0), [_t, ke] = m(!1), [Nt, F] = m([]), [Te, St] = m({ top: 0, left: 0 }), [Ie, be] = m(!1), [Ae, Le] = m(!1), I = S ?? bt, E = R ?? At, X = v ?? Lt, we = Qe ?? u.slash;
|
|
80
|
+
_(() => {
|
|
81
|
+
D !== void 0 && de(D);
|
|
82
|
+
}, [D]), _(() => {
|
|
83
|
+
S && fe(S);
|
|
84
|
+
}, [S]), _(() => {
|
|
85
|
+
R && pe(R);
|
|
86
|
+
}, [R]), _(() => {
|
|
87
|
+
v !== void 0 && he(v);
|
|
88
|
+
}, [v]), _(() => {
|
|
89
89
|
!r.current || g === void 0 || r.current.innerHTML !== g && (r.current.innerHTML = g);
|
|
90
|
-
}, [g]),
|
|
91
|
-
if (!r.current
|
|
92
|
-
const
|
|
93
|
-
|
|
90
|
+
}, [g]), _(() => {
|
|
91
|
+
if (!r.current) return;
|
|
92
|
+
const e = le ? Nn(ue) : "";
|
|
93
|
+
if (e) {
|
|
94
|
+
r.current.innerHTML = e, O.current = new ee(e), C == null || C(e);
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
g === void 0 && T && (r.current.innerHTML = T, O.current = new ee(T), C == null || C(T));
|
|
94
98
|
}, []);
|
|
95
99
|
const Q = (e) => {
|
|
96
100
|
var t;
|
|
97
|
-
|
|
98
|
-
},
|
|
101
|
+
O.current.push(e), C == null || C(e), le && Sn(e, ue), ce && r.current && gt(((t = r.current.textContent) == null ? void 0 : t.length) ?? 0);
|
|
102
|
+
}, L = (e) => {
|
|
99
103
|
r.current && (r.current.innerHTML = e, Q(e));
|
|
100
|
-
},
|
|
101
|
-
|
|
104
|
+
}, P = (e) => {
|
|
105
|
+
fe(e), G == null || G(e);
|
|
102
106
|
}, Y = (e) => {
|
|
103
|
-
|
|
107
|
+
pe(e), $ == null || $(e);
|
|
104
108
|
}, Z = (e) => {
|
|
105
|
-
|
|
109
|
+
he(e), z == null || z(e);
|
|
106
110
|
}, Rt = (e) => {
|
|
107
|
-
|
|
111
|
+
de(e), W == null || W(e);
|
|
108
112
|
}, K = () => {
|
|
109
113
|
ft(En());
|
|
110
114
|
const e = Pn("formatBlock");
|
|
111
|
-
if (e &&
|
|
112
|
-
const t = window.getSelection(), n = (t == null ? void 0 : t.anchorNode) ?? null, o =
|
|
115
|
+
if (e && me(e.toLowerCase().replace(/[<>]/g, "")), wt(ne()), !r.current || !u.blocks) return;
|
|
116
|
+
const t = window.getSelection(), n = (t == null ? void 0 : t.anchorNode) ?? null, o = Me(n, r.current);
|
|
113
117
|
if (pn(r.current, o), o) {
|
|
114
118
|
const s = r.current.getBoundingClientRect(), p = o.getBoundingClientRect();
|
|
115
|
-
|
|
119
|
+
yt(p.top - s.top + r.current.scrollTop), ke(!0);
|
|
116
120
|
} else
|
|
117
|
-
|
|
121
|
+
ke(!1);
|
|
118
122
|
}, l = () => {
|
|
119
123
|
var t, n, o;
|
|
120
124
|
if (!r.current) return;
|
|
@@ -122,23 +126,23 @@ const te = () => {
|
|
|
122
126
|
if (y && u.trackChanges) {
|
|
123
127
|
const s = window.getSelection();
|
|
124
128
|
if (s && !s.isCollapsed) {
|
|
125
|
-
const p =
|
|
129
|
+
const p = ne();
|
|
126
130
|
if (p) {
|
|
127
|
-
const
|
|
128
|
-
|
|
131
|
+
const b = J("delete", p, w);
|
|
132
|
+
P([...I, b]), vt(b.id), e = r.current.innerHTML;
|
|
129
133
|
}
|
|
130
134
|
}
|
|
131
135
|
}
|
|
132
|
-
if (Q(e), K(),
|
|
136
|
+
if (Q(e), K(), we && r.current) {
|
|
133
137
|
const s = ((n = (t = window.getSelection()) == null ? void 0 : t.anchorNode) == null ? void 0 : n.textContent) ?? "", p = bn(s);
|
|
134
138
|
if (p !== null) {
|
|
135
139
|
F(An(p));
|
|
136
|
-
const
|
|
137
|
-
if (
|
|
138
|
-
const
|
|
140
|
+
const b = (o = window.getSelection()) == null ? void 0 : o.getRangeAt(0);
|
|
141
|
+
if (b && r.current) {
|
|
142
|
+
const x = b.getBoundingClientRect(), B = r.current.getBoundingClientRect();
|
|
139
143
|
St({
|
|
140
|
-
top:
|
|
141
|
-
left:
|
|
144
|
+
top: x.bottom - B.top + 8,
|
|
145
|
+
left: x.left - B.left
|
|
142
146
|
});
|
|
143
147
|
}
|
|
144
148
|
} else
|
|
@@ -147,8 +151,8 @@ const te = () => {
|
|
|
147
151
|
}, vt = (e) => {
|
|
148
152
|
const t = window.getSelection();
|
|
149
153
|
if (!t || t.rangeCount === 0) return;
|
|
150
|
-
const n =
|
|
151
|
-
n &&
|
|
154
|
+
const n = ne();
|
|
155
|
+
n && A(Cn(n, e));
|
|
152
156
|
}, Ot = () => {
|
|
153
157
|
if (!r.current || !ze || !u.typoAutoFix || c || i) return;
|
|
154
158
|
const e = r.current.innerHTML, t = mn(e);
|
|
@@ -157,25 +161,25 @@ const te = () => {
|
|
|
157
161
|
var n;
|
|
158
162
|
if (c || i) return;
|
|
159
163
|
(n = r.current) == null || n.focus();
|
|
160
|
-
const t =
|
|
161
|
-
t && (t.value ?
|
|
164
|
+
const t = De[e];
|
|
165
|
+
t && (t.value ? k(t.command, t.value) : k(t.command), l());
|
|
162
166
|
}, Pt = (e) => {
|
|
163
167
|
var t;
|
|
164
|
-
c || i || ((t = r.current) == null || t.focus(),
|
|
168
|
+
c || i || ((t = r.current) == null || t.focus(), k("formatBlock", e), me(e), l());
|
|
165
169
|
}, xt = () => {
|
|
166
170
|
var t;
|
|
167
171
|
if (c || i) return;
|
|
168
172
|
const e = window.prompt("Enter URL:", "https://");
|
|
169
173
|
e && ((t = r.current) == null || t.focus(), xn(e), l());
|
|
170
|
-
},
|
|
174
|
+
}, He = async (e) => at && ae ? ae(e) : Bn(e), Bt = async () => {
|
|
171
175
|
if (c || i) return;
|
|
172
176
|
const e = document.createElement("input");
|
|
173
177
|
e.type = "file", e.accept = "image/*", e.onchange = async () => {
|
|
174
178
|
var o, s;
|
|
175
179
|
const t = (o = e.files) == null ? void 0 : o[0];
|
|
176
180
|
if (!t) return;
|
|
177
|
-
const n = await
|
|
178
|
-
(s = r.current) == null || s.focus(),
|
|
181
|
+
const n = await He(t);
|
|
182
|
+
(s = r.current) == null || s.focus(), te(n, t.name), l();
|
|
179
183
|
}, e.click();
|
|
180
184
|
}, ye = () => {
|
|
181
185
|
var t;
|
|
@@ -183,90 +187,90 @@ const te = () => {
|
|
|
183
187
|
(t = r.current) == null || t.focus();
|
|
184
188
|
const e = dn(Ye, Ze);
|
|
185
189
|
if (y && u.trackChanges) {
|
|
186
|
-
const n = J("insert", e,
|
|
187
|
-
|
|
190
|
+
const n = J("insert", e, w);
|
|
191
|
+
P([...I, n]), A(Ve(e, n.id));
|
|
188
192
|
} else
|
|
189
|
-
|
|
193
|
+
A(e);
|
|
190
194
|
l();
|
|
191
|
-
},
|
|
192
|
-
const e =
|
|
195
|
+
}, _e = () => {
|
|
196
|
+
const e = O.current.undo();
|
|
193
197
|
if (e === null || !r.current) {
|
|
194
|
-
|
|
198
|
+
k("undo"), l();
|
|
195
199
|
return;
|
|
196
200
|
}
|
|
197
|
-
|
|
198
|
-
},
|
|
199
|
-
const e =
|
|
201
|
+
L(e);
|
|
202
|
+
}, Ne = () => {
|
|
203
|
+
const e = O.current.redo();
|
|
200
204
|
if (e === null || !r.current) {
|
|
201
|
-
|
|
205
|
+
k("redo"), l();
|
|
202
206
|
return;
|
|
203
207
|
}
|
|
204
|
-
|
|
208
|
+
L(e);
|
|
205
209
|
}, Ut = () => {
|
|
206
210
|
var s;
|
|
207
211
|
if (c || i || !u.comments) return;
|
|
208
212
|
const e = window.prompt("Comment:");
|
|
209
213
|
if (!(e != null && e.trim())) return;
|
|
210
|
-
const t =
|
|
214
|
+
const t = Ke("hl");
|
|
211
215
|
if ((s = r.current) == null || s.focus(), !Tn(t)) return;
|
|
212
|
-
const o = In(
|
|
213
|
-
Y([o, ...
|
|
214
|
-
},
|
|
216
|
+
const o = In(w, e.trim(), t);
|
|
217
|
+
Y([o, ...E]), Z(!0), l();
|
|
218
|
+
}, Se = (e) => {
|
|
215
219
|
if (!r.current) return;
|
|
216
220
|
const t = gn(r.current.innerHTML, e);
|
|
217
|
-
|
|
218
|
-
|
|
221
|
+
L(t), P(
|
|
222
|
+
I.map((n) => n.id === e ? { ...n, accepted: !0 } : n)
|
|
219
223
|
);
|
|
220
|
-
},
|
|
224
|
+
}, Re = (e) => {
|
|
221
225
|
if (!r.current) return;
|
|
222
226
|
const t = hn(r.current.innerHTML, e);
|
|
223
|
-
|
|
224
|
-
|
|
227
|
+
L(t), P(
|
|
228
|
+
I.map((n) => n.id === e ? { ...n, rejected: !0 } : n)
|
|
225
229
|
);
|
|
226
|
-
},
|
|
227
|
-
const t = await
|
|
230
|
+
}, ve = async (e) => {
|
|
231
|
+
const t = await He(e), n = `<img src="${t}" alt="" style="max-width:100%;height:auto;" />`;
|
|
228
232
|
if (y && u.trackChanges) {
|
|
229
|
-
const o = J("insert", n,
|
|
230
|
-
|
|
233
|
+
const o = J("insert", n, w);
|
|
234
|
+
P([...I, o]), A(Ve(n, o.id));
|
|
231
235
|
} else
|
|
232
|
-
|
|
236
|
+
te(t);
|
|
233
237
|
l();
|
|
234
238
|
}, Dt = async (e) => {
|
|
235
239
|
if (c || i) return;
|
|
236
240
|
const t = e.clipboardData;
|
|
237
241
|
if (!t) return;
|
|
238
242
|
if (mt) {
|
|
239
|
-
const o =
|
|
243
|
+
const o = Hn(t);
|
|
240
244
|
if (o) {
|
|
241
245
|
e.preventDefault();
|
|
242
|
-
const p =
|
|
243
|
-
p && (
|
|
244
|
-
const
|
|
245
|
-
if (
|
|
246
|
-
for (const
|
|
247
|
-
if (!
|
|
248
|
-
const
|
|
249
|
-
|
|
246
|
+
const p = yn(o);
|
|
247
|
+
p && (A(p), l());
|
|
248
|
+
const b = t.items;
|
|
249
|
+
if (oe && b)
|
|
250
|
+
for (const x of Array.from(b)) {
|
|
251
|
+
if (!x.type.startsWith("image/")) continue;
|
|
252
|
+
const B = x.getAsFile();
|
|
253
|
+
B && await ve(B);
|
|
250
254
|
}
|
|
251
255
|
return;
|
|
252
256
|
}
|
|
253
257
|
const s = _n(t);
|
|
254
258
|
if (s) {
|
|
255
|
-
e.preventDefault(),
|
|
259
|
+
e.preventDefault(), A(s.replace(/\n/g, "<br />")), l();
|
|
256
260
|
return;
|
|
257
261
|
}
|
|
258
262
|
}
|
|
259
|
-
if (!
|
|
263
|
+
if (!oe) return;
|
|
260
264
|
const n = t.items;
|
|
261
265
|
if (n)
|
|
262
266
|
for (const o of Array.from(n)) {
|
|
263
267
|
if (!o.type.startsWith("image/")) continue;
|
|
264
268
|
e.preventDefault();
|
|
265
269
|
const s = o.getAsFile();
|
|
266
|
-
s && await
|
|
270
|
+
s && await ve(s);
|
|
267
271
|
}
|
|
268
272
|
}, Ft = (e) => {
|
|
269
|
-
e.key === "Escape" && F([]), (e.metaKey || e.ctrlKey) && e.key === "z" && (e.preventDefault(), e.shiftKey ?
|
|
273
|
+
e.key === "Escape" && F([]), (e.metaKey || e.ctrlKey) && e.key === "z" && (e.preventDefault(), e.shiftKey ? Ne() : _e());
|
|
270
274
|
}, Kt = (e) => {
|
|
271
275
|
var n, o;
|
|
272
276
|
(n = r.current) == null || n.focus();
|
|
@@ -277,16 +281,16 @@ const te = () => {
|
|
|
277
281
|
}
|
|
278
282
|
switch (F([]), e.insert) {
|
|
279
283
|
case "heading1":
|
|
280
|
-
|
|
284
|
+
k("formatBlock", "h1");
|
|
281
285
|
break;
|
|
282
286
|
case "heading2":
|
|
283
|
-
|
|
287
|
+
k("formatBlock", "h2");
|
|
284
288
|
break;
|
|
285
289
|
case "bulletList":
|
|
286
|
-
|
|
290
|
+
k("insertUnorderedList");
|
|
287
291
|
break;
|
|
288
292
|
case "orderedList":
|
|
289
|
-
|
|
293
|
+
k("insertOrderedList");
|
|
290
294
|
break;
|
|
291
295
|
case "table":
|
|
292
296
|
ye();
|
|
@@ -296,9 +300,9 @@ const te = () => {
|
|
|
296
300
|
break;
|
|
297
301
|
}
|
|
298
302
|
l();
|
|
299
|
-
},
|
|
303
|
+
}, Oe = (e) => {
|
|
300
304
|
if (!r.current) return;
|
|
301
|
-
const t = window.getSelection(), n =
|
|
305
|
+
const t = window.getSelection(), n = Me((t == null ? void 0 : t.anchorNode) ?? null, r.current);
|
|
302
306
|
n && fn(n, e) && (l(), K());
|
|
303
307
|
}, Mt = (e, t) => {
|
|
304
308
|
if (e === "divider")
|
|
@@ -380,31 +384,31 @@ const te = () => {
|
|
|
380
384
|
},
|
|
381
385
|
"table"
|
|
382
386
|
) : null;
|
|
383
|
-
if (e ===
|
|
387
|
+
if (e === xe)
|
|
384
388
|
return u.signature ? /* @__PURE__ */ a(
|
|
385
389
|
h,
|
|
386
390
|
{
|
|
387
391
|
icon: f.signature,
|
|
388
392
|
title: "Sign pad",
|
|
389
|
-
active:
|
|
393
|
+
active: Ie,
|
|
390
394
|
disabled: c || i,
|
|
391
|
-
onClick: () =>
|
|
395
|
+
onClick: () => be(!0)
|
|
392
396
|
},
|
|
393
|
-
|
|
397
|
+
xe
|
|
394
398
|
) : null;
|
|
395
|
-
if (e ===
|
|
399
|
+
if (e === Be)
|
|
396
400
|
return u.findReplace ? /* @__PURE__ */ a(
|
|
397
401
|
h,
|
|
398
402
|
{
|
|
399
403
|
icon: f.findReplace,
|
|
400
404
|
title: "Find and replace",
|
|
401
|
-
active:
|
|
405
|
+
active: Ae,
|
|
402
406
|
disabled: c || i,
|
|
403
|
-
onClick: () =>
|
|
407
|
+
onClick: () => Le((o) => !o)
|
|
404
408
|
},
|
|
405
|
-
|
|
409
|
+
Be
|
|
406
410
|
) : null;
|
|
407
|
-
if (e ===
|
|
411
|
+
if (e === Ue)
|
|
408
412
|
return u.horizontalRule ? /* @__PURE__ */ a(
|
|
409
413
|
h,
|
|
410
414
|
{
|
|
@@ -413,10 +417,10 @@ const te = () => {
|
|
|
413
417
|
disabled: c || i,
|
|
414
418
|
onClick: () => {
|
|
415
419
|
var o;
|
|
416
|
-
(o = r.current) == null || o.focus(),
|
|
420
|
+
(o = r.current) == null || o.focus(), A("<hr />"), l();
|
|
417
421
|
}
|
|
418
422
|
},
|
|
419
|
-
|
|
423
|
+
Ue
|
|
420
424
|
) : null;
|
|
421
425
|
if (e === "undo")
|
|
422
426
|
return /* @__PURE__ */ a(
|
|
@@ -425,7 +429,7 @@ const te = () => {
|
|
|
425
429
|
icon: f.undo,
|
|
426
430
|
title: "Undo",
|
|
427
431
|
disabled: c || i,
|
|
428
|
-
onClick:
|
|
432
|
+
onClick: _e
|
|
429
433
|
},
|
|
430
434
|
"undo"
|
|
431
435
|
);
|
|
@@ -436,7 +440,7 @@ const te = () => {
|
|
|
436
440
|
icon: f.redo,
|
|
437
441
|
title: "Redo",
|
|
438
442
|
disabled: c || i,
|
|
439
|
-
onClick:
|
|
443
|
+
onClick: Ne
|
|
440
444
|
},
|
|
441
445
|
"redo"
|
|
442
446
|
);
|
|
@@ -472,13 +476,13 @@ const te = () => {
|
|
|
472
476
|
{
|
|
473
477
|
icon: f.ai,
|
|
474
478
|
title: "Ink AI",
|
|
475
|
-
active:
|
|
479
|
+
active: ge,
|
|
476
480
|
disabled: c || i,
|
|
477
481
|
onClick: () => q((o) => !o)
|
|
478
482
|
},
|
|
479
483
|
"ai"
|
|
480
484
|
);
|
|
481
|
-
const n =
|
|
485
|
+
const n = De[e];
|
|
482
486
|
return n ? /* @__PURE__ */ a(
|
|
483
487
|
h,
|
|
484
488
|
{
|
|
@@ -490,7 +494,7 @@ const te = () => {
|
|
|
490
494
|
},
|
|
491
495
|
e
|
|
492
496
|
) : null;
|
|
493
|
-
}, Vt = typeof V == "number" ? `${V}px` : V, jt = typeof j == "number" ? `${j}px` : j, Gt = !!(d != null && d.enabled &&
|
|
497
|
+
}, Vt = typeof V == "number" ? `${V}px` : V, jt = typeof j == "number" ? `${j}px` : j, Gt = !!(d != null && d.enabled && ge);
|
|
494
498
|
return /* @__PURE__ */ M(
|
|
495
499
|
"div",
|
|
496
500
|
{
|
|
@@ -498,7 +502,7 @@ const te = () => {
|
|
|
498
502
|
"data-testid": $e,
|
|
499
503
|
"data-disabled": c || void 0,
|
|
500
504
|
"data-variant": qe,
|
|
501
|
-
"data-premium":
|
|
505
|
+
"data-premium": H.active || void 0,
|
|
502
506
|
"data-wysiwyg": lt || void 0,
|
|
503
507
|
style: { ...ut, ...rt },
|
|
504
508
|
...ot,
|
|
@@ -507,34 +511,34 @@ const te = () => {
|
|
|
507
511
|
/* @__PURE__ */ a(
|
|
508
512
|
jn,
|
|
509
513
|
{
|
|
510
|
-
open:
|
|
511
|
-
onClose: () =>
|
|
514
|
+
open: Ie,
|
|
515
|
+
onClose: () => be(!1),
|
|
512
516
|
onConfirm: (e) => {
|
|
513
517
|
var t;
|
|
514
|
-
(t = r.current) == null || t.focus(),
|
|
518
|
+
(t = r.current) == null || t.focus(), te(e), l();
|
|
515
519
|
}
|
|
516
520
|
}
|
|
517
521
|
),
|
|
518
522
|
/* @__PURE__ */ a(
|
|
519
523
|
Gn,
|
|
520
524
|
{
|
|
521
|
-
open:
|
|
522
|
-
onClose: () =>
|
|
525
|
+
open: Ae,
|
|
526
|
+
onClose: () => Le(!1),
|
|
523
527
|
onReplace: (e, t, n) => {
|
|
524
528
|
if (!r.current) return;
|
|
525
529
|
const o = Rn(r.current.innerHTML, e, t, n);
|
|
526
|
-
|
|
530
|
+
L(o);
|
|
527
531
|
}
|
|
528
532
|
}
|
|
529
533
|
),
|
|
530
534
|
y && u.trackChanges ? /* @__PURE__ */ a(
|
|
531
535
|
Vn,
|
|
532
536
|
{
|
|
533
|
-
changes:
|
|
534
|
-
onAccept:
|
|
535
|
-
onReject:
|
|
536
|
-
onAcceptAll: () =>
|
|
537
|
-
onRejectAll: () =>
|
|
537
|
+
changes: I,
|
|
538
|
+
onAccept: Se,
|
|
539
|
+
onReject: Re,
|
|
540
|
+
onAcceptAll: () => I.forEach((e) => Se(e.id)),
|
|
541
|
+
onRejectAll: () => I.forEach((e) => Re(e.id))
|
|
538
542
|
}
|
|
539
543
|
) : null,
|
|
540
544
|
/* @__PURE__ */ M("div", { className: nn, children: [
|
|
@@ -543,9 +547,9 @@ const te = () => {
|
|
|
543
547
|
Kn,
|
|
544
548
|
{
|
|
545
549
|
visible: _t && !c && !i,
|
|
546
|
-
top:
|
|
547
|
-
onMoveUp: () =>
|
|
548
|
-
onMoveDown: () =>
|
|
550
|
+
top: Ht,
|
|
551
|
+
onMoveUp: () => Oe("up"),
|
|
552
|
+
onMoveDown: () => Oe("down")
|
|
549
553
|
}
|
|
550
554
|
) : null,
|
|
551
555
|
/* @__PURE__ */ a(
|
|
@@ -556,8 +560,8 @@ const te = () => {
|
|
|
556
560
|
contentEditable: !c && !i,
|
|
557
561
|
role: "textbox",
|
|
558
562
|
"aria-multiline": "true",
|
|
559
|
-
"aria-placeholder":
|
|
560
|
-
"data-placeholder":
|
|
563
|
+
"aria-placeholder": re,
|
|
564
|
+
"data-placeholder": re,
|
|
561
565
|
suppressContentEditableWarning: !0,
|
|
562
566
|
style: { minHeight: Vt, maxHeight: jt },
|
|
563
567
|
onInput: l,
|
|
@@ -570,12 +574,12 @@ const te = () => {
|
|
|
570
574
|
}
|
|
571
575
|
}
|
|
572
576
|
),
|
|
573
|
-
|
|
577
|
+
we ? /* @__PURE__ */ a(
|
|
574
578
|
Mn,
|
|
575
579
|
{
|
|
576
580
|
items: Nt,
|
|
577
|
-
top:
|
|
578
|
-
left:
|
|
581
|
+
top: Te.top,
|
|
582
|
+
left: Te.left,
|
|
579
583
|
onSelect: Kt
|
|
580
584
|
}
|
|
581
585
|
) : null
|
|
@@ -583,27 +587,27 @@ const te = () => {
|
|
|
583
587
|
X && u.comments ? /* @__PURE__ */ a(
|
|
584
588
|
Dn,
|
|
585
589
|
{
|
|
586
|
-
comments:
|
|
587
|
-
author:
|
|
590
|
+
comments: E,
|
|
591
|
+
author: w,
|
|
588
592
|
onClose: () => Z(!1),
|
|
589
593
|
onResolve: (e) => {
|
|
590
|
-
const t =
|
|
594
|
+
const t = E.find((n) => n.id === e);
|
|
591
595
|
Y(
|
|
592
|
-
|
|
596
|
+
E.map(
|
|
593
597
|
(n) => n.id === e ? { ...n, resolved: !0 } : n
|
|
594
598
|
)
|
|
595
|
-
), t && r.current &&
|
|
599
|
+
), t && r.current && L(kn(r.current.innerHTML, t.highlightId));
|
|
596
600
|
},
|
|
597
601
|
onAddReply: (e, t) => {
|
|
598
602
|
Y(
|
|
599
|
-
|
|
603
|
+
E.map(
|
|
600
604
|
(n) => n.id === e ? {
|
|
601
605
|
...n,
|
|
602
606
|
replies: [
|
|
603
607
|
...n.replies,
|
|
604
608
|
{
|
|
605
|
-
id:
|
|
606
|
-
author:
|
|
609
|
+
id: Ke("reply"),
|
|
610
|
+
author: w,
|
|
607
611
|
body: t,
|
|
608
612
|
timestamp: Date.now()
|
|
609
613
|
}
|
|
@@ -618,15 +622,15 @@ const te = () => {
|
|
|
618
622
|
Fn,
|
|
619
623
|
{
|
|
620
624
|
config: d,
|
|
621
|
-
documentHtml: ((
|
|
622
|
-
selectionHtml:
|
|
625
|
+
documentHtml: ((Ee = r.current) == null ? void 0 : Ee.innerHTML) ?? g ?? "",
|
|
626
|
+
selectionHtml: Ce,
|
|
623
627
|
onClose: () => q(!1),
|
|
624
628
|
onApplyHtml: (e) => {
|
|
625
629
|
var t;
|
|
626
|
-
if ((t = r.current) == null || t.focus(),
|
|
627
|
-
|
|
630
|
+
if ((t = r.current) == null || t.focus(), Ce)
|
|
631
|
+
A(e);
|
|
628
632
|
else {
|
|
629
|
-
|
|
633
|
+
L(e);
|
|
630
634
|
return;
|
|
631
635
|
}
|
|
632
636
|
l();
|
|
@@ -634,9 +638,9 @@ const te = () => {
|
|
|
634
638
|
}
|
|
635
639
|
) : null
|
|
636
640
|
] }),
|
|
637
|
-
|
|
641
|
+
ce ? /* @__PURE__ */ M("div", { className: cn, children: [
|
|
638
642
|
ht,
|
|
639
|
-
|
|
643
|
+
ie ? ` / ${ie}` : ""
|
|
640
644
|
] }) : null
|
|
641
645
|
]
|
|
642
646
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),l=require("react"),a=require("../../../../constants/numbers.cjs"),n=require("./SignPad.const.cjs"),I=require("./SignPad.utils.cjs"),R=f=>{const{open:_,onClose:S,onConfirm:P,clearLabel:C=n.SIGN_PAD_DEFAULT_CLEAR,confirmLabel:E=n.SIGN_PAD_DEFAULT_CONFIRM,cancelLabel:D=n.SIGN_PAD_DEFAULT_CANCEL,title:d=n.SIGN_PAD_DEFAULT_TITLE}=f,r=l.useRef(null),s=l.useRef(!1),[N,u]=l.useState(!1);if(l.useEffect(()=>{if(!_){s.current=!1;return}const e=r.current,t=e==null?void 0:e.getContext("2d");!e||!t||(t.fillStyle=n.SIGN_PAD_FILL_STYLE,t.fillRect(a.NUMBER_ZERO,a.NUMBER_ZERO,e.width,e.height),t.strokeStyle=n.SIGN_PAD_STROKE_STYLE,t.lineWidth=n.SIGN_PAD_LINE_WIDTH,t.lineCap="round",t.lineJoin="round",s.current=!1,u(!1))},[_]),!_)return null;const L=e=>{const t=r.current,o=t==null?void 0:t.getContext("2d");if(!t||!o)return;s.current=!0,t.setPointerCapture(e.pointerId);const c=I.getCanvasPoint(t,e.clientX,e.clientY);o.beginPath(),o.moveTo(c.x,c.y)},b=e=>{if(!s.current)return;const t=r.current,o=t==null?void 0:t.getContext("2d");if(!t||!o)return;const c=I.getCanvasPoint(t,e.clientX,e.clientY);o.lineTo(c.x,c.y),o.stroke(),u(!0)},A=e=>{var t;s.current=!1,(t=r.current)==null||t.releasePointerCapture(e.pointerId)},h=()=>{const e=r.current,t=e==null?void 0:e.getContext("2d");!e||!t||(t.fillStyle=n.SIGN_PAD_FILL_STYLE,t.fillRect(a.NUMBER_ZERO,a.NUMBER_ZERO,e.width,e.height),u(!1))},g=()=>{const e=r.current;!e||!N||(P(e.toDataURL(n.SIGN_PAD_MIME)),S())};return i.jsxs("div",{className:n.SIGN_PAD_CLASS,role:"dialog","aria-modal":"true","aria-label":d,children:[i.jsx("p",{className:n.SIGN_PAD_TITLE_CLASS,children:d}),i.jsx("canvas",{ref:r,className:n.SIGN_PAD_CANVAS_CLASS,width:n.SIGN_PAD_CANVAS_WIDTH,height:n.SIGN_PAD_CANVAS_HEIGHT,onPointerDown:L,onPointerMove:b,onPointerUp:A,onPointerLeave:A}),i.jsxs("div",{className:n.SIGN_PAD_ACTIONS_CLASS,children:[i.jsx("button",{type:"button",className:"Ink-Editor__button",onClick:h,children:C}),i.jsx("button",{type:"button",className:"Ink-Editor__button",onClick:S,children:D}),i.jsx("button",{type:"button",className:"Ink-Editor__button Ink-Editor__button--active",disabled:!N,onClick:g,children:E})]})]})};exports.SignPad=R;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("../../../../constants/numbers.cjs"),S="Ink-SignPad flex flex-col gap-2 p-3 border-b",A="Ink-SignPad__canvas w-full max-w-xl h-44 border border-dashed rounded-lg bg-white cursor-crosshair",I="Ink-SignPad__actions flex flex-wrap gap-1",N="Ink-SignPad__title m-0 text-sm font-semibold",D="Sign here",
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("../../../../constants/numbers.cjs"),S="Ink-SignPad flex flex-col gap-2 p-3 border-b",A="Ink-SignPad__canvas w-full max-w-xl h-44 border border-dashed rounded-lg bg-white cursor-crosshair",I="Ink-SignPad__actions flex flex-wrap gap-1",N="Ink-SignPad__title m-0 text-sm font-semibold",D="Sign here",n="Clear",L="Insert",P="Cancel",T=480,G=180,e=_.NUMBER_TWO,o="#111827",t="#ffffff",E="image/png";exports.SIGN_PAD_ACTIONS_CLASS=I;exports.SIGN_PAD_CANVAS_CLASS=A;exports.SIGN_PAD_CANVAS_HEIGHT=G;exports.SIGN_PAD_CANVAS_WIDTH=T;exports.SIGN_PAD_CLASS=S;exports.SIGN_PAD_DEFAULT_CANCEL=P;exports.SIGN_PAD_DEFAULT_CLEAR=n;exports.SIGN_PAD_DEFAULT_CONFIRM=L;exports.SIGN_PAD_DEFAULT_TITLE=D;exports.SIGN_PAD_FILL_STYLE=t;exports.SIGN_PAD_LINE_WIDTH=e;exports.SIGN_PAD_MIME=E;exports.SIGN_PAD_STROKE_STYLE=o;exports.SIGN_PAD_TITLE_CLASS=N;
|
|
@@ -14,4 +14,11 @@ export declare const SIGN_PAD_FILL_STYLE = "#ffffff";
|
|
|
14
14
|
export declare const SIGN_PAD_MIME = "image/png";
|
|
15
15
|
export declare const SIGN_PAD_EMPTY_ALPHA_THRESHOLD = 4;
|
|
16
16
|
export declare const SIGN_PAD_SAMPLE_STEP = 6;
|
|
17
|
+
export declare const SIGN_PAD_FILL_CHANNEL = 255;
|
|
18
|
+
export declare const SIGN_PAD_INK_CHANNEL_MAX = 250;
|
|
19
|
+
export declare const SIGN_PAD_RGBA_STRIDE = 4;
|
|
20
|
+
export declare const SIGN_PAD_RED_OFFSET = 0;
|
|
21
|
+
export declare const SIGN_PAD_GREEN_OFFSET = 1;
|
|
22
|
+
export declare const SIGN_PAD_BLUE_OFFSET = 2;
|
|
23
|
+
export declare const SIGN_PAD_ALPHA_OFFSET = 3;
|
|
17
24
|
//# sourceMappingURL=SignPad.const.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SignPad.const.d.ts","sourceRoot":"","sources":["../../../../../src/components/InkEditor/components/SignPad/SignPad.const.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,cAAc,iDAAiD,CAAC;AAC7E,eAAO,MAAM,qBAAqB,uGAAuG,CAAC;AAC1I,eAAO,MAAM,sBAAsB,8CAA8C,CAAC;AAClF,eAAO,MAAM,oBAAoB,iDAAiD,CAAC;AACnF,eAAO,MAAM,sBAAsB,cAAc,CAAC;AAClD,eAAO,MAAM,sBAAsB,UAAU,CAAC;AAC9C,eAAO,MAAM,wBAAwB,WAAW,CAAC;AACjD,eAAO,MAAM,uBAAuB,WAAW,CAAC;AAChD,eAAO,MAAM,qBAAqB,MAAM,CAAC;AACzC,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAC1C,eAAO,MAAM,mBAAmB,IAAa,CAAC;AAC9C,eAAO,MAAM,qBAAqB,YAAY,CAAC;AAC/C,eAAO,MAAM,mBAAmB,YAAY,CAAC;AAC7C,eAAO,MAAM,aAAa,cAAc,CAAC;AACzC,eAAO,MAAM,8BAA8B,IAAc,CAAC;AAC1D,eAAO,MAAM,oBAAoB,IAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"SignPad.const.d.ts","sourceRoot":"","sources":["../../../../../src/components/InkEditor/components/SignPad/SignPad.const.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,cAAc,iDAAiD,CAAC;AAC7E,eAAO,MAAM,qBAAqB,uGAAuG,CAAC;AAC1I,eAAO,MAAM,sBAAsB,8CAA8C,CAAC;AAClF,eAAO,MAAM,oBAAoB,iDAAiD,CAAC;AACnF,eAAO,MAAM,sBAAsB,cAAc,CAAC;AAClD,eAAO,MAAM,sBAAsB,UAAU,CAAC;AAC9C,eAAO,MAAM,wBAAwB,WAAW,CAAC;AACjD,eAAO,MAAM,uBAAuB,WAAW,CAAC;AAChD,eAAO,MAAM,qBAAqB,MAAM,CAAC;AACzC,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAC1C,eAAO,MAAM,mBAAmB,IAAa,CAAC;AAC9C,eAAO,MAAM,qBAAqB,YAAY,CAAC;AAC/C,eAAO,MAAM,mBAAmB,YAAY,CAAC;AAC7C,eAAO,MAAM,aAAa,cAAc,CAAC;AACzC,eAAO,MAAM,8BAA8B,IAAc,CAAC;AAC1D,eAAO,MAAM,oBAAoB,IAAa,CAAC;AAC/C,eAAO,MAAM,qBAAqB,MAAgC,CAAC;AACnE,eAAO,MAAM,wBAAwB,MAA2B,CAAC;AACjE,eAAO,MAAM,oBAAoB,IAAc,CAAC;AAChD,eAAO,MAAM,mBAAmB,IAAI,CAAC;AACrC,eAAO,MAAM,qBAAqB,IAAI,CAAC;AACvC,eAAO,MAAM,oBAAoB,IAAI,CAAC;AACtC,eAAO,MAAM,qBAAqB,IAAI,CAAC"}
|
|
@@ -1,20 +1,18 @@
|
|
|
1
|
-
import { NUMBER_TWO as _
|
|
2
|
-
const
|
|
1
|
+
import { NUMBER_TWO as _ } from "../../../../constants/numbers.js";
|
|
2
|
+
const A = "Ink-SignPad flex flex-col gap-2 p-3 border-b", n = "Ink-SignPad__canvas w-full max-w-xl h-44 border border-dashed rounded-lg bg-white cursor-crosshair", I = "Ink-SignPad__actions flex flex-wrap gap-1", o = "Ink-SignPad__title m-0 text-sm font-semibold", t = "Sign here", s = "Clear", N = "Insert", c = "Cancel", e = 480, D = 180, r = _, P = "#111827", L = "#ffffff", a = "image/png";
|
|
3
3
|
export {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
I as SIGN_PAD_ACTIONS_CLASS,
|
|
5
|
+
n as SIGN_PAD_CANVAS_CLASS,
|
|
6
|
+
D as SIGN_PAD_CANVAS_HEIGHT,
|
|
7
|
+
e as SIGN_PAD_CANVAS_WIDTH,
|
|
8
|
+
A as SIGN_PAD_CLASS,
|
|
9
9
|
c as SIGN_PAD_DEFAULT_CANCEL,
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
r as
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
T as SIGN_PAD_STROKE_STYLE,
|
|
19
|
-
N as SIGN_PAD_TITLE_CLASS
|
|
10
|
+
s as SIGN_PAD_DEFAULT_CLEAR,
|
|
11
|
+
N as SIGN_PAD_DEFAULT_CONFIRM,
|
|
12
|
+
t as SIGN_PAD_DEFAULT_TITLE,
|
|
13
|
+
L as SIGN_PAD_FILL_STYLE,
|
|
14
|
+
r as SIGN_PAD_LINE_WIDTH,
|
|
15
|
+
a as SIGN_PAD_MIME,
|
|
16
|
+
P as SIGN_PAD_STROKE_STYLE,
|
|
17
|
+
o as SIGN_PAD_TITLE_CLASS
|
|
20
18
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SignPad.d.ts","sourceRoot":"","sources":["../../../../../src/components/InkEditor/components/SignPad/SignPad.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA+B,KAAK,EAAE,EAAqB,MAAM,OAAO,CAAC;AAkBhF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAGpD,eAAO,MAAM,OAAO,EAAE,EAAE,CAAC,YAAY,
|
|
1
|
+
{"version":3,"file":"SignPad.d.ts","sourceRoot":"","sources":["../../../../../src/components/InkEditor/components/SignPad/SignPad.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA+B,KAAK,EAAE,EAAqB,MAAM,OAAO,CAAC;AAkBhF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAGpD,eAAO,MAAM,OAAO,EAAE,EAAE,CAAC,YAAY,CA4GpC,CAAC"}
|
|
@@ -1,42 +1,45 @@
|
|
|
1
|
-
import { jsxs as f, jsx as
|
|
1
|
+
import { jsxs as f, jsx as l } from "react/jsx-runtime";
|
|
2
2
|
import { useRef as A, useState as p, useEffect as b } from "react";
|
|
3
|
-
import { NUMBER_ZERO as
|
|
4
|
-
import { SIGN_PAD_DEFAULT_TITLE as T, SIGN_PAD_DEFAULT_CLEAR as G, SIGN_PAD_DEFAULT_CONFIRM as g, SIGN_PAD_DEFAULT_CANCEL as x, SIGN_PAD_FILL_STYLE as I, SIGN_PAD_STROKE_STYLE as k, SIGN_PAD_LINE_WIDTH as R, SIGN_PAD_CLASS as
|
|
5
|
-
import { getCanvasPoint as C
|
|
6
|
-
const
|
|
3
|
+
import { NUMBER_ZERO as c } from "../../../../constants/numbers.js";
|
|
4
|
+
import { SIGN_PAD_DEFAULT_TITLE as T, SIGN_PAD_DEFAULT_CLEAR as G, SIGN_PAD_DEFAULT_CONFIRM as g, SIGN_PAD_DEFAULT_CANCEL as x, SIGN_PAD_FILL_STYLE as I, SIGN_PAD_STROKE_STYLE as k, SIGN_PAD_LINE_WIDTH as R, SIGN_PAD_CLASS as w, SIGN_PAD_TITLE_CLASS as y, SIGN_PAD_CANVAS_HEIGHT as U, SIGN_PAD_CANVAS_WIDTH as F, SIGN_PAD_CANVAS_CLASS as H, SIGN_PAD_ACTIONS_CLASS as M, SIGN_PAD_MIME as v } from "./SignPad.const.js";
|
|
5
|
+
import { getCanvasPoint as C } from "./SignPad.utils.js";
|
|
6
|
+
const J = (N) => {
|
|
7
7
|
const {
|
|
8
|
-
open:
|
|
8
|
+
open: a,
|
|
9
9
|
onClose: _,
|
|
10
10
|
onConfirm: D,
|
|
11
11
|
clearLabel: m = G,
|
|
12
12
|
confirmLabel: P = g,
|
|
13
13
|
cancelLabel: h = x,
|
|
14
14
|
title: u = T
|
|
15
|
-
} = N, n = A(null),
|
|
15
|
+
} = N, n = A(null), r = A(!1), [S, s] = p(!1);
|
|
16
16
|
if (b(() => {
|
|
17
|
-
if (!
|
|
17
|
+
if (!a) {
|
|
18
|
+
r.current = !1;
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
18
21
|
const e = n.current, t = e == null ? void 0 : e.getContext("2d");
|
|
19
|
-
!e || !t || (t.fillStyle = I, t.fillRect(
|
|
20
|
-
}, [
|
|
22
|
+
!e || !t || (t.fillStyle = I, t.fillRect(c, c, e.width, e.height), t.strokeStyle = k, t.lineWidth = R, t.lineCap = "round", t.lineJoin = "round", r.current = !1, s(!1));
|
|
23
|
+
}, [a]), !a) return null;
|
|
21
24
|
const L = (e) => {
|
|
22
25
|
const t = n.current, o = t == null ? void 0 : t.getContext("2d");
|
|
23
26
|
if (!t || !o) return;
|
|
24
|
-
|
|
25
|
-
const
|
|
26
|
-
o.beginPath(), o.moveTo(
|
|
27
|
+
r.current = !0, t.setPointerCapture(e.pointerId);
|
|
28
|
+
const i = C(t, e.clientX, e.clientY);
|
|
29
|
+
o.beginPath(), o.moveTo(i.x, i.y);
|
|
27
30
|
}, E = (e) => {
|
|
28
|
-
if (!
|
|
31
|
+
if (!r.current) return;
|
|
29
32
|
const t = n.current, o = t == null ? void 0 : t.getContext("2d");
|
|
30
33
|
if (!t || !o) return;
|
|
31
|
-
const
|
|
32
|
-
o.lineTo(
|
|
33
|
-
},
|
|
34
|
+
const i = C(t, e.clientX, e.clientY);
|
|
35
|
+
o.lineTo(i.x, i.y), o.stroke(), s(!0);
|
|
36
|
+
}, d = (e) => {
|
|
34
37
|
var t;
|
|
35
|
-
|
|
38
|
+
r.current = !1, (t = n.current) == null || t.releasePointerCapture(e.pointerId);
|
|
36
39
|
};
|
|
37
|
-
return /* @__PURE__ */ f("div", { className:
|
|
38
|
-
/* @__PURE__ */
|
|
39
|
-
/* @__PURE__ */
|
|
40
|
+
return /* @__PURE__ */ f("div", { className: w, role: "dialog", "aria-modal": "true", "aria-label": u, children: [
|
|
41
|
+
/* @__PURE__ */ l("p", { className: y, children: u }),
|
|
42
|
+
/* @__PURE__ */ l(
|
|
40
43
|
"canvas",
|
|
41
44
|
{
|
|
42
45
|
ref: n,
|
|
@@ -45,25 +48,25 @@ const K = (N) => {
|
|
|
45
48
|
height: U,
|
|
46
49
|
onPointerDown: L,
|
|
47
50
|
onPointerMove: E,
|
|
48
|
-
onPointerUp:
|
|
49
|
-
onPointerLeave:
|
|
51
|
+
onPointerUp: d,
|
|
52
|
+
onPointerLeave: d
|
|
50
53
|
}
|
|
51
54
|
),
|
|
52
|
-
/* @__PURE__ */ f("div", { className:
|
|
53
|
-
/* @__PURE__ */
|
|
55
|
+
/* @__PURE__ */ f("div", { className: M, children: [
|
|
56
|
+
/* @__PURE__ */ l("button", { type: "button", className: "Ink-Editor__button", onClick: () => {
|
|
54
57
|
const e = n.current, t = e == null ? void 0 : e.getContext("2d");
|
|
55
|
-
!e || !t || (t.fillStyle = I, t.fillRect(
|
|
58
|
+
!e || !t || (t.fillStyle = I, t.fillRect(c, c, e.width, e.height), s(!1));
|
|
56
59
|
}, children: m }),
|
|
57
|
-
/* @__PURE__ */
|
|
58
|
-
/* @__PURE__ */
|
|
60
|
+
/* @__PURE__ */ l("button", { type: "button", className: "Ink-Editor__button", onClick: _, children: h }),
|
|
61
|
+
/* @__PURE__ */ l(
|
|
59
62
|
"button",
|
|
60
63
|
{
|
|
61
64
|
type: "button",
|
|
62
65
|
className: "Ink-Editor__button Ink-Editor__button--active",
|
|
63
|
-
disabled: !
|
|
66
|
+
disabled: !S,
|
|
64
67
|
onClick: () => {
|
|
65
68
|
const e = n.current;
|
|
66
|
-
!e || !
|
|
69
|
+
!e || !S || (D(e.toDataURL(v)), _());
|
|
67
70
|
},
|
|
68
71
|
children: P
|
|
69
72
|
}
|
|
@@ -72,5 +75,5 @@ const K = (N) => {
|
|
|
72
75
|
] });
|
|
73
76
|
};
|
|
74
77
|
export {
|
|
75
|
-
|
|
78
|
+
J as SignPad
|
|
76
79
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=(e,n,o)=>{const t=e.getBoundingClientRect(),i=e.width/t.width,c=e.height/t.height;return{x:(n-t.left)*i,y:(o-t.top)*c}};exports.getCanvasPoint=g;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SignPad.utils.d.ts","sourceRoot":"","sources":["../../../../../src/components/InkEditor/components/SignPad/SignPad.utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SignPad.utils.d.ts","sourceRoot":"","sources":["../../../../../src/components/InkEditor/components/SignPad/SignPad.utils.ts"],"names":[],"mappings":"AAwBA,eAAO,MAAM,YAAY,GAAI,QAAQ,iBAAiB,KAAG,OAUxD,CAAC;AAEF,eAAO,MAAM,cAAc,GACzB,QAAQ,iBAAiB,EACzB,SAAS,MAAM,EACf,SAAS,MAAM,KACd;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAQxB,CAAC"}
|
|
@@ -1,19 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
const
|
|
3
|
-
const n = t.getContext("2d");
|
|
4
|
-
if (!n) return !1;
|
|
5
|
-
const { width: r, height: e } = t, { data: o } = n.getImageData(0, 0, r, e), s = 3;
|
|
6
|
-
for (let i = s; i < o.length; i += c * 4)
|
|
7
|
-
if (o[i] > h) return !0;
|
|
8
|
-
return !1;
|
|
9
|
-
}, f = (t, n, r) => {
|
|
10
|
-
const e = t.getBoundingClientRect(), o = t.width / e.width, s = t.height / e.height;
|
|
1
|
+
const h = (e, n, o) => {
|
|
2
|
+
const t = e.getBoundingClientRect(), i = e.width / t.width, c = e.height / t.height;
|
|
11
3
|
return {
|
|
12
|
-
x: (n -
|
|
13
|
-
y: (
|
|
4
|
+
x: (n - t.left) * i,
|
|
5
|
+
y: (o - t.top) * c
|
|
14
6
|
};
|
|
15
7
|
};
|
|
16
8
|
export {
|
|
17
|
-
|
|
18
|
-
f as getCanvasPoint
|
|
9
|
+
h as getCanvasPoint
|
|
19
10
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E="",t="ink-memory:",_="default";exports.DEFAULT_MEMORY_KEY=_;exports.EMPTY_STRING=E;exports.LOCAL_STORAGE_PREFIX=t;
|
|
@@ -2,5 +2,6 @@ export declare const EMPTY_STRING = "";
|
|
|
2
2
|
export declare const SPACE_STRING = " ";
|
|
3
3
|
export declare const NEWLINE_STRING = "\n";
|
|
4
4
|
export declare const LOCAL_STORAGE_PREFIX = "ink-memory:";
|
|
5
|
+
export declare const DEFAULT_MEMORY_KEY = "default";
|
|
5
6
|
export declare const DATA_IMAGE_PNG_PREFIX = "data:image/png;base64,";
|
|
6
7
|
//# sourceMappingURL=generals.const.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generals.const.d.ts","sourceRoot":"","sources":["../../src/constants/generals.const.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,KAAK,CAAC;AAC/B,eAAO,MAAM,YAAY,MAAM,CAAC;AAChC,eAAO,MAAM,cAAc,OAAO,CAAC;AACnC,eAAO,MAAM,oBAAoB,gBAAgB,CAAC;AAClD,eAAO,MAAM,qBAAqB,2BAA2B,CAAC"}
|
|
1
|
+
{"version":3,"file":"generals.const.d.ts","sourceRoot":"","sources":["../../src/constants/generals.const.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,KAAK,CAAC;AAC/B,eAAO,MAAM,YAAY,MAAM,CAAC;AAChC,eAAO,MAAM,cAAc,OAAO,CAAC;AACnC,eAAO,MAAM,oBAAoB,gBAAgB,CAAC;AAClD,eAAO,MAAM,kBAAkB,YAAY,CAAC;AAC5C,eAAO,MAAM,qBAAqB,2BAA2B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=150,I="#111827",E="#fef08a",
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=150,I="#111827",E="#fef08a",L=3,N=3,T=1,O=1,A=12,M=12,K=50,S="#fde047",t=8,H=180,R=0,o=2;exports.INK_COMMENT_HIGHLIGHT_COLOR=S;exports.INK_DEFAULT_HIGHLIGHT_COLOR=E;exports.INK_DEFAULT_TABLE_COLS=N;exports.INK_DEFAULT_TABLE_ROWS=L;exports.INK_DEFAULT_TEXT_COLOR=I;exports.INK_DEMO_AI_DELAY_MS=H;exports.INK_HISTORY_MAX=K;exports.INK_MIN_HEIGHT=_;exports.INK_SLASH_MENU_MAX_ITEMS=t;exports.INK_TABLE_MAX_COLS=M;exports.INK_TABLE_MAX_ROWS=A;exports.INK_TABLE_MIN_COLS=O;exports.INK_TABLE_MIN_ROWS=T;exports.NUMBER_TWO=o;exports.NUMBER_ZERO=R;
|
|
@@ -116,4 +116,6 @@ export declare const NUMBER_NINETY_SEVEN = 97;
|
|
|
116
116
|
export declare const NUMBER_NINETY_EIGHT = 98;
|
|
117
117
|
export declare const NUMBER_NINETY_NINE = 99;
|
|
118
118
|
export declare const NUMBER_ONE_HUNDRED = 100;
|
|
119
|
+
export declare const NUMBER_TWO_HUNDRED_FIFTY = 250;
|
|
120
|
+
export declare const NUMBER_TWO_HUNDRED_FIFTY_FIVE = 255;
|
|
119
121
|
//# sourceMappingURL=numbers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"numbers.d.ts","sourceRoot":"","sources":["../../src/constants/numbers.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,MAAM,CAAC;AAClC,eAAO,MAAM,sBAAsB,YAAY,CAAC;AAChD,eAAO,MAAM,2BAA2B,YAAY,CAAC;AACrD,eAAO,MAAM,sBAAsB,IAAI,CAAC;AACxC,eAAO,MAAM,sBAAsB,IAAI,CAAC;AACxC,eAAO,MAAM,sBAAsB,IA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rC,eAAO,MAAM,kBAAkB,KAAK,CAAC;AACrC,eAAO,MAAM,iBAAiB,KAAK,CAAC;AACpC,eAAO,MAAM,mBAAmB,KAAK,CAAC;AACtC,eAAO,MAAM,mBAAmB,KAAK,CAAC;AACtC,eAAO,MAAM,kBAAkB,KAAK,CAAC;AACrC,eAAO,MAAM,kBAAkB,MAAM,CAAC;AACtC,eAAO,MAAM,wBAAwB,MAAM,CAAC;AAC5C,eAAO,MAAM,6BAA6B,MAAM,CAAC"}
|
|
@@ -1,20 +1,18 @@
|
|
|
1
|
-
const _ = 150, I = "#111827", E = "#fef08a",
|
|
1
|
+
const _ = 150, I = "#111827", E = "#fef08a", L = 3, N = 3, T = 1, A = 1, O = 12, o = 12, t = 50, c = "#fde047", n = 8, s = 180, M = 0, K = 2;
|
|
2
2
|
export {
|
|
3
|
-
|
|
3
|
+
c as INK_COMMENT_HIGHLIGHT_COLOR,
|
|
4
4
|
E as INK_DEFAULT_HIGHLIGHT_COLOR,
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
N as INK_DEFAULT_TABLE_COLS,
|
|
6
|
+
L as INK_DEFAULT_TABLE_ROWS,
|
|
7
7
|
I as INK_DEFAULT_TEXT_COLOR,
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
s as INK_DEMO_AI_DELAY_MS,
|
|
9
|
+
t as INK_HISTORY_MAX,
|
|
10
10
|
_ as INK_MIN_HEIGHT,
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
n as INK_SLASH_MENU_MAX_ITEMS,
|
|
12
|
+
o as INK_TABLE_MAX_COLS,
|
|
13
|
+
O as INK_TABLE_MAX_ROWS,
|
|
14
|
+
A as INK_TABLE_MIN_COLS,
|
|
15
15
|
T as INK_TABLE_MIN_ROWS,
|
|
16
|
-
R as NUMBER_FOUR,
|
|
17
|
-
S as NUMBER_SIX,
|
|
18
16
|
K as NUMBER_TWO,
|
|
19
17
|
M as NUMBER_ZERO
|
|
20
18
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../constants/generals.const.cjs"),o=require("./storage.utils.cjs"),t=e=>`${r.LOCAL_STORAGE_PREFIX}${e||
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../constants/generals.const.cjs"),o=require("./storage.utils.cjs"),t=e=>`${r.LOCAL_STORAGE_PREFIX}${e||r.DEFAULT_MEMORY_KEY}`,n=e=>{if(!o.isLocalStorageAvailable())return r.EMPTY_STRING;try{return localStorage.getItem(t(e))??r.EMPTY_STRING}catch{return r.EMPTY_STRING}},l=(e,a)=>{if(o.isLocalStorageAvailable())try{localStorage.setItem(t(a),e)}catch{return}};exports.buildInkMemoryKey=t;exports.readInkMemory=n;exports.writeInkMemory=l;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory.utils.d.ts","sourceRoot":"","sources":["../../src/utils/memory.utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"memory.utils.d.ts","sourceRoot":"","sources":["../../src/utils/memory.utils.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,iBAAiB,GAAI,YAAY,MAAM,KAAG,MACM,CAAC;AAE9D,eAAO,MAAM,aAAa,GAAI,YAAY,MAAM,KAAG,MAOlD,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,MAAM,MAAM,EAAE,YAAY,MAAM,KAAG,IAOjE,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,YAAY,MAAM,KAAG,IAOnD,CAAC"}
|
|
@@ -1,10 +1,22 @@
|
|
|
1
|
-
import { EMPTY_STRING as
|
|
2
|
-
import { isLocalStorageAvailable as
|
|
3
|
-
const o = (
|
|
4
|
-
|
|
1
|
+
import { EMPTY_STRING as t, LOCAL_STORAGE_PREFIX as n, DEFAULT_MEMORY_KEY as c } from "../constants/generals.const.js";
|
|
2
|
+
import { isLocalStorageAvailable as e } from "./storage.utils.js";
|
|
3
|
+
const o = (r) => `${n}${r || c}`, l = (r) => {
|
|
4
|
+
if (!e()) return t;
|
|
5
|
+
try {
|
|
6
|
+
return localStorage.getItem(o(r)) ?? t;
|
|
7
|
+
} catch {
|
|
8
|
+
return t;
|
|
9
|
+
}
|
|
10
|
+
}, I = (r, a) => {
|
|
11
|
+
if (e())
|
|
12
|
+
try {
|
|
13
|
+
localStorage.setItem(o(a), r);
|
|
14
|
+
} catch {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
5
17
|
};
|
|
6
18
|
export {
|
|
7
19
|
o as buildInkMemoryKey,
|
|
8
|
-
|
|
20
|
+
l as readInkMemory,
|
|
9
21
|
I as writeInkMemory
|
|
10
22
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forgedevstack/ink",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.3",
|
|
4
4
|
"description": "ForgeStack rich text editor for React — WYSIWYG with tables, track changes, comments, block handles, sign pad, and pluggable Ink AI (BYO LLM). The writing layer of ForgeStack.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|