@layers-app/editor 0.0.18 → 0.0.19
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/index.cjs +2 -2
- package/dist/index.js +2 -2
- package/dist/{layers.CWaWCp52.js → layers.BUUIsCG-.js} +1 -1
- package/dist/layers.C31Xdz2y.js +164 -0
- package/dist/{layers.CmuE7cyq.js → layers.COWIfs98.js} +1 -1
- package/dist/{layers.DicigL6z.js → layers.CsVBstP7.js} +1 -1
- package/dist/{layers.Beb8H5iK.js → layers.Dp_VLKWP.js} +1 -1
- package/dist/{layers.Cnf8ktNm.js → layers.q72Rt2k1.js} +9445 -9540
- package/package.json +5 -4
- package/dist/layers.Crl1Kzhp.js +0 -164
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),s=require("react"),_=require("react-i18next"),t=require("./layers.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),s=require("react"),_=require("react-i18next"),t=require("./layers.C31Xdz2y.js"),E=require("@mantine/core"),U=require("@tabler/icons-react"),A=i=>{const{width:g,height:r,isLoading:l,isError:h,src:f,id:m,altText:p,imageRef:j,maxWidth:v}=i;return n.jsxs("div",{className:"media-wrapper",style:{width:g,height:r,display:"inline-flex",position:"relative"},children:[n.jsx(E.LoadingOverlay,{visible:l,zIndex:1e3,overlayProps:{backgroundOpacity:.5},loaderProps:{size:24,color:"black"}}),n.jsx(E.LoadingOverlay,{visible:h,zIndex:1e3,overlayProps:{backgroundOpacity:.5},loaderProps:{children:n.jsx(E.Flex,{bg:"white",maw:300,justify:"center",children:n.jsx(E.Alert,{variant:"light",color:"red",title:"Ошибка загрузки",icon:n.jsx(U.IconInfoCircle,{}),children:"Попробуйте загрузить заново."})})}}),n.jsx(B,{className:null,src:f,altText:p,imageRef:j,width:"inherit",height:"inherit",maxWidth:v||"auto",id:m})]})};function B({altText:i,className:g,imageRef:r,src:l,width:h,height:f,maxWidth:m,id:p}){return n.jsx("img",{className:g||void 0,src:l,alt:i,ref:r,style:{height:f,maxWidth:m,width:h},draggable:"false","data-id":p})}function G({src:i,altText:g,nodeKey:r,width:l,height:h,maxWidth:f,showCaption:m,caption:p,id:j,create:v,alignment:D}){const M=s.useRef(null),[W,S]=s.useState(!0),[P,F]=s.useState(!1),{isCollabActive:R}=t.l(),[u]=t.u(),[x,b]=s.useState(!0),[d,w]=s.useState({width:0,height:0}),{fetchUploadMedia:O,fetchDeleteMedia:z}=s.useContext(t.Context),{t:y}=_.useTranslation();s.useEffect(()=>{if(!i||i.startsWith("data:image/")){S(!1);return}const e=new Image;e.src=i,e.onload=()=>S(!1),e.onerror=()=>{S(!1),F(!0)}},[i]);const H=(e,a)=>{u.update(()=>{t.Ft(null);const c=t.Ct(r);t.$isImageNode(c)&&c.setWidthAndHeight(e,a)})},{historyState:L}=t.useSharedHistoryContext(),{settings:{showNestedEditorTreeView:k}}=t.useSettings(),[C,I]=s.useState(!1);function T(e){return e.endsWith(".svg")||e.includes("image/svg+xml")}function $(e){return new Promise((a,c)=>{if(T(e)){a(0);return}const o=new Image;o.src=e,o.onload=()=>{a(o.width)},o.onerror=()=>{c(new Error("Failed to load image"))}})}return s.useEffect(()=>{v&&I(!0)},[v]),s.useEffect(()=>{let e=l,a=h,c=100;i&&$(i).then(o=>{typeof e=="number"&&e<c&&o<c?(b(!0),w({width:e,height:a})):o<c?(b(!0),w({width:"auto",height:"auto"})):(w({width:o,height:o}),b(!1))})},[i]),s.useEffect(()=>{d.width&&d.height&&x&&u.update(()=>{const e=t.Ct(r);t.$isImageNode(e)&&e.setWidthAndHeight(d.width,d.height)})},[d.width,d.height,x]),s.useEffect(()=>{const e=document.documentElement;t.toggleLockScroll(C,e)},[C]),i?x?n.jsx(A,{width:d.width,height:d.height,isLoading:W,isError:P,isIcon:x,src:i,id:j,editor:u,nodeKey:r,fetchDeleteMedia:z,altText:g,imageRef:M,maxWidth:f,showCaption:m,caption:p,isCollabActive:R,historyState:L,showNestedEditorTreeView:k,t:y}):n.jsx(t.ResizableContainer,{editor:u,isIcon:x,width:typeof l=="string"&&l.includes("%")?parseFloat(l):l,height:typeof h=="string"&&h.includes("%")?parseFloat(h):l,initialWidth:d.width||"",initialHeight:d.height||"",onResizeEnd:H,alignment:D,children:n.jsx(A,{width:"inherit",height:"inherit",isLoading:W,isError:P,isIcon:x,src:i,id:j,editor:u,nodeKey:r,fetchDeleteMedia:z,altText:g,imageRef:M,maxWidth:f,showCaption:m,caption:p,isCollabActive:R,historyState:L,showNestedEditorTreeView:k,t:y})}):n.jsx(t.ImagePicker,{uploading:!1,onUpload:e=>{!O||!e.length||(e.forEach((a,c)=>{O(a,(o,q)=>{c===0?u.update(()=>{const N=t.Ct(r);t.$isImageNode(N)&&(N.setSrc(o),N.setId(q))}):u.dispatchCommand(t.INSERT_IMAGE_COMMAND,{altText:"",src:o,id:q})})}),I(!1))},popoverProps:{opened:C,position:"bottom",onChange:I},onChange:e=>{I(!1),u.update(()=>{const a=t.Ct(r);t.$isImageNode(a)&&a.setSrc(e)})},children:n.jsx(t.EmptyNodeButton,{title:y("editor.image.add_photo"),icon:"photo",onClick:()=>I(!C)})})}exports.default=G;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as o, jsxs as G } from "react/jsx-runtime";
|
|
2
2
|
import { useRef as V, useState as I, useContext as q, useEffect as w } from "react";
|
|
3
3
|
import { useTranslation as J } from "react-i18next";
|
|
4
|
-
import { l as Q, u as X, C as Y, a as Z, b as K, c as C, $ as E, t as ee, I as te, E as ie, d as oe, R as ne, F as ae } from "./layers.
|
|
4
|
+
import { l as Q, u as X, C as Y, a as Z, b as K, c as C, $ as E, t as ee, I as te, E as ie, d as oe, R as ne, F as ae } from "./layers.q72Rt2k1.js";
|
|
5
5
|
import { LoadingOverlay as H, Flex as se, Alert as re } from "@mantine/core";
|
|
6
6
|
import { IconInfoCircle as le } from "@tabler/icons-react";
|
|
7
7
|
const T = (t) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as a, jsxs as v, Fragment as j } from "react/jsx-runtime";
|
|
2
2
|
import { useRef as k, useContext as K, useMemo as U, useEffect as P, useState as T, useCallback as y, Suspense as W } from "react";
|
|
3
|
-
import { e as R, o as q, l as z, f as G, g as H, u as J, w as M, h as D, c as A, i as Q, F as $, N as V, j as X, K as w, k as Y, m as Z, n as ee, D as te, r as ne, p as ae, L as le, q as re, s as oe, v as ie, x as se } from "./layers.
|
|
3
|
+
import { e as R, o as q, l as z, f as G, g as H, u as J, w as M, h as D, c as A, i as Q, F as $, N as V, j as X, K as w, k as Y, m as Z, n as ee, D as te, r as ne, p as ae, L as le, q as re, s as oe, v as ie, x as se } from "./layers.q72Rt2k1.js";
|
|
4
4
|
import { Button as ce, TextInput as ue } from "@mantine/core";
|
|
5
5
|
function de(e) {
|
|
6
6
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|