@layers-app/editor 0.5.10-optimization → 0.6.0-specific.2
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 +2 -252
- package/dist/index.cjs +2 -2
- package/dist/index.d.ts +3 -4
- package/dist/index.js +11 -12
- package/dist/layers.BAh77n3h.js +53500 -0
- package/dist/layers.BR_PAAvW.js +319 -0
- package/dist/layers.BVrvmVeX.js +343 -0
- package/dist/layers.BeZDS7Yo.js +1 -0
- package/dist/layers.C9DRKDGJ.js +1 -0
- package/dist/layers.Dawun4Ev.js +44715 -0
- package/dist/layers.DwBS80Kn.js +285 -0
- package/dist/layers.Zo4c9OM_.js +161 -0
- package/package.json +23 -66
- package/dist/ExcalidrawComponent-D7Z_2awF.cjs +0 -1
- package/dist/ExcalidrawComponent-Re4zFgLg.js +0 -283
- package/dist/InlineImageComponent-DHgCaPNk.cjs +0 -1
- package/dist/InlineImageComponent-kXhZcmF6.js +0 -265
- package/dist/collaboration-C7xVk0Zj.cjs +0 -4
- package/dist/collaboration-Cn7KizEJ.js +0 -5997
- package/dist/excalidraw-C-6bid_P.js +0 -16497
- package/dist/excalidraw-DpwKTNBz.cjs +0 -574
- package/dist/index-B4yOqKUQ.cjs +0 -1
- package/dist/index-BZu8Qnrg.cjs +0 -1
- package/dist/index-CFA9Drk2.cjs +0 -16
- package/dist/index-CX5msaMB.js +0 -296
- package/dist/index-CbQX0N2c.js +0 -136
- package/dist/index-DEC5JR_F.js +0 -60
- package/dist/index-Dan3tqoj.cjs +0 -1
- package/dist/index-WCOc4LNL.js +0 -16600
- package/dist/lexical-2rxs76dr.cjs +0 -41
- package/dist/lexical-C60GkwxR.js +0 -13122
- package/dist/lexical-code-DKIWiZdJ.js +0 -604
- package/dist/lexical-code-VafvPacU.cjs +0 -9
- package/dist/lexical-collab-1tX9tFVC.js +0 -1025
- package/dist/lexical-collab-Nk2LVpJv.cjs +0 -1
- package/dist/lexical-file-C52Mze5k.cjs +0 -1
- package/dist/lexical-file-DjHP4vVw.js +0 -43
- package/dist/lexical-markdown-BSl_ahWw.cjs +0 -12
- package/dist/lexical-markdown-DcEwQQba.js +0 -488
- package/dist/lodash-3PEMjFQT.cjs +0 -1
- package/dist/lodash-jftOdrxX.js +0 -711
- package/dist/stats.html +0 -4949
- package/dist/vendor-BrXDSyZX.js +0 -136433
- package/dist/vendor-Bt6Lma3y.cjs +0 -2469
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@layers-app/editor",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.6.0-specific.2",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"start": "VITE_LAYERS=true vite --mode full ",
|
|
@@ -15,12 +15,7 @@
|
|
|
15
15
|
"dev:local": "cross-env NODE_ENV=development concurrently \"npm:server:ws\" \"vite --host\"",
|
|
16
16
|
"server:ws": "concurrently \"cd server && npm start\"",
|
|
17
17
|
"format": "prettier --write .",
|
|
18
|
-
"format:check": "prettier --check ."
|
|
19
|
-
"test:e2e": "playwright test",
|
|
20
|
-
"test:e2e:ui": "playwright test --ui",
|
|
21
|
-
"test:e2e:debug": "playwright test --debug",
|
|
22
|
-
"test:e2e:headed": "playwright test --headed",
|
|
23
|
-
"start-test-server": "VITE_LAYERS=true vite --mode full --port 3000 --strictPort --host localhost"
|
|
18
|
+
"format:check": "prettier --check ."
|
|
24
19
|
},
|
|
25
20
|
"publishConfig": {
|
|
26
21
|
"access": "public"
|
|
@@ -32,28 +27,28 @@
|
|
|
32
27
|
"types": "dist/index.d.ts",
|
|
33
28
|
"dependencies": {
|
|
34
29
|
"@excalidraw/excalidraw": "^0.18.0",
|
|
35
|
-
"@
|
|
36
|
-
"@lexical/headless": "^0.
|
|
37
|
-
"@lexical/markdown": "^0.
|
|
38
|
-
"@lexical/react": "^0.
|
|
30
|
+
"@layers-app/shared": "0.0.39",
|
|
31
|
+
"@lexical/headless": "^0.32.1",
|
|
32
|
+
"@lexical/markdown": "^0.32.1",
|
|
33
|
+
"@lexical/react": "^0.32.1",
|
|
39
34
|
"@tanstack/react-query": "^5.64.1",
|
|
40
35
|
"install": "^0.13.0",
|
|
41
|
-
"lexical": "^0.
|
|
36
|
+
"lexical": "^0.32.1",
|
|
42
37
|
"npm": "^11.0.0",
|
|
38
|
+
"react-selecto": "^1.26.3",
|
|
39
|
+
"swagger-ui-react": "^5.27.1",
|
|
43
40
|
"y-websocket": "^1.5.3",
|
|
44
41
|
"yjs": "^13.6.20"
|
|
45
42
|
},
|
|
46
|
-
|
|
47
43
|
"devDependencies": {
|
|
48
44
|
"@eslint/js": "^9.9.0",
|
|
49
|
-
"@mantine/core": "
|
|
50
|
-
"@mantine/dropzone": "
|
|
51
|
-
"@mantine/form": "
|
|
52
|
-
"@mantine/hooks": "
|
|
53
|
-
"@mantine/modals": "
|
|
54
|
-
"@mantine/notifications": "
|
|
55
|
-
"@mantine/tiptap": "
|
|
56
|
-
"@playwright/test": "^1.40.0",
|
|
45
|
+
"@mantine/core": "7.17.2",
|
|
46
|
+
"@mantine/dropzone": "7.17.2",
|
|
47
|
+
"@mantine/form": "7.17.2",
|
|
48
|
+
"@mantine/hooks": "7.17.2",
|
|
49
|
+
"@mantine/modals": "7.17.2",
|
|
50
|
+
"@mantine/notifications": "7.17.2",
|
|
51
|
+
"@mantine/tiptap": "7.17.2",
|
|
57
52
|
"@rollup/plugin-typescript": "^11.1.6",
|
|
58
53
|
"@tabler/icons-react": "^3.7.0",
|
|
59
54
|
"@trivago/prettier-plugin-sort-imports": "^5.2.1",
|
|
@@ -77,14 +72,11 @@
|
|
|
77
72
|
"eslint-plugin-react": "^7.37.4",
|
|
78
73
|
"eslint-plugin-react-refresh": "^0.4.19",
|
|
79
74
|
"eslint-plugin-unused-imports": "^4.1.4",
|
|
80
|
-
"glob": "^10.3.10",
|
|
81
75
|
"i18next": "^25.5.2",
|
|
82
76
|
"lodash-es": "^4.17.21",
|
|
83
77
|
"postcss-import": "^16.1.0",
|
|
84
|
-
"postcss-preset-mantine": "^1.
|
|
78
|
+
"postcss-preset-mantine": "^1.15.0",
|
|
85
79
|
"prettier": "^3.4.2",
|
|
86
|
-
"prettier-plugin-organize-attributes": "^1.0.0",
|
|
87
|
-
"proper-lockfile": "^4.1.2",
|
|
88
80
|
"react-i18next": "^15.7.3",
|
|
89
81
|
"rollup-plugin-typescript-paths": "^1.5.0",
|
|
90
82
|
"rollup-plugin-visualizer": "^5.12.0",
|
|
@@ -105,13 +97,6 @@
|
|
|
105
97
|
"dompurify": "^3.2.4",
|
|
106
98
|
"mermaid": "^10.9.4",
|
|
107
99
|
"i18next": "^25.5.2",
|
|
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",
|
|
115
100
|
"@excalidraw/mermaid-to-excalidraw": {
|
|
116
101
|
"nanoid": "^5.0.9"
|
|
117
102
|
},
|
|
@@ -123,44 +108,16 @@
|
|
|
123
108
|
}
|
|
124
109
|
},
|
|
125
110
|
"peerDependencies": {
|
|
126
|
-
"@mantine/core": ">=
|
|
127
|
-
"@mantine/dropzone": ">=
|
|
128
|
-
"@mantine/form": ">=
|
|
129
|
-
"@mantine/hooks": ">=
|
|
130
|
-
"@mantine/modals": ">=
|
|
131
|
-
"@mantine/notifications": ">=8.0.0",
|
|
132
|
-
"@mantine/carousel": ">=8.0.0",
|
|
111
|
+
"@mantine/core": ">=7.17.2",
|
|
112
|
+
"@mantine/dropzone": ">=7.17.2",
|
|
113
|
+
"@mantine/form": ">=7.17.2",
|
|
114
|
+
"@mantine/hooks": ">=7.17.2",
|
|
115
|
+
"@mantine/modals": ">=7.17.2",
|
|
133
116
|
"@tabler/icons-react": ">=3.7.0",
|
|
134
117
|
"i18next": "^25.5.2",
|
|
135
118
|
"lodash-es": ">=4.17.21",
|
|
136
119
|
"react": "^18.3.1",
|
|
137
120
|
"react-dom": "^18.3.1",
|
|
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"
|
|
142
|
-
},
|
|
143
|
-
"peerDependenciesMeta": {
|
|
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
|
|
155
|
-
},
|
|
156
|
-
"@mantine/modals": {
|
|
157
|
-
"optional": false
|
|
158
|
-
},
|
|
159
|
-
"@mantine/notifications": {
|
|
160
|
-
"optional": false
|
|
161
|
-
},
|
|
162
|
-
"@mantine/carousel": {
|
|
163
|
-
"optional": false
|
|
164
|
-
}
|
|
121
|
+
"react-i18next": "^15.7.3"
|
|
165
122
|
}
|
|
166
123
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),l=require("react"),n=require("./lexical-2rxs76dr.cjs"),m=require("./index-CFA9Drk2.cjs"),q=require("react-i18next"),c=require("@mantine/core"),$=require("@tabler/icons-react"),y=require("./index-BZu8Qnrg.cjs"),F=({isCloseModal:t,setCloseModalOpen:a,confirmClose:d})=>{const{t:o}=q.useTranslation();return e.jsx(c.Modal,{opened:t,onClose:()=>{a(!1)},centered:!0,title:o("editor.unsavedChanges.title"),closeOnClickOutside:!0,closeOnEscape:!0,size:"500",zIndex:999,children:e.jsxs("div",{children:[e.jsx(c.Text,{mb:"md",children:o("editor.unsavedChanges.message")}),e.jsxs(c.Flex,{justify:"flex-end",gap:"sm",children:[e.jsx(c.Button,{variant:"default",onClick:()=>{a(!1)},fullWidth:!0,children:o("editor.unsavedChanges.cancel")}),e.jsx(c.Button,{color:"red",onClick:d,fullWidth:!0,children:o("editor.unsavedChanges.closeWithoutSaving")})]})]})})},H=t=>{var o;const a=(o=t==null?void 0:t.firstElementChild)==null?void 0:o.firstElementChild,d=t.getAttribute("viewBox");if(d!=null){const u=d.split(" ");t.setAttribute("width",u[2]),t.setAttribute("height",u[3])}a&&a.tagName==="style"&&a.remove()};function W({elements:t,files:a,imageContainerRef:d,appState:o,editor:u,rootClassName:i=null,width:v="inherit",height:A="inherit",nodeKey:f,alignment:k,setModalOpen:j}){const[b,M]=l.useState(null),[S,h]=l.useState(!1);c.useMantineTheme();const{t:p}=q.useTranslation();l.useEffect(()=>{(async()=>{const r=await y.exportExcalidrawToSvg({appState:o,elements:t,files:a});H(r),r.setAttribute("width","100%"),r.setAttribute("height","100%"),r.setAttribute("display","block"),r.classList.add("excalidraw-svg"),M(r)})()},[t,a,o]);const w=(g,r)=>{u.update(()=>{n.wo(null);const O=n.xo(f);return m.$isExcalidrawNode(O)&&O.setWidthAndHeight(g,r),!0})},z=g=>{m.deleteNode(u,f)};return e.jsx(m.ResizableContainer,{editor:u,isIcon:!1,isEmbed:!0,width:m.parseContainerSize(v),height:m.parseContainerSize(A),onResizeEnd:w,alignment:k,children:e.jsxs(c.Box,{className:"media-wrapper excaildraw",children:[e.jsxs("div",{className:"media-actions",children:[e.jsx(c.Tooltip,{label:p("editor.link.edit"),children:e.jsx(c.ActionIcon,{color:"gray","aria-label":"Settings",className:"media-action",variant:"default",size:24,onClick:()=>{j(!0)},children:e.jsx($.IconEdit,{size:14})})}),e.jsx(m.AlignmentImage,{opened:S,setOpened:h,t:p,editor:u,nodeKey:f}),e.jsx(c.Tooltip,{label:p("editor.actions.delete"),children:e.jsx(c.ActionIcon,{color:"gray","aria-label":"Settings",className:"media-action",variant:"default",size:24,onClick:z,children:e.jsx(m.Icon,{name:"trash",size:"14"})})})]}),e.jsx(c.Box,{w:"100%",ref:g=>{g&&d&&(d.current=g)},className:i??"",dangerouslySetInnerHTML:{__html:(b==null?void 0:b.outerHTML)??""}})]})})}function L({nodeKey:t,data:a,width:d,height:o,alignment:u}){const[i]=n.o(),v=n.a$2(),[A,f]=l.useState(a==="[]"&&i.isEditable()),[k,j]=l.useState(!1),b=l.useRef(null),M=l.useRef(null),S=l.useRef(null),[h,p,w]=n.u(t),[z,g]=l.useState(!1),r=l.useCallback(s=>(h&&(s.preventDefault(),i.update(()=>{const x=n.xo(t);x&&x.remove()})),!1),[i,h,t]);l.useEffect(()=>{if(!v){h&&w();return}return n.U(i.registerCommand(n.se,s=>{const x=M.current,C=s.target;return z?!0:x!==null&&x.contains(C)?(s.shiftKey||w(),p(!h),s.detail>1&&f(!0),!0):!1},n.zi),i.registerCommand(n.Oe,r,n.zi),i.registerCommand(n.we,r,n.zi))},[w,i,h,z,r,p,v]);const O=l.useCallback(()=>(f(!1),i.update(()=>{const s=n.xo(t);s&&s.remove()})),[i,t]),B=(s,x,C)=>i.update(()=>{const N=n.xo(t);m.$isExcalidrawNode(N)&&(s&&s.length>0||Object.keys(C).length>0?N.setData(JSON.stringify({appState:x,elements:s,files:C})):N.remove())}),{elements:E=[],files:T={},appState:I={}}=l.useMemo(()=>JSON.parse(a),[a]),R=l.useCallback(()=>{f(!1),j(!1),S.current=!1,E.length===0&&i.update(()=>{const s=n.xo(t);s&&s.remove()})},[i,t,E.length]),D=l.useCallback(()=>{S.current?j(!0):R()},[]);return e.jsxs(e.Fragment,{children:[e.jsx(F,{isCloseModal:k,confirmClose:R,setCloseModalOpen:j}),e.jsx(y.ExcalidrawModal,{initialElements:E,isEdited:S,initialFiles:T,initialAppState:I,isShown:A,onDelete:O,onClose:D,onSave:(s,x,C)=>{B(s,x,C),f(!1)},closeOnClickOutside:!1}),E.length>0&&e.jsx("div",{style:{display:"flex",justifyContent:u},children:e.jsx(W,{imageContainerRef:b,className:"image",elements:E,files:T,appState:I,width:d,height:o,editor:i,nodeKey:t,alignment:u,setModalOpen:f})})]})}exports.default=L;
|
|
@@ -1,283 +0,0 @@
|
|
|
1
|
-
import { jsx as i, jsxs as E, Fragment as G } from "react/jsx-runtime";
|
|
2
|
-
import { useState as v, useEffect as _, useRef as T, useCallback as z, useMemo as P } from "react";
|
|
3
|
-
import { av as Q, x as w, a1 as V, c4 as X, aK as Y, U as Z, aM as K, z as D, aN as ee, aD as te } from "./lexical-C60GkwxR.js";
|
|
4
|
-
import { R as ie, p as B, A as se, I as ne, a as J, d as ae } from "./index-WCOc4LNL.js";
|
|
5
|
-
import { useTranslation as $ } from "react-i18next";
|
|
6
|
-
import { Modal as le, Text as oe, Flex as re, Button as F, useMantineTheme as ce, Box as H, Tooltip as W, ActionIcon as L } from "@mantine/core";
|
|
7
|
-
import { IconEdit as de } from "@tabler/icons-react";
|
|
8
|
-
import { e as ue, E as fe } from "./index-CbQX0N2c.js";
|
|
9
|
-
const me = ({
|
|
10
|
-
isCloseModal: e,
|
|
11
|
-
setCloseModalOpen: n,
|
|
12
|
-
confirmClose: r
|
|
13
|
-
}) => {
|
|
14
|
-
const { t: a } = $();
|
|
15
|
-
return /* @__PURE__ */ i(
|
|
16
|
-
le,
|
|
17
|
-
{
|
|
18
|
-
opened: e,
|
|
19
|
-
onClose: () => {
|
|
20
|
-
n(!1);
|
|
21
|
-
},
|
|
22
|
-
centered: !0,
|
|
23
|
-
title: a("editor.unsavedChanges.title"),
|
|
24
|
-
closeOnClickOutside: !0,
|
|
25
|
-
closeOnEscape: !0,
|
|
26
|
-
size: "500",
|
|
27
|
-
zIndex: 999,
|
|
28
|
-
children: /* @__PURE__ */ E("div", { children: [
|
|
29
|
-
/* @__PURE__ */ i(oe, { mb: "md", children: a("editor.unsavedChanges.message") }),
|
|
30
|
-
/* @__PURE__ */ E(re, { justify: "flex-end", gap: "sm", children: [
|
|
31
|
-
/* @__PURE__ */ i(
|
|
32
|
-
F,
|
|
33
|
-
{
|
|
34
|
-
variant: "default",
|
|
35
|
-
onClick: () => {
|
|
36
|
-
n(!1);
|
|
37
|
-
},
|
|
38
|
-
fullWidth: !0,
|
|
39
|
-
children: a("editor.unsavedChanges.cancel")
|
|
40
|
-
}
|
|
41
|
-
),
|
|
42
|
-
/* @__PURE__ */ i(F, { color: "red", onClick: r, fullWidth: !0, children: a("editor.unsavedChanges.closeWithoutSaving") })
|
|
43
|
-
] })
|
|
44
|
-
] })
|
|
45
|
-
}
|
|
46
|
-
);
|
|
47
|
-
}, he = (e) => {
|
|
48
|
-
var a;
|
|
49
|
-
const n = (a = e == null ? void 0 : e.firstElementChild) == null ? void 0 : a.firstElementChild, r = e.getAttribute("viewBox");
|
|
50
|
-
if (r != null) {
|
|
51
|
-
const o = r.split(" ");
|
|
52
|
-
e.setAttribute("width", o[2]), e.setAttribute("height", o[3]);
|
|
53
|
-
}
|
|
54
|
-
n && n.tagName === "style" && n.remove();
|
|
55
|
-
};
|
|
56
|
-
function pe({
|
|
57
|
-
elements: e,
|
|
58
|
-
files: n,
|
|
59
|
-
imageContainerRef: r,
|
|
60
|
-
appState: a,
|
|
61
|
-
editor: o,
|
|
62
|
-
rootClassName: s = null,
|
|
63
|
-
width: S = "inherit",
|
|
64
|
-
height: M = "inherit",
|
|
65
|
-
nodeKey: c,
|
|
66
|
-
alignment: N,
|
|
67
|
-
setModalOpen: p
|
|
68
|
-
}) {
|
|
69
|
-
const [g, k] = v(null), [C, u] = v(!1);
|
|
70
|
-
ce();
|
|
71
|
-
const { t: m } = $();
|
|
72
|
-
_(() => {
|
|
73
|
-
(async () => {
|
|
74
|
-
const l = await ue({
|
|
75
|
-
appState: a,
|
|
76
|
-
elements: e,
|
|
77
|
-
files: n
|
|
78
|
-
});
|
|
79
|
-
he(l), l.setAttribute("width", "100%"), l.setAttribute("height", "100%"), l.setAttribute("display", "block"), l.classList.add("excalidraw-svg"), k(l);
|
|
80
|
-
})();
|
|
81
|
-
}, [e, n, a]);
|
|
82
|
-
const x = (f, l) => {
|
|
83
|
-
o.update(() => {
|
|
84
|
-
Q(null);
|
|
85
|
-
const O = w(c);
|
|
86
|
-
return J(O) && O.setWidthAndHeight(f, l), !0;
|
|
87
|
-
});
|
|
88
|
-
}, A = (f) => {
|
|
89
|
-
ae(o, c);
|
|
90
|
-
};
|
|
91
|
-
return /* @__PURE__ */ i(
|
|
92
|
-
ie,
|
|
93
|
-
{
|
|
94
|
-
editor: o,
|
|
95
|
-
isIcon: !1,
|
|
96
|
-
isEmbed: !0,
|
|
97
|
-
width: B(S),
|
|
98
|
-
height: B(M),
|
|
99
|
-
onResizeEnd: x,
|
|
100
|
-
alignment: N,
|
|
101
|
-
children: /* @__PURE__ */ E(H, { className: "media-wrapper excaildraw", children: [
|
|
102
|
-
/* @__PURE__ */ E("div", { className: "media-actions", children: [
|
|
103
|
-
/* @__PURE__ */ i(W, { label: m("editor.link.edit"), children: /* @__PURE__ */ i(
|
|
104
|
-
L,
|
|
105
|
-
{
|
|
106
|
-
color: "gray",
|
|
107
|
-
"aria-label": "Settings",
|
|
108
|
-
className: "media-action",
|
|
109
|
-
variant: "default",
|
|
110
|
-
size: 24,
|
|
111
|
-
onClick: () => {
|
|
112
|
-
p(!0);
|
|
113
|
-
},
|
|
114
|
-
children: /* @__PURE__ */ i(de, { size: 14 })
|
|
115
|
-
}
|
|
116
|
-
) }),
|
|
117
|
-
/* @__PURE__ */ i(
|
|
118
|
-
se,
|
|
119
|
-
{
|
|
120
|
-
opened: C,
|
|
121
|
-
setOpened: u,
|
|
122
|
-
t: m,
|
|
123
|
-
editor: o,
|
|
124
|
-
nodeKey: c
|
|
125
|
-
}
|
|
126
|
-
),
|
|
127
|
-
/* @__PURE__ */ i(W, { label: m("editor.actions.delete"), children: /* @__PURE__ */ i(
|
|
128
|
-
L,
|
|
129
|
-
{
|
|
130
|
-
color: "gray",
|
|
131
|
-
"aria-label": "Settings",
|
|
132
|
-
className: "media-action",
|
|
133
|
-
variant: "default",
|
|
134
|
-
size: 24,
|
|
135
|
-
onClick: A,
|
|
136
|
-
children: /* @__PURE__ */ i(ne, { name: "trash", size: "14" })
|
|
137
|
-
}
|
|
138
|
-
) })
|
|
139
|
-
] }),
|
|
140
|
-
/* @__PURE__ */ i(
|
|
141
|
-
H,
|
|
142
|
-
{
|
|
143
|
-
w: "100%",
|
|
144
|
-
ref: (f) => {
|
|
145
|
-
f && r && (r.current = f);
|
|
146
|
-
},
|
|
147
|
-
className: s ?? "",
|
|
148
|
-
dangerouslySetInnerHTML: { __html: (g == null ? void 0 : g.outerHTML) ?? "" }
|
|
149
|
-
}
|
|
150
|
-
)
|
|
151
|
-
] })
|
|
152
|
-
}
|
|
153
|
-
);
|
|
154
|
-
}
|
|
155
|
-
function Ae({
|
|
156
|
-
nodeKey: e,
|
|
157
|
-
data: n,
|
|
158
|
-
width: r,
|
|
159
|
-
height: a,
|
|
160
|
-
alignment: o
|
|
161
|
-
}) {
|
|
162
|
-
const [s] = V(), S = X(), [M, c] = v(
|
|
163
|
-
n === "[]" && s.isEditable()
|
|
164
|
-
), [N, p] = v(!1), g = T(null), k = T(null), C = T(null), [u, m, x] = Y(e), [A, f] = v(!1), l = z(
|
|
165
|
-
(t) => (u && (t.preventDefault(), s.update(() => {
|
|
166
|
-
const d = w(e);
|
|
167
|
-
d && d.remove();
|
|
168
|
-
})), !1),
|
|
169
|
-
[s, u, e]
|
|
170
|
-
);
|
|
171
|
-
_(() => {
|
|
172
|
-
if (!S) {
|
|
173
|
-
u && x();
|
|
174
|
-
return;
|
|
175
|
-
}
|
|
176
|
-
return Z(
|
|
177
|
-
s.registerCommand(
|
|
178
|
-
te,
|
|
179
|
-
(t) => {
|
|
180
|
-
const d = k.current, h = t.target;
|
|
181
|
-
return A ? !0 : d !== null && d.contains(h) ? (t.shiftKey || x(), m(!u), t.detail > 1 && c(!0), !0) : !1;
|
|
182
|
-
},
|
|
183
|
-
D
|
|
184
|
-
),
|
|
185
|
-
s.registerCommand(
|
|
186
|
-
ee,
|
|
187
|
-
l,
|
|
188
|
-
D
|
|
189
|
-
),
|
|
190
|
-
s.registerCommand(
|
|
191
|
-
K,
|
|
192
|
-
l,
|
|
193
|
-
D
|
|
194
|
-
)
|
|
195
|
-
);
|
|
196
|
-
}, [
|
|
197
|
-
x,
|
|
198
|
-
s,
|
|
199
|
-
u,
|
|
200
|
-
A,
|
|
201
|
-
l,
|
|
202
|
-
m,
|
|
203
|
-
S
|
|
204
|
-
]);
|
|
205
|
-
const O = z(() => (c(!1), s.update(() => {
|
|
206
|
-
const t = w(e);
|
|
207
|
-
t && t.remove();
|
|
208
|
-
})), [s, e]), U = (t, d, h) => s.update(() => {
|
|
209
|
-
const I = w(e);
|
|
210
|
-
J(I) && (t && t.length > 0 || Object.keys(h).length > 0 ? I.setData(
|
|
211
|
-
JSON.stringify({
|
|
212
|
-
appState: d,
|
|
213
|
-
elements: t,
|
|
214
|
-
files: h
|
|
215
|
-
})
|
|
216
|
-
) : I.remove());
|
|
217
|
-
}), {
|
|
218
|
-
elements: b = [],
|
|
219
|
-
files: R = {},
|
|
220
|
-
appState: j = {}
|
|
221
|
-
} = P(() => JSON.parse(n), [n]), y = z(() => {
|
|
222
|
-
c(!1), p(!1), C.current = !1, b.length === 0 && s.update(() => {
|
|
223
|
-
const t = w(e);
|
|
224
|
-
t && t.remove();
|
|
225
|
-
});
|
|
226
|
-
}, [s, e, b.length]), q = z(() => {
|
|
227
|
-
C.current ? p(!0) : y();
|
|
228
|
-
}, []);
|
|
229
|
-
return /* @__PURE__ */ E(G, { children: [
|
|
230
|
-
/* @__PURE__ */ i(
|
|
231
|
-
me,
|
|
232
|
-
{
|
|
233
|
-
isCloseModal: N,
|
|
234
|
-
confirmClose: y,
|
|
235
|
-
setCloseModalOpen: p
|
|
236
|
-
}
|
|
237
|
-
),
|
|
238
|
-
/* @__PURE__ */ i(
|
|
239
|
-
fe,
|
|
240
|
-
{
|
|
241
|
-
initialElements: b,
|
|
242
|
-
isEdited: C,
|
|
243
|
-
initialFiles: R,
|
|
244
|
-
initialAppState: j,
|
|
245
|
-
isShown: M,
|
|
246
|
-
onDelete: O,
|
|
247
|
-
onClose: q,
|
|
248
|
-
onSave: (t, d, h) => {
|
|
249
|
-
U(t, d, h), c(!1);
|
|
250
|
-
},
|
|
251
|
-
closeOnClickOutside: !1
|
|
252
|
-
}
|
|
253
|
-
),
|
|
254
|
-
b.length > 0 && /* @__PURE__ */ i(
|
|
255
|
-
"div",
|
|
256
|
-
{
|
|
257
|
-
style: {
|
|
258
|
-
display: "flex",
|
|
259
|
-
justifyContent: o
|
|
260
|
-
},
|
|
261
|
-
children: /* @__PURE__ */ i(
|
|
262
|
-
pe,
|
|
263
|
-
{
|
|
264
|
-
imageContainerRef: g,
|
|
265
|
-
className: "image",
|
|
266
|
-
elements: b,
|
|
267
|
-
files: R,
|
|
268
|
-
appState: j,
|
|
269
|
-
width: r,
|
|
270
|
-
height: a,
|
|
271
|
-
editor: s,
|
|
272
|
-
nodeKey: e,
|
|
273
|
-
alignment: o,
|
|
274
|
-
setModalOpen: c
|
|
275
|
-
}
|
|
276
|
-
)
|
|
277
|
-
}
|
|
278
|
-
)
|
|
279
|
-
] });
|
|
280
|
-
}
|
|
281
|
-
export {
|
|
282
|
-
Ae as default
|
|
283
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),l=require("react"),e=require("./lexical-2rxs76dr.cjs"),h=require("./index-CFA9Drk2.cjs"),T=require("@mantine/core");function D({children:n,className:o}){return t.jsx("div",{className:o||"Placeholder__root",children:n})}function y({label:n,value:o,onChange:a,placeholder:x="","data-test-id":i,type:d="text"}){return t.jsx(T.TextInput,{type:d,placeholder:x,value:o,onChange:c=>{a(c.target.value)},label:n,"data-test-id":i,mb:10})}const R=new Set;function F(n){if(!R.has(n))throw new Promise(o=>{const a=new Image;a.src=n,a.onload=()=>{R.add(n),o(null)}})}function q({altText:n,className:o,imageRef:a,src:x,width:i,height:d,position:c}){return F(x),t.jsx("img",{className:o||void 0,src:x,alt:n,ref:a,"data-position":c,style:{display:"block",height:d,width:i},draggable:"false"})}function _({activeEditor:n,nodeKey:o,onClose:a}){const i=n.getEditorState().read(()=>e.xo(o)),[d,c]=l.useState(i.getAltText()),[j,I]=l.useState(i.getShowCaption()),[S,b]=l.useState(i.getPosition()),p=g=>{I(g.target.checked)},m=()=>{const g={altText:d,position:S,showCaption:j};i&&n.update(()=>{i.update(g)}),a()};return t.jsxs(t.Fragment,{children:[t.jsx("div",{style:{marginBottom:"1em"},children:t.jsx(y,{label:"Alt-текст",placeholder:"Альтернативный текст",onChange:c,value:d,"data-test-id":"image-modal-alt-text-input"})}),t.jsxs("div",{className:"Input__wrapper",children:[t.jsx("input",{id:"caption",type:"checkbox",checked:j,onChange:p}),t.jsx("label",{htmlFor:"caption",children:"Show Caption"})]}),t.jsx(h.Button,{"data-test-id":"image-modal-file-upload-btn",onClick:()=>m(),children:"Применить"})]})}function U({src:n,altText:o,nodeKey:a,width:x,height:i,showCaption:d,caption:c,position:j}){const[I,S]=h.useModal(),b=l.useRef(null),p=l.useRef(null),[m,g,E]=e.u(a),[s]=e.o(),[z,L]=l.useState(null),N=l.useRef(null),v=l.useCallback(u=>{if(m&&e.xr(e.Lr())){u.preventDefault();const r=e.xo(a);h.$isInlineImageNode(r)&&r.remove()}return!1},[m,a]),w=l.useCallback(u=>{const f=e.Lr(),r=p.current;if(m&&e.xr(f)&&f.getNodes().length===1){if(d)return e.wo(null),u.preventDefault(),c.focus(),!0;if(r!==null&&r!==document.activeElement)return u.preventDefault(),r.focus(),!0}return!1},[c,m,d]),k=l.useCallback(u=>N.current===c||p.current===u.target?(e.wo(null),s.update(()=>{g(!0);const f=s.getRootElement();f!==null&&f.focus()}),!0):!1,[c,s,g]);l.useEffect(()=>{let u=!0;const f=e.U(s.registerUpdateListener(({editorState:r})=>{u&&L(r.read(()=>e.Lr()))}),s.registerCommand(e.ie,(r,C)=>(N.current=C,!1),e.zi),s.registerCommand(e.se,r=>{const C=r;return C.target===b.current?(C.shiftKey?g(!m):(E(),g(!0)),!0):!1},e.zi),s.registerCommand(e.Ie,r=>r.target===b.current?(r.preventDefault(),!0):!1,e.zi),s.registerCommand(e.Oe,v,e.zi),s.registerCommand(e.we,v,e.zi),s.registerCommand(e.Ne,w,e.zi),s.registerCommand(e.Ee$1,k,e.zi));return()=>{u=!1,f()}},[E,s,m,a,v,w,k,g]);const P=m;return t.jsxs(l.Suspense,{fallback:null,children:[t.jsxs(t.Fragment,{children:[t.jsxs("div",{draggable:!1,children:[t.jsx("button",{className:"image-edit-button",ref:p,onClick:()=>{S("Update Inline Image",u=>t.jsx(_,{activeEditor:s,nodeKey:a,onClose:u}))},children:"Edit"}),t.jsx(q,{className:P?`focused ${e.xr(z)?"draggable":""}`:null,src:n,altText:o,imageRef:b,width:x,height:i,position:j})]}),d&&t.jsx("div",{className:"image-caption-container",children:t.jsxs(e.m$3,{initialEditor:c,children:[t.jsx(h.LinkPlugin,{}),t.jsx(h.FloatingTextFormatToolbarPlugin,{}),t.jsx(e.L,{contentEditable:t.jsx(h.LexicalContentEditable,{className:"InlineImageNode__contentEditable"}),placeholder:t.jsx(D,{className:"InlineImageNode__placeholder",children:"Enter a caption..."}),ErrorBoundary:e.n$1})]})})]}),I]})}exports.UpdateInlineImageDialog=_;exports.default=U;
|