@uva-glass/component-library 3.54.2 → 3.55.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{Lexical.prod-A4JuKqM3.js → Lexical.prod-o6Eq_uLx.js} +27 -27
- package/dist/{Lexical.prod-A4JuKqM3.js.map → Lexical.prod-o6Eq_uLx.js.map} +1 -1
- package/dist/{LexicalClipboard.prod-CoyZP29w.js → LexicalClipboard.prod-CnUrf2_p.js} +20 -20
- package/dist/{LexicalClipboard.prod-CoyZP29w.js.map → LexicalClipboard.prod-CnUrf2_p.js.map} +1 -1
- package/dist/{LexicalExtension.prod-DFPuTMk1.js → LexicalExtension.prod-CanXuzFO.js} +19 -19
- package/dist/{LexicalExtension.prod-DFPuTMk1.js.map → LexicalExtension.prod-CanXuzFO.js.map} +1 -1
- package/dist/{LexicalLink.prod-Dp06n3Hn.js → LexicalLink.prod-DAVbKER8.js} +4 -4
- package/dist/{LexicalLink.prod-Dp06n3Hn.js.map → LexicalLink.prod-DAVbKER8.js.map} +1 -1
- package/dist/{LexicalList.prod-D3TdO_Pq.js → LexicalList.prod-C6cknPBV.js} +4 -4
- package/dist/{LexicalList.prod-D3TdO_Pq.js.map → LexicalList.prod-C6cknPBV.js.map} +1 -1
- package/dist/{LexicalSelection.prod-BapitO0n.js → LexicalSelection.prod-B8GGrzJ3.js} +18 -18
- package/dist/{LexicalSelection.prod-BapitO0n.js.map → LexicalSelection.prod-B8GGrzJ3.js.map} +1 -1
- package/dist/{LexicalTable.prod-bzYpvqMi.js → LexicalTable.prod-upbwOtcE.js} +5 -5
- package/dist/{LexicalTable.prod-bzYpvqMi.js.map → LexicalTable.prod-upbwOtcE.js.map} +1 -1
- package/dist/{LexicalUtils.prod-CAsHFX57.js → LexicalUtils.prod-CF7x-KWm.js} +5 -5
- package/dist/{LexicalUtils.prod-CAsHFX57.js.map → LexicalUtils.prod-CF7x-KWm.js.map} +1 -1
- package/dist/RteEditor.module-CoTOIw5i.js +41 -0
- package/dist/RteEditor.module-CoTOIw5i.js.map +1 -0
- package/dist/{TableCellResizerPlugin-ffA1s2mD.js → TableCellResizerPlugin-qMtSAoKT.js} +4 -4
- package/dist/{TableCellResizerPlugin-ffA1s2mD.js.map → TableCellResizerPlugin-qMtSAoKT.js.map} +1 -1
- package/dist/{TablePlugin-CzmrXpxk.js → TablePlugin-BRZcXq73.js} +28 -28
- package/dist/{TablePlugin-CzmrXpxk.js.map → TablePlugin-BRZcXq73.js.map} +1 -1
- package/dist/assets/RteEditor.css +1 -1
- package/dist/components/CheckboxTree/CheckboxTree.js +1 -1
- package/dist/components/FormInput/FormInput.js +1 -1
- package/dist/components/InputField/InputField.stories.js +1 -1
- package/dist/components/MultiSelect/MultiSelect.js +1 -1
- package/dist/components/MultiSelect/MultiSelect.stories.js +1 -1
- package/dist/components/MultiSelect/components/MultiSelectHeader.js +1 -1
- package/dist/components/MultiSelect/index.js +1 -1
- package/dist/components/PeriodSelector/PeriodSelector.js +1 -1
- package/dist/components/ProgrammeCard/ProgrammeCard.stories.js +1 -1
- package/dist/components/RadioTabSelector/RadioTabSelector.js +1 -1
- package/dist/components/RteEditor/EditorHeader/EditorHeader.js +1 -1
- package/dist/components/RteEditor/Plugins/BlockFormatPlugin/BlockFormatPlugin.js +2 -2
- package/dist/components/RteEditor/Plugins/CourseCataloguePlugin/CourseCataloguePlugin.js +108 -105
- package/dist/components/RteEditor/Plugins/CourseCataloguePlugin/CourseCataloguePlugin.js.map +1 -1
- package/dist/components/RteEditor/Plugins/HistoryPlugin/HistoryPlugin.js +3 -3
- package/dist/components/RteEditor/Plugins/LinkPlugin/AddLinkForm/AddLinkFrom.js +1 -1
- package/dist/components/RteEditor/Plugins/LinkPlugin/LinkContextMenu/LinkContextMenu.js +35 -31
- package/dist/components/RteEditor/Plugins/LinkPlugin/LinkContextMenu/LinkContextMenu.js.map +1 -1
- package/dist/components/RteEditor/Plugins/LinkPlugin/LinkPlugin.js +121 -118
- package/dist/components/RteEditor/Plugins/LinkPlugin/LinkPlugin.js.map +1 -1
- package/dist/components/RteEditor/Plugins/LinkPlugin/helpers.js +1 -1
- package/dist/components/RteEditor/Plugins/ListPlugin/ListPlugin.js +12 -12
- package/dist/components/RteEditor/Plugins/PasteHandlerPlugin/PasteHandlerPlugin.js +5 -5
- package/dist/components/RteEditor/Plugins/TableCellResizerPlugin/TableCellResizerPlugin.js +4 -4
- package/dist/components/RteEditor/Plugins/TableCellResizerPlugin/index.js +1 -1
- package/dist/components/RteEditor/Plugins/TablePlugin/AddTableFrom.js +1 -1
- package/dist/components/RteEditor/Plugins/TablePlugin/TablePlugin.js +5 -5
- package/dist/components/RteEditor/Plugins/TablePlugin/helpers.js +2 -2
- package/dist/components/RteEditor/Plugins/TablePlugin/index.js +1 -1
- package/dist/components/RteEditor/Plugins/ToolbarPlugin/ToolbarPlugin.js +70 -65
- package/dist/components/RteEditor/Plugins/ToolbarPlugin/ToolbarPlugin.js.map +1 -1
- package/dist/components/RteEditor/Plugins/index.js +2 -2
- package/dist/components/RteEditor/RteEditor.d.ts +4 -2
- package/dist/components/RteEditor/RteEditor.js +218 -215
- package/dist/components/RteEditor/RteEditor.js.map +1 -1
- package/dist/components/RteEditor/RteEditor.stories.js +23 -19
- package/dist/components/RteEditor/RteEditor.stories.js.map +1 -1
- package/dist/components/RteEditor/UvaTheme/UvaTheme.js +1 -1
- package/dist/components/RteEditor/helpers.js +4 -4
- package/dist/components/RteEditor/nodes/CourseCatalogueNode/CourseCatalogueNode.js +2 -2
- package/dist/components/RteEditor/nodes/TableWrapperNode/TableWrapperNode.js +3 -3
- package/dist/components/index.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +19 -19
- package/dist/RteEditor.module-DaBh86FK.js +0 -41
- package/dist/RteEditor.module-DaBh86FK.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { P as c, g as d,
|
|
1
|
+
import { P as c, g as d, at as h, ak as N, q as v, $ as y, w as x, J as z, h as E, am as p, K as S, V as P, an as T, al as A, z as k, au as B, av as M, aw as w, ax as R, ay as V, az as C } from "./Lexical.prod-o6Eq_uLx.js";
|
|
2
2
|
function b(e, ...t) {
|
|
3
3
|
const n = new URL("https://lexical.dev/docs/error"), r = new URLSearchParams();
|
|
4
4
|
r.append("code", e);
|
|
@@ -46,9 +46,9 @@ function W(e) {
|
|
|
46
46
|
return c(t) || b(4, e.__key), t;
|
|
47
47
|
}
|
|
48
48
|
function X(e) {
|
|
49
|
-
const t = y() ||
|
|
49
|
+
const t = y() || z();
|
|
50
50
|
let n;
|
|
51
|
-
if (x(t)) n =
|
|
51
|
+
if (x(t)) n = E(t.focus, "next");
|
|
52
52
|
else {
|
|
53
53
|
if (t != null) {
|
|
54
54
|
const u = t.getNodes(), s = u[u.length - 1];
|
|
@@ -56,7 +56,7 @@ function X(e) {
|
|
|
56
56
|
}
|
|
57
57
|
n = n || d(S(), "previous").getFlipped().insert(P());
|
|
58
58
|
}
|
|
59
|
-
const r = J(e, n), o =
|
|
59
|
+
const r = J(e, n), o = T(r), i = A(o) ? k(o) : r;
|
|
60
60
|
return B(M(i)), e.getLatest();
|
|
61
61
|
}
|
|
62
62
|
function J(e, t, n) {
|
|
@@ -131,4 +131,4 @@ export {
|
|
|
131
131
|
X as x,
|
|
132
132
|
W as y
|
|
133
133
|
};
|
|
134
|
-
//# sourceMappingURL=LexicalUtils.prod-
|
|
134
|
+
//# sourceMappingURL=LexicalUtils.prod-CF7x-KWm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LexicalUtils.prod-CAsHFX57.js","sources":["../node_modules/@lexical/utils/LexicalUtils.prod.mjs"],"sourcesContent":["/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport{isHTMLElement as t,mergeRegister as e,$getSelection as n,$isRangeSelection as o,$isElementNode as r,getDOMTextNode as i,$getAdjacentSiblingOrParentSiblingCaret as l,$getSiblingCaret as s,$getChildCaretOrSelf as u,$findMatchingParent as c,$cloneWithProperties as a,$setSelection as f,$getPreviousSelection as d,$caretFromPoint as g,$getChildCaret as p,$getRoot as m,$createParagraphNode as h,$getAdjacentChildCaret as v,$isChildCaret as y,$normalizeCaret as w,$setSelectionFromCaretRange as E,$getCollapsedCaretRange as x,$getCaretInDirection as S,$splitAtPointCaretNext as C,$isTextPointCaret as A,$rewindSiblingCaret as N,$getState as b,$setState as P,makeStepwiseIterator as L,$isSiblingCaret as M}from\"lexical\";export{$findMatchingParent,$getAdjacentSiblingOrParentSiblingCaret,$splitNode,addClassNamesToElement,isBlockDomNode,isHTMLAnchorElement,isHTMLElement,isInlineDomNode,mergeRegister,removeClassNamesFromElement}from\"lexical\";import{createRectsFromDOMRange as R}from\"@lexical/selection\";function T(t,...e){const n=new URL(\"https://lexical.dev/docs/error\"),o=new URLSearchParams;o.append(\"code\",t);for(const t of e)o.append(\"v\",t);throw n.search=o.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const B=\"undefined\"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,_=B&&\"documentMode\"in document?document.documentMode:null,K=B&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),k=B&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),$=!(!B||!(\"InputEvent\"in window)||_)&&\"getTargetRanges\"in new window.InputEvent(\"input\"),I=B&&/Version\\/[\\d.]+.*Safari/.test(navigator.userAgent),O=B&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,H=B&&/Android/.test(navigator.userAgent),j=B&&/^(?=.*Chrome).*/i.test(navigator.userAgent),D=B&&H&&j,F=B&&/AppleWebKit\\/[\\d.]+/.test(navigator.userAgent)&&K&&!j;function z(t){return`${t}px`}const U={attributes:!0,characterData:!0,childList:!0,subtree:!0};function V(e,n,o){let r=null,i=null,l=null,s=[];const u=document.createElement(\"div\");function c(){null===r&&T(182),null===i&&T(183);const{left:t,top:l}=i.getBoundingClientRect(),c=R(e,n);var a,f;u.isConnected||(f=u,(a=i).insertBefore(f,a.firstChild));let d=!1;for(let e=0;e<c.length;e++){const n=c[e],o=s[e]||document.createElement(\"div\"),r=o.style;\"absolute\"!==r.position&&(r.position=\"absolute\",d=!0);const i=z(n.left-t);r.left!==i&&(r.left=i,d=!0);const a=z(n.top-l);r.top!==a&&(o.style.top=a,d=!0);const f=z(n.width);r.width!==f&&(o.style.width=f,d=!0);const g=z(n.height);r.height!==g&&(o.style.height=g,d=!0),o.parentNode!==u&&(u.append(o),d=!0),s[e]=o}for(;s.length>c.length;)s.pop();d&&o(s)}function a(){i=null,r=null,null!==l&&l.disconnect(),l=null,u.remove();for(const t of s)t.remove();s=[]}u.style.position=\"relative\";const f=e.registerRootListener(function n(){const o=e.getRootElement();if(null===o)return a();const s=o.parentElement;if(!t(s))return a();a(),r=o,i=s,l=new MutationObserver(t=>{const o=e.getRootElement(),l=o&&o.parentElement;if(o!==r||l!==i)return n();for(const e of t)if(!u.contains(e.target))return c()}),l.observe(s,U),c()});return()=>{f(),a()}}function W(t,e,n){if(\"text\"!==t.type&&r(e)){const o=e.getDOMSlot(n);return[o.element,o.getFirstChildOffset()+t.offset]}return[i(n)||n,t.offset]}function G(t,r){let i=null,l=null,s=null,u=null,c=null,a=null,f=()=>{};function d(e){e.read(()=>{const e=n();if(!o(e))return i=null,s=null,u=null,a=null,f(),void(f=()=>{});const[d,g]=function(t){const e=t.getStartEndPoints();return t.isBackward()?[e[1],e[0]]:e}(e),p=d.getNode(),m=p.getKey(),h=d.offset,v=g.getNode(),y=v.getKey(),w=g.offset,E=t.getElementByKey(m),x=t.getElementByKey(y),S=null===i||E!==l||h!==s||m!==i.getKey(),C=null===u||x!==c||w!==a||y!==u.getKey();if((S||C)&&null!==E&&null!==x){const e=function(t,e,n,o,r,i,l){const s=(t._window?t._window.document:document).createRange();return s.setStart(...W(e,n,o)),s.setEnd(...W(r,i,l)),s}(t,d,p,E,g,v,x);f(),f=V(t,e,t=>{if(void 0===r)for(const e of t){const t=e.style;\"Highlight\"!==t.background&&(t.background=\"Highlight\"),\"HighlightText\"!==t.color&&(t.color=\"HighlightText\"),t.marginTop!==z(-1.5)&&(t.marginTop=z(-1.5)),t.paddingTop!==z(4)&&(t.paddingTop=z(4)),t.paddingBottom!==z(0)&&(t.paddingBottom=z(0))}else r(t)})}i=p,l=E,s=h,u=v,c=x,a=w})}return d(t.getEditorState()),e(t.registerUpdateListener(({editorState:t})=>d(t)),()=>{f()})}function q(t,e){let n=null;const o=()=>{const o=getSelection(),r=o&&o.anchorNode,i=t.getRootElement();null!==r&&null!==i&&i.contains(r)?null!==n&&(n(),n=null):null===n&&(n=G(t,e))};return document.addEventListener(\"selectionchange\",o),()=>{null!==n&&n(),document.removeEventListener(\"selectionchange\",o)}}const J=$,Q=B,X=H,Y=D,Z=K,tt=F,et=j,nt=k,ot=O,rt=I;function it(t,e){for(const n of e)if(t.type.startsWith(n))return!0;return!1}function lt(t,e){const n=t[Symbol.iterator]();return new Promise((t,o)=>{const r=[],i=()=>{const{done:l,value:s}=n.next();if(l)return t(r);const u=new FileReader;u.addEventListener(\"error\",o),u.addEventListener(\"load\",()=>{const t=u.result;\"string\"==typeof t&&r.push({file:s,result:t}),i()}),it(s,e)?u.readAsDataURL(s):i()};i()})}function st(t,e){return Array.from(at(t,e))}function ut(t){return t?t.getAdjacentCaret():null}function ct(t,e){return Array.from(ht(t,e))}function at(t,e){return dt(\"next\",t,e)}function ft(t,e){const n=l(s(t,e));return n&&n[0]}function dt(t,e,n){const o=m(),i=e||o,c=r(i)?p(i,t):s(i,t),a=pt(i),f=n?v(u(s(n,t)))||ft(n,t):ft(i,t);let d=a;return L({hasNext:t=>null!==t,initial:c,map:t=>({depth:d,node:t.origin}),step:t=>{if(t.isSameNodeCaret(f))return null;y(t)&&d++;const e=l(t);return!e||e[0].isSameNodeCaret(f)?null:(d+=e[1],e[0])}})}function gt(t){const e=l(s(t,\"next\"));return e&&[e[0].origin,e[1]]}function pt(t){let e=-1;for(let n=t;null!==n;n=n.getParent())e++;return e}function mt(t){const e=u(s(t,\"previous\")),n=l(e,\"root\");return n&&n[0].origin}function ht(t,e){return dt(\"previous\",t,e)}function vt(t,e){let n=t;for(;null!=n;){if(n instanceof e)return n;n=n.getParent()}return null}function yt(t){const e=c(t,t=>r(t)&&!t.isInline());return r(e)||T(4,t.__key),e}function wt(t,e,n,o){const r=t=>t instanceof e;return t.registerNodeTransform(e,t=>{const e=(t=>{const e=t.getChildren();for(let t=0;t<e.length;t++){const n=e[t];if(r(n))return null}let n=t,o=t;for(;null!==n;)if(o=n,n=n.getParent(),r(n))return{child:o,parent:n};return null})(t);if(null!==e){const{child:r,parent:i}=e;if(r.is(t)){o(i,t);const e=r.getNextSiblings(),l=e.length;if(i.insertAfter(r),0!==l){const t=n(i);r.insertAfter(t);for(let n=0;n<l;n++)t.append(e[n])}i.canBeEmpty()||0!==i.getChildrenSize()||i.remove()}}})}function Et(t,e){const n=new Map,o=t._pendingEditorState;for(const[t,o]of e._nodeMap)n.set(t,a(o));o&&(o._nodeMap=n),t._dirtyType=2;const r=e._selection;f(null===r?null:r.clone())}function xt(t){const e=n()||d();let r;if(o(e))r=g(e.focus,\"next\");else{if(null!=e){const t=e.getNodes(),n=t[t.length-1];n&&(r=s(n,\"next\"))}r=r||p(m(),\"previous\").getFlipped().insert(h())}const i=St(t,r),l=v(i),u=y(l)?w(l):i;return E(x(u)),t.getLatest()}function St(t,e,n){let o=S(e,\"next\");for(let t=o;t;t=C(t,n))o=t;return A(o)&&T(283),o.insert(t.isInline()?h().append(t):t),S(s(t.getLatest(),\"next\"),e.direction)}function Ct(t,e){const n=e();return t.replace(n),n.append(t),n}function At(t,e){return null!==t&&Object.getPrototypeOf(t).constructor.name===e.name}function Nt(t,e){const n=[];for(let o=0;o<t.length;o++){const r=e(t[o]);null!==r&&n.push(r)}return n}function bt(t){const e=n();if(!o(e))return!1;const i=new Set,l=e.getNodes();for(let e=0;e<l.length;e++){const n=l[e],o=n.getKey();if(i.has(o))continue;const s=c(n,t=>r(t)&&!t.isInline());if(null===s)continue;const u=s.getKey();s.canIndent()&&!i.has(u)&&(i.add(u),t(s))}return i.size>0}function Pt(t,e){p(t,\"next\").insert(e)}let Lt=!(nt||!Q)&&void 0;function Mt(t,e=!1){let n=1;if(function(){if(void 0===Lt){const t=document.createElement(\"div\");t.style.cssText=\"position: absolute; opacity: 0; width: 100px; left: -1000px;\",document.body.appendChild(t);const e=t.getBoundingClientRect();t.style.setProperty(\"zoom\",\"2\"),Lt=t.getBoundingClientRect().width===e.width,document.body.removeChild(t)}return Lt}()||e)for(;t;)n*=Number(window.getComputedStyle(t).getPropertyValue(\"zoom\")),t=t.parentElement;return n}function Rt(t){return null!==t._parentEditor}function Tt(t,e){return Bt(t,e,null)}function Bt(t,e,n){let o=!1;for(const i of kt(t))e(i)?null!==n&&n(i):(o=!0,r(i)&&Bt(i,e,n||(t=>i.insertAfter(t))),i.remove());return o}function _t(t,e){const n=[],o=Array.from(t).reverse();for(let t=o.pop();void 0!==t;t=o.pop())if(e(t))n.push(t);else if(r(t))for(const e of kt(t))o.push(e);return n}function Kt(t){return $t(p(t,\"next\"))}function kt(t){return $t(p(t,\"previous\"))}function $t(t){return L({hasNext:M,initial:t.getAdjacentCaret(),map:t=>t.origin.getLatest(),step:t=>t.getAdjacentCaret()})}function It(t){N(s(t,\"next\")).splice(1,t.getChildren())}function Ot(t){const e=e=>b(e,t),n=(e,n)=>P(e,t,n);return{$get:e,$set:n,accessors:[e,n],makeGetterMethod:()=>function(){return e(this)},makeSetterMethod:()=>function(t){return n(this,t)},stateConfig:t}}export{_t as $descendantsMatching,st as $dfs,at as $dfsIterator,Nt as $filter,Kt as $firstToLastIterator,ut as $getAdjacentCaret,pt as $getDepth,yt as $getNearestBlockElementAncestorOrThrow,vt as $getNearestNodeOfType,mt as $getNextRightPreorderNode,gt as $getNextSiblingOrParentSibling,bt as $handleIndentAndOutdent,Pt as $insertFirst,xt as $insertNodeToNearestRoot,St as $insertNodeToNearestRootAtCaret,Rt as $isEditorIsNestedEditor,kt as $lastToFirstIterator,Et as $restoreEditorState,ct as $reverseDfs,ht as $reverseDfsIterator,Tt as $unwrapAndFilterDescendants,It as $unwrapNode,Ct as $wrapNodeInElement,J as CAN_USE_BEFORE_INPUT,Q as CAN_USE_DOM,X as IS_ANDROID,Y as IS_ANDROID_CHROME,Z as IS_APPLE,tt as IS_APPLE_WEBKIT,et as IS_CHROME,nt as IS_FIREFOX,ot as IS_IOS,rt as IS_SAFARI,Mt as calculateZoomLevel,it as isMimeType,Ot as makeStateWrapper,G as markSelection,lt as mediaFileReader,At as objectKlassEquals,V as positionNodeOnRange,wt as registerNestedElementResolver,q as selectionAlwaysOnDisplay};\n"],"names":["T","t","e","o","B","k","Q","nt","st","at","dt","ft","l","s","m","i","c","r","p","a","pt","f","d","L","y","vt","yt","xt","n","g","h","St","v","u","w","E","x","S","C","A","At","bt","Pt","Lt","Mt","Tt","Bt","kt","_t","$t","M"],"mappings":";AAQ4+B,SAASA,EAAEC,MAAKC,GAAE;AAAC,QAAM,IAAE,IAAI,IAAI,gCAAgC,GAAEC,IAAE,IAAI;AAAgB,EAAAA,EAAE,OAAO,QAAOF,CAAC;AAAE,aAAUA,KAAKC,EAAE,CAAAC,EAAE,OAAO,KAAIF,CAAC;AAAE,QAAM,EAAE,SAAOE,EAAE,SAAQ,GAAG,MAAM,2BAA2BF,CAAC,WAAW,EAAE,SAAQ,CAAE,gHAAgH;AAAC;AAAM,MAACG,IAAe,OAAO,SAApB,OAAqC,OAAO,aAAhB,UAAmC,OAAO,SAAS,kBAAzB,QAAuC,IAAEA,KAAG,kBAAiB,WAAS,SAAS,eAAa,MAA0DC,IAAED,KAAG,mCAAmC,KAAK,UAAU,SAAS;AAAI,EAAE,CAACA,KAAG,EAAE,gBAAe,WAAS,MAAI,qBAAoB,IAAI,OAAO,WAA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Wm.js","sources":["../node_modules/@lexical/utils/LexicalUtils.prod.mjs"],"sourcesContent":["/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport{isHTMLElement as t,mergeRegister as e,$getSelection as n,$isRangeSelection as o,$isElementNode as r,getDOMTextNode as i,$getAdjacentSiblingOrParentSiblingCaret as l,$getSiblingCaret as s,$getChildCaretOrSelf as u,$findMatchingParent as c,$cloneWithProperties as a,$setSelection as f,$getPreviousSelection as d,$caretFromPoint as g,$getChildCaret as p,$getRoot as m,$createParagraphNode as h,$getAdjacentChildCaret as v,$isChildCaret as y,$normalizeCaret as w,$setSelectionFromCaretRange as E,$getCollapsedCaretRange as x,$getCaretInDirection as S,$splitAtPointCaretNext as C,$isTextPointCaret as A,$rewindSiblingCaret as N,$getState as b,$setState as P,makeStepwiseIterator as L,$isSiblingCaret as M}from\"lexical\";export{$findMatchingParent,$getAdjacentSiblingOrParentSiblingCaret,$splitNode,addClassNamesToElement,isBlockDomNode,isHTMLAnchorElement,isHTMLElement,isInlineDomNode,mergeRegister,removeClassNamesFromElement}from\"lexical\";import{createRectsFromDOMRange as R}from\"@lexical/selection\";function T(t,...e){const n=new URL(\"https://lexical.dev/docs/error\"),o=new URLSearchParams;o.append(\"code\",t);for(const t of e)o.append(\"v\",t);throw n.search=o.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const B=\"undefined\"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,_=B&&\"documentMode\"in document?document.documentMode:null,K=B&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),k=B&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),$=!(!B||!(\"InputEvent\"in window)||_)&&\"getTargetRanges\"in new window.InputEvent(\"input\"),I=B&&/Version\\/[\\d.]+.*Safari/.test(navigator.userAgent),O=B&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,H=B&&/Android/.test(navigator.userAgent),j=B&&/^(?=.*Chrome).*/i.test(navigator.userAgent),D=B&&H&&j,F=B&&/AppleWebKit\\/[\\d.]+/.test(navigator.userAgent)&&K&&!j;function z(t){return`${t}px`}const U={attributes:!0,characterData:!0,childList:!0,subtree:!0};function V(e,n,o){let r=null,i=null,l=null,s=[];const u=document.createElement(\"div\");function c(){null===r&&T(182),null===i&&T(183);const{left:t,top:l}=i.getBoundingClientRect(),c=R(e,n);var a,f;u.isConnected||(f=u,(a=i).insertBefore(f,a.firstChild));let d=!1;for(let e=0;e<c.length;e++){const n=c[e],o=s[e]||document.createElement(\"div\"),r=o.style;\"absolute\"!==r.position&&(r.position=\"absolute\",d=!0);const i=z(n.left-t);r.left!==i&&(r.left=i,d=!0);const a=z(n.top-l);r.top!==a&&(o.style.top=a,d=!0);const f=z(n.width);r.width!==f&&(o.style.width=f,d=!0);const g=z(n.height);r.height!==g&&(o.style.height=g,d=!0),o.parentNode!==u&&(u.append(o),d=!0),s[e]=o}for(;s.length>c.length;)s.pop();d&&o(s)}function a(){i=null,r=null,null!==l&&l.disconnect(),l=null,u.remove();for(const t of s)t.remove();s=[]}u.style.position=\"relative\";const f=e.registerRootListener(function n(){const o=e.getRootElement();if(null===o)return a();const s=o.parentElement;if(!t(s))return a();a(),r=o,i=s,l=new MutationObserver(t=>{const o=e.getRootElement(),l=o&&o.parentElement;if(o!==r||l!==i)return n();for(const e of t)if(!u.contains(e.target))return c()}),l.observe(s,U),c()});return()=>{f(),a()}}function W(t,e,n){if(\"text\"!==t.type&&r(e)){const o=e.getDOMSlot(n);return[o.element,o.getFirstChildOffset()+t.offset]}return[i(n)||n,t.offset]}function G(t,r){let i=null,l=null,s=null,u=null,c=null,a=null,f=()=>{};function d(e){e.read(()=>{const e=n();if(!o(e))return i=null,s=null,u=null,a=null,f(),void(f=()=>{});const[d,g]=function(t){const e=t.getStartEndPoints();return t.isBackward()?[e[1],e[0]]:e}(e),p=d.getNode(),m=p.getKey(),h=d.offset,v=g.getNode(),y=v.getKey(),w=g.offset,E=t.getElementByKey(m),x=t.getElementByKey(y),S=null===i||E!==l||h!==s||m!==i.getKey(),C=null===u||x!==c||w!==a||y!==u.getKey();if((S||C)&&null!==E&&null!==x){const e=function(t,e,n,o,r,i,l){const s=(t._window?t._window.document:document).createRange();return s.setStart(...W(e,n,o)),s.setEnd(...W(r,i,l)),s}(t,d,p,E,g,v,x);f(),f=V(t,e,t=>{if(void 0===r)for(const e of t){const t=e.style;\"Highlight\"!==t.background&&(t.background=\"Highlight\"),\"HighlightText\"!==t.color&&(t.color=\"HighlightText\"),t.marginTop!==z(-1.5)&&(t.marginTop=z(-1.5)),t.paddingTop!==z(4)&&(t.paddingTop=z(4)),t.paddingBottom!==z(0)&&(t.paddingBottom=z(0))}else r(t)})}i=p,l=E,s=h,u=v,c=x,a=w})}return d(t.getEditorState()),e(t.registerUpdateListener(({editorState:t})=>d(t)),()=>{f()})}function q(t,e){let n=null;const o=()=>{const o=getSelection(),r=o&&o.anchorNode,i=t.getRootElement();null!==r&&null!==i&&i.contains(r)?null!==n&&(n(),n=null):null===n&&(n=G(t,e))};return document.addEventListener(\"selectionchange\",o),()=>{null!==n&&n(),document.removeEventListener(\"selectionchange\",o)}}const J=$,Q=B,X=H,Y=D,Z=K,tt=F,et=j,nt=k,ot=O,rt=I;function it(t,e){for(const n of e)if(t.type.startsWith(n))return!0;return!1}function lt(t,e){const n=t[Symbol.iterator]();return new Promise((t,o)=>{const r=[],i=()=>{const{done:l,value:s}=n.next();if(l)return t(r);const u=new FileReader;u.addEventListener(\"error\",o),u.addEventListener(\"load\",()=>{const t=u.result;\"string\"==typeof t&&r.push({file:s,result:t}),i()}),it(s,e)?u.readAsDataURL(s):i()};i()})}function st(t,e){return Array.from(at(t,e))}function ut(t){return t?t.getAdjacentCaret():null}function ct(t,e){return Array.from(ht(t,e))}function at(t,e){return dt(\"next\",t,e)}function ft(t,e){const n=l(s(t,e));return n&&n[0]}function dt(t,e,n){const o=m(),i=e||o,c=r(i)?p(i,t):s(i,t),a=pt(i),f=n?v(u(s(n,t)))||ft(n,t):ft(i,t);let d=a;return L({hasNext:t=>null!==t,initial:c,map:t=>({depth:d,node:t.origin}),step:t=>{if(t.isSameNodeCaret(f))return null;y(t)&&d++;const e=l(t);return!e||e[0].isSameNodeCaret(f)?null:(d+=e[1],e[0])}})}function gt(t){const e=l(s(t,\"next\"));return e&&[e[0].origin,e[1]]}function pt(t){let e=-1;for(let n=t;null!==n;n=n.getParent())e++;return e}function mt(t){const e=u(s(t,\"previous\")),n=l(e,\"root\");return n&&n[0].origin}function ht(t,e){return dt(\"previous\",t,e)}function vt(t,e){let n=t;for(;null!=n;){if(n instanceof e)return n;n=n.getParent()}return null}function yt(t){const e=c(t,t=>r(t)&&!t.isInline());return r(e)||T(4,t.__key),e}function wt(t,e,n,o){const r=t=>t instanceof e;return t.registerNodeTransform(e,t=>{const e=(t=>{const e=t.getChildren();for(let t=0;t<e.length;t++){const n=e[t];if(r(n))return null}let n=t,o=t;for(;null!==n;)if(o=n,n=n.getParent(),r(n))return{child:o,parent:n};return null})(t);if(null!==e){const{child:r,parent:i}=e;if(r.is(t)){o(i,t);const e=r.getNextSiblings(),l=e.length;if(i.insertAfter(r),0!==l){const t=n(i);r.insertAfter(t);for(let n=0;n<l;n++)t.append(e[n])}i.canBeEmpty()||0!==i.getChildrenSize()||i.remove()}}})}function Et(t,e){const n=new Map,o=t._pendingEditorState;for(const[t,o]of e._nodeMap)n.set(t,a(o));o&&(o._nodeMap=n),t._dirtyType=2;const r=e._selection;f(null===r?null:r.clone())}function xt(t){const e=n()||d();let r;if(o(e))r=g(e.focus,\"next\");else{if(null!=e){const t=e.getNodes(),n=t[t.length-1];n&&(r=s(n,\"next\"))}r=r||p(m(),\"previous\").getFlipped().insert(h())}const i=St(t,r),l=v(i),u=y(l)?w(l):i;return E(x(u)),t.getLatest()}function St(t,e,n){let o=S(e,\"next\");for(let t=o;t;t=C(t,n))o=t;return A(o)&&T(283),o.insert(t.isInline()?h().append(t):t),S(s(t.getLatest(),\"next\"),e.direction)}function Ct(t,e){const n=e();return t.replace(n),n.append(t),n}function At(t,e){return null!==t&&Object.getPrototypeOf(t).constructor.name===e.name}function Nt(t,e){const n=[];for(let o=0;o<t.length;o++){const r=e(t[o]);null!==r&&n.push(r)}return n}function bt(t){const e=n();if(!o(e))return!1;const i=new Set,l=e.getNodes();for(let e=0;e<l.length;e++){const n=l[e],o=n.getKey();if(i.has(o))continue;const s=c(n,t=>r(t)&&!t.isInline());if(null===s)continue;const u=s.getKey();s.canIndent()&&!i.has(u)&&(i.add(u),t(s))}return i.size>0}function Pt(t,e){p(t,\"next\").insert(e)}let Lt=!(nt||!Q)&&void 0;function Mt(t,e=!1){let n=1;if(function(){if(void 0===Lt){const t=document.createElement(\"div\");t.style.cssText=\"position: absolute; opacity: 0; width: 100px; left: -1000px;\",document.body.appendChild(t);const e=t.getBoundingClientRect();t.style.setProperty(\"zoom\",\"2\"),Lt=t.getBoundingClientRect().width===e.width,document.body.removeChild(t)}return Lt}()||e)for(;t;)n*=Number(window.getComputedStyle(t).getPropertyValue(\"zoom\")),t=t.parentElement;return n}function Rt(t){return null!==t._parentEditor}function Tt(t,e){return Bt(t,e,null)}function Bt(t,e,n){let o=!1;for(const i of kt(t))e(i)?null!==n&&n(i):(o=!0,r(i)&&Bt(i,e,n||(t=>i.insertAfter(t))),i.remove());return o}function _t(t,e){const n=[],o=Array.from(t).reverse();for(let t=o.pop();void 0!==t;t=o.pop())if(e(t))n.push(t);else if(r(t))for(const e of kt(t))o.push(e);return n}function Kt(t){return $t(p(t,\"next\"))}function kt(t){return $t(p(t,\"previous\"))}function $t(t){return L({hasNext:M,initial:t.getAdjacentCaret(),map:t=>t.origin.getLatest(),step:t=>t.getAdjacentCaret()})}function It(t){N(s(t,\"next\")).splice(1,t.getChildren())}function Ot(t){const e=e=>b(e,t),n=(e,n)=>P(e,t,n);return{$get:e,$set:n,accessors:[e,n],makeGetterMethod:()=>function(){return e(this)},makeSetterMethod:()=>function(t){return n(this,t)},stateConfig:t}}export{_t as $descendantsMatching,st as $dfs,at as $dfsIterator,Nt as $filter,Kt as $firstToLastIterator,ut as $getAdjacentCaret,pt as $getDepth,yt as $getNearestBlockElementAncestorOrThrow,vt as $getNearestNodeOfType,mt as $getNextRightPreorderNode,gt as $getNextSiblingOrParentSibling,bt as $handleIndentAndOutdent,Pt as $insertFirst,xt as $insertNodeToNearestRoot,St as $insertNodeToNearestRootAtCaret,Rt as $isEditorIsNestedEditor,kt as $lastToFirstIterator,Et as $restoreEditorState,ct as $reverseDfs,ht as $reverseDfsIterator,Tt as $unwrapAndFilterDescendants,It as $unwrapNode,Ct as $wrapNodeInElement,J as CAN_USE_BEFORE_INPUT,Q as CAN_USE_DOM,X as IS_ANDROID,Y as IS_ANDROID_CHROME,Z as IS_APPLE,tt as IS_APPLE_WEBKIT,et as IS_CHROME,nt as IS_FIREFOX,ot as IS_IOS,rt as IS_SAFARI,Mt as calculateZoomLevel,it as isMimeType,Ot as makeStateWrapper,G as markSelection,lt as mediaFileReader,At as objectKlassEquals,V as positionNodeOnRange,wt as registerNestedElementResolver,q as selectionAlwaysOnDisplay};\n"],"names":["T","t","e","o","B","k","Q","nt","st","at","dt","ft","l","s","m","i","c","r","p","a","pt","f","d","L","y","vt","yt","xt","n","g","h","St","v","u","w","E","x","S","C","A","At","bt","Pt","Lt","Mt","Tt","Bt","kt","_t","$t","M"],"mappings":";AAQ4+B,SAASA,EAAEC,MAAKC,GAAE;AAAC,QAAM,IAAE,IAAI,IAAI,gCAAgC,GAAEC,IAAE,IAAI;AAAgB,EAAAA,EAAE,OAAO,QAAOF,CAAC;AAAE,aAAUA,KAAKC,EAAE,CAAAC,EAAE,OAAO,KAAIF,CAAC;AAAE,QAAM,EAAE,SAAOE,EAAE,SAAQ,GAAG,MAAM,2BAA2BF,CAAC,WAAW,EAAE,SAAQ,CAAE,gHAAgH;AA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CAAC;AAAC;AAAC,SAASgD,EAAGhD,GAAE;AAAC,SAAOsB,EAAE,EAAC,SAAQ2B,GAAE,SAAQjD,EAAE,oBAAmB,KAAI,OAAG,EAAE,OAAO,UAAS,GAAG,MAAK,OAAG,EAAE,iBAAgB,EAAE,CAAC;AAAC;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import './assets/RteEditor.css';const t = "_editor__container_17vay_1", _ = "_editor__header_17vay_6", e = "_editor_17vay_1", o = "_editor__field_17vay_36", i = "_editor__toolbar_17vay_44", r = "_editor__placeholder_17vay_202", a = {
|
|
2
|
+
editor__container: t,
|
|
3
|
+
editor__header: _,
|
|
4
|
+
"editor__header-word-count": "_editor__header-word-count_17vay_14",
|
|
5
|
+
"editor__header-word-count--alert": "_editor__header-word-count--alert_17vay_23",
|
|
6
|
+
editor: e,
|
|
7
|
+
editor__field: o,
|
|
8
|
+
"not-valid": "_not-valid_17vay_40",
|
|
9
|
+
editor__toolbar: i,
|
|
10
|
+
"editor__toolbar-flyout-wrapper": "_editor__toolbar-flyout-wrapper_17vay_53",
|
|
11
|
+
"editor__toolbar-button-group": "_editor__toolbar-button-group_17vay_66",
|
|
12
|
+
"editor__toolbar-button-group--text": "_editor__toolbar-button-group--text_17vay_73",
|
|
13
|
+
"editor__toolbar-button": "_editor__toolbar-button_17vay_66",
|
|
14
|
+
"editor__toolbar-button--active": "_editor__toolbar-button--active_17vay_105",
|
|
15
|
+
"editor__toolbar-button--text": "_editor__toolbar-button--text_17vay_112",
|
|
16
|
+
"editor__toolbar-button--bold": "_editor__toolbar-button--bold_17vay_132",
|
|
17
|
+
"editor__toolbar-button--italic": "_editor__toolbar-button--italic_17vay_136",
|
|
18
|
+
"editor__toolbar-button-flyoutwrapper": "_editor__toolbar-button-flyoutwrapper_17vay_155",
|
|
19
|
+
"editor__field-wrapper": "_editor__field-wrapper_17vay_159",
|
|
20
|
+
editor__placeholder: r,
|
|
21
|
+
"guide-text-ltr": "_guide-text-ltr_17vay_212",
|
|
22
|
+
"guide-text-rtl": "_guide-text-rtl_17vay_216",
|
|
23
|
+
"guide-text-paragraph": "_guide-text-paragraph_17vay_220",
|
|
24
|
+
"guide-text__text--bold": "_guide-text__text--bold_17vay_225",
|
|
25
|
+
"guide-text__text--italic": "_guide-text__text--italic_17vay_229",
|
|
26
|
+
"guide-text__list--ul": "_guide-text__list--ul_17vay_233",
|
|
27
|
+
"guide-text__list--ol": "_guide-text__list--ol_17vay_234",
|
|
28
|
+
"guide-text__list--listitem": "_guide-text__list--listitem_17vay_246",
|
|
29
|
+
"guide-text__list--nested-listitem": "_guide-text__list--nested-listitem_17vay_255",
|
|
30
|
+
"guide-text__list--ul2": "_guide-text__list--ul2_17vay_265",
|
|
31
|
+
"guide-text__list--ul3": "_guide-text__list--ul3_17vay_269",
|
|
32
|
+
"guide-text__list--ul4": "_guide-text__list--ul4_17vay_273",
|
|
33
|
+
"guide-text__list--ul5": "_guide-text__list--ul5_17vay_277",
|
|
34
|
+
"guide-text__table-wrapper": "_guide-text__table-wrapper_17vay_309",
|
|
35
|
+
"guide-text__table": "_guide-text__table_17vay_309",
|
|
36
|
+
"guide-text__course-catalogue-link": "_guide-text__course-catalogue-link_17vay_358"
|
|
37
|
+
};
|
|
38
|
+
export {
|
|
39
|
+
a as s
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=RteEditor.module-CoTOIw5i.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RteEditor.module-CoTOIw5i.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as M, jsxs as J, Fragment as Q } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo as F, useState as x, useRef as E, useLayoutEffect as Z, useEffect as L, useCallback as b } from "react";
|
|
3
3
|
import { o as A } from "./LexicalComposerContext.prod-DOyoZx0P.js";
|
|
4
|
-
import { _ as ee, K as te, M as S, X as $, q as ne, B as oe, S as re, I as le, $ as se } from "./LexicalTable.prod-
|
|
5
|
-
import { v as ie, M as B } from "./LexicalUtils.prod-
|
|
6
|
-
import { D, M as ce } from "./Lexical.prod-
|
|
4
|
+
import { _ as ee, K as te, M as S, X as $, q as ne, B as oe, S as re, I as le, $ as se } from "./LexicalTable.prod-upbwOtcE.js";
|
|
5
|
+
import { v as ie, M as B } from "./LexicalUtils.prod-CF7x-KWm.js";
|
|
6
|
+
import { D, M as ce } from "./Lexical.prod-o6Eq_uLx.js";
|
|
7
7
|
import { createPortal as ue } from "react-dom";
|
|
8
8
|
import { tableHasContent as ae, getEditorParrentCellWidth as de, getEditorContentWidth as fe } from "./components/RteEditor/Plugins/TablePlugin/helpers.js";
|
|
9
9
|
import { TableWrapperNode as he, $createTableWrapperNode as ge } from "./components/RteEditor/nodes/TableWrapperNode/TableWrapperNode.js";
|
|
@@ -245,4 +245,4 @@ export {
|
|
|
245
245
|
$e as T,
|
|
246
246
|
me as a
|
|
247
247
|
};
|
|
248
|
-
//# sourceMappingURL=TableCellResizerPlugin-
|
|
248
|
+
//# sourceMappingURL=TableCellResizerPlugin-qMtSAoKT.js.map
|
package/dist/{TableCellResizerPlugin-ffA1s2mD.js.map → TableCellResizerPlugin-qMtSAoKT.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableCellResizerPlugin-ffA1s2mD.js","sources":["../node_modules/@lexical/react/useLexicalEditable.prod.mjs","../src/components/RteEditor/Plugins/TableCellResizerPlugin/TableCellResizerPlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport{useLexicalComposerContext as e}from\"@lexical/react/LexicalComposerContext\";import{useLayoutEffect as n,useEffect as t,useMemo as i,useState as r,useRef as o}from\"react\";const c=\"undefined\"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?n:t;function u(e){return{initialValueFn:()=>e.isEditable(),subscribe:n=>e.registerEditableListener(n)}}function a(){return function(n){const[t]=e(),u=i(()=>n(t),[t,n]),[a,l]=r(()=>u.initialValueFn()),d=o(a);return c(()=>{const{initialValueFn:e,subscribe:n}=u,t=e();return d.current!==t&&(d.current=t,l(t)),n(e=>{d.current=e,l(e)})},[u,n]),a}(u)}export{a as useLexicalEditable};\n","/* eslint-disable jsx-a11y/no-static-element-interactions */\r\n/**\r\n * Copyright (c) Meta Platforms, Inc. and affiliates.\r\n *\r\n * This source code is licensed under the MIT license found in the\r\n * LICENSE file in the root directory of this source tree.\r\n *\r\n * Modified from original to fit project needs wim jurriaans.\r\n *\r\n *\r\n */\r\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'react';\r\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';\r\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable';\r\nimport {\r\n $computeTableMapSkipCellCheck,\r\n $getTableNodeFromLexicalNodeOrThrow,\r\n $getTableRowIndexFromTableCellNode,\r\n $isTableCellNode,\r\n $isTableRowNode,\r\n TableNode,\r\n getDOMCellFromTarget,\r\n getTableElement,\r\n TableCellNode,\r\n} from '@lexical/table';\r\nimport { $getNearestNodeOfType, calculateZoomLevel } from '@lexical/utils';\r\nimport { $getNearestNodeFromDOMNode, isHTMLElement } from 'lexical';\r\nimport { createPortal } from 'react-dom';\r\n\r\nimport type { LexicalEditor } from 'lexical';\r\nimport type { TableDOMCell, TableMapType, TableRowNode } from '@lexical/table';\r\nimport type { JSX, MouseEventHandler, ReactPortal } from 'react';\r\n\r\nimport styles from './TableCellResizerPlugin.module.css';\r\n\r\nimport {\r\n getEditorContentWidth,\r\n getEditorParrentCellWidth,\r\n tableHasContent,\r\n} from 'components/RteEditor/Plugins/TablePlugin/helpers';\r\nimport { $createTableWrapperNode, TableWrapperNode } from 'components/RteEditor/nodes';\r\n\r\ntype MousePosition = {\r\n x: number;\r\n y: number;\r\n};\r\n\r\ntype MouseDraggingDirection = 'right' | 'bottom';\r\n\r\nconst MIN_ROW_HEIGHT = 33;\r\nconst MIN_COLUMN_WIDTH = 32;\r\nconst HALF = 2;\r\n\r\nfunction TableCellResizer({ editor }: { editor: LexicalEditor }): JSX.Element {\r\n const targetRef = useRef<HTMLElement | null>(null);\r\n const resizerRef = useRef<HTMLDivElement | null>(null);\r\n const tableRectRef = useRef<DOMRect | null>(null);\r\n\r\n const mouseStartPosRef = useRef<MousePosition | null>(null);\r\n const [mouseCurrentPos, updateMouseCurrentPos] = useState<MousePosition | null>(null);\r\n\r\n const [activeCell, updateActiveCell] = useState<TableDOMCell | null>(null);\r\n const [isMouseDown, updateIsMouseDown] = useState<boolean>(false);\r\n const [draggingDirection, updateDraggingDirection] = useState<MouseDraggingDirection | null>(null);\r\n\r\n const resetState = useCallback(() => {\r\n updateActiveCell(null);\r\n targetRef.current = null;\r\n updateDraggingDirection(null);\r\n mouseStartPosRef.current = null;\r\n tableRectRef.current = null;\r\n }, []);\r\n\r\n const isMouseDownOnEvent = (event: MouseEvent) => {\r\n return (event.buttons & 1) === 1;\r\n };\r\n\r\n useEffect(() => {\r\n return editor.registerNodeTransform(TableNode, (tableNode) => {\r\n // modification: set default column widths if not defined or table cells of imported tables has the width set\r\n if (!tableNode.getColWidths()) {\r\n const tableRows = tableNode.getChildren();\r\n const columnCount = tableNode.getColumnCount();\r\n const colWidths = new Array(columnCount).fill(undefined);\r\n\r\n const firstRow = tableRows[0] as TableRowNode;\r\n const cells = firstRow.getChildren();\r\n cells.forEach((cell, colIdx) => {\r\n const domCell = editor.getElementByKey(cell.getKey());\r\n if (domCell && domCell.style.width) {\r\n colWidths[colIdx] = parseInt(domCell.style.width, 10);\r\n domCell.style.width = '';\r\n } else if (tableHasContent(tableNode)) {\r\n const isNested = tableNode ? $getNearestNodeOfType(tableNode, TableCellNode) : null;\r\n\r\n const availableWidth = isNested\r\n ? getEditorParrentCellWidth(isNested, columnCount, editor)\r\n : getEditorContentWidth(editor);\r\n const newColWidth = availableWidth / columnCount;\r\n colWidths[colIdx] = Math.max(newColWidth, MIN_COLUMN_WIDTH);\r\n } else {\r\n colWidths[colIdx] = MIN_COLUMN_WIDTH;\r\n }\r\n });\r\n\r\n tableNode.setColWidths(colWidths);\r\n }\r\n\r\n // modification: wrap table node in a wrapper node if there is no wrapper node present\r\n if (tableNode && !(tableNode.getParent() instanceof TableWrapperNode)) {\r\n const wrapperNode = $createTableWrapperNode();\r\n tableNode.replace(wrapperNode);\r\n wrapperNode.append(tableNode);\r\n }\r\n\r\n return tableNode;\r\n });\r\n }, [editor]);\r\n\r\n useEffect(() => {\r\n const onMouseMove = (event: MouseEvent) => {\r\n const target = event.target;\r\n if (!isHTMLElement(target)) {\r\n return;\r\n }\r\n\r\n if (draggingDirection) {\r\n updateMouseCurrentPos({\r\n x: event.clientX,\r\n y: event.clientY,\r\n });\r\n return;\r\n }\r\n updateIsMouseDown(isMouseDownOnEvent(event));\r\n if (resizerRef.current && resizerRef.current.contains(target)) {\r\n return;\r\n }\r\n\r\n if (targetRef.current !== target) {\r\n targetRef.current = target;\r\n const cell = getDOMCellFromTarget(target);\r\n\r\n if (cell && activeCell !== cell) {\r\n editor.getEditorState().read(\r\n () => {\r\n const tableCellNode = $getNearestNodeFromDOMNode(cell.elem);\r\n if (!tableCellNode) {\r\n throw new Error('TableCellResizer: Table cell node not found.');\r\n }\r\n\r\n const tableNode = $getTableNodeFromLexicalNodeOrThrow(tableCellNode);\r\n const tableElement = getTableElement(tableNode, editor.getElementByKey(tableNode.getKey()));\r\n\r\n if (!tableElement) {\r\n throw new Error('TableCellResizer: Table element not found.');\r\n }\r\n\r\n targetRef.current = target;\r\n tableRectRef.current = tableElement.getBoundingClientRect();\r\n updateActiveCell(cell);\r\n },\r\n { editor }\r\n );\r\n } else if (cell == null) {\r\n resetState();\r\n }\r\n }\r\n };\r\n\r\n const onMouseDown = () => {\r\n updateIsMouseDown(true);\r\n };\r\n\r\n const onMouseUp = () => {\r\n updateIsMouseDown(false);\r\n };\r\n\r\n const removeRootListener = editor.registerRootListener((rootElement, prevRootElement) => {\r\n prevRootElement?.removeEventListener('mousemove', onMouseMove);\r\n prevRootElement?.removeEventListener('mousedown', onMouseDown);\r\n prevRootElement?.removeEventListener('mouseup', onMouseUp);\r\n rootElement?.addEventListener('mousemove', onMouseMove);\r\n rootElement?.addEventListener('mousedown', onMouseDown);\r\n rootElement?.addEventListener('mouseup', onMouseUp);\r\n });\r\n\r\n return () => {\r\n removeRootListener();\r\n };\r\n }, [activeCell, draggingDirection, editor, resetState]);\r\n\r\n const isHeightChanging = (direction: MouseDraggingDirection) => {\r\n if (direction === 'bottom') {\r\n return true;\r\n }\r\n return false;\r\n };\r\n\r\n const updateRowHeight = useCallback(\r\n (heightChange: number) => {\r\n if (!activeCell) {\r\n throw new Error('TableCellResizer: Expected active cell.');\r\n }\r\n\r\n editor.update(\r\n () => {\r\n const tableCellNode = $getNearestNodeFromDOMNode(activeCell.elem);\r\n if (!$isTableCellNode(tableCellNode)) {\r\n throw new Error('TableCellResizer: Table cell node not found.');\r\n }\r\n\r\n const tableNode = $getTableNodeFromLexicalNodeOrThrow(tableCellNode);\r\n\r\n const tableRowIndex = $getTableRowIndexFromTableCellNode(tableCellNode) + tableCellNode.getRowSpan() - 1;\r\n\r\n const tableRows = tableNode.getChildren();\r\n\r\n if (tableRowIndex >= tableRows.length || tableRowIndex < 0) {\r\n throw new Error('Expected table cell to be inside of table row.');\r\n }\r\n\r\n const tableRow = tableRows[tableRowIndex];\r\n\r\n if (!$isTableRowNode(tableRow)) {\r\n throw new Error('Expected table row');\r\n }\r\n\r\n let height = tableRow.getHeight();\r\n if (height === undefined) {\r\n const rowCells = tableRow.getChildren<TableCellNode>();\r\n height = Math.min(...rowCells.map((cell) => getCellNodeHeight(cell, editor) ?? Infinity));\r\n }\r\n\r\n const newHeight = Math.max(height + heightChange, MIN_ROW_HEIGHT);\r\n tableRow.setHeight(newHeight);\r\n },\r\n { tag: 'skip-scroll-into-view' }\r\n );\r\n },\r\n [activeCell, editor]\r\n );\r\n\r\n const getCellNodeHeight = (cell: TableCellNode, activeEditor: LexicalEditor): number | undefined => {\r\n const domCellNode = activeEditor.getElementByKey(cell.getKey());\r\n return domCellNode?.clientHeight;\r\n };\r\n\r\n const getCellColumnIndex = (tableCellNode: TableCellNode, tableMap: TableMapType) => {\r\n for (let row = 0; row < tableMap.length; row++) {\r\n for (let column = 0; column < tableMap[row].length; column++) {\r\n if (tableMap[row][column].cell === tableCellNode) {\r\n return column;\r\n }\r\n }\r\n }\r\n return -1;\r\n };\r\n\r\n const updateColumnWidth = useCallback(\r\n (widthChange: number) => {\r\n if (!activeCell) {\r\n throw new Error('TableCellResizer: Expected active cell.');\r\n }\r\n editor.update(\r\n () => {\r\n const tableCellNode = $getNearestNodeFromDOMNode(activeCell.elem);\r\n if (!$isTableCellNode(tableCellNode)) {\r\n throw new Error('TableCellResizer: Table cell node not found.');\r\n }\r\n\r\n const tableNode = $getTableNodeFromLexicalNodeOrThrow(tableCellNode);\r\n const [tableMap] = $computeTableMapSkipCellCheck(tableNode, null, null);\r\n const columnIndex = getCellColumnIndex(tableCellNode, tableMap);\r\n if (columnIndex === undefined) {\r\n throw new Error('TableCellResizer: Table column not found.');\r\n }\r\n\r\n const colWidths = tableNode.getColWidths();\r\n if (!colWidths) {\r\n return;\r\n }\r\n const width = colWidths[columnIndex];\r\n if (width === undefined) {\r\n return;\r\n }\r\n const newColWidths = [...colWidths];\r\n const newWidth = Math.max(width + widthChange, MIN_COLUMN_WIDTH);\r\n newColWidths[columnIndex] = newWidth;\r\n tableNode.setColWidths(newColWidths);\r\n\r\n // modification: when resizing a column, also resize the next column so the table doesn't overflow\r\n if (columnIndex < tableNode.getColumnCount() - 1) {\r\n const nextColWidths = tableNode.getColWidths();\r\n if (!nextColWidths) {\r\n return;\r\n }\r\n const newNextColWidths = [...nextColWidths];\r\n const newColumnIndex = columnIndex + 1;\r\n const newNextWidth = nextColWidths[newColumnIndex];\r\n const nextWidth = Math.max(newNextWidth - widthChange, MIN_COLUMN_WIDTH);\r\n newNextColWidths[newColumnIndex] = nextWidth;\r\n tableNode.setColWidths(newNextColWidths);\r\n }\r\n },\r\n { tag: 'skip-scroll-into-view' }\r\n );\r\n },\r\n [activeCell, editor]\r\n );\r\n\r\n const mouseUpHandler = useCallback(\r\n (direction: MouseDraggingDirection) => {\r\n const handler = (event: MouseEvent) => {\r\n event.preventDefault();\r\n event.stopPropagation();\r\n\r\n if (!activeCell) {\r\n throw new Error('TableCellResizer: Expected active cell.');\r\n }\r\n\r\n if (mouseStartPosRef.current) {\r\n const { x, y } = mouseStartPosRef.current;\r\n\r\n if (activeCell === null) {\r\n return;\r\n }\r\n const zoom = calculateZoomLevel(event.target as Element);\r\n\r\n if (isHeightChanging(direction)) {\r\n const heightChange = (event.clientY - y) / zoom;\r\n updateRowHeight(heightChange);\r\n } else {\r\n const widthChange = (event.clientX - x) / zoom;\r\n updateColumnWidth(widthChange);\r\n }\r\n\r\n resetState();\r\n document.removeEventListener('mouseup', handler);\r\n }\r\n };\r\n return handler;\r\n },\r\n [activeCell, resetState, updateColumnWidth, updateRowHeight]\r\n );\r\n\r\n const toggleResize = useCallback(\r\n (direction: MouseDraggingDirection): MouseEventHandler<HTMLDivElement> =>\r\n (event) => {\r\n event.preventDefault();\r\n event.stopPropagation();\r\n\r\n if (!activeCell) {\r\n throw new Error('TableCellResizer: Expected active cell.');\r\n }\r\n\r\n mouseStartPosRef.current = {\r\n x: event.clientX,\r\n y: event.clientY,\r\n };\r\n updateMouseCurrentPos(mouseStartPosRef.current);\r\n updateDraggingDirection(direction);\r\n\r\n document.addEventListener('mouseup', mouseUpHandler(direction));\r\n },\r\n [activeCell, mouseUpHandler]\r\n );\r\n\r\n const getResizers = useCallback(() => {\r\n if (activeCell) {\r\n const { height, width, top, left } = activeCell.elem.getBoundingClientRect();\r\n const zoom = calculateZoomLevel(activeCell.elem);\r\n const zoneWidth = 10; // Pixel width of the zone where you can drag the edge\r\n const styles = {\r\n bottom: {\r\n backgroundColor: 'none',\r\n cursor: 'ns-resize',\r\n height: `${zoneWidth}px`,\r\n left: `${window.pageXOffset + left}px`,\r\n top: `${window.pageYOffset + top + height - zoneWidth / HALF}px`,\r\n width: `${width}px`,\r\n zIndex: 5000,\r\n },\r\n right: {\r\n backgroundColor: 'none',\r\n cursor: 'ew-resize',\r\n height: `${height}px`,\r\n left: `${window.pageXOffset + left + width - zoneWidth / HALF}px`,\r\n top: `${window.pageYOffset + top}px`,\r\n width: `${zoneWidth}px`,\r\n zIndex: 5000,\r\n },\r\n };\r\n\r\n const tableRect = tableRectRef.current;\r\n\r\n if (draggingDirection && mouseCurrentPos && tableRect) {\r\n if (isHeightChanging(draggingDirection)) {\r\n styles[draggingDirection].left = `${window.pageXOffset + tableRect.left}px`;\r\n styles[draggingDirection].top = `${window.pageYOffset + mouseCurrentPos.y / zoom}px`;\r\n styles[draggingDirection].height = '3px';\r\n styles[draggingDirection].width = `${tableRect.width}px`;\r\n } else {\r\n styles[draggingDirection].top = `${window.pageYOffset + tableRect.top}px`;\r\n styles[draggingDirection].left = `${window.pageXOffset + mouseCurrentPos.x / zoom}px`;\r\n styles[draggingDirection].width = '3px';\r\n styles[draggingDirection].height = `${tableRect.height}px`;\r\n }\r\n\r\n styles[draggingDirection].backgroundColor = '#adf';\r\n }\r\n\r\n return styles;\r\n }\r\n\r\n return {\r\n bottom: null,\r\n left: null,\r\n right: null,\r\n top: null,\r\n };\r\n }, [activeCell, draggingDirection, mouseCurrentPos]);\r\n\r\n const resizerStyles = getResizers();\r\n\r\n return (\r\n <div ref={resizerRef}>\r\n {activeCell != null && !isMouseDown && (\r\n <>\r\n <div\r\n className={styles['table-cell-resizer__resizer']}\r\n style={resizerStyles.right || undefined}\r\n onMouseDown={toggleResize('right')}\r\n />\r\n <div\r\n className={styles['table-cell-resizer__resizer']}\r\n style={resizerStyles.bottom || undefined}\r\n onMouseDown={toggleResize('bottom')}\r\n />\r\n </>\r\n )}\r\n </div>\r\n );\r\n}\r\n\r\nexport const TableCellResizerPlugin = (): null | ReactPortal => {\r\n const [editor] = useLexicalComposerContext();\r\n const isEditable = useLexicalEditable();\r\n\r\n return useMemo(\r\n () => (isEditable ? createPortal(<TableCellResizer editor={editor} />, document.body) : null),\r\n [editor, isEditable]\r\n );\r\n};\r\n"],"names":["c","n","t","u","e","a","i","l","r","d","o","MIN_ROW_HEIGHT","MIN_COLUMN_WIDTH","HALF","TableCellResizer","editor","targetRef","useRef","resizerRef","tableRectRef","mouseStartPosRef","mouseCurrentPos","updateMouseCurrentPos","useState","activeCell","updateActiveCell","isMouseDown","updateIsMouseDown","draggingDirection","updateDraggingDirection","resetState","useCallback","isMouseDownOnEvent","event","useEffect","TableNode","tableNode","tableRows","columnCount","colWidths","cell","colIdx","domCell","tableHasContent","isNested","$getNearestNodeOfType","TableCellNode","newColWidth","getEditorParrentCellWidth","getEditorContentWidth","TableWrapperNode","wrapperNode","$createTableWrapperNode","onMouseMove","target","isHTMLElement","getDOMCellFromTarget","tableCellNode","$getNearestNodeFromDOMNode","$getTableNodeFromLexicalNodeOrThrow","tableElement","getTableElement","onMouseDown","onMouseUp","removeRootListener","rootElement","prevRootElement","isHeightChanging","direction","updateRowHeight","heightChange","$isTableCellNode","tableRowIndex","$getTableRowIndexFromTableCellNode","tableRow","$isTableRowNode","height","rowCells","getCellNodeHeight","newHeight","activeEditor","getCellColumnIndex","tableMap","row","column","updateColumnWidth","widthChange","$computeTableMapSkipCellCheck","columnIndex","width","newColWidths","newWidth","nextColWidths","newNextColWidths","newColumnIndex","newNextWidth","nextWidth","mouseUpHandler","handler","x","y","zoom","calculateZoomLevel","toggleResize","resizerStyles","top","left","zoneWidth","styles","tableRect","jsx","jsxs","Fragment","TableCellResizerPlugin","useLexicalComposerContext","isEditable","useLexicalEditable","useMemo","createPortal"],"mappings":";;;;;;;;;AAQgL,MAAMA,KAAe,OAAO,SAApB,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AAO,GAAG,OAAO,cAAcP,EAAgB,IAAIgF,CAAI,MACjFO,EAAOhF,CAAiB,EAAE,QAAQ,OAClCgF,EAAOhF,CAAiB,EAAE,SAAS,GAAGiF,EAAU,MAAM,OAGxDD,EAAOhF,CAAiB,EAAE,kBAAkB,SAGvCgF;AAAAA,IACT;AAEA,WAAO;AAAA,MACL,QAAQ;AAAA,MACR,MAAM;AAAA,MACN,OAAO;AAAA,MACP,KAAK;AAAA,IAAA;AAAA,EAET,GAAG,CAACpF,GAAYI,GAAmBP,CAAe,CAAC,EAE7B;AAEtB,SACE,gBAAAyF,EAAC,SAAI,KAAK5F,GACP,eAAc,QAAQ,CAACQ,KACtB,gBAAAqF,EAAAC,GAAA,EACE,UAAA;AAAA,IAAA,gBAAAF;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,WAAWF,EAAO,6BAA6B;AAAA,QAC/C,OAAOJ,EAAc,SAAS;AAAA,QAC9B,aAAaD,EAAa,OAAO;AAAA,MAAA;AAAA,IAAA;AAAA,IAEnC,gBAAAO;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,WAAWF,EAAO,6BAA6B;AAAA,QAC/C,OAAOJ,EAAc,UAAU;AAAA,QAC/B,aAAaD,EAAa,QAAQ;AAAA,MAAA;AAAA,IAAA;AAAA,EACpC,EAAA,CACF,EAAA,CAEJ;AAEJ;AAEO,MAAMU,KAAyB,MAA0B;AAC9D,QAAM,CAAClG,CAAM,IAAImG,EAAA,GACXC,IAAaC,GAAA;AAEnB,SAAOC;AAAA,IACL,MAAOF,IAAaG,GAAa,gBAAAR,EAAChG,MAAiB,QAAAC,EAAA,CAAgB,GAAI,SAAS,IAAI,IAAI;AAAA,IACxF,CAACA,GAAQoG,CAAU;AAAA,EAAA;AAEvB;","x_google_ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"TableCellResizerPlugin-qMtSAoKT.js","sources":["../node_modules/@lexical/react/useLexicalEditable.prod.mjs","../src/components/RteEditor/Plugins/TableCellResizerPlugin/TableCellResizerPlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport{useLexicalComposerContext as e}from\"@lexical/react/LexicalComposerContext\";import{useLayoutEffect as n,useEffect as t,useMemo as i,useState as r,useRef as o}from\"react\";const c=\"undefined\"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?n:t;function u(e){return{initialValueFn:()=>e.isEditable(),subscribe:n=>e.registerEditableListener(n)}}function a(){return function(n){const[t]=e(),u=i(()=>n(t),[t,n]),[a,l]=r(()=>u.initialValueFn()),d=o(a);return c(()=>{const{initialValueFn:e,subscribe:n}=u,t=e();return d.current!==t&&(d.current=t,l(t)),n(e=>{d.current=e,l(e)})},[u,n]),a}(u)}export{a as useLexicalEditable};\n","/* eslint-disable jsx-a11y/no-static-element-interactions */\r\n/**\r\n * Copyright (c) Meta Platforms, Inc. and affiliates.\r\n *\r\n * This source code is licensed under the MIT license found in the\r\n * LICENSE file in the root directory of this source tree.\r\n *\r\n * Modified from original to fit project needs wim jurriaans.\r\n *\r\n *\r\n */\r\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'react';\r\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';\r\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable';\r\nimport {\r\n $computeTableMapSkipCellCheck,\r\n $getTableNodeFromLexicalNodeOrThrow,\r\n $getTableRowIndexFromTableCellNode,\r\n $isTableCellNode,\r\n $isTableRowNode,\r\n TableNode,\r\n getDOMCellFromTarget,\r\n getTableElement,\r\n TableCellNode,\r\n} from '@lexical/table';\r\nimport { $getNearestNodeOfType, calculateZoomLevel } from '@lexical/utils';\r\nimport { $getNearestNodeFromDOMNode, isHTMLElement } from 'lexical';\r\nimport { createPortal } from 'react-dom';\r\n\r\nimport type { LexicalEditor } from 'lexical';\r\nimport type { TableDOMCell, TableMapType, TableRowNode } from '@lexical/table';\r\nimport type { JSX, MouseEventHandler, ReactPortal } from 'react';\r\n\r\nimport styles from './TableCellResizerPlugin.module.css';\r\n\r\nimport {\r\n getEditorContentWidth,\r\n getEditorParrentCellWidth,\r\n tableHasContent,\r\n} from 'components/RteEditor/Plugins/TablePlugin/helpers';\r\nimport { $createTableWrapperNode, TableWrapperNode } from 'components/RteEditor/nodes';\r\n\r\ntype MousePosition = {\r\n x: number;\r\n y: number;\r\n};\r\n\r\ntype MouseDraggingDirection = 'right' | 'bottom';\r\n\r\nconst MIN_ROW_HEIGHT = 33;\r\nconst MIN_COLUMN_WIDTH = 32;\r\nconst HALF = 2;\r\n\r\nfunction TableCellResizer({ editor }: { editor: LexicalEditor }): JSX.Element {\r\n const targetRef = useRef<HTMLElement | null>(null);\r\n const resizerRef = useRef<HTMLDivElement | null>(null);\r\n const tableRectRef = useRef<DOMRect | null>(null);\r\n\r\n const mouseStartPosRef = useRef<MousePosition | null>(null);\r\n const [mouseCurrentPos, updateMouseCurrentPos] = useState<MousePosition | null>(null);\r\n\r\n const [activeCell, updateActiveCell] = useState<TableDOMCell | null>(null);\r\n const [isMouseDown, updateIsMouseDown] = useState<boolean>(false);\r\n const [draggingDirection, updateDraggingDirection] = useState<MouseDraggingDirection | null>(null);\r\n\r\n const resetState = useCallback(() => {\r\n updateActiveCell(null);\r\n targetRef.current = null;\r\n updateDraggingDirection(null);\r\n mouseStartPosRef.current = null;\r\n tableRectRef.current = null;\r\n }, []);\r\n\r\n const isMouseDownOnEvent = (event: MouseEvent) => {\r\n return (event.buttons & 1) === 1;\r\n };\r\n\r\n useEffect(() => {\r\n return editor.registerNodeTransform(TableNode, (tableNode) => {\r\n // modification: set default column widths if not defined or table cells of imported tables has the width set\r\n if (!tableNode.getColWidths()) {\r\n const tableRows = tableNode.getChildren();\r\n const columnCount = tableNode.getColumnCount();\r\n const colWidths = new Array(columnCount).fill(undefined);\r\n\r\n const firstRow = tableRows[0] as TableRowNode;\r\n const cells = firstRow.getChildren();\r\n cells.forEach((cell, colIdx) => {\r\n const domCell = editor.getElementByKey(cell.getKey());\r\n if (domCell && domCell.style.width) {\r\n colWidths[colIdx] = parseInt(domCell.style.width, 10);\r\n domCell.style.width = '';\r\n } else if (tableHasContent(tableNode)) {\r\n const isNested = tableNode ? $getNearestNodeOfType(tableNode, TableCellNode) : null;\r\n\r\n const availableWidth = isNested\r\n ? getEditorParrentCellWidth(isNested, columnCount, editor)\r\n : getEditorContentWidth(editor);\r\n const newColWidth = availableWidth / columnCount;\r\n colWidths[colIdx] = Math.max(newColWidth, MIN_COLUMN_WIDTH);\r\n } else {\r\n colWidths[colIdx] = MIN_COLUMN_WIDTH;\r\n }\r\n });\r\n\r\n tableNode.setColWidths(colWidths);\r\n }\r\n\r\n // modification: wrap table node in a wrapper node if there is no wrapper node present\r\n if (tableNode && !(tableNode.getParent() instanceof TableWrapperNode)) {\r\n const wrapperNode = $createTableWrapperNode();\r\n tableNode.replace(wrapperNode);\r\n wrapperNode.append(tableNode);\r\n }\r\n\r\n return tableNode;\r\n });\r\n }, [editor]);\r\n\r\n useEffect(() => {\r\n const onMouseMove = (event: MouseEvent) => {\r\n const target = event.target;\r\n if (!isHTMLElement(target)) {\r\n return;\r\n }\r\n\r\n if (draggingDirection) {\r\n updateMouseCurrentPos({\r\n x: event.clientX,\r\n y: event.clientY,\r\n });\r\n return;\r\n }\r\n updateIsMouseDown(isMouseDownOnEvent(event));\r\n if (resizerRef.current && resizerRef.current.contains(target)) {\r\n return;\r\n }\r\n\r\n if (targetRef.current !== target) {\r\n targetRef.current = target;\r\n const cell = getDOMCellFromTarget(target);\r\n\r\n if (cell && activeCell !== cell) {\r\n editor.getEditorState().read(\r\n () => {\r\n const tableCellNode = $getNearestNodeFromDOMNode(cell.elem);\r\n if (!tableCellNode) {\r\n throw new Error('TableCellResizer: Table cell node not found.');\r\n }\r\n\r\n const tableNode = $getTableNodeFromLexicalNodeOrThrow(tableCellNode);\r\n const tableElement = getTableElement(tableNode, editor.getElementByKey(tableNode.getKey()));\r\n\r\n if (!tableElement) {\r\n throw new Error('TableCellResizer: Table element not found.');\r\n }\r\n\r\n targetRef.current = target;\r\n tableRectRef.current = tableElement.getBoundingClientRect();\r\n updateActiveCell(cell);\r\n },\r\n { editor }\r\n );\r\n } else if (cell == null) {\r\n resetState();\r\n }\r\n }\r\n };\r\n\r\n const onMouseDown = () => {\r\n updateIsMouseDown(true);\r\n };\r\n\r\n const onMouseUp = () => {\r\n updateIsMouseDown(false);\r\n };\r\n\r\n const removeRootListener = editor.registerRootListener((rootElement, prevRootElement) => {\r\n prevRootElement?.removeEventListener('mousemove', onMouseMove);\r\n prevRootElement?.removeEventListener('mousedown', onMouseDown);\r\n prevRootElement?.removeEventListener('mouseup', onMouseUp);\r\n rootElement?.addEventListener('mousemove', onMouseMove);\r\n rootElement?.addEventListener('mousedown', onMouseDown);\r\n rootElement?.addEventListener('mouseup', onMouseUp);\r\n });\r\n\r\n return () => {\r\n removeRootListener();\r\n };\r\n }, [activeCell, draggingDirection, editor, resetState]);\r\n\r\n const isHeightChanging = (direction: MouseDraggingDirection) => {\r\n if (direction === 'bottom') {\r\n return true;\r\n }\r\n return false;\r\n };\r\n\r\n const updateRowHeight = useCallback(\r\n (heightChange: number) => {\r\n if (!activeCell) {\r\n throw new Error('TableCellResizer: Expected active cell.');\r\n }\r\n\r\n editor.update(\r\n () => {\r\n const tableCellNode = $getNearestNodeFromDOMNode(activeCell.elem);\r\n if (!$isTableCellNode(tableCellNode)) {\r\n throw new Error('TableCellResizer: Table cell node not found.');\r\n }\r\n\r\n const tableNode = $getTableNodeFromLexicalNodeOrThrow(tableCellNode);\r\n\r\n const tableRowIndex = $getTableRowIndexFromTableCellNode(tableCellNode) + tableCellNode.getRowSpan() - 1;\r\n\r\n const tableRows = tableNode.getChildren();\r\n\r\n if (tableRowIndex >= tableRows.length || tableRowIndex < 0) {\r\n throw new Error('Expected table cell to be inside of table row.');\r\n }\r\n\r\n const tableRow = tableRows[tableRowIndex];\r\n\r\n if (!$isTableRowNode(tableRow)) {\r\n throw new Error('Expected table row');\r\n }\r\n\r\n let height = tableRow.getHeight();\r\n if (height === undefined) {\r\n const rowCells = tableRow.getChildren<TableCellNode>();\r\n height = Math.min(...rowCells.map((cell) => getCellNodeHeight(cell, editor) ?? Infinity));\r\n }\r\n\r\n const newHeight = Math.max(height + heightChange, MIN_ROW_HEIGHT);\r\n tableRow.setHeight(newHeight);\r\n },\r\n { tag: 'skip-scroll-into-view' }\r\n );\r\n },\r\n [activeCell, editor]\r\n );\r\n\r\n const getCellNodeHeight = (cell: TableCellNode, activeEditor: LexicalEditor): number | undefined => {\r\n const domCellNode = activeEditor.getElementByKey(cell.getKey());\r\n return domCellNode?.clientHeight;\r\n };\r\n\r\n const getCellColumnIndex = (tableCellNode: TableCellNode, tableMap: TableMapType) => {\r\n for (let row = 0; row < tableMap.length; row++) {\r\n for (let column = 0; column < tableMap[row].length; column++) {\r\n if (tableMap[row][column].cell === tableCellNode) {\r\n return column;\r\n }\r\n }\r\n }\r\n return -1;\r\n };\r\n\r\n const updateColumnWidth = useCallback(\r\n (widthChange: number) => {\r\n if (!activeCell) {\r\n throw new Error('TableCellResizer: Expected active cell.');\r\n }\r\n editor.update(\r\n () => {\r\n const tableCellNode = $getNearestNodeFromDOMNode(activeCell.elem);\r\n if (!$isTableCellNode(tableCellNode)) {\r\n throw new Error('TableCellResizer: Table cell node not found.');\r\n }\r\n\r\n const tableNode = $getTableNodeFromLexicalNodeOrThrow(tableCellNode);\r\n const [tableMap] = $computeTableMapSkipCellCheck(tableNode, null, null);\r\n const columnIndex = getCellColumnIndex(tableCellNode, tableMap);\r\n if (columnIndex === undefined) {\r\n throw new Error('TableCellResizer: Table column not found.');\r\n }\r\n\r\n const colWidths = tableNode.getColWidths();\r\n if (!colWidths) {\r\n return;\r\n }\r\n const width = colWidths[columnIndex];\r\n if (width === undefined) {\r\n return;\r\n }\r\n const newColWidths = [...colWidths];\r\n const newWidth = Math.max(width + widthChange, MIN_COLUMN_WIDTH);\r\n newColWidths[columnIndex] = newWidth;\r\n tableNode.setColWidths(newColWidths);\r\n\r\n // modification: when resizing a column, also resize the next column so the table doesn't overflow\r\n if (columnIndex < tableNode.getColumnCount() - 1) {\r\n const nextColWidths = tableNode.getColWidths();\r\n if (!nextColWidths) {\r\n return;\r\n }\r\n const newNextColWidths = [...nextColWidths];\r\n const newColumnIndex = columnIndex + 1;\r\n const newNextWidth = nextColWidths[newColumnIndex];\r\n const nextWidth = Math.max(newNextWidth - widthChange, MIN_COLUMN_WIDTH);\r\n newNextColWidths[newColumnIndex] = nextWidth;\r\n tableNode.setColWidths(newNextColWidths);\r\n }\r\n },\r\n { tag: 'skip-scroll-into-view' }\r\n );\r\n },\r\n [activeCell, editor]\r\n );\r\n\r\n const mouseUpHandler = useCallback(\r\n (direction: MouseDraggingDirection) => {\r\n const handler = (event: MouseEvent) => {\r\n event.preventDefault();\r\n event.stopPropagation();\r\n\r\n if (!activeCell) {\r\n throw new Error('TableCellResizer: Expected active cell.');\r\n }\r\n\r\n if (mouseStartPosRef.current) {\r\n const { x, y } = mouseStartPosRef.current;\r\n\r\n if (activeCell === null) {\r\n return;\r\n }\r\n const zoom = calculateZoomLevel(event.target as Element);\r\n\r\n if (isHeightChanging(direction)) {\r\n const heightChange = (event.clientY - y) / zoom;\r\n updateRowHeight(heightChange);\r\n } else {\r\n const widthChange = (event.clientX - x) / zoom;\r\n updateColumnWidth(widthChange);\r\n }\r\n\r\n resetState();\r\n document.removeEventListener('mouseup', handler);\r\n }\r\n };\r\n return handler;\r\n },\r\n [activeCell, resetState, updateColumnWidth, updateRowHeight]\r\n );\r\n\r\n const toggleResize = useCallback(\r\n (direction: MouseDraggingDirection): MouseEventHandler<HTMLDivElement> =>\r\n (event) => {\r\n event.preventDefault();\r\n event.stopPropagation();\r\n\r\n if (!activeCell) {\r\n throw new Error('TableCellResizer: Expected active cell.');\r\n }\r\n\r\n mouseStartPosRef.current = {\r\n x: event.clientX,\r\n y: event.clientY,\r\n };\r\n updateMouseCurrentPos(mouseStartPosRef.current);\r\n updateDraggingDirection(direction);\r\n\r\n document.addEventListener('mouseup', mouseUpHandler(direction));\r\n },\r\n [activeCell, mouseUpHandler]\r\n );\r\n\r\n const getResizers = useCallback(() => {\r\n if (activeCell) {\r\n const { height, width, top, left } = activeCell.elem.getBoundingClientRect();\r\n const zoom = calculateZoomLevel(activeCell.elem);\r\n const zoneWidth = 10; // Pixel width of the zone where you can drag the edge\r\n const styles = {\r\n bottom: {\r\n backgroundColor: 'none',\r\n cursor: 'ns-resize',\r\n height: `${zoneWidth}px`,\r\n left: `${window.pageXOffset + left}px`,\r\n top: `${window.pageYOffset + top + height - zoneWidth / HALF}px`,\r\n width: `${width}px`,\r\n zIndex: 5000,\r\n },\r\n right: {\r\n backgroundColor: 'none',\r\n cursor: 'ew-resize',\r\n height: `${height}px`,\r\n left: `${window.pageXOffset + left + width - zoneWidth / HALF}px`,\r\n top: `${window.pageYOffset + top}px`,\r\n width: `${zoneWidth}px`,\r\n zIndex: 5000,\r\n },\r\n };\r\n\r\n const tableRect = tableRectRef.current;\r\n\r\n if (draggingDirection && mouseCurrentPos && tableRect) {\r\n if (isHeightChanging(draggingDirection)) {\r\n styles[draggingDirection].left = `${window.pageXOffset + tableRect.left}px`;\r\n styles[draggingDirection].top = `${window.pageYOffset + mouseCurrentPos.y / zoom}px`;\r\n styles[draggingDirection].height = '3px';\r\n styles[draggingDirection].width = `${tableRect.width}px`;\r\n } else {\r\n styles[draggingDirection].top = `${window.pageYOffset + tableRect.top}px`;\r\n styles[draggingDirection].left = `${window.pageXOffset + mouseCurrentPos.x / zoom}px`;\r\n styles[draggingDirection].width = '3px';\r\n styles[draggingDirection].height = `${tableRect.height}px`;\r\n }\r\n\r\n styles[draggingDirection].backgroundColor = '#adf';\r\n }\r\n\r\n return styles;\r\n }\r\n\r\n return {\r\n bottom: null,\r\n left: null,\r\n right: null,\r\n top: null,\r\n };\r\n }, [activeCell, draggingDirection, mouseCurrentPos]);\r\n\r\n const resizerStyles = getResizers();\r\n\r\n return (\r\n <div ref={resizerRef}>\r\n {activeCell != null && !isMouseDown && (\r\n <>\r\n <div\r\n className={styles['table-cell-resizer__resizer']}\r\n style={resizerStyles.right || undefined}\r\n onMouseDown={toggleResize('right')}\r\n />\r\n <div\r\n className={styles['table-cell-resizer__resizer']}\r\n style={resizerStyles.bottom || undefined}\r\n onMouseDown={toggleResize('bottom')}\r\n />\r\n </>\r\n )}\r\n </div>\r\n );\r\n}\r\n\r\nexport const TableCellResizerPlugin = (): null | ReactPortal => {\r\n const [editor] = useLexicalComposerContext();\r\n const isEditable = useLexicalEditable();\r\n\r\n return useMemo(\r\n () => (isEditable ? createPortal(<TableCellResizer editor={editor} />, document.body) : null),\r\n [editor, isEditable]\r\n );\r\n};\r\n"],"names":["c","n","t","u","e","a","i","l","r","d","o","MIN_ROW_HEIGHT","MIN_COLUMN_WIDTH","HALF","TableCellResizer","editor","targetRef","useRef","resizerRef","tableRectRef","mouseStartPosRef","mouseCurrentPos","updateMouseCurrentPos","useState","activeCell","updateActiveCell","isMouseDown","updateIsMouseDown","draggingDirection","updateDraggingDirection","resetState","useCallback","isMouseDownOnEvent","event","useEffect","TableNode","tableNode","tableRows","columnCount","colWidths","cell","colIdx","domCell","tableHasContent","isNested","$getNearestNodeOfType","TableCellNode","newColWidth","getEditorParrentCellWidth","getEditorContentWidth","TableWrapperNode","wrapperNode","$createTableWrapperNode","onMouseMove","target","isHTMLElement","getDOMCellFromTarget","tableCellNode","$getNearestNodeFromDOMNode","$getTableNodeFromLexicalNodeOrThrow","tableElement","getTableElement","onMouseDown","onMouseUp","removeRootListener","rootElement","prevRootElement","isHeightChanging","direction","updateRowHeight","heightChange","$isTableCellNode","tableRowIndex","$getTableRowIndexFromTableCellNode","tableRow","$isTableRowNode","height","rowCells","getCellNodeHeight","newHeight","activeEditor","getCellColumnIndex","tableMap","row","column","updateColumnWidth","widthChange","$computeTableMapSkipCellCheck","columnIndex","width","newColWidths","newWidth","nextColWidths","newNextColWidths","newColumnIndex","newNextWidth","nextWidth","mouseUpHandler","handler","x","y","zoom","calculateZoomLevel","toggleResize","resizerStyles","top","left","zoneWidth","styles","tableRect","jsx","jsxs","Fragment","TableCellResizerPlugin","useLexicalComposerContext","isEditable","useLexicalEditable","useMemo","createPortal"],"mappings":";;;;;;;;;AAQgL,MAAMA,KAAe,OAAO,SAApB,OAAqC,OAAO,aAAhB,UAAmC,OAAO,SAAS,kBAAzB,SAAuCC,IAAEC;AAAE,SAASC,GAAEC,GAAE;AAAC,SAAM,EAAC,gBAAe,MAAIA,EAAE,WAAU,GAAG,WAAU,CAAAH,MAAGG,EAAE,yBAAyBH,CAAC,EAAC;AAAC;AAAC,SAASI,KAAG;AAAC,UAAO,SAASJ,GAAE;AAAC,UAAK,CAACC,CAAC,IAAEE,EAAC,GAAGD,IAAEG,EAAE,MAAIL,EAAEC,CAAC,GAAE,CAACA,GAAED,CAAC,CAAC,GAAE,CAACI,GAAEE,CAAC,IAAEC,EAAE,MAAIL,EAAE,eAAc,CAAE,GAAEM,IAAEC,EAAEL,CAAC;AAAE,WAAOL,GAAE,MAAI;AAAC,YAAK,EAAC,gBAAeI,GAAE,WAAUH,EAAC,IAAEE,GAAED,IAAEE;AAAI,aAAOK,EAAE,YAAUP,MAAIO,EAAE,UAAQP,GAAEK,EAAEL,CAAC,IAAGD,EAAE,CAAAG,MAAG;AAAC,QAAAK,EAAE,UAAQL,GAAEG,EAAEH,CAAC;AAAA,MAAC,CAAC;AAAA,IAAC,GAAE,CAACD,GAAEF,CAAC,CAAC,GAAEI;AAAA,EAAC,GAAEF,EAAC;AAAC;;;GCyCvmBQ,KAAiB,IACjBC,IAAmB,IACnBC,IAAO;AAEb,SAASC,GAAiB,EAAE,QAAAC,KAAkD;AAC5E,QAAMC,IAAYC,EAA2B,IAAI,GAC3CC,IAAaD,EAA8B,IAAI,GAC/CE,IAAeF,EAAuB,IAAI,GAE1CG,IAAmBH,EAA6B,IAAI,GACp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,MAAiB,QAAAC,EAAA,CAAgB,GAAI,SAAS,IAAI,IAAI;AAAA,IACxF,CAACA,GAAQoG,CAAU;AAAA,EAAA;AAEvB;","x_google_ignoreList":[0]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsxs as c, jsx as e, Fragment as Z } from "react/jsx-runtime";
|
|
2
2
|
import { o as ee } from "./LexicalComposerContext.prod-DOyoZx0P.js";
|
|
3
|
-
import { c as
|
|
4
|
-
import { J as te, M as oe, K as re } from "./LexicalTable.prod-
|
|
5
|
-
import {
|
|
6
|
-
import { v as se } from "./LexicalUtils.prod-
|
|
7
|
-
import { forwardRef as
|
|
3
|
+
import { c as q } from "./clsx-OuTLNxxd.js";
|
|
4
|
+
import { J as te, M as oe, K as re } from "./LexicalTable.prod-upbwOtcE.js";
|
|
5
|
+
import { ap as le, aq as ne, $ as J, w as O, i as ie, K as ae } from "./Lexical.prod-o6Eq_uLx.js";
|
|
6
|
+
import { v as se } from "./LexicalUtils.prod-CF7x-KWm.js";
|
|
7
|
+
import { forwardRef as z, useState as y, useRef as g, useId as P, useImperativeHandle as V, useEffect as L } from "react";
|
|
8
8
|
import "./components/Accordion/Accordion.js";
|
|
9
9
|
import { Button as I } from "./components/Buttons/Button.js";
|
|
10
10
|
import "./components/Buttons/LinkButton.js";
|
|
@@ -19,7 +19,7 @@ import { FormField as H } from "./components/FormField/FormField.js";
|
|
|
19
19
|
import "./components/GridRow/GridRow.js";
|
|
20
20
|
import "./components/IconButton/IconButton.js";
|
|
21
21
|
import "./components/Input/Input.js";
|
|
22
|
-
import { InputField as
|
|
22
|
+
import { InputField as U } from "./components/InputField/InputField.js";
|
|
23
23
|
import "react-router";
|
|
24
24
|
import { s as R, M as ce } from "./MultiSelectItem-BzBmsKof.js";
|
|
25
25
|
import "./components/RteEditor/Providers/LanguageProvider.js";
|
|
@@ -32,7 +32,7 @@ import "./components/RteEditor/hooks/components/Flyout.js";
|
|
|
32
32
|
import { PREVENT_OPEN_DELAY as ue, deleteTable as fe, deleteColumn as pe, insertColumn as be, deleteRow as _e, insertRow as he, createTable as ke, getEditorParrentCellWidth as ve, getEditorContentWidth as we, DEFAULT_EDITOR_WIDTH as Fe, DEFAULT_COL_WIDTH as Ce } from "./components/RteEditor/Plugins/TablePlugin/helpers.js";
|
|
33
33
|
import { $createTableWrapperNode as ye } from "./components/RteEditor/nodes/TableWrapperNode/TableWrapperNode.js";
|
|
34
34
|
import { useFlyout as Ne } from "./components/RteEditor/hooks/useFlyout.js";
|
|
35
|
-
import { s as $ } from "./RteEditor.module-
|
|
35
|
+
import { s as $ } from "./RteEditor.module-CoTOIw5i.js";
|
|
36
36
|
import "react-dom";
|
|
37
37
|
import "./index-yEhaxKq-.js";
|
|
38
38
|
import "./components/SearchField/SearchField.js";
|
|
@@ -53,13 +53,13 @@ const G = ({ scrollable: _ = !0, noBorder: u, header: a, children: o }) => /* @_
|
|
|
53
53
|
/* @__PURE__ */ e(
|
|
54
54
|
"div",
|
|
55
55
|
{
|
|
56
|
-
className:
|
|
56
|
+
className: q(R["multi-select"], {
|
|
57
57
|
[R["multi-select--no-border"]]: u
|
|
58
58
|
}),
|
|
59
59
|
children: /* @__PURE__ */ e(
|
|
60
60
|
"ul",
|
|
61
61
|
{
|
|
62
|
-
className:
|
|
62
|
+
className: q(R["multi-select__list"], {
|
|
63
63
|
[R["multi-select__list--scrollable"]]: _
|
|
64
64
|
}),
|
|
65
65
|
id: "multi-select-list",
|
|
@@ -77,7 +77,7 @@ const Ee = "_linkform_1anda_1", Le = "_linkform__footer_1anda_12", x = {
|
|
|
77
77
|
linkform__footer: Le,
|
|
78
78
|
"linkform__input-url-wrapper": "_linkform__input-url-wrapper_1anda_19",
|
|
79
79
|
"linkform__open-url-button": "_linkform__open-url-button_1anda_31"
|
|
80
|
-
}, yt =
|
|
80
|
+
}, yt = z(
|
|
81
81
|
({ onCloseHandler: _, onSaveHandler: u, isLink: a = { active: !1, url: "", linktext: "" } }, o) => {
|
|
82
82
|
const l = j(), [f, m] = y(a.url || ""), [s, h] = y(a.linktext || ""), [F, k] = y(!1), [C, v] = y(null), [w, p] = y(null), n = g(null), N = `link_${P()}`, t = `text_${P()}`, r = () => {
|
|
83
83
|
window.open(me(f), "_blank");
|
|
@@ -85,9 +85,9 @@ const Ee = "_linkform_1anda_1", Le = "_linkform__footer_1anda_12", x = {
|
|
|
85
85
|
m(i.target.value);
|
|
86
86
|
}, d = (i) => {
|
|
87
87
|
h(i.target.value);
|
|
88
|
-
}, D = (i) => de(i) === !1 || i.trim() === "" ? (v(l.errortext.urlNotValid), !1) : (v(null), !0), M = (i) => i.trim() === "" ? (p(l.errortext.linkTextNotValid), !1) : (p(null), !0),
|
|
88
|
+
}, D = (i) => de(i) === !1 || i.trim() === "" ? (v(l.errortext.urlNotValid), !1) : (v(null), !0), M = (i) => i.trim() === "" ? (p(l.errortext.linkTextNotValid), !1) : (p(null), !0), B = () => {
|
|
89
89
|
!D(f) || F && !M(s) || (u(f, s), E());
|
|
90
|
-
},
|
|
90
|
+
}, K = () => {
|
|
91
91
|
_(), E();
|
|
92
92
|
}, E = () => {
|
|
93
93
|
m(""), k(!1), v(null), p(null);
|
|
@@ -96,7 +96,7 @@ const Ee = "_linkform_1anda_1", Le = "_linkform__footer_1anda_12", x = {
|
|
|
96
96
|
}, W = () => {
|
|
97
97
|
n.current && n.current.focus();
|
|
98
98
|
};
|
|
99
|
-
return
|
|
99
|
+
return V(o, () => ({
|
|
100
100
|
clearForm: E,
|
|
101
101
|
focusFirstField: W,
|
|
102
102
|
setDefaults: T
|
|
@@ -105,7 +105,7 @@ const Ee = "_linkform_1anda_1", Le = "_linkform__footer_1anda_12", x = {
|
|
|
105
105
|
/* @__PURE__ */ e(S, { htmlFor: N, children: l.links.linkLabel }),
|
|
106
106
|
/* @__PURE__ */ c("div", { className: x["linkform__input-url-wrapper"], children: [
|
|
107
107
|
/* @__PURE__ */ e(
|
|
108
|
-
|
|
108
|
+
U,
|
|
109
109
|
{
|
|
110
110
|
id: N,
|
|
111
111
|
placeholder: l.links.linkPlaceholder,
|
|
@@ -123,7 +123,7 @@ const Ee = "_linkform_1anda_1", Le = "_linkform__footer_1anda_12", x = {
|
|
|
123
123
|
F && /* @__PURE__ */ c(H, { className: x["linkform__input-field"], children: [
|
|
124
124
|
/* @__PURE__ */ e(S, { htmlFor: t, children: l.links.linkText }),
|
|
125
125
|
/* @__PURE__ */ e(
|
|
126
|
-
|
|
126
|
+
U,
|
|
127
127
|
{
|
|
128
128
|
id: t,
|
|
129
129
|
value: s,
|
|
@@ -135,8 +135,8 @@ const Ee = "_linkform_1anda_1", Le = "_linkform__footer_1anda_12", x = {
|
|
|
135
135
|
w && /* @__PURE__ */ e(Q, { level: "error", feedback: w })
|
|
136
136
|
] }),
|
|
137
137
|
/* @__PURE__ */ c("div", { className: x.linkform__footer, children: [
|
|
138
|
-
/* @__PURE__ */ e(I, { variant: "secondary", onClick:
|
|
139
|
-
/* @__PURE__ */ e(I, { variant: "primary", onClick:
|
|
138
|
+
/* @__PURE__ */ e(I, { variant: "secondary", onClick: K, "aria-label": l.common.cancel, type: "button", children: l.common.cancel }),
|
|
139
|
+
/* @__PURE__ */ e(I, { variant: "primary", onClick: B, "aria-label": l.aria.labels.linkOkButton, type: "button", children: l.links.addLink })
|
|
140
140
|
] })
|
|
141
141
|
] });
|
|
142
142
|
}
|
|
@@ -144,7 +144,7 @@ const Ee = "_linkform_1anda_1", Le = "_linkform__footer_1anda_12", x = {
|
|
|
144
144
|
tableform: Re,
|
|
145
145
|
"tableform__input-field": "_tableform__input-field_t5fpq_5",
|
|
146
146
|
tableform__footer: Ie
|
|
147
|
-
}, Se =
|
|
147
|
+
}, Se = z(({ onCloseHandler: _, onSaveHandler: u }, a) => {
|
|
148
148
|
const o = j(), [l, f] = y(), [m, s] = y(), h = g(null), F = `row_${P()}`, k = `column_${P()}`, C = (n, N) => {
|
|
149
149
|
const t = n.target.value;
|
|
150
150
|
N === "row" ? f(parseInt(t)) : s(parseInt(t));
|
|
@@ -155,7 +155,7 @@ const Ee = "_linkform_1anda_1", Le = "_linkform__footer_1anda_12", x = {
|
|
|
155
155
|
}, p = () => {
|
|
156
156
|
f(void 0), s(void 0);
|
|
157
157
|
};
|
|
158
|
-
return
|
|
158
|
+
return V(a, () => ({
|
|
159
159
|
clearForm: p,
|
|
160
160
|
focusFirstField: () => h.current?.focus()
|
|
161
161
|
})), L(() => {
|
|
@@ -169,7 +169,7 @@ const Ee = "_linkform_1anda_1", Le = "_linkform__footer_1anda_12", x = {
|
|
|
169
169
|
/* @__PURE__ */ c(H, { className: A["tableform__input-field"], children: [
|
|
170
170
|
/* @__PURE__ */ e(S, { htmlFor: F, children: o.table.nrofRows }),
|
|
171
171
|
/* @__PURE__ */ e(
|
|
172
|
-
|
|
172
|
+
U,
|
|
173
173
|
{
|
|
174
174
|
id: F,
|
|
175
175
|
placeholder: o.table.nrofRowsPlaceholder,
|
|
@@ -183,7 +183,7 @@ const Ee = "_linkform_1anda_1", Le = "_linkform__footer_1anda_12", x = {
|
|
|
183
183
|
/* @__PURE__ */ c(H, { className: A["tableform__input-field"], children: [
|
|
184
184
|
/* @__PURE__ */ e(S, { htmlFor: k, children: o.table.nrofColumns }),
|
|
185
185
|
/* @__PURE__ */ e(
|
|
186
|
-
|
|
186
|
+
U,
|
|
187
187
|
{
|
|
188
188
|
id: k,
|
|
189
189
|
placeholder: o.table.nrofColumnsPlaceholder,
|
|
@@ -207,7 +207,7 @@ const Ee = "_linkform_1anda_1", Le = "_linkform__footer_1anda_12", x = {
|
|
|
207
207
|
)
|
|
208
208
|
] })
|
|
209
209
|
] });
|
|
210
|
-
}), Nt =
|
|
210
|
+
}), Nt = z(({ isActive: _ }, u) => {
|
|
211
211
|
const a = j(), [o] = ee(), { flyout: l, showFlyout: f, hideFlyout: m, isVisible: s } = Ne(), h = g(void 0), F = g(null), k = g(!1), C = g(s), v = () => {
|
|
212
212
|
const t = F.current?.getBoundingClientRect();
|
|
213
213
|
!k.current && t && f({ position: { top: t.bottom, left: t.left }, ...N });
|
|
@@ -215,17 +215,17 @@ const Ee = "_linkform_1anda_1", Le = "_linkform__footer_1anda_12", x = {
|
|
|
215
215
|
m();
|
|
216
216
|
}, p = (t, r) => {
|
|
217
217
|
o.update(() => {
|
|
218
|
-
const b = J(), d = ke(t, r), D =
|
|
218
|
+
const b = J(), d = ke(t, r), D = O(b) && b.anchor.getNode() || ie(b) && b.getNodes()[0] || null, M = D ? se(D, re) : null, B = M ? ve(M, r, o) : we(o) || Fe, K = Math.max(Ce, Math.floor(B / Math.max(1, r))), E = Array.from({ length: r }, () => K);
|
|
219
219
|
d.setColWidths(E);
|
|
220
220
|
const T = ye();
|
|
221
|
-
T.append(d),
|
|
221
|
+
T.append(d), O(b) ? b.insertNodes([T]) : ae().append(T);
|
|
222
222
|
const W = T.getFirstDescendant();
|
|
223
223
|
W && W.select();
|
|
224
224
|
}), w();
|
|
225
225
|
}, n = (t) => {
|
|
226
226
|
o.update(() => {
|
|
227
227
|
const r = J();
|
|
228
|
-
if (
|
|
228
|
+
if (O(r)) {
|
|
229
229
|
const b = r.anchor.getNode(), d = te(b);
|
|
230
230
|
if (oe(d))
|
|
231
231
|
switch (t) {
|
|
@@ -279,7 +279,7 @@ const Ee = "_linkform_1anda_1", Le = "_linkform__footer_1anda_12", x = {
|
|
|
279
279
|
return document.addEventListener("keydown", t, { capture: !0 }), () => {
|
|
280
280
|
document.removeEventListener("keydown", t);
|
|
281
281
|
};
|
|
282
|
-
}, []),
|
|
282
|
+
}, []), V(u, () => ({
|
|
283
283
|
mutateTable: n
|
|
284
284
|
})), /* @__PURE__ */ e("div", { className: $["editor__toolbar-button-group"], children: /* @__PURE__ */ c("div", { className: $["editor__toolbar-button-flyoutwrapper"], children: [
|
|
285
285
|
/* @__PURE__ */ e(
|
|
@@ -287,7 +287,7 @@ const Ee = "_linkform_1anda_1", Le = "_linkform__footer_1anda_12", x = {
|
|
|
287
287
|
{
|
|
288
288
|
onClick: v,
|
|
289
289
|
title: a.table.tableTooltip,
|
|
290
|
-
className:
|
|
290
|
+
className: q($["editor__toolbar-button"], _ && $["editor__toolbar-button--active"]),
|
|
291
291
|
"aria-label": a.aria.labels.table,
|
|
292
292
|
"aria-keyshortcuts": a.aria.keyshortcuts.table,
|
|
293
293
|
ref: F,
|
|
@@ -305,4 +305,4 @@ export {
|
|
|
305
305
|
ge as a,
|
|
306
306
|
Se as b
|
|
307
307
|
};
|
|
308
|
-
//# sourceMappingURL=TablePlugin-
|
|
308
|
+
//# sourceMappingURL=TablePlugin-BRZcXq73.js.map
|