@layers-app/editor 0.5.7-optimization → 0.5.10-optimization
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/README.md +0 -19
- package/dist/ExcalidrawComponent-D7Z_2awF.cjs +1 -0
- package/dist/ExcalidrawComponent-Re4zFgLg.js +283 -0
- package/dist/InlineImageComponent-DHgCaPNk.cjs +1 -0
- package/dist/InlineImageComponent-kXhZcmF6.js +265 -0
- package/dist/collaboration-C7xVk0Zj.cjs +4 -0
- package/dist/collaboration-Cn7KizEJ.js +5997 -0
- package/dist/excalidraw-C-6bid_P.js +16497 -0
- package/dist/excalidraw-DpwKTNBz.cjs +574 -0
- package/dist/index-B4yOqKUQ.cjs +1 -0
- package/dist/index-BZu8Qnrg.cjs +1 -0
- package/dist/index-CFA9Drk2.cjs +16 -0
- package/dist/index-CX5msaMB.js +296 -0
- package/dist/index-CbQX0N2c.js +136 -0
- package/dist/index-DEC5JR_F.js +60 -0
- package/dist/index-Dan3tqoj.cjs +1 -0
- package/dist/index-WCOc4LNL.js +16600 -0
- package/dist/index.cjs +2 -2
- package/dist/index.js +12 -13
- package/dist/lexical-2rxs76dr.cjs +41 -0
- package/dist/lexical-C60GkwxR.js +13122 -0
- package/dist/lexical-code-DKIWiZdJ.js +604 -0
- package/dist/lexical-code-VafvPacU.cjs +9 -0
- package/dist/lexical-collab-1tX9tFVC.js +1025 -0
- package/dist/lexical-collab-Nk2LVpJv.cjs +1 -0
- package/dist/lexical-file-C52Mze5k.cjs +1 -0
- package/dist/lexical-file-DjHP4vVw.js +43 -0
- package/dist/lexical-markdown-BSl_ahWw.cjs +12 -0
- package/dist/lexical-markdown-DcEwQQba.js +488 -0
- package/dist/lodash-3PEMjFQT.cjs +1 -0
- package/dist/lodash-jftOdrxX.js +711 -0
- package/dist/stats.html +4949 -0
- package/dist/vendor-BrXDSyZX.js +136433 -0
- package/dist/vendor-Bt6Lma3y.cjs +2469 -0
- package/package.json +56 -87
- package/dist/layers.BC4vtoR_.js +0 -1
- package/dist/layers.B_yux7vw.js +0 -4
- package/dist/layers.BcAsUBEd.js +0 -341
- package/dist/layers.BtlL1tAr.js +0 -2
- package/dist/layers.DDFAbldJ.js +0 -530
- package/dist/layers.DNCgFYS7.js +0 -27
- package/dist/layers.DRco4RUq.js +0 -6
- package/dist/layers.DmkizKAP.js +0 -2511
- package/dist/layers.DydTPA8C.js +0 -2227
- package/dist/layers.JnfXnfvp.js +0 -1
- package/dist/layers.NH0RP3cX.js +0 -3
- package/dist/layers.QjAkD17S.js +0 -3677
- package/dist/layers.ZHcm9ChQ.js +0 -6774
- package/dist/layers.bsL5r2kj.js +0 -864
- package/dist/layers.hBfNB8NK.js +0 -7
- package/dist/layers.vxLVQC3Y.js +0 -7723
package/package.json
CHANGED
|
@@ -1,29 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@layers-app/editor",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.5.
|
|
4
|
+
"version": "0.5.10-optimization",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"description": "Powerful rich-text editor ",
|
|
7
|
-
"keywords": [
|
|
8
|
-
"editor",
|
|
9
|
-
"rich-text",
|
|
10
|
-
"wysiwyg",
|
|
11
|
-
"react",
|
|
12
|
-
"typescript",
|
|
13
|
-
"collaboration",
|
|
14
|
-
"comments",
|
|
15
|
-
"markdown"
|
|
16
|
-
],
|
|
17
|
-
"author": "Layers Team",
|
|
18
|
-
"license": "MIT",
|
|
19
|
-
"repository": {
|
|
20
|
-
"type": "git",
|
|
21
|
-
"url": "https://www.npmjs.com/package/@layers-app/editor/"
|
|
22
|
-
},
|
|
23
|
-
"bugs": {
|
|
24
|
-
"url": "https://www.npmjs.com/package/@layers-app/editor/"
|
|
25
|
-
},
|
|
26
|
-
"homepage": "https://www.npmjs.com/package/@layers-app/editor/",
|
|
27
6
|
"scripts": {
|
|
28
7
|
"start": "VITE_LAYERS=true vite --mode full ",
|
|
29
8
|
"start:specific": "VITE_LAYERS=false vite --mode full ",
|
|
@@ -51,36 +30,29 @@
|
|
|
51
30
|
],
|
|
52
31
|
"main": "dist/index.js",
|
|
53
32
|
"types": "dist/index.d.ts",
|
|
54
|
-
"
|
|
55
|
-
".": {
|
|
56
|
-
"types": "./dist/index.d.ts",
|
|
57
|
-
"import": "./dist/index.js",
|
|
58
|
-
"require": "./dist/index.cjs"
|
|
59
|
-
},
|
|
60
|
-
"./types": {
|
|
61
|
-
"types": "./dist/types.d.ts"
|
|
62
|
-
},
|
|
63
|
-
"./package.json": "./package.json"
|
|
64
|
-
},
|
|
65
|
-
"sideEffects": [
|
|
66
|
-
"*.css",
|
|
67
|
-
"*.scss"
|
|
68
|
-
],
|
|
69
|
-
"devDependencies": {
|
|
70
|
-
"@eslint/js": "^9.9.0",
|
|
33
|
+
"dependencies": {
|
|
71
34
|
"@excalidraw/excalidraw": "^0.18.0",
|
|
72
|
-
"@layers-app/shared": ">=0.0.44",
|
|
73
35
|
"@lexical/file": "^0.38.2",
|
|
74
36
|
"@lexical/headless": "^0.38.2",
|
|
75
37
|
"@lexical/markdown": "^0.38.2",
|
|
76
38
|
"@lexical/react": "^0.38.2",
|
|
77
|
-
"@
|
|
78
|
-
"
|
|
79
|
-
"
|
|
80
|
-
"
|
|
81
|
-
"
|
|
82
|
-
"
|
|
83
|
-
|
|
39
|
+
"@tanstack/react-query": "^5.64.1",
|
|
40
|
+
"install": "^0.13.0",
|
|
41
|
+
"lexical": "^0.38.2",
|
|
42
|
+
"npm": "^11.0.0",
|
|
43
|
+
"y-websocket": "^1.5.3",
|
|
44
|
+
"yjs": "^13.6.20"
|
|
45
|
+
},
|
|
46
|
+
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@eslint/js": "^9.9.0",
|
|
49
|
+
"@mantine/core": "^8.0.0",
|
|
50
|
+
"@mantine/dropzone": "^8.0.0",
|
|
51
|
+
"@mantine/form": "^8.0.0",
|
|
52
|
+
"@mantine/hooks": "^8.0.0",
|
|
53
|
+
"@mantine/modals": "^8.0.0",
|
|
54
|
+
"@mantine/notifications": "^8.0.0",
|
|
55
|
+
"@mantine/tiptap": "^8.0.0",
|
|
84
56
|
"@playwright/test": "^1.40.0",
|
|
85
57
|
"@rollup/plugin-typescript": "^11.1.6",
|
|
86
58
|
"@tabler/icons-react": "^3.7.0",
|
|
@@ -107,7 +79,6 @@
|
|
|
107
79
|
"eslint-plugin-unused-imports": "^4.1.4",
|
|
108
80
|
"glob": "^10.3.10",
|
|
109
81
|
"i18next": "^25.5.2",
|
|
110
|
-
"lexical": "^0.38.2",
|
|
111
82
|
"lodash-es": "^4.17.21",
|
|
112
83
|
"postcss-import": "^16.1.0",
|
|
113
84
|
"postcss-preset-mantine": "^1.17.0",
|
|
@@ -115,11 +86,9 @@
|
|
|
115
86
|
"prettier-plugin-organize-attributes": "^1.0.0",
|
|
116
87
|
"proper-lockfile": "^4.1.2",
|
|
117
88
|
"react-i18next": "^15.7.3",
|
|
118
|
-
"react-selecto": "^1.26.3",
|
|
119
89
|
"rollup-plugin-typescript-paths": "^1.5.0",
|
|
120
90
|
"rollup-plugin-visualizer": "^5.12.0",
|
|
121
91
|
"sass": "^1.71.1",
|
|
122
|
-
"swagger-ui-react": "^5.30.2",
|
|
123
92
|
"terser": "^5.39.0",
|
|
124
93
|
"typescript": "^5.5.4",
|
|
125
94
|
"typescript-eslint": "^8.2.0",
|
|
@@ -128,9 +97,7 @@
|
|
|
128
97
|
"vite-plugin-css-injected-by-js": "^3.5.0",
|
|
129
98
|
"vite-plugin-dts": "^4.0.0-beta.1",
|
|
130
99
|
"vite-plugin-static-copy": "^2.3.2",
|
|
131
|
-
"vite-plugin-svgr": "^4.2.0"
|
|
132
|
-
"y-websocket": "^1.5.3",
|
|
133
|
-
"yjs": "^13.6.20"
|
|
100
|
+
"vite-plugin-svgr": "^4.2.0"
|
|
134
101
|
},
|
|
135
102
|
"overrides": {
|
|
136
103
|
"nanoid": "^5.0.9",
|
|
@@ -138,13 +105,13 @@
|
|
|
138
105
|
"dompurify": "^3.2.4",
|
|
139
106
|
"mermaid": "^10.9.4",
|
|
140
107
|
"i18next": "^25.5.2",
|
|
141
|
-
"@mantine/core": "8.
|
|
142
|
-
"@mantine/hooks": "8.
|
|
143
|
-
"@mantine/form": "8.
|
|
144
|
-
"@mantine/dropzone": "8.
|
|
145
|
-
"@mantine/modals": "8.
|
|
146
|
-
"@mantine/notifications": "8.
|
|
147
|
-
"@mantine/tiptap": "8.
|
|
108
|
+
"@mantine/core": "^8.0.0",
|
|
109
|
+
"@mantine/hooks": "^8.0.0",
|
|
110
|
+
"@mantine/form": "^8.0.0",
|
|
111
|
+
"@mantine/dropzone": "^8.0.0",
|
|
112
|
+
"@mantine/modals": "^8.0.0",
|
|
113
|
+
"@mantine/notifications": "^8.0.0",
|
|
114
|
+
"@mantine/tiptap": "^8.0.0",
|
|
148
115
|
"@excalidraw/mermaid-to-excalidraw": {
|
|
149
116
|
"nanoid": "^5.0.9"
|
|
150
117
|
},
|
|
@@ -156,42 +123,44 @@
|
|
|
156
123
|
}
|
|
157
124
|
},
|
|
158
125
|
"peerDependencies": {
|
|
159
|
-
"@
|
|
160
|
-
"@
|
|
161
|
-
"@
|
|
162
|
-
"@
|
|
163
|
-
"@
|
|
164
|
-
"@
|
|
165
|
-
"@mantine/
|
|
166
|
-
"@mantine/dropzone": "8.3.8",
|
|
167
|
-
"@mantine/form": "8.3.8",
|
|
168
|
-
"@mantine/hooks": "8.3.8",
|
|
169
|
-
"@mantine/modals": "8.3.8",
|
|
126
|
+
"@mantine/core": ">=8.0.0",
|
|
127
|
+
"@mantine/dropzone": ">=8.0.0",
|
|
128
|
+
"@mantine/form": ">=8.0.0",
|
|
129
|
+
"@mantine/hooks": ">=8.0.0",
|
|
130
|
+
"@mantine/modals": ">=8.0.0",
|
|
131
|
+
"@mantine/notifications": ">=8.0.0",
|
|
132
|
+
"@mantine/carousel": ">=8.0.0",
|
|
170
133
|
"@tabler/icons-react": ">=3.7.0",
|
|
171
|
-
"
|
|
172
|
-
"i18next": ">=25.5.2",
|
|
173
|
-
"lexical": ">=0.38.2",
|
|
134
|
+
"i18next": "^25.5.2",
|
|
174
135
|
"lodash-es": ">=4.17.21",
|
|
175
136
|
"react": "^18.3.1",
|
|
176
137
|
"react-dom": "^18.3.1",
|
|
177
|
-
"react-i18next": "
|
|
178
|
-
"react-selecto": "
|
|
179
|
-
"swagger-ui-react": "^5.
|
|
180
|
-
"
|
|
181
|
-
"yjs": ">=13.6.20"
|
|
138
|
+
"react-i18next": "^15.7.3",
|
|
139
|
+
"react-selecto": "^1.26.3",
|
|
140
|
+
"swagger-ui-react": "^5.27.1",
|
|
141
|
+
"@layers-app/shared": "^0.1.0"
|
|
182
142
|
},
|
|
183
143
|
"peerDependenciesMeta": {
|
|
184
|
-
"@
|
|
185
|
-
"optional":
|
|
144
|
+
"@mantine/core": {
|
|
145
|
+
"optional": false
|
|
146
|
+
},
|
|
147
|
+
"@mantine/dropzone": {
|
|
148
|
+
"optional": false
|
|
149
|
+
},
|
|
150
|
+
"@mantine/form": {
|
|
151
|
+
"optional": false
|
|
152
|
+
},
|
|
153
|
+
"@mantine/hooks": {
|
|
154
|
+
"optional": false
|
|
186
155
|
},
|
|
187
|
-
"
|
|
188
|
-
"optional":
|
|
156
|
+
"@mantine/modals": {
|
|
157
|
+
"optional": false
|
|
189
158
|
},
|
|
190
|
-
"
|
|
191
|
-
"optional":
|
|
159
|
+
"@mantine/notifications": {
|
|
160
|
+
"optional": false
|
|
192
161
|
},
|
|
193
|
-
"
|
|
194
|
-
"optional":
|
|
162
|
+
"@mantine/carousel": {
|
|
163
|
+
"optional": false
|
|
195
164
|
}
|
|
196
165
|
}
|
|
197
166
|
}
|
package/dist/layers.BC4vtoR_.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const r=require("lexical"),g=require("./layers.B_yux7vw.js"),x=require("./layers.BtlL1tAr.js"),k=require("@lexical/utils"),O=require("@lexical/selection");require("@lexical/code");require("@lexical/hashtag");require("@lexical/link");require("@lexical/mark");require("@lexical/overflow");require("@lexical/react/LexicalHorizontalRuleNode");require("@lexical/rich-text");const f=require("./layers.hBfNB8NK.js");function T(e,t){if(t.add(e.getKey()),r.$isElementNode(e))for(const n of e.getChildren())T(n,t)}function I(e){e.preventDefault(),e.stopImmediatePropagation(),e.stopPropagation()}const R=r.createCommand(),F=r.createCommand(),K=r.createCommand(),B=r.createCommand(),U=r.createCommand(),q=r.createCommand(),z=r.createCommand(),W=r.createCommand(),G=(()=>{var t;const e=(t=window.navigator)==null?void 0:t.userAgentData;return e!==void 0?e.mobile:window.innerWidth<=800&&window.innerHeight<=600})(),V=e=>typeof e=="string"&&e.includes("%")?parseFloat(e):e;function H(e,t){if(!t||!(t instanceof HTMLElement)){console.error("Invalid DOM element provided.");return}e?t.classList.add("disable-scroll"):t.classList.remove("disable-scroll")}function m(e){const t=r.$getSelection();if(r.$isRangeSelection(t)){const o=t.anchor.getNode();if(o!==null){const s=o.getParent();return e?s:o}}return null}function Y(e){e.update(()=>{const t=r.$getSelection();if(r.$isRangeSelection(t)){const n=t.getNodes();let o=null,s=null;if(n.forEach((l,c)=>{c===0&&(o=l.getParent()),c===n.length-1&&(s=l.getParent())}),o&&s){const l=r.$getSelection();r.$isRangeSelection(l)&&(o.isAttached()&&s.isAttached()?g.$isExtendedTextNode(o)&&g.$isExtendedTextNode(s)?l.setTextNodeRange(o,0,s,s.getTextContentSize()):(l.anchor.set(o.getKey(),0,"element"),l.focus.set(s.getKey(),s.getChildrenSize(),"element")):console.error("Error: One of the nodes is not attached."))}}})}const $=(e,t)=>{e.update(()=>{if(typeof t=="string"){const n=r.$getNodeByKey(t);n&&n.remove();return}t&&t.remove()})};function J(e,t){t.update(()=>{let n=r.$createRangeSelection();e.getParent()&&(n.anchor.set(e.getKey(),0,"element"),n.focus.set(e.getKey(),0,"element"),r.$setSelection(n))})}function j(){const e=r.$getSelection();if(r.$isRangeSelection(e)){const t=e.anchor,n=e.focus,o=n.getNode(),s=g.$isExtendedCodeNode(o)?o.__size:o.getTextContentSize(),l=t.offset===0,c=n.offset===s;if(l&&c)return!0}return!1}function Z(e,t){const n=r.$copyNode(e),o=[[e,n]];let s;for(;(s=o.length)>0;)for(let l=0;l<s;l++){const c=o.shift();if(c!==void 0){const[a,i]=c;if(r.$isElementNode(a)&&r.$isElementNode(i)){const d=a.getChildren();for(const u of d){if(t&&u.is(t))continue;const h=r.$copyNode(u);g.$isExtendedTextNode(u)&&g.$isExtendedTextNode(h)&&(h.setFormat(u.__format),h.setStyle(u.__style)),i.append(h),o.push([u,h])}}}}return n}function v(e,t,n=3){if(!e)return null;let o=e,s=0;for(;o&&s<n;){if(t(o))return o;if(o.__type==="root")break;o=o.getParent(),s++}return null}function E(e,t,n){var s;const o=n||{root:!0};if(e){let l=e.getParent();if(o[l==null?void 0:l.__type]){const c=t.getElementByKey(e.__key),a=v(l,g.$isCalloutNode);if(a&&(a.getFirstChild()===e.getTopLevelElement()||a.getFirstChild()===((s=e.getTopLevelElement())==null?void 0:s.getParent()))){const d=a.getParent(),u=d?t.getElementByKey(d.__key):null;if(u)return{htmlElement:u,lexicalNode:r.$getNearestNodeFromDOMNode(u)}}return{htmlElement:c,lexicalNode:e}}return E(l,t,o)}return{htmlElement:null,lexicalNode:null}}function Q(e,t,n,o){var s;if(e)if((e==null?void 0:e.__type)==="root"||(e==null?void 0:e.__type)==="layout-item"||(e==null?void 0:e.__type)==="callout-wrapper"||(e==null?void 0:e.__type)==="collapsible-content"){const l=(o==null?void 0:o.clientY)||0,{left:c}=((s=t.getElementByKey(e.__key))==null?void 0:s.getBoundingClientRect())||{left:0},{paddingLeft:a}=window.getComputedStyle(o==null?void 0:o.target),i=document.elementFromPoint(c+parseFloat(a)+10,l),d=r.$getNearestNodeFromDOMNode(i||document.body);return d?E(d,t,n):{htmlElement:null,lexicalNode:null}}else return E(e,t,n);return{htmlElement:null,lexicalNode:null}}const X=e=>{e.update(()=>{r.$getSelection()!==null&&r.$setSelection(null)})},ee=()=>{const e=r.$getRoot(),t=e==null?void 0:e.getFirstChild();return e.getChildren().length>1?!1:t&&r.$isElementNode(t)&&t.isEmpty()&&!g.$isExtendedCodeNode(t)},te=e=>{e.update(()=>{const t=r.$getRoot(),n=r.$createParagraphNode(),o=r.$getSelection();r.$isRangeSelection(o)&&(o.format=0,o.setStyle("")),t.append(n).selectEnd()})},ne=(e,t,n)=>{const o=e.target;if(o&&(o instanceof HTMLElement||o instanceof SVGElement)){let s=null;const l=o.closest(t);for(const a of n)if(s=o.closest(a),s)break;return{lexicalDOMNode:l,isOutside:!(l||s)}}else return{lexicalDOMNode:null,isOutside:!0}};async function*L(e){let t=!1;for(;!t;){const n=await e.read(),{value:o}=n;o!==void 0&&(yield o),t=n.done}}async function oe(e){const t=[];for await(const o of L(e))for(let s=0;s<o.length;s+=32768)t.push(String.fromCharCode(...o.subarray(s,s+32768)));return t.join("")}async function se(e){const t=new CompressionStream("gzip"),n=t.writable.getWriter(),[,o]=await Promise.all([n.write(new TextEncoder().encode(JSON.stringify(e))).then(()=>n.close()),oe(t.readable.getReader())]);return`#doc=${btoa(o).replace(/\//g,"_").replace(/\+/g,"-").replace(/=+$/,"")}`}async function le(e){const t=/^#doc=(.*)$/.exec(e);if(!t)return null;const n=new DecompressionStream("gzip"),o=n.writable.getWriter(),s=atob(t[1].replace(/_/g,"/").replace(/-/g,"+")),l=new Uint8Array(s.length);for(let i=0;i<s.length;i++)l[i]=s.charCodeAt(i);const c=o.write(l).then(()=>o.close()),a=[];for await(const i of L(n.readable.pipeThrough(new TextDecoderStream).getReader()))a.push(i);return await c,JSON.parse(a.join(""))}const P=()=>!!document.querySelector(".selected-all-document"),re=(e,t,n)=>{var s,l,c,a,i;const o=r.$getSelection();if(r.$isRangeSelection(o)&&o.isCollapsed()){const d=o.anchor.getNode(),u=d.getKey(),h=d.getParent()===n,C=n instanceof r.ElementNode&&(n.__type==="layout-item"?(l=(s=n.getLastChild())==null?void 0:s.getPreviousSibling())==null?void 0:l.getKey():(c=n.getLastChild())==null?void 0:c.getKey())===u,b=n instanceof r.ElementNode&&((a=n.getFirstChild())==null?void 0:a.getKey())===u;if(n&&d instanceof r.ParagraphNode&&!d.getTextContent()&&h&&!((i=d.getPreviousSibling())!=null&&i.getTextContent())&&C&&!b){const D=e.registerCommand(r.INSERT_PARAGRAPH_COMMAND,()=>(D(),!0),r.COMMAND_PRIORITY_NORMAL);return e.update(()=>{var _;if(n){let p=n.getChildren();const w=n.getLastChild();g.$isLayoutDividerNode(w)&&(p=p.slice(0,-1)),p.length===2?p.slice(-1).forEach(y=>y.remove()):p.slice(-2).forEach(y=>y.remove())}const S=t==null?void 0:t.getNextSibling();if(r.$isParagraphNode(S)&&S.getTextContent()==="")(_=t==null?void 0:t.getNextSibling())==null||_.selectEnd();else{const p=t==null?void 0:t.insertAfter(r.$createParagraphNode());p==null||p.selectStart()}}),!0}}return!1},ie=(e,t,n)=>{var l,c,a;const o=(n==null?void 0:n.getChildren())||[];if((o==null?void 0:o.length)===2){for(const i of o)i.__key!==(t==null?void 0:t.__key)&&(n==null||n.insertBefore(i),(l=i.getFirstChild())==null||l.selectEnd());n.remove()}else for(const i of o)if(i.__key===(t==null?void 0:t.__key)){x.setTemplateColumnsAfterDelete(e,i),$(e,i);const d=i.getPreviousSibling()??i.getNextSibling();(a=(c=d==null?void 0:d.getFirstChild)==null?void 0:c.call(d))==null||a.selectEnd()}const s=e.registerCommand(r.DELETE_CHARACTER_COMMAND,()=>(s(),!0),r.COMMAND_PRIORITY_NORMAL);return!0},ce=(e,t,n)=>{if(!e)return null;let o=null;return n.read(()=>{const s=r.$getNearestNodeFromDOMNode(e);o=s&&k.$getNearestNodeOfType(s,t)}),o};function ae(e){return e instanceof HTMLElement}function N(e){let t=0;e instanceof WheelEvent?t=e.deltaY:e instanceof TouchEvent&&(t=1);let n=e.target;for(;n&&n!==document.body&&n!==document.documentElement;){if(n.scrollHeight>n.clientHeight&&(t<0&&n.scrollTop>0||t>0&&n.scrollTop+n.clientHeight<n.scrollHeight))return;n=n.parentElement}e.preventDefault()}function A(){document.addEventListener("wheel",N,{passive:!1}),document.addEventListener("touchmove",N,{passive:!1})}function M(){document.removeEventListener("wheel",N),document.removeEventListener("touchmove",N)}function de(e){const t=e.anchor,n=e.focus,o=e.anchor.getNode(),s=e.focus.getNode();return o===s?o:e.isBackward()?O.$isAtNodeEnd(n)?o:s:O.$isAtNodeEnd(t)?o:s}const ue=new Set(["http:","https:","mailto:","sms:","tel:"]);function fe(e){try{const t=new URL(e);if(!ue.has(t.protocol))return"about:blank"}catch{return e}return e}function ge(e,t){const n=e.getRangeAt(0);let o;if(e.anchorNode===t){let s=t;for(;s.firstElementChild!=null;)s=s.firstElementChild;o=s.getBoundingClientRect()}else o=n.getBoundingClientRect();return o}const he=()=>{var n;const e=(n=window.getSelection())==null?void 0:n.toString().trim();return e==null?void 0:e.replace(/\s+/g,"")},pe=10,me=5;function Ce(e,t,n,o=!1,s=pe,l=me){const c=n.parentElement,a=document.querySelector(".ai-editor-menu");if(e===null||!c||a){t.style.opacity="0",t.style.transform="translate(-10000px, -10000px)",M();return}const i=t.getBoundingClientRect(),d=c.getBoundingClientRect();let u=e.top-i.height-s;u<0&&(u=10);let h=e.left-l;if(u<d.top&&(u+=i.height+e.height+s*2),h+i.width>d.right&&(h=d.right-i.width-l),e.bottom-e.height>d.bottom){t.style.transform="translate(-1000px, -1000px)";return}if(e.bottom+e.height<d.top){t.style.transform="translate(-1000px, -1000px)";return}let C=u;i.top>=d.bottom&&(C=d.bottom),t.style.transform=`translate(${h}px, ${C}px)`,t.style.opacity="1",A()}const Ee=e=>{const t=r.$getSelection(),n=m(),o=n==null?void 0:n.getParent(),s=o==null?void 0:o.getParent();if(n){if(P())return r.$getRoot().clear(),t.insertParagraph(),!0;if(s instanceof f.CollapsibleContentNode||s instanceof f.CollapsibleTitleNode)return f.handleDeleteCollapsibleCharacter();if(o instanceof g.ExtendCodeNode)return f.handleDeleteCodeCharacter()}return!1},Ne=(e,t)=>{var n,o,s,l,c,a;if(e.dataTransfer){const i=Object.values(e.dataTransfer.files);if(i&&i.length)return e.preventDefault(),e.target instanceof HTMLElement&&((n=t.current)!=null&&n.insertImages)&&((o=r.$getNearestNodeFromDOMNode(e.target))==null||o.selectEnd(),i[0].type.includes("video")&&((s=t.current)!=null&&s.insertVideos)?t.current.insertVideos(i):i[0].type.includes("image")&&((l=t.current)!=null&&l.insertImages)?t.current.insertImages(i):i[0].type.includes("audio")&&((c=t.current)!=null&&c.insertMusics)?t.current.insertMusics(i):(a=t.current)!=null&&a.insertFiles&&(t==null||t.current.insertFiles(i))),!0}return!1},ye=()=>{const e=m(),t=e==null?void 0:e.getParent();return e&&f.$isCollapsibleContentNode(t)?f.$onEscapeDownRightCollapsible():!1},Se=()=>{const e=m(),t=e==null?void 0:e.getParent();return e&&f.$isCollapsibleTitleNode(t)?f.$onEscapeUpLeftCollapsible():!1},_e=e=>{const t=r.$getSelection();if(!r.$isRangeSelection(t)||!t.isCollapsed())return!1;const n=t.anchor.getNode();if(n.getPreviousSibling()===null&&t.anchor.offset===0){const o=n.getParent();if(o){const s=r.$createParagraphNode();return s.append(...o.getChildren()),o.replace(s),e.preventDefault(),!0}}return!1};function Oe(e){if(!e)return null;const n=new DOMParser().parseFromString(e,"text/html").body,o=Array.from(n.children);if(o.length!==1)return null;const s=o[0];return s.tagName!=="IMG"||n.textContent&&n.textContent.trim().length>0?null:s.getAttribute("src")||""||null}const Te=(e,t,n)=>{var l,c;const o=m(),s=o==null?void 0:o.getParent();if(o){if(f.$isCollapsibleTitleNode(s))return f.deleteCollapsibleContainer(e);if(g.$isCalloutNode(s))(c=(l=n.current)==null?void 0:l.onDeleteCallout)==null||c.call(l,t);else{if(g.$isLayoutItemNode(s))return f.deleteLayoutItem(e);if(g.$isListItemNode(s))return _e(t)}}return!1},$e=(e,t)=>{const n=t.ctrlKey||t.metaKey,o=t.shiftKey,s=t.code==="KeyZ";return n&&o&&s?(t.preventDefault(),e.dispatchCommand(r.REDO_COMMAND,void 0),!0):!1},Le=(e,t,n,o,s)=>{var a,i;if(s)return o.preventDefault(),o.key==="Enter"&&o.shiftKey&&t.insertParagraph(),!0;const l=m(),c=l==null?void 0:l.getParent();if(l){if(c instanceof g.LayoutItemNode)return f.handleExitLayout(e);if(c instanceof f.CollapsibleContentNode)return f.handleExitCollapsible(e);if(c instanceof g.CalloutNode)return f.handleExitCallout(e);if(c instanceof g.TableCellNode)return f.handleExitTable(e);if(c instanceof g.ListNode||g.LayoutItemNode)return f.handleEnterCheckList()}return(i=(a=n.current)==null?void 0:a.decoratorEnterAction)==null||i.call(a),!1};function Pe(e,t){var n,o,s,l,c,a,i,d;if("dataTransfer"in e&&((o=(n=e.dataTransfer)==null?void 0:n.files)!=null&&o.length)){const u=Array.from(e.dataTransfer.files),h=u[0];return h.type.includes("video")&&((s=t.current)!=null&&s.insertVideos)?t.current.insertVideos(u):h.type.includes("image")&&((l=t.current)!=null&&l.insertImages)?t.current.insertImages(u):h.type.includes("audio")&&((c=t.current)!=null&&c.insertMusics)?t.current.insertMusics(u):(a=t.current)!=null&&a.insertFiles&&t.current.insertFiles(u),!0}if("clipboardData"in e){const u=(d=(i=e.clipboardData)==null?void 0:i.getData("text/html"))==null?void 0:d.trim();if(Oe(u))return!0}return!1}function Ae(e){if(!e||e.classList.contains("video-container")||e.classList.contains("resizable-container")||e.classList.contains("editor-image"))return null;if(e.closest("ol, ul"))return e;let t=e;for(;t&&!t.classList.contains("ContentEditable__root");)t=t.parentElement;if(t!=null&&t.classList.contains("ContentEditable__root")){let n=e;for(;n&&n.parentElement!==t;)n=n.parentElement;return n}return null}function Me(e,t=!1){e.focus(),e.update(()=>{var o,s;const n=r.$getRoot();t?(n.selectStart(),(o=n.getFirstChild())==null||o.selectEnd()):(n.selectEnd(),(s=n.getLastChild())==null||s.selectEnd())})}exports.$copyNodeDeep=Z;exports.$createNewParagraph=te;exports.$getBlockNode=Q;exports.$getClosestParentNode=E;exports.CREATE_TEMPLATE=q;exports.INSERT_CALLOUT_COMMAND=K;exports.KeyBackSpace=Te;exports.ON_CHANGE_COMMAND=R;exports.ON_OPEN_KEBAB_MENU=F;exports.ON_SCROLL_EDITOR=B;exports.ON_SHOW_LINK_POPUP=U;exports.OPEN_EMOJI_PICKER_COMMAND=W;exports.RIGHT_CLICK_COMMAND=z;exports.addNodeAndChildrenToSelection=T;exports.allEditorSelected=P;exports.blockScroll=A;exports.checkIsEmpty=ee;exports.deleteCharacterCommand=Ee;exports.deleteNode=$;exports.docFromHash=le;exports.docToHash=se;exports.dropCommand=Ne;exports.findTopParentElement=Ae;exports.focusEditor=Me;exports.focusOnNode=J;exports.getCurrentElement=m;exports.getDOMRangeRect=ge;exports.getMouseInfo=ne;exports.getNativeSelectedText=he;exports.getNearestBlockNodeOfType=ce;exports.getSelectedNode=de;exports.handleEnterExitContainer=re;exports.isHTMLElement=ae;exports.isMobile=G;exports.isWholeNodeSelected=j;exports.keyArrowRightDown=ye;exports.keyArrowUpLeft=Se;exports.keyDownCommand=$e;exports.keyEnterListener=Le;exports.parseContainerSize=V;exports.pasteCommand=Pe;exports.removeNodeKeepContent=ie;exports.resetSelection=X;exports.sanitizeUrl=fe;exports.selectCurrentNode=Y;exports.setFloatingElemPosition=Ce;exports.stopEvent=I;exports.toggleLockScroll=H;exports.unblockScroll=M;
|