@remarkablejames/editor 0.0.1 → 0.0.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/lib/{ActionMenuButton-B0EHT9CC.js → ActionMenuButton-Bmn3RME4.js} +10 -9
- package/lib/ActionMenuButton-C5P0Kzrb.cjs +1 -0
- package/lib/Attachment.cjs +2 -2
- package/lib/Attachment.js +33 -31
- package/lib/Blockquote.cjs +2 -2
- package/lib/Blockquote.js +12 -13
- package/lib/Bold.cjs +1 -1
- package/lib/Bold.js +10 -11
- package/lib/BulletList.cjs +1 -1
- package/lib/BulletList.js +8 -9
- package/lib/Callout.cjs +1 -1
- package/lib/Callout.js +45 -41
- package/lib/Clear.cjs +1 -1
- package/lib/Clear.js +14 -13
- package/lib/Code.cjs +1 -1
- package/lib/Code.js +5 -6
- package/lib/CodeBlock.cjs +1 -44
- package/lib/CodeBlock.js +183 -3858
- package/lib/CodeView.cjs +1 -1
- package/lib/CodeView.js +8 -9
- package/lib/Color.cjs +1 -1
- package/lib/Color.js +19 -18
- package/lib/Column.cjs +1 -1
- package/lib/Column.js +8 -9
- package/lib/{Drawer-BCWVN-4l.js → Drawer-DvGh9aXG.js} +52 -46
- package/lib/Drawer-gz9U5ArC.cjs +2 -0
- package/lib/Drawer.cjs +1 -1
- package/lib/Drawer.js +3 -3
- package/lib/Emoji.cjs +1 -1
- package/lib/Emoji.js +15 -14
- package/lib/Excalidraw.cjs +1 -1
- package/lib/Excalidraw.js +20 -16
- package/lib/ExportPdf.cjs +3 -3
- package/lib/ExportPdf.js +13 -14
- package/lib/ExportWord.cjs +1 -1
- package/lib/ExportWord.js +6 -6
- package/lib/FontFamily.cjs +1 -1
- package/lib/FontFamily.js +6 -7
- package/lib/FontSize.cjs +1 -1
- package/lib/FontSize.js +14 -15
- package/lib/Heading.cjs +1 -1
- package/lib/Heading.js +26 -26
- package/lib/Highlight.cjs +1 -1
- package/lib/Highlight.js +23 -22
- package/lib/History.cjs +1 -1
- package/lib/History.js +11 -11
- package/lib/HorizontalRule.cjs +1 -1
- package/lib/HorizontalRule.js +9 -10
- package/lib/Icon-CKM0tYbW.js +15 -0
- package/lib/Icon-CQyFgXeo.cjs +1 -0
- package/lib/{Iframe-BdgiWGml.js → Iframe-CnnvV6cK.js} +21 -19
- package/lib/Iframe-Ds6gG2YO.cjs +1 -0
- package/lib/Iframe.cjs +1 -1
- package/lib/Iframe.js +2 -2
- package/lib/Image.cjs +1 -1
- package/lib/Image.js +5 -4
- package/lib/ImageCropper-BKhXlnXN.cjs +1 -0
- package/lib/ImageCropper-DUzu_9-6.js +896 -0
- package/lib/ImageGif.cjs +1 -1
- package/lib/ImageGif.js +94 -91
- package/lib/ImportWord.cjs +1 -1
- package/lib/ImportWord.js +26 -25
- package/lib/{Indent-BpMcZKok.js → Indent-Bsj8gKvT.js} +30 -31
- package/lib/Indent-D_7HOYYd.cjs +1 -0
- package/lib/Indent.cjs +1 -1
- package/lib/Indent.js +2 -2
- package/lib/Italic.cjs +1 -1
- package/lib/Italic.js +11 -12
- package/lib/{Katex-B8_uprkO.js → Katex-CilGTz7u.js} +22 -19
- package/lib/Katex-lL3bHXJd.cjs +4 -0
- package/lib/Katex.cjs +1 -1
- package/lib/Katex.js +2 -2
- package/lib/LineHeight.cjs +1 -1
- package/lib/LineHeight.js +20 -19
- package/lib/Link.cjs +1 -1
- package/lib/Link.js +2 -2
- package/lib/{LinkEditBlock-BX0fXXpF.js → LinkEditBlock-BD_WvA3r.js} +24 -19
- package/lib/LinkEditBlock-D3HSHmsU.cjs +5 -0
- package/lib/Mention.js +3 -3
- package/lib/Mermaid-BfeLPzoS.cjs +2 -0
- package/lib/{Mermaid-D8bbIgAl.js → Mermaid-BrjU75Bs.js} +48 -45
- package/lib/Mermaid.cjs +1 -1
- package/lib/Mermaid.js +2 -2
- package/lib/MoreMark.cjs +1 -1
- package/lib/MoreMark.js +28 -26
- package/lib/OrderedList.cjs +1 -1
- package/lib/OrderedList.js +10 -11
- package/lib/SearchAndReplace.cjs +1 -1
- package/lib/SearchAndReplace.js +42 -37
- package/lib/SlashCommand.cjs +1 -1
- package/lib/SlashCommand.js +5 -5
- package/lib/{SlashCommandNodeView-BcmtKbEE.js → SlashCommandNodeView-COx5qZ2y.js} +41 -39
- package/lib/SlashCommandNodeView-DD-nlhM-.cjs +1 -0
- package/lib/Strike.cjs +1 -1
- package/lib/Strike.js +11 -12
- package/lib/{Table-DbxuP5xh.js → Table-BlM8yMhr.js} +46 -46
- package/lib/Table-C21AlUrh.cjs +5 -0
- package/lib/Table.cjs +1 -1
- package/lib/Table.js +1 -1
- package/lib/TaskList.cjs +1 -1
- package/lib/TaskList.js +11 -12
- package/lib/TextAlign.cjs +1 -1
- package/lib/TextAlign.js +27 -26
- package/lib/TextDirection.cjs +1 -1
- package/lib/TextDirection.js +19 -18
- package/lib/TextUnderline.cjs +1 -1
- package/lib/TextUnderline.js +8 -9
- package/lib/{Twitter-9I6BLNmg.js → Twitter-BP8sYXX7.js} +22 -18
- package/lib/Twitter-D46MnvPr.cjs +1 -0
- package/lib/Twitter.cjs +1 -1
- package/lib/Twitter.js +2 -2
- package/lib/Video-Bpd8W8l6.js +231 -0
- package/lib/Video-BwrHx6B1.cjs +1 -0
- package/lib/Video.cjs +1 -1
- package/lib/Video.js +5 -4
- package/lib/bubble.cjs +3 -3
- package/lib/bubble.js +171 -162
- package/lib/button-BmTP96NR.cjs +1 -0
- package/lib/button-CDIxPURh.js +35 -0
- package/lib/checkbox-7sfSdzy9.js +29 -0
- package/lib/checkbox-DyVlLWHv.cjs +1 -0
- package/lib/{clsx-CDyrfCnw.js → clsx-m_C5j3RU.js} +24 -24
- package/lib/dialog-B-jOQ5i3.cjs +1 -0
- package/lib/dialog-QWWUWOGP.js +95 -0
- package/lib/{dropdown-menu-Bs69ZBbO.js → dropdown-menu-C1hdPLCZ.js} +1 -1
- package/lib/{dropdown-menu-DjWlG2-J.cjs → dropdown-menu-CkHN04Mx.cjs} +1 -1
- package/lib/events.constant-Bh2uzJud.js +71 -0
- package/lib/events.constant-ELn21EzG.cjs +1 -0
- package/lib/extensions/CodeBlock/CodeBlock.d.ts +1 -1
- package/lib/file-BLas99n7.js +43 -0
- package/lib/file-i7e4nQY2.cjs +1 -0
- package/lib/{index-C-tDsIKJ.js → index-B3Ijnbxs.js} +1 -1
- package/lib/{index-C1WCZhyA.js → index-C1KQsOcg.js} +1 -1
- package/lib/{index-CsSfYR30.js → index-C8FjP66D.js} +1 -1
- package/lib/index-CAiZY1nx.js +2741 -0
- package/lib/index-DWSAk_9a.cjs +1 -0
- package/lib/{index-DjDf4BK8.js → index-s3l5RdyW.js} +1 -1
- package/lib/index.cjs +4 -4
- package/lib/index.js +392 -147
- package/lib/input-qvpuOf-3.js +21 -0
- package/lib/input-s0JD5kf2.cjs +1 -0
- package/lib/isNumber-BTYSVlKo.cjs +1 -0
- package/lib/isNumber-WaBzl_0s.js +15 -0
- package/lib/label-CFax-gzo.cjs +1 -0
- package/lib/label-DC37f2RQ.js +11 -0
- package/lib/{popover-D-hUKDYu.cjs → popover-B05Fd8lC.cjs} +1 -1
- package/lib/{popover-CPr9bHYn.js → popover-CsSXh7w6.js} +1 -1
- package/lib/{renderNodeView-BJSrgyGj.js → renderNodeView-C_hPIdEs.js} +2 -2
- package/lib/{select-C2KF4RNg.cjs → select-7ubC1NF0.cjs} +1 -1
- package/lib/{select-CuE_HaQJ.js → select-B3-5wTqn.js} +1 -1
- package/lib/{separator-CHzYNMVt.js → separator-CYCA8tSn.js} +13 -12
- package/lib/separator-ncbdw4oq.cjs +1 -0
- package/lib/style.css +1 -1
- package/lib/tabs-BeHxylKH.js +46 -0
- package/lib/tabs-DBqNpGAq.cjs +1 -0
- package/lib/{textarea-gEoNp9CA.js → textarea-1FhpmBkP.js} +1 -1
- package/lib/{textarea-DZj6EY-N.cjs → textarea-Bjhcpp76.cjs} +1 -1
- package/lib/throttle-CRNq0z-O.js +249 -0
- package/lib/throttle-gTTvqDTW.cjs +1 -0
- package/lib/toggle-DoJTBdvy.js +89 -0
- package/lib/toggle-oFwBZC4x.cjs +1 -0
- package/lib/{updatePosition-e90ZrFWW.js → updatePosition-DvfTZHcH.js} +2 -2
- package/lib/useButtonProps-BE10eHkG.js +165 -0
- package/lib/useButtonProps-CFu0GHzW.cjs +1 -0
- package/package.json +1 -1
- package/lib/ActionMenuButton-J1el_e6Z.cjs +0 -1
- package/lib/Drawer-BTouEroZ.cjs +0 -2
- package/lib/Iframe-BfBLILDA.cjs +0 -1
- package/lib/Indent-Dvqz_WEn.cjs +0 -1
- package/lib/Katex-BQyeCeQ0.cjs +0 -4
- package/lib/LinkEditBlock-CIshn_8F.cjs +0 -5
- package/lib/Mermaid-0GiGVxn0.cjs +0 -2
- package/lib/SlashCommandNodeView-rDJ7OjRd.cjs +0 -1
- package/lib/Table-BEhNBeuA.cjs +0 -5
- package/lib/Twitter-BuEBgpi9.cjs +0 -1
- package/lib/index-D9oM__YW.cjs +0 -1
- package/lib/index-lj3VWExo.js +0 -4883
- package/lib/separator-_gvUNba_.cjs +0 -1
package/lib/CodeView.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("./clsx-CXbNJWDD.cjs"),n=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("./clsx-CXbNJWDD.cjs"),n=require("react/jsx-runtime"),v=require("./toggle-oFwBZC4x.cjs"),r=require("./useButtonProps-CFu0GHzW.cjs");function w(){const e=r.useButtonProps(a.name),{icon:t=void 0,tooltip:o=void 0,shortcutKeys:i=void 0,tooltipOptions:d={},action:s=void 0,isActive:l=void 0}=(e==null?void 0:e.componentProps)??{},{dataState:u,disabled:c,update:p}=r.useToggleActive(l),g=()=>{c||s&&(s(),p())};return e?n.jsx(v.ActionButton,{action:g,dataState:u,disabled:c,icon:t,shortcutKeys:i,tooltip:o,tooltipOptions:d}):n.jsx(n.Fragment,{})}const a=m.Extension.create({name:"codeView",addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),button({editor:t,t:o}){return{componentProps:{action:()=>{t.commands.toggleCodeView()},isActive:()=>t.storage.codeView.isActive,disabled:!1,icon:"Html",tooltip:o("editor.codeView.tooltip")||"View HTML Code",customClass:"tiptap-code-view-button"}}}}},addStorage(){return{isActive:!1,originalContent:""}},addCommands(){return{toggleCodeView:()=>({editor:e})=>{const t=e.storage.codeView.isActive;if(t)e.commands.setContent(e.getText());else{const o=e.getHTML();e.storage.codeView.originalContent=o;const i=o.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'");e.commands.setContent(`<div class="tiptap-code-view-wrapper">${i}</div>`)}return e.storage.codeView.isActive=!t,!0}}}});exports.CodeView=a;exports.RichTextCodeView=w;
|
package/lib/CodeView.js
CHANGED
|
@@ -1,21 +1,20 @@
|
|
|
1
|
-
import { E as l } from "./clsx-
|
|
1
|
+
import { E as l } from "./clsx-m_C5j3RU.js";
|
|
2
2
|
import { jsx as c, Fragment as g } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
4
|
-
import "
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const t = u(C.name), {
|
|
3
|
+
import { A as u } from "./toggle-DoJTBdvy.js";
|
|
4
|
+
import { u as v, c as w } from "./useButtonProps-BE10eHkG.js";
|
|
5
|
+
function T() {
|
|
6
|
+
const t = v(C.name), {
|
|
8
7
|
icon: e = void 0,
|
|
9
8
|
tooltip: o = void 0,
|
|
10
9
|
shortcutKeys: i = void 0,
|
|
11
10
|
tooltipOptions: a = {},
|
|
12
11
|
action: n = void 0,
|
|
13
12
|
isActive: r = void 0
|
|
14
|
-
} = (t == null ? void 0 : t.componentProps) ?? {}, { dataState: d, disabled: s, update: p } =
|
|
13
|
+
} = (t == null ? void 0 : t.componentProps) ?? {}, { dataState: d, disabled: s, update: p } = w(r), m = () => {
|
|
15
14
|
s || n && (n(), p());
|
|
16
15
|
};
|
|
17
16
|
return t ? /* @__PURE__ */ c(
|
|
18
|
-
|
|
17
|
+
u,
|
|
19
18
|
{
|
|
20
19
|
action: m,
|
|
21
20
|
dataState: d,
|
|
@@ -77,5 +76,5 @@ const C = /* @__PURE__ */ l.create({
|
|
|
77
76
|
});
|
|
78
77
|
export {
|
|
79
78
|
C as CodeView,
|
|
80
|
-
|
|
79
|
+
T as RichTextCodeView
|
|
81
80
|
};
|
package/lib/Color.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("./index-CjhjjJsN.cjs"),t=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("./index-CjhjjJsN.cjs"),t=require("react/jsx-runtime"),d=require("react"),g=require("./toggle-oFwBZC4x.cjs"),v=require("./separator-ncbdw4oq.cjs"),h=require("./useButtonProps-CFu0GHzW.cjs"),j=require("./Icon-CQyFgXeo.cjs");function m({fill:e}){return t.jsx("svg",{height:"18px",version:"1.1",viewBox:"0 0 240 240",width:"18px",xmlns:"http://www.w3.org/2000/svg",children:t.jsx("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:1,children:t.jsx("g",{transform:"translate(0.000000, 0.500000)",children:t.jsxs("g",{transform:"translate(39.000000, 17.353553)",children:[t.jsx("path",{d:"M11,201.146447 L167,201.146447 C173.075132,201.146447 178,206.071314 178,212.146447 C178,218.221579 173.075132,223.146447 167,223.146447 L11,223.146447 C4.92486775,223.146447 7.43989126e-16,218.221579 0,212.146447 C-7.43989126e-16,206.071314 4.92486775,201.146447 11,201.146447 Z",fill:typeof e=="string"?e:"#000",fillRule:"evenodd"}),t.jsx("path",{d:"M72.3425855,16.8295583 C75.799482,7.50883712 86.1577877,2.75526801 95.4785089,6.21216449 C100.284516,7.99463061 104.096358,11.7387855 105.968745,16.4968188 L106.112518,16.8745422 L159.385152,161.694068 C161.291848,166.877345 158.635655,172.624903 153.452378,174.531599 C148.358469,176.405421 142.719567,173.872338 140.716873,168.864661 L140.614848,168.598825 L89.211,28.86 L37.3759214,168.623816 C35.4885354,173.712715 29.8981043,176.351047 24.7909589,174.617647 L24.5226307,174.522368 C19.4337312,172.634982 16.7953993,167.044551 18.5287999,161.937406 L18.6240786,161.669077 L72.3425855,16.8295583 Z",fill:"currentColor",fillRule:"nonzero"}),t.jsx("path",{d:"M121,103.146447 C126.522847,103.146447 131,107.623599 131,113.146447 C131,118.575687 126.673329,122.994378 121.279905,123.142605 L121,123.146447 L55,123.146447 C49.4771525,123.146447 45,118.669294 45,113.146447 C45,107.717207 49.3266708,103.298515 54.7200952,103.150288 L55,103.146447 L121,103.146447 Z",fill:"currentColor",fillRule:"nonzero"})]})})})})}function L(){const e=h.useButtonProps(C.name),{tooltip:o=void 0,isActive:s=void 0,defaultColor:r=void 0,colors:n,action:i}=(e==null?void 0:e.componentProps)??{},{disabled:l,dataState:c}=h.useActive(s),[f,u]=d.useState(r);d.useEffect(()=>{u(c)},[c]);function x(a){l||i&&(i==null||i(a),u(a))}return e?t.jsx(v.ColorPicker,{colors:n,disabled:l,onChange:x,value:f,children:t.jsx(g.ActionButton,{disabled:l,tooltip:o,children:t.jsxs("span",{className:"richtext-flex richtext-items-center richtext-justify-center richtext-gap-[4px] richtext-text-sm",children:[t.jsx(m,{fill:c}),t.jsx(j.IconComponent,{className:"!richtext-h-3 !richtext-w-3 richtext-text-zinc-500",name:"MenuDown"})]})})}):t.jsx(t.Fragment,{})}const C=p.Color.extend({addStorage(){return{currentColor:this.options.defaultColor||void 0}},addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),button({editor:o,t:s,extension:r}){return{componentProps:{colors:r.options.colors,defaultColor:r.options.defaultColor,action:n=>{if(typeof n=="string"){o.storage.color.currentColor=n,o.chain().focus().setColor(n).run();return}o.chain().focus().unsetColor().run()},isActive:()=>{const{color:n}=o.getAttributes("textStyle");return n},disabled:!1,shortcutKeys:r.options.shortcutKeys??["⇧","alt","C"],tooltip:s("editor.color.tooltip")}}}}},addKeyboardShortcuts(){var e;return{...(e=this.parent)==null?void 0:e.call(this),"Alt-Shift-c":()=>{const o=this.storage.currentColor||this.options.defaultColor;if(!o){const{color:r}=this.editor.getAttributes("textStyle");return r?this.editor.chain().focus().unsetColor().run():!1}return this.editor.isActive("textStyle",{color:o})?this.editor.chain().focus().unsetColor().run():this.editor.chain().focus().setColor(o).run()}}}});exports.Color=C;exports.RichTextColor=L;
|
package/lib/Color.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { C
|
|
2
|
-
import { jsx as o, jsxs as
|
|
3
|
-
import { useState as
|
|
4
|
-
import {
|
|
5
|
-
import { C as
|
|
6
|
-
import "./
|
|
1
|
+
import { C } from "./index-C1KQsOcg.js";
|
|
2
|
+
import { jsx as o, jsxs as f, Fragment as p } from "react/jsx-runtime";
|
|
3
|
+
import { useState as m, useEffect as x } from "react";
|
|
4
|
+
import { A as g } from "./toggle-DoJTBdvy.js";
|
|
5
|
+
import { C as v } from "./separator-CYCA8tSn.js";
|
|
6
|
+
import { u as L, d as A } from "./useButtonProps-BE10eHkG.js";
|
|
7
|
+
import { I as y } from "./Icon-CKM0tYbW.js";
|
|
7
8
|
function S({ fill: t }) {
|
|
8
9
|
return /* @__PURE__ */ o(
|
|
9
10
|
"svg",
|
|
@@ -13,7 +14,7 @@ function S({ fill: t }) {
|
|
|
13
14
|
viewBox: "0 0 240 240",
|
|
14
15
|
width: "18px",
|
|
15
16
|
xmlns: "http://www.w3.org/2000/svg",
|
|
16
|
-
children: /* @__PURE__ */ o("g", { fill: "none", fillRule: "evenodd", stroke: "none", strokeWidth: 1, children: /* @__PURE__ */ o("g", { transform: "translate(0.000000, 0.500000)", children: /* @__PURE__ */
|
|
17
|
+
children: /* @__PURE__ */ o("g", { fill: "none", fillRule: "evenodd", stroke: "none", strokeWidth: 1, children: /* @__PURE__ */ o("g", { transform: "translate(0.000000, 0.500000)", children: /* @__PURE__ */ f("g", { transform: "translate(39.000000, 17.353553)", children: [
|
|
17
18
|
/* @__PURE__ */ o(
|
|
18
19
|
"path",
|
|
19
20
|
{
|
|
@@ -42,29 +43,29 @@ function S({ fill: t }) {
|
|
|
42
43
|
}
|
|
43
44
|
);
|
|
44
45
|
}
|
|
45
|
-
function
|
|
46
|
-
const t =
|
|
46
|
+
function E() {
|
|
47
|
+
const t = L(w.name), {
|
|
47
48
|
tooltip: r = void 0,
|
|
48
49
|
isActive: i = void 0,
|
|
49
50
|
defaultColor: e = void 0,
|
|
50
51
|
colors: n,
|
|
51
52
|
action: s
|
|
52
|
-
} = (t == null ? void 0 : t.componentProps) ?? {}, { disabled: l, dataState: c } =
|
|
53
|
-
|
|
53
|
+
} = (t == null ? void 0 : t.componentProps) ?? {}, { disabled: l, dataState: c } = A(i), [h, u] = m(e);
|
|
54
|
+
x(() => {
|
|
54
55
|
u(c);
|
|
55
56
|
}, [c]);
|
|
56
|
-
function
|
|
57
|
+
function d(a) {
|
|
57
58
|
l || s && (s == null || s(a), u(a));
|
|
58
59
|
}
|
|
59
|
-
return t ? /* @__PURE__ */ o(
|
|
60
|
-
|
|
60
|
+
return t ? /* @__PURE__ */ o(v, { colors: n, disabled: l, onChange: d, value: h, children: /* @__PURE__ */ o(
|
|
61
|
+
g,
|
|
61
62
|
{
|
|
62
63
|
disabled: l,
|
|
63
64
|
tooltip: r,
|
|
64
|
-
children: /* @__PURE__ */
|
|
65
|
+
children: /* @__PURE__ */ f("span", { className: "richtext-flex richtext-items-center richtext-justify-center richtext-gap-[4px] richtext-text-sm", children: [
|
|
65
66
|
/* @__PURE__ */ o(S, { fill: c }),
|
|
66
67
|
/* @__PURE__ */ o(
|
|
67
|
-
|
|
68
|
+
y,
|
|
68
69
|
{
|
|
69
70
|
className: "!richtext-h-3 !richtext-w-3 richtext-text-zinc-500",
|
|
70
71
|
name: "MenuDown"
|
|
@@ -74,7 +75,7 @@ function B() {
|
|
|
74
75
|
}
|
|
75
76
|
) }) : /* @__PURE__ */ o(p, {});
|
|
76
77
|
}
|
|
77
|
-
const w = /* @__PURE__ */
|
|
78
|
+
const w = /* @__PURE__ */ C.extend({
|
|
78
79
|
addStorage() {
|
|
79
80
|
return {
|
|
80
81
|
// Stores the currently selected text color; undefined indicates "No Fill" (default color)
|
|
@@ -130,5 +131,5 @@ const w = /* @__PURE__ */ d.extend({
|
|
|
130
131
|
});
|
|
131
132
|
export {
|
|
132
133
|
w as Color,
|
|
133
|
-
|
|
134
|
+
E as RichTextColor
|
|
134
135
|
};
|
package/lib/Column.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./clsx-CXbNJWDD.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./clsx-CXbNJWDD.cjs"),C=require("@tiptap/pm/state"),A=require("@tiptap/pm/model"),f=require("react/jsx-runtime"),v=require("./toggle-oFwBZC4x.cjs"),y=require("./useButtonProps-CFu0GHzW.cjs");function M(e,t,r=null){return r?e.createChecked({index:t},r):e.createAndFill({index:t})}function H(e){if(e.cached.columnsNodeTypes)return e.cached.columnsNodeTypes;const t={columns:e.nodes.columns,column:e.nodes.column};return e.cached.columnsNodeTypes=t,t}function O(e,t,r=null){const n=H(e),c=[];for(let o=0;o<t;o+=1){const s=M(n.column,o,r);s&&c.push(s)}return n.columns.createChecked({cols:t},c)}function h({state:e,dispatch:t,type:r}){const n=u.findParentNode(o=>o.type.name===T.name)(e.selection),c=u.findParentNode(o=>o.type.name===x.name)(e.selection);if(t&&n&&c){const o=n.node,s=c.node.attrs.index,i=o.toJSON();let l=s;r==="delete"?(l=s-1,i.content.splice(s,1)):(l=r==="addBefore"?s:s+1,i.content.splice(l,0,{type:"column",attrs:{index:s},content:[{type:"paragraph"}]})),i.attrs.cols=i.content.length,i.content.forEach((m,b)=>{m.attrs.index=b});const d=A.Node.fromJSON(e.schema,i);let a=n.pos;d.content.forEach((m,b,N)=>{N<l&&(a+=m.nodeSize)});const p=e.tr.setTime(Date.now());p.replaceWith(n.pos,n.pos+n.node.nodeSize,d).setSelection(C.TextSelection.near(p.doc.resolve(a))),t(p)}return!0}function g({state:e,dispatch:t,type:r}){const n=u.findParentNode(o=>o.type.name===T.name)(e.selection),c=u.findParentNode(o=>o.type.name===x.name)(e.selection);if(t&&n&&c){const o=n.node,s=c.node.attrs.index;let i=0;r==="before"?i=(s-1+o.attrs.cols)%o.attrs.cols:i=(s+1)%o.attrs.cols;let l=n.pos;o.content.forEach((a,p,m)=>{m<i&&(l+=a.nodeSize)});const d=e.tr.setTime(Date.now());return d.setSelection(C.TextSelection.near(d.doc.resolve(l))),t(d),!0}return!1}function P(){const e=y.useButtonProps(S.name),{icon:t=void 0,tooltip:r=void 0,shortcutKeys:n=void 0,tooltipOptions:c={},action:o=void 0,isActive:s=void 0}=(e==null?void 0:e.componentProps)??{},{dataState:i,disabled:l,update:d}=y.useToggleActive(s),a=()=>{l||o&&(o(),d())};return e?f.jsx(v.ActionButton,{action:a,dataState:i,disabled:l,icon:t,shortcutKeys:n,tooltip:r,tooltipOptions:c}):f.jsx(f.Fragment,{})}const L=200,S=u.Extension.create({name:"richtextColumnExtension",addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),button:({editor:t,t:r})=>({componentProps:{action:()=>{t.chain().focus().insertColumns({cols:2}).run()},icon:"Columns",tooltip:r("editor.columns.tooltip")}})}}}),x=u.Node3.create({name:"column",content:"block+",isolating:!0,addOptions(){return{HTMLAttributes:{class:"column"}}},addAttributes(){return{index:{default:0,parseHTML:e=>e.getAttribute("index")}}},parseHTML(){return[{tag:"div[class=column]"}]},renderHTML({HTMLAttributes:e}){return["div",u.mergeAttributes(this.options.HTMLAttributes,e),0]}}),T=u.Node3.create({name:"columns",group:"block",defining:!0,isolating:!0,allowGapCursor:!1,content:"column{1,}",priority:L,addOptions(){return{HTMLAttributes:{class:"columns"}}},addAttributes(){return{cols:{default:2,parseHTML:e=>e.getAttribute("cols")}}},parseHTML(){return[{tag:"div[class=grid]"}]},renderHTML({HTMLAttributes:e}){return["div",u.mergeAttributes(this.options.HTMLAttributes,e),0]},addCommands(){return{insertColumns:e=>({tr:t,dispatch:r,editor:n})=>{const c=O(n.schema,e&&e.cols||3);if(r){const o=t.selection.anchor+1;t.replaceSelectionWith(c).scrollIntoView().setSelection(C.TextSelection.near(t.doc.resolve(o)))}return!0},addColBefore:()=>({dispatch:e,state:t})=>h({dispatch:e,state:t,type:"addBefore"}),addColAfter:()=>({dispatch:e,state:t})=>h({dispatch:e,state:t,type:"addAfter"}),deleteCol:()=>({dispatch:e,state:t})=>h({dispatch:e,state:t,type:"delete"})}},addKeyboardShortcuts(){return{"Mod-Alt-G":()=>this.editor.commands.insertColumns(),Tab:()=>g({state:this.editor.state,dispatch:this.editor.view.dispatch,type:"after"}),"Shift-Tab":()=>g({state:this.editor.state,dispatch:this.editor.view.dispatch,type:"before"})}}});exports.Column=S;exports.ColumnNode=x;exports.MultipleColumnNode=T;exports.RichTextColumn=P;
|
package/lib/Column.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { l as p, E as v, N as b, m as y } from "./clsx-
|
|
1
|
+
import { l as p, E as v, N as b, m as y } from "./clsx-m_C5j3RU.js";
|
|
2
2
|
import { TextSelection as h } from "@tiptap/pm/state";
|
|
3
3
|
import { Node as N } from "@tiptap/pm/model";
|
|
4
4
|
import { jsx as T, Fragment as H } from "react/jsx-runtime";
|
|
5
|
-
import {
|
|
6
|
-
import "
|
|
7
|
-
import "./theme.js";
|
|
5
|
+
import { A as M } from "./toggle-DoJTBdvy.js";
|
|
6
|
+
import { u as L, c as O } from "./useButtonProps-BE10eHkG.js";
|
|
8
7
|
function E(e, t, r = null) {
|
|
9
8
|
return r ? e.createChecked({ index: t }, r) : e.createAndFill({ index: t });
|
|
10
9
|
}
|
|
@@ -88,19 +87,19 @@ function x({
|
|
|
88
87
|
}
|
|
89
88
|
return !1;
|
|
90
89
|
}
|
|
91
|
-
function
|
|
92
|
-
const e =
|
|
90
|
+
function F() {
|
|
91
|
+
const e = L(B.name), {
|
|
93
92
|
icon: t = void 0,
|
|
94
93
|
tooltip: r = void 0,
|
|
95
94
|
shortcutKeys: n = void 0,
|
|
96
95
|
tooltipOptions: c = {},
|
|
97
96
|
action: o = void 0,
|
|
98
97
|
isActive: s = void 0
|
|
99
|
-
} = (e == null ? void 0 : e.componentProps) ?? {}, { dataState: i, disabled: l, update: a } =
|
|
98
|
+
} = (e == null ? void 0 : e.componentProps) ?? {}, { dataState: i, disabled: l, update: a } = O(s), d = () => {
|
|
100
99
|
l || o && (o(), a());
|
|
101
100
|
};
|
|
102
101
|
return e ? /* @__PURE__ */ T(
|
|
103
|
-
|
|
102
|
+
M,
|
|
104
103
|
{
|
|
105
104
|
action: d,
|
|
106
105
|
dataState: i,
|
|
@@ -226,5 +225,5 @@ export {
|
|
|
226
225
|
B as Column,
|
|
227
226
|
A as ColumnNode,
|
|
228
227
|
S as MultipleColumnNode,
|
|
229
|
-
|
|
228
|
+
F as RichTextColumn
|
|
230
229
|
};
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
-
import { h as oe,
|
|
2
|
-
import {
|
|
1
|
+
import { h as oe, _ as X, m as le, k as ne } from "./clsx-m_C5j3RU.js";
|
|
2
|
+
import { a as K, c as ie } from "./throttle-CRNq0z-O.js";
|
|
3
3
|
import { jsx as e, jsxs as y, Fragment as j } from "react/jsx-runtime";
|
|
4
|
-
import { useState as H, useMemo as G, useCallback as q, useEffect as
|
|
5
|
-
import { I as
|
|
6
|
-
import {
|
|
4
|
+
import { useState as H, useMemo as G, useCallback as q, useEffect as U, useRef as Q } from "react";
|
|
5
|
+
import { I as Y, i as J, j as se } from "./index-4Q5IhypJ.js";
|
|
6
|
+
import { m as ae, f as ce, u as he, c as de } from "./useButtonProps-BE10eHkG.js";
|
|
7
|
+
import { Color4 as m, Editor as ue, makeDropdownToolbar as ge } from "easydrawer";
|
|
8
|
+
import { A as me } from "./toggle-DoJTBdvy.js";
|
|
9
|
+
import { D as pe, a as we, b as ve, c as fe, d as Ce } from "./dialog-QWWUWOGP.js";
|
|
10
|
+
import { c as g } from "./index-CAiZY1nx.js";
|
|
11
|
+
import { d as Te } from "./file-BLas99n7.js";
|
|
12
|
+
import { B as be } from "./button-CDIxPURh.js";
|
|
7
13
|
const W = {
|
|
8
14
|
TOP_LEFT: "tl",
|
|
9
15
|
TOP_RIGHT: "tr",
|
|
@@ -12,8 +18,8 @@ const W = {
|
|
|
12
18
|
};
|
|
13
19
|
function xe({ editor: t, node: r, updateAttributes: o, getPos: n, selected: v }) {
|
|
14
20
|
const [b, M] = H({
|
|
15
|
-
width:
|
|
16
|
-
height:
|
|
21
|
+
width: Y,
|
|
22
|
+
height: Y
|
|
17
23
|
}), [d, a] = H({
|
|
18
24
|
width: 0,
|
|
19
25
|
height: 0
|
|
@@ -29,12 +35,12 @@ function xe({ editor: t, node: r, updateAttributes: o, getPos: n, selected: v })
|
|
|
29
35
|
h: 0,
|
|
30
36
|
dir: ""
|
|
31
37
|
}), { align: T } = r == null ? void 0 : r.attrs, C = G(() => {
|
|
32
|
-
const { src: u, alt: N, width: L, height:
|
|
38
|
+
const { src: u, alt: N, width: L, height: _ } = r == null ? void 0 : r.attrs, z = X(L) ? `${L}px` : L, f = X(_) ? `${_}px` : _;
|
|
33
39
|
return {
|
|
34
40
|
src: u || void 0,
|
|
35
41
|
alt: N || void 0,
|
|
36
42
|
style: {
|
|
37
|
-
width:
|
|
43
|
+
width: z || void 0,
|
|
38
44
|
height: f || void 0
|
|
39
45
|
}
|
|
40
46
|
};
|
|
@@ -53,7 +59,7 @@ function xe({ editor: t, node: r, updateAttributes: o, getPos: n, selected: v })
|
|
|
53
59
|
const P = q(() => {
|
|
54
60
|
t.commands.setNodeSelection(n());
|
|
55
61
|
}, []), D = q(
|
|
56
|
-
|
|
62
|
+
K(() => {
|
|
57
63
|
const { width: u } = getComputedStyle(t.view.dom);
|
|
58
64
|
M((N) => ({
|
|
59
65
|
...N,
|
|
@@ -64,10 +70,10 @@ function xe({ editor: t, node: r, updateAttributes: o, getPos: n, selected: v })
|
|
|
64
70
|
);
|
|
65
71
|
function V(u, N) {
|
|
66
72
|
u.preventDefault(), u.stopPropagation();
|
|
67
|
-
const L = d.width,
|
|
73
|
+
const L = d.width, _ = d.height, z = L / _;
|
|
68
74
|
let f = Number(r.attrs.width), A = Number(r.attrs.height);
|
|
69
75
|
const E = b.width;
|
|
70
|
-
f && !A ? (f = f > E ? E : f, A = Math.round(f /
|
|
76
|
+
f && !A ? (f = f > E ? E : f, A = Math.round(f / z)) : A && !f ? (f = Math.round(A * z), f = f > E ? E : f) : !f && !A ? (f = L > E ? E : L, A = Math.round(f / z)) : f = f > E ? E : f, B(!0), h({
|
|
71
77
|
x: u.clientX,
|
|
72
78
|
y: u.clientY,
|
|
73
79
|
w: f,
|
|
@@ -76,10 +82,10 @@ function xe({ editor: t, node: r, updateAttributes: o, getPos: n, selected: v })
|
|
|
76
82
|
});
|
|
77
83
|
}
|
|
78
84
|
const p = q(
|
|
79
|
-
|
|
85
|
+
K((u) => {
|
|
80
86
|
if (u.preventDefault(), u.stopPropagation(), !x)
|
|
81
87
|
return;
|
|
82
|
-
const { x: N, w: L, dir:
|
|
88
|
+
const { x: N, w: L, dir: _ } = c, z = (u.clientX - N) * (/l/.test(_) ? -1 : 1), { width: f, height: A } = r == null ? void 0 : r.attrs, E = f / A, Z = ae(L + z, se, b.width), re = Math.round(Z / E);
|
|
83
89
|
o({
|
|
84
90
|
width: Z,
|
|
85
91
|
height: re
|
|
@@ -102,11 +108,11 @@ function xe({ editor: t, node: r, updateAttributes: o, getPos: n, selected: v })
|
|
|
102
108
|
}, [p, s]), k = q(() => {
|
|
103
109
|
document == null || document.removeEventListener("mousemove", p, !0), document == null || document.removeEventListener("mouseup", s, !0);
|
|
104
110
|
}, [p, s]);
|
|
105
|
-
|
|
111
|
+
U(() => (x ? w() : k(), () => {
|
|
106
112
|
k();
|
|
107
113
|
}), [x, w, k]);
|
|
108
114
|
const R = G(() => new ResizeObserver(() => D()), [D]);
|
|
109
|
-
return
|
|
115
|
+
return U(() => (R.observe(t.view.dom), () => {
|
|
110
116
|
R.disconnect();
|
|
111
117
|
}), [t.view.dom, R]), /* @__PURE__ */ e(
|
|
112
118
|
oe,
|
|
@@ -221,7 +227,7 @@ function ke(t) {
|
|
|
221
227
|
}
|
|
222
228
|
);
|
|
223
229
|
}
|
|
224
|
-
function
|
|
230
|
+
function _e(t) {
|
|
225
231
|
return /* @__PURE__ */ y("svg", { height: "1em", viewBox: "0 0 16 16", width: "1em", xmlns: "http://www.w3.org/2000/svg", ...t, children: [
|
|
226
232
|
/* @__PURE__ */ e(
|
|
227
233
|
"path",
|
|
@@ -239,7 +245,7 @@ function ze(t) {
|
|
|
239
245
|
)
|
|
240
246
|
] });
|
|
241
247
|
}
|
|
242
|
-
function
|
|
248
|
+
function ze(t) {
|
|
243
249
|
return /* @__PURE__ */ e("svg", { height: "1em", viewBox: "0 0 24 24", width: "1em", xmlns: "http://www.w3.org/2000/svg", ...t, children: /* @__PURE__ */ e("path", { d: "M3 3h18v18H3zm2 2v14h14V5z", fill: "currentColor" }) });
|
|
244
250
|
}
|
|
245
251
|
function Be(t) {
|
|
@@ -350,7 +356,7 @@ function Ge(t) {
|
|
|
350
356
|
}
|
|
351
357
|
) });
|
|
352
358
|
}
|
|
353
|
-
function
|
|
359
|
+
function Ue(t) {
|
|
354
360
|
return /* @__PURE__ */ e("svg", { height: "1em", viewBox: "0 0 24 24", width: "1em", xmlns: "http://www.w3.org/2000/svg", ...t, children: /* @__PURE__ */ e(
|
|
355
361
|
"path",
|
|
356
362
|
{
|
|
@@ -359,7 +365,7 @@ function $e(t) {
|
|
|
359
365
|
}
|
|
360
366
|
) });
|
|
361
367
|
}
|
|
362
|
-
function
|
|
368
|
+
function $e(t) {
|
|
363
369
|
return /* @__PURE__ */ e("svg", { height: "1em", viewBox: "0 0 24 24", width: "1em", xmlns: "http://www.w3.org/2000/svg", ...t, children: /* @__PURE__ */ e(
|
|
364
370
|
"path",
|
|
365
371
|
{
|
|
@@ -379,12 +385,12 @@ function je(t) {
|
|
|
379
385
|
}
|
|
380
386
|
) });
|
|
381
387
|
}
|
|
382
|
-
const Ze = "_wrapper_pva9d_1", Xe = "_tool_pva9d_17",
|
|
388
|
+
const Ze = "_wrapper_pva9d_1", Xe = "_tool_pva9d_17", Ke = "_active_pva9d_37", Qe = "_pen_pva9d_41", Ye = "_line_pva9d_48", Je = "_options_pva9d_56", et = "_colorWrap_pva9d_66", tt = "_color_pva9d_66", rt = "_colorActive_pva9d_83", l = {
|
|
383
389
|
wrapper: Ze,
|
|
384
390
|
tool: Xe,
|
|
385
|
-
active:
|
|
386
|
-
pen:
|
|
387
|
-
line:
|
|
391
|
+
active: Ke,
|
|
392
|
+
pen: Qe,
|
|
393
|
+
line: Ye,
|
|
388
394
|
options: Je,
|
|
389
395
|
colorWrap: et,
|
|
390
396
|
color: tt,
|
|
@@ -429,7 +435,7 @@ function lt({ onChange: t }) {
|
|
|
429
435
|
v
|
|
430
436
|
)) });
|
|
431
437
|
}
|
|
432
|
-
function
|
|
438
|
+
function $({ onChange: t }) {
|
|
433
439
|
const [r, o] = H(m.black);
|
|
434
440
|
return /* @__PURE__ */ y(j, { children: [
|
|
435
441
|
/* @__PURE__ */ e("div", { className: l.colorWrap, children: ee.slice(0, 7).map((n, v) => /* @__PURE__ */ e(
|
|
@@ -463,7 +469,7 @@ function U({ onChange: t }) {
|
|
|
463
469
|
function nt({ setColorPen: t, setThicknessPen: r }) {
|
|
464
470
|
const [o, n] = H(2);
|
|
465
471
|
return /* @__PURE__ */ y("div", { className: l.options, children: [
|
|
466
|
-
/* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(
|
|
472
|
+
/* @__PURE__ */ e("div", { children: /* @__PURE__ */ e($, { onChange: (v) => t(v) }) }),
|
|
467
473
|
/* @__PURE__ */ e("div", { className: l.line }),
|
|
468
474
|
/* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(
|
|
469
475
|
"input",
|
|
@@ -485,9 +491,9 @@ function it({ setColorHighlight: t }) {
|
|
|
485
491
|
}
|
|
486
492
|
function st({ changeColorShape: t, changeBorderColorShape: r, onThicknessChange: o }) {
|
|
487
493
|
return /* @__PURE__ */ y("div", { className: l.options, children: [
|
|
488
|
-
/* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(
|
|
494
|
+
/* @__PURE__ */ e("div", { children: /* @__PURE__ */ e($, { onChange: (n) => t(n) }) }),
|
|
489
495
|
/* @__PURE__ */ e("div", { className: l.line }),
|
|
490
|
-
/* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(
|
|
496
|
+
/* @__PURE__ */ e("div", { children: /* @__PURE__ */ e($, { onChange: (n) => r(n) }) }),
|
|
491
497
|
/* @__PURE__ */ e("div", { className: l.line }),
|
|
492
498
|
/* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(
|
|
493
499
|
"input",
|
|
@@ -608,7 +614,7 @@ function at(t) {
|
|
|
608
614
|
}
|
|
609
615
|
h("eraser"), i[4].setEnabled(!0);
|
|
610
616
|
},
|
|
611
|
-
children: /* @__PURE__ */ e(
|
|
617
|
+
children: /* @__PURE__ */ e(_e, {})
|
|
612
618
|
}
|
|
613
619
|
),
|
|
614
620
|
/* @__PURE__ */ e("div", { className: l.line }),
|
|
@@ -629,7 +635,7 @@ function at(t) {
|
|
|
629
635
|
/* square */
|
|
630
636
|
);
|
|
631
637
|
},
|
|
632
|
-
children: /* @__PURE__ */ e(
|
|
638
|
+
children: /* @__PURE__ */ e(ze, {})
|
|
633
639
|
}
|
|
634
640
|
),
|
|
635
641
|
/* @__PURE__ */ e(
|
|
@@ -809,7 +815,7 @@ function at(t) {
|
|
|
809
815
|
/* star */
|
|
810
816
|
);
|
|
811
817
|
},
|
|
812
|
-
children: /* @__PURE__ */ e(
|
|
818
|
+
children: /* @__PURE__ */ e(Ue, {})
|
|
813
819
|
}
|
|
814
820
|
),
|
|
815
821
|
/* @__PURE__ */ e(
|
|
@@ -829,7 +835,7 @@ function at(t) {
|
|
|
829
835
|
/* cloud */
|
|
830
836
|
);
|
|
831
837
|
},
|
|
832
|
-
children: /* @__PURE__ */ e(
|
|
838
|
+
children: /* @__PURE__ */ e($e, {})
|
|
833
839
|
}
|
|
834
840
|
),
|
|
835
841
|
/* @__PURE__ */ e(
|
|
@@ -876,17 +882,17 @@ function ct(t = 8) {
|
|
|
876
882
|
return Math.random().toString(36).substring(2, t + 2);
|
|
877
883
|
}
|
|
878
884
|
let I = !1;
|
|
879
|
-
function
|
|
880
|
-
const t =
|
|
885
|
+
function yt() {
|
|
886
|
+
const t = ce(), r = he(ht.name), { isActive: o = void 0, upload: n } = (r == null ? void 0 : r.componentProps) ?? {}, { editorDisabled: v } = de(o), [b, M] = H(!1), d = Q(null), a = Q(null), S = () => {
|
|
881
887
|
(async () => {
|
|
882
888
|
const s = document.querySelector("#easydrawer");
|
|
883
|
-
s && (d.current = new
|
|
889
|
+
s && (d.current = new ue(s, {
|
|
884
890
|
wheelEventsEnabled: !1,
|
|
885
891
|
disableZoom: !0
|
|
886
|
-
}), a.current =
|
|
892
|
+
}), a.current = ge(d.current), a.current.addDefaultToolWidgets());
|
|
887
893
|
})();
|
|
888
894
|
};
|
|
889
|
-
|
|
895
|
+
U(() => {
|
|
890
896
|
b && setTimeout(() => {
|
|
891
897
|
S();
|
|
892
898
|
}, 200);
|
|
@@ -896,7 +902,7 @@ function vt() {
|
|
|
896
902
|
const p = d.current.toSVG(), s = p.outerHTML, w = `drawer-${ct()}.svg`;
|
|
897
903
|
let k = Ee(p.outerHTML);
|
|
898
904
|
if (n) {
|
|
899
|
-
const R =
|
|
905
|
+
const R = Te(k, w);
|
|
900
906
|
k = await n(R);
|
|
901
907
|
}
|
|
902
908
|
t == null || t.chain().focus().setDrawer(
|
|
@@ -949,9 +955,9 @@ function vt() {
|
|
|
949
955
|
I = !0;
|
|
950
956
|
}
|
|
951
957
|
};
|
|
952
|
-
return r ? /* @__PURE__ */ y(
|
|
953
|
-
/* @__PURE__ */ e(
|
|
954
|
-
|
|
958
|
+
return r ? /* @__PURE__ */ y(pe, { onOpenChange: M, open: b, children: [
|
|
959
|
+
/* @__PURE__ */ e(we, { asChild: !0, children: /* @__PURE__ */ e(
|
|
960
|
+
me,
|
|
955
961
|
{
|
|
956
962
|
disabled: v,
|
|
957
963
|
action: () => {
|
|
@@ -961,8 +967,8 @@ function vt() {
|
|
|
961
967
|
tooltip: "Drawer"
|
|
962
968
|
}
|
|
963
969
|
) }),
|
|
964
|
-
/* @__PURE__ */ y(
|
|
965
|
-
/* @__PURE__ */ e(
|
|
970
|
+
/* @__PURE__ */ y(ve, { className: "richtext-z-[99999] !richtext-max-w-[1300px]", children: [
|
|
971
|
+
/* @__PURE__ */ e(fe, { children: "Drawer" }),
|
|
966
972
|
/* @__PURE__ */ y(
|
|
967
973
|
"div",
|
|
968
974
|
{
|
|
@@ -994,11 +1000,11 @@ function vt() {
|
|
|
994
1000
|
]
|
|
995
1001
|
}
|
|
996
1002
|
),
|
|
997
|
-
/* @__PURE__ */ e(
|
|
1003
|
+
/* @__PURE__ */ e(Ce, { children: /* @__PURE__ */ e(be, { onClick: x, type: "button", children: "Save changes" }) })
|
|
998
1004
|
] })
|
|
999
1005
|
] }) : /* @__PURE__ */ e(j, {});
|
|
1000
1006
|
}
|
|
1001
|
-
const ht = /* @__PURE__ */
|
|
1007
|
+
const ht = /* @__PURE__ */ ie.extend({
|
|
1002
1008
|
name: "richTextDrawer",
|
|
1003
1009
|
//@ts-expect-error
|
|
1004
1010
|
addOptions() {
|
|
@@ -1119,7 +1125,7 @@ const ht = /* @__PURE__ */ fe.extend({
|
|
|
1119
1125
|
export {
|
|
1120
1126
|
at as C,
|
|
1121
1127
|
ht as D,
|
|
1122
|
-
|
|
1128
|
+
yt as R,
|
|
1123
1129
|
Ee as i,
|
|
1124
1130
|
ct as s
|
|
1125
1131
|
};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";const I=require("./clsx-CXbNJWDD.cjs"),$=require("./throttle-gTTvqDTW.cjs"),e=require("react/jsx-runtime"),g=require("react"),B=require("./index-bVGIXhRg.cjs"),O=require("./useButtonProps-CFu0GHzW.cjs"),m=require("easydrawer"),re=require("./toggle-oFwBZC4x.cjs"),P=require("./dialog-B-jOQ5i3.cjs"),p=require("./index-DWSAk_9a.cjs"),oe=require("./file-i7e4nQY2.cjs"),le=require("./button-BmTP96NR.cjs"),W={TOP_LEFT:"tl",TOP_RIGHT:"tr",BOTTOM_LEFT:"bl",BOTTOM_RIGHT:"br"};function ne({editor:t,node:r,updateAttributes:o,getPos:n,selected:v}){const[j,S]=g.useState({width:B.IMAGE_MAX_SIZE,height:B.IMAGE_MAX_SIZE}),[u,a]=g.useState({width:0,height:0}),[M]=g.useState([W.TOP_LEFT,W.TOP_RIGHT,W.BOTTOM_LEFT,W.BOTTOM_RIGHT]),[b,_]=g.useState(!1),[c,h]=g.useState({x:0,y:0,w:0,h:0,dir:""}),{align:T}=r==null?void 0:r.attrs,f=g.useMemo(()=>{const{src:d,alt:E,width:H,height:k}=r==null?void 0:r.attrs,A=I.isNumber(H)?`${H}px`:H,C=I.isNumber(k)?`${k}px`:k;return{src:d||void 0,alt:E||void 0,style:{width:A||void 0,height:C||void 0}}},[r==null?void 0:r.attrs]),s=g.useMemo(()=>{const{style:{width:d}}=f;return{width:d==="100%"?d:void 0}},[f]);function V(d){a({width:d.target.width,height:d.target.height})}const z=g.useCallback(()=>{t.commands.setNodeSelection(n())},[]),D=g.useCallback($.throttle(()=>{const{width:d}=getComputedStyle(t.view.dom);S(E=>({...E,width:Number.parseInt(d,10)}))},B.IMAGE_THROTTLE_WAIT_TIME),[t]);function G(d,E){d.preventDefault(),d.stopPropagation();const H=u.width,k=u.height,A=H/k;let C=Number(r.attrs.width),N=Number(r.attrs.height);const y=j.width;C&&!N?(C=C>y?y:C,N=Math.round(C/A)):N&&!C?(C=Math.round(N*A),C=C>y?y:C):!C&&!N?(C=H>y?y:H,N=Math.round(C/A)):C=C>y?y:C,_(!0),h({x:d.clientX,y:d.clientY,w:C,h:N,dir:E})}const x=g.useCallback($.throttle(d=>{if(d.preventDefault(),d.stopPropagation(),!b)return;const{x:E,w:H,dir:k}=c,A=(d.clientX-E)*(/l/.test(k)?-1:1),{width:C,height:N}=r==null?void 0:r.attrs,y=C/N,Z=O.clamp(H+A,B.IMAGE_MIN_SIZE,j.width),te=Math.round(Z/y);o({width:Z,height:te})},B.IMAGE_THROTTLE_WAIT_TIME),[b,c,j,o,r==null?void 0:r.attrs]),i=g.useCallback(d=>{d.preventDefault(),d.stopPropagation(),b&&(h({x:0,y:0,w:0,h:0,dir:""}),_(!1),z())},[b,z]),w=g.useCallback(()=>{document==null||document.addEventListener("mousemove",x,!0),document==null||document.addEventListener("mouseup",i,!0)},[x,i]),L=g.useCallback(()=>{document==null||document.removeEventListener("mousemove",x,!0),document==null||document.removeEventListener("mouseup",i,!0)},[x,i]);g.useEffect(()=>(b?w():L(),()=>{L()}),[b,w,L]);const q=g.useMemo(()=>new ResizeObserver(()=>D()),[D]);return g.useEffect(()=>(q.observe(t.view.dom),()=>{q.disconnect()}),[t.view.dom,q]),e.jsx(I.NodeViewWrapper,{className:"image-view",style:{...s,width:"100%",textAlign:T},children:e.jsxs("div",{"data-drag-handle":!0,draggable:"true",style:{...s,background:"#fff"},className:`image-view__body ${v?"image-view__body--focused":""} ${b?"image-view__body--resizing":""}`,children:[e.jsx("img",{alt:f.alt,className:"image-view__body__image block",height:"auto",onClick:z,onLoad:V,src:f.src,style:f.style}),t.view.editable&&(v||b)&&e.jsx("div",{className:"image-resizer",children:M==null?void 0:M.map(d=>e.jsx("span",{className:`image-resizer__handler image-resizer__handler--${d}`,onMouseDown:E=>G(E,d)},`image-dir-${d}`))})]})})}const F="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",se=t=>{t=t.replace(/\r\n/g,`
|
|
2
|
+
`);let r=0,o="";for(;r<t.length;r++){const n=t.charCodeAt(r);n<128?o+=String.fromCharCode(n):n>127&&n<2048?(o+=String.fromCharCode(n>>6|192),o+=String.fromCharCode(63&n|128)):(o+=String.fromCharCode(n>>12|224),o+=String.fromCharCode(n>>6&63|128),o+=String.fromCharCode(63&n|128))}return o},ie=t=>{let r,o,n,v,j,S,u,a=0,M="";for(t=se(t);a<t.length;)r=t.charCodeAt(a++),o=t.charCodeAt(a++),n=t.charCodeAt(a++),v=r>>2,j=(3&r)<<4|o>>4,S=(15&o)<<2|n>>6,u=63&n,isNaN(o)?S=u=64:isNaN(n)&&(u=64),M=M+F.charAt(v)+F.charAt(j)+F.charAt(S)+F.charAt(u);return M},ae=t=>typeof t=="string"?"string":typeof SVGElement<"u"&&t instanceof SVGElement?"element":void 0,K=t=>"data:image/svg+xml;base64,"+ie(t),ce=t=>K(new XMLSerializer().serializeToString(t)),Q=t=>{switch(ae(t)){case"string":return K(t);case"element":return ce(t);default:return t}};function he(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{color:"currentColor",d:"M2 9.2v3.6M12.8 2H9.2M7.5 20H9M20 7.5V9M2.133 4.699c.155-.727.415-1.274.854-1.712c.426-.426.954-.684 1.652-.84m15.228 2.552c-.155-.727-.415-1.274-.854-1.712c-.417-.417-.932-.673-1.608-.83M4.64 19.853c-.698-.156-1.226-.414-1.652-.84c-.43-.43-.69-.965-.845-1.673m11.638 3.626c-1.812.125-3.607-8.326-2.374-9.559s9.684.561 9.559 2.373c-.087 1.187-2.095 1.656-2.037 2.711c.018.309.408.59 1.188 1.154c.543.39 1.096.77 1.629 1.175a.66.66 0 0 1 .234.687a3.35 3.35 0 0 1-2.472 2.473a.66.66 0 0 1-.688-.235c-.404-.533-.784-1.086-1.175-1.628c-.563-.78-.844-1.17-1.153-1.188c-1.055-.059-1.524 1.95-2.71 2.037",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5"})})}function ue(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M20.06 18a4 4 0 0 1-.2-.89c-.67.7-1.48 1.05-2.41 1.05c-.83 0-1.52-.24-2.05-.71c-.53-.45-.8-1.06-.8-1.79c0-.88.33-1.56 1-2.05s1.61-.73 2.83-.73h1.4v-.64q0-.735-.45-1.17c-.3-.29-.75-.43-1.33-.43c-.52 0-.95.12-1.3.36c-.35.25-.52.54-.52.89h-1.46c0-.43.15-.84.45-1.24c.28-.4.71-.71 1.22-.94c.51-.21 1.06-.35 1.69-.35c.98 0 1.74.24 2.29.73s.84 1.16.86 2.02V16c0 .8.1 1.42.3 1.88V18zm-2.4-1.12c.45 0 .88-.11 1.29-.32c.4-.21.7-.49.88-.83v-1.57H18.7c-1.77 0-2.66.47-2.66 1.41c0 .43.15.73.46.96c.3.23.68.35 1.16.35m-12.2-3.17h4.07L7.5 8.29zM6.64 6h1.72l4.71 12h-1.93l-.97-2.57H4.82L3.86 18H1.93z",fill:"currentColor"})})}function de(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M3 21v-4.25L16.2 3.575q.3-.275.663-.425t.762-.15t.775.15t.65.45L20.425 5q.3.275.438.65T21 6.4q0 .4-.137.763t-.438.662L7.25 21zM17.6 7.8L19 6.4L17.6 5l-1.4 1.4z",fill:"currentColor"})})}function ge(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 256 256",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M253.66 106.34a8 8 0 0 0-11.32 0L192 156.69L107.31 72l50.35-50.34a8 8 0 1 0-11.32-11.32L96 60.69a16 16 0 0 0-2.82 18.81L72 100.69a16 16 0 0 0 0 22.62l4.69 4.69l-58.35 58.34a8 8 0 0 0 3.13 13.25l72 24A7.9 7.9 0 0 0 96 224a8 8 0 0 0 5.66-2.34L136 187.31l4.69 4.69a16 16 0 0 0 22.62 0l21.19-21.18a16 16 0 0 0 18.81-2.82l50.35-50.34a8 8 0 0 0 0-11.32M93.84 206.85l-55-18.35L88 139.31L124.69 176ZM152 180.69L83.31 112L104 91.31L172.69 160Z",fill:"currentColor"})})}function me(t){return e.jsxs("svg",{height:"1em",viewBox:"0 0 16 16",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:[e.jsx("path",{d:"m2.648 9.937l7.29-7.288a2.21 2.21 0 0 1 3.124 0l2.29 2.288a2.21 2.21 0 0 1 0 3.126L10.413 13H12.5a.5.5 0 0 1 0 1H4.501a2.2 2.2 0 0 1-1.563-.647l.707-.707c.227.226.535.354.856.354h4.005a1.2 1.2 0 0 0 .848-.354l1.292-1.293l-4-4l-3.29 3.291a1.21 1.21 0 0 0 0 1.712l.29.29l-.708.707l-.29-.29a2.21 2.21 0 0 1 0-3.126M8 6h6.89a1.2 1.2 0 0 0-.246-.356L14 5H9zm2-2h3l-.645-.644a1.21 1.21 0 0 0-1.71 0zm4.89 3H7.708l1 1H14l.644-.644A1.2 1.2 0 0 0 14.891 7zM9.708 9l1.646 1.646L13 9z",fill:"currentColor"}),e.jsx("path",{d:"M14 11.5a.5.5 0 1 1-1 0a.5.5 0 0 1 1 0m1.5-.5a.5.5 0 1 0 0-1a.5.5 0 0 0 0 1m-1 2a.5.5 0 0 0 0 1h1a.5.5 0 0 0 0-1z",fill:"currentColor"})]})}function pe(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M3 3h18v18H3zm2 2v14h14V5z",fill:"currentColor"})})}function xe(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M2 20V4h20v16zm2-2h16V6H4zm0 0V6z",fill:"currentColor"})})}function we(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M12 22q-2.075 0-3.9-.788t-3.175-2.137T2.788 15.9T2 12t.788-3.9t2.137-3.175T8.1 2.788T12 2t3.9.788t3.175 2.137T21.213 8.1T22 12t-.788 3.9t-2.137 3.175t-3.175 2.138T12 22m0-2q3.35 0 5.675-2.325T20 12t-2.325-5.675T12 4T6.325 6.325T4 12t2.325 5.675T12 20m0-8",fill:"currentColor"})})}function ve(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M10.363 3.591L2.257 17.125a1.914 1.914 0 0 0 1.636 2.871h16.214a1.914 1.914 0 0 0 1.636-2.87L13.637 3.59a1.914 1.914 0 0 0-3.274 0z",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"})})}function Ce(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"m6.8 21l-5.2-9l5.2-9h10.4l5.2 9l-5.2 9zm1.15-2h8.1l4.025-7l-4.025-7h-8.1L3.9 12zM12 12",fill:"currentColor"})})}function fe(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsxs("g",{fill:"none",fillRule:"evenodd",children:[e.jsx("path",{d:"m12.594 23.258l-.012.002l-.071.035l-.02.004l-.014-.004l-.071-.036q-.016-.004-.024.006l-.004.01l-.017.428l.005.02l.01.013l.104.074l.015.004l.012-.004l.104-.074l.012-.016l.004-.017l-.017-.427q-.004-.016-.016-.018m.264-.113l-.014.002l-.184.093l-.01.01l-.003.011l.018.43l.005.012l.008.008l.201.092q.019.005.029-.008l.004-.014l-.034-.614q-.005-.019-.02-.022m-.715.002a.02.02 0 0 0-.027.006l-.006.014l-.034.614q.001.018.017.024l.015-.002l.201-.093l.01-.008l.003-.011l.018-.43l-.003-.012l-.01-.01z"}),e.jsx("path",{d:"M10.586 2.807a2 2 0 0 1 2.828 0l7.778 7.779a2 2 0 0 1 0 2.828l-7.778 7.778a2 2 0 0 1-2.828 0l-7.778-7.778a2 2 0 0 1 0-2.828zM12 4.222L4.222 12L12 19.778L19.778 12z",fill:"currentColor"})]})})}function Te(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M16.01 11H4v2h12.01v3L20 12l-3.99-4z",fill:"currentColor"})})}function je(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{clipRule:"evenodd",d:"M7.53 3.47a.75.75 0 0 1 0 1.06L5.81 6.25H15a5.75 5.75 0 0 1 0 11.5H8a.75.75 0 0 1 0-1.5h7a4.25 4.25 0 0 0 0-8.5H5.81l1.72 1.72a.75.75 0 1 1-1.06 1.06l-3-3a.75.75 0 0 1 0-1.06l3-3a.75.75 0 0 1 1.06 0",fill:"currentColor",fillRule:"evenodd"})})}function be(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{clipRule:"evenodd",d:"M16.47 3.47a.75.75 0 0 1 1.06 0l3 3a.75.75 0 0 1 0 1.06l-3 3a.75.75 0 1 1-1.06-1.06l1.72-1.72H9a4.25 4.25 0 0 0 0 8.5h7a.75.75 0 0 1 0 1.5H9a5.75 5.75 0 0 1 0-11.5h9.19l-1.72-1.72a.75.75 0 0 1 0-1.06",fill:"currentColor",fillRule:"evenodd"})})}function Se(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M7 21q-.825 0-1.412-.587T5 19V6H4V4h5V3h6v1h5v2h-1v13q0 .825-.587 1.413T17 21zm2-4h2V8H9zm4 0h2V8h-2z",fill:"currentColor"})})}function Me(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 256 256",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M211.81 83.79a28 28 0 0 1-33.12 4.83l-90.07 90.07a28 28 0 1 1-44.43-6.48a28 28 0 0 1 33.12-4.83l90.07-90.07a28 28 0 1 1 44.43 6.48",fill:"currentColor"})})}function ye(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M12 20.325q-.35 0-.712-.125t-.638-.4l-1.725-1.575q-2.65-2.425-4.788-4.812T2 8.15Q2 5.8 3.575 4.225T7.5 2.65q1.325 0 2.5.562t2 1.538q.825-.975 2-1.537t2.5-.563q2.35 0 3.925 1.575T22 8.15q0 2.875-2.125 5.275T15.05 18.25l-1.7 1.55q-.275.275-.637.4t-.713.125M11.05 6.75q-.725-1.025-1.55-1.563t-2-.537q-1.5 0-2.5 1t-1 2.5q0 1.3.925 2.763t2.213 2.837t2.65 2.575T12 18.3q.85-.775 2.213-1.975t2.65-2.575t2.212-2.837T20 8.15q0-1.5-1-2.5t-2.5-1q-1.175 0-2 .538T12.95 6.75q-.175.25-.425.375T12 7.25t-.525-.125t-.425-.375m.95 4.725",fill:"currentColor"})})}function Ee(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"m7.625 6.4l2.8-3.625q.3-.4.713-.587T12 2t.863.188t.712.587l2.8 3.625l4.25 1.425q.65.2 1.025.738t.375 1.187q0 .3-.088.6t-.287.575l-2.75 3.9l.1 4.1q.025.875-.575 1.475t-1.4.6q-.05 0-.55-.075L12 19.675l-4.475 1.25q-.125.05-.275.063T6.975 21q-.8 0-1.4-.6T5 18.925l.1-4.125l-2.725-3.875q-.2-.275-.288-.575T2 9.75q0-.625.363-1.162t1.012-.763zM8.85 8.125L4 9.725L7.1 14.2L7 18.975l5-1.375l5 1.4l-.1-4.8L20 9.775l-4.85-1.65L12 4zM12 11.5",fill:"currentColor"})})}function He(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M12.01 6c2.61 0 4.89 1.86 5.4 4.43l.3 1.5l1.52.11c1.56.11 2.78 1.41 2.78 2.96c0 1.65-1.35 3-3 3h-13c-2.21 0-4-1.79-4-4c0-2.05 1.53-3.76 3.56-3.97l1.07-.11l.5-.95A5.46 5.46 0 0 1 12.01 6m0-2C9.12 4 6.6 5.64 5.35 8.04C2.35 8.36.01 10.91.01 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5c0-2.64-2.05-4.78-4.64-4.96C18.68 6.59 15.65 4 12.01 4",fill:"currentColor"})})}function Ne(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M5.586 6.45A2 2 0 0 1 7.509 5h11.84a2 2 0 0 1 1.923 2.55l-2.858 10A2 2 0 0 1 16.491 19H4.651a2 2 0 0 1-1.923-2.55z",fill:"none",stroke:"currentColor",strokeWidth:"2"})})}const Le="_wrapper_pva9d_1",ke="_tool_pva9d_17",Ae="_active_pva9d_37",_e="_pen_pva9d_41",ze="_line_pva9d_48",qe="_options_pva9d_56",Be="_colorWrap_pva9d_66",Pe="_color_pva9d_66",Re="_colorActive_pva9d_83",l={wrapper:Le,tool:ke,active:Ae,pen:_e,line:ze,options:qe,colorWrap:Be,color:Pe,colorActive:Re},Ie=[m.Color4.blackHighlight,m.Color4.ofRGBA(166/255,81/255,167/255,.3),m.Color4.ofRGBA(247/255,78/255,158/255,.3),m.Color4.ofRGBA(166/255,83/255,88/255,.3),m.Color4.ofRGBA(246/255,130/255,28/255,.3),m.Color4.ofRGBA(166/255,198/255,0,.3),m.Color4.ofRGBA(98/255,186/255,70/255,.3)],X=[m.Color4.black,m.Color4.fromHex("#007AFF"),m.Color4.fromHex("#A651A7"),m.Color4.fromHex("#F74E9E"),m.Color4.fromHex("#FF5358"),m.Color4.fromHex("#F6821C"),m.Color4.fromHex("#FFC600"),m.Color4.fromHex("#62BA46"),m.Color4.fromHex("#E6BFE8"),m.Color4.fromHex("#FEA3D2"),m.Color4.fromHex("#FFA0A3"),m.Color4.fromHex("#FBC276"),m.Color4.fromHex("#FFFB85"),m.Color4.fromHex("#AADC99")];function De({onChange:t}){const[r,o]=g.useState(m.Color4.blackHighlight);return e.jsx("div",{className:l.colorWrap,children:Ie.map((n,v)=>e.jsx("button",{style:{backgroundColor:n.toHexString()},className:p.cn(l.color,{[l.colorActive]:r.toHexString()===n.toHexString()}),onClick:()=>{o(n),t(n)}},v))})}function U({onChange:t}){const[r,o]=g.useState(m.Color4.black);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:l.colorWrap,children:X.slice(0,7).map((n,v)=>e.jsx("button",{style:{backgroundColor:n.toHexString()},className:p.cn(l.color,{[l.colorActive]:r.toHexString()===n.toHexString()}),onClick:()=>{o(n),t(n)}},v))}),e.jsx("div",{className:l.colorWrap,children:X.slice(7).map((n,v)=>e.jsx("button",{style:{backgroundColor:n.toHexString()},className:p.cn(l.color,{[l.colorActive]:r.toHexString()===n.toHexString()}),onClick:()=>{o(n),t(n)}},v))})]})}function We({setColorPen:t,setThicknessPen:r}){const[o,n]=g.useState(2);return e.jsxs("div",{className:l.options,children:[e.jsx("div",{children:e.jsx(U,{onChange:v=>t(v)})}),e.jsx("div",{className:l.line}),e.jsx("div",{children:e.jsx("input",{max:10,min:1,step:.1,type:"range",value:o,onChange:v=>{r(Number.parseFloat(v.target.value)),n(Number.parseFloat(v.target.value))}})})]})}function Fe({setColorHighlight:t}){return e.jsx("div",{className:l.options,children:e.jsx(De,{onChange:r=>t(r)})})}function Oe({changeColorShape:t,changeBorderColorShape:r,onThicknessChange:o}){return e.jsxs("div",{className:l.options,children:[e.jsx("div",{children:e.jsx(U,{onChange:n=>t(n)})}),e.jsx("div",{className:l.line}),e.jsx("div",{children:e.jsx(U,{onChange:n=>r(n)})}),e.jsx("div",{className:l.line}),e.jsx("div",{children:e.jsx("input",{defaultValue:0,max:20,min:0,step:1,type:"range",onChange:n=>{o(Number.parseFloat(n.target.value))}})})]})}function Y(t){const{setColorPen:r,refEditor:o,setThicknessPen:n,setColorHighlight:v,changeBorderColorShape:j,onUndo:S,changeColorShape:u,changeShape:a,onThicknessChange:M,onRedo:b,onClear:_}=t,[c,h]=g.useState(null),[T,f]=g.useState(0);return e.jsx(e.Fragment,{children:e.jsxs("div",{className:l.wrapper,children:[e.jsxs("div",{className:l.pen,children:[e.jsx("button",{className:p.cn(l.tool,{[l.active]:c==="select"}),onClick:()=>{const s=o.current.toolController.getPrimaryTools();if(c==="select"){h(null),s[0].setEnabled(!1);return}h("select"),s[0].setEnabled(!0)},children:e.jsx(he,{})}),e.jsx("div",{className:l.line}),e.jsx("button",{className:p.cn(l.tool,{[l.active]:c==="text"}),onClick:()=>{const s=o.current.toolController.getPrimaryTools();if(o.current.toolController.setToolEnabled(s[1]),c==="text"){s[1].setEnabled(!1),h(null);return}h("text"),s[1].setEnabled(!0)},children:e.jsx(ue,{})}),e.jsx("div",{className:l.line}),e.jsx("button",{className:p.cn(l.tool,{[l.active]:c==="pencil"}),onClick:()=>{const s=o.current.toolController.getPrimaryTools();if(c==="pencil"){h(null),s[2].setEnabled(!1);return}h("pencil"),s[2].setEnabled(!0)},children:e.jsx(de,{})}),e.jsx("button",{className:p.cn(l.tool,{[l.active]:c==="highlighter"}),onClick:()=>{const s=o.current.toolController.getPrimaryTools();if(c==="highlighter"){h(null),s[3].setEnabled(!1);return}h("highlighter"),s[3].setEnabled(!0)},children:e.jsx(ge,{})}),e.jsx("div",{className:l.line}),e.jsx("button",{className:p.cn(l.tool,{[l.active]:c==="eraser"}),onClick:()=>{const s=o.current.toolController.getPrimaryTools();if(c==="eraser"){h(null),s[4].setEnabled(!1);return}h("eraser"),s[4].setEnabled(!0)},children:e.jsx(me,{})}),e.jsx("div",{className:l.line}),e.jsx("button",{className:p.cn(l.tool,{[l.active]:c==="shapes"&&T===0}),onClick:()=>{const s=o.current.toolController.getPrimaryTools();o.current.toolController.setToolEnabled(s[5]),h("shapes"),s[5].setEnabled(!0),a(0),f(0)},children:e.jsx(pe,{})}),e.jsx("button",{className:p.cn(l.tool,{[l.active]:c==="shapes"&&T===1}),onClick:()=>{const s=o.current.toolController.getPrimaryTools();o.current.toolController.setToolEnabled(s[5]),h("shapes"),s[5].setEnabled(!0),a(1),f(1)},children:e.jsx(xe,{})}),e.jsx("button",{className:p.cn(l.tool,{[l.active]:c==="shapes"&&T===2}),onClick:()=>{const s=o.current.toolController.getPrimaryTools();o.current.toolController.setToolEnabled(s[5]),h("shapes"),s[5].setEnabled(!0),a(2),f(2)},children:e.jsx(we,{})}),e.jsx("button",{className:p.cn(l.tool,{[l.active]:c==="shapes"&&T===3}),onClick:()=>{const s=o.current.toolController.getPrimaryTools();o.current.toolController.setToolEnabled(s[5]),h("shapes"),s[5].setEnabled(!0),a(3),f(3)},children:e.jsx(ve,{})}),e.jsx("button",{className:p.cn(l.tool,{[l.active]:c==="shapes"&&T===4}),onClick:()=>{const s=o.current.toolController.getPrimaryTools();o.current.toolController.setToolEnabled(s[5]),h("shapes"),s[5].setEnabled(!0),a(4),f(4)},children:e.jsx(Ce,{})}),e.jsx("button",{className:p.cn(l.tool,{[l.active]:c==="shapes"&&T===5}),onClick:()=>{const s=o.current.toolController.getPrimaryTools();o.current.toolController.setToolEnabled(s[5]),h("shapes"),s[5].setEnabled(!0),a(5),f(5)},children:e.jsx(fe,{})}),e.jsx("button",{className:p.cn(l.tool,{[l.active]:c==="shapes"&&T===6}),onClick:()=>{const s=o.current.toolController.getPrimaryTools();o.current.toolController.setToolEnabled(s[5]),h("shapes"),s[5].setEnabled(!0),a(6),f(6)},children:e.jsx(Te,{})}),e.jsx("button",{className:p.cn(l.tool,{[l.active]:c==="shapes"&&T===7}),onClick:()=>{const s=o.current.toolController.getPrimaryTools();o.current.toolController.setToolEnabled(s[5]),h("shapes"),s[5].setEnabled(!0),a(7),f(7)},children:e.jsx(Me,{})}),e.jsx("button",{className:p.cn(l.tool,{[l.active]:c==="shapes"&&T===8}),onClick:()=>{const s=o.current.toolController.getPrimaryTools();o.current.toolController.setToolEnabled(s[5]),h("shapes"),s[5].setEnabled(!0),a(8),f(8)},children:e.jsx(ye,{})}),e.jsx("button",{className:p.cn(l.tool,{[l.active]:c==="shapes"&&T===9}),onClick:()=>{const s=o.current.toolController.getPrimaryTools();o.current.toolController.setToolEnabled(s[5]),h("shapes"),s[5].setEnabled(!0),a(9),f(9)},children:e.jsx(Ee,{})}),e.jsx("button",{className:p.cn(l.tool,{[l.active]:c==="shapes"&&T===10}),onClick:()=>{const s=o.current.toolController.getPrimaryTools();o.current.toolController.setToolEnabled(s[5]),h("shapes"),s[5].setEnabled(!0),a(10),f(10)},children:e.jsx(He,{})}),e.jsx("button",{className:p.cn(l.tool,{[l.active]:c==="shapes"&&T===11}),onClick:()=>{const s=o.current.toolController.getPrimaryTools();o.current.toolController.setToolEnabled(s[5]),h("shapes"),s[5].setEnabled(!0),a(11),f(11)},children:e.jsx(Ne,{})}),e.jsx("div",{className:l.line}),e.jsx("button",{className:p.cn(l.tool),onClick:S,children:e.jsx(je,{})}),e.jsx("button",{className:p.cn(l.tool),onClick:b,children:e.jsx(be,{})}),e.jsx("button",{className:p.cn(l.tool),onClick:_,children:e.jsx(Se,{})})]}),e.jsxs("div",{className:l.optionsWrap,children:[c==="pencil"&&e.jsx(We,{setColorPen:r,setThicknessPen:n}),c==="highlighter"&&e.jsx(Fe,{setColorHighlight:v}),c==="shapes"&&e.jsx(Oe,{changeBorderColorShape:j,changeColorShape:u,changeShape:a,onThicknessChange:M})]})]})})}function J(t=8){return Math.random().toString(36).substring(2,t+2)}let R=!1;function Ve(){const t=O.useEditorInstance(),r=O.useButtonProps(ee.name),{isActive:o=void 0,upload:n}=(r==null?void 0:r.componentProps)??{},{editorDisabled:v}=O.useToggleActive(o),[j,S]=g.useState(!1),u=g.useRef(null),a=g.useRef(null),M=()=>{(async()=>{const i=document.querySelector("#easydrawer");i&&(u.current=new m.Editor(i,{wheelEventsEnabled:!1,disableZoom:!0}),a.current=m.makeDropdownToolbar(u.current),a.current.addDefaultToolWidgets())})()};g.useEffect(()=>{j&&setTimeout(()=>{M()},200)},[j]);const b=async()=>{if(u.current){const x=u.current.toSVG(),i=x.outerHTML,w=`drawer-${J()}.svg`;let L=Q(x.outerHTML);if(n){const q=oe.dataURLtoFile(L,w);L=await n(q)}t==null||t.chain().focus().setDrawer({type:"drawer",src:L,alt:encodeURIComponent(i),width:426,height:212},!!i).run()}S(!1)},_=x=>{const i=u.current.toolController.getPrimaryTools()[2],w=a.current.getWidgetById("pen-1");i&&w&&(i.setColor(x),w.serializeState())},c=x=>{const i=u.current.toolController.getPrimaryTools()[2],w=a.current.getWidgetById("pen-1");i&&w&&(i.setThickness(x),w.serializeState())},h=x=>{const i=u.current.toolController.getPrimaryTools()[3],w=a.current.getWidgetById("pen-2");i&&w&&(i.setColor(x),w.serializeState())},T=x=>{const i=a.current.getWidgetById("shape");i&&i.setShapeType(x)},f=x=>{const i=u.current.toolController.getPrimaryTools()[5],w=a.current.getWidgetById("shape");i&&w&&(i.setColor(x),w.serializeState())},s=x=>{const i=u.current.toolController.getPrimaryTools()[5],w=a.current.getWidgetById("shape");i&&w&&(i.setThickness(x),w.serializeState())},V=x=>{const i=u.current.toolController.getPrimaryTools()[5],w=a.current.getWidgetById("shape");i&&w&&(i.setBorderColor(x),w.serializeState())},z=()=>{if(R){for(;u.current.history.redoStackSize>0;)u.current.history.redo();R=!1;return}u.current.history.undo()},D=()=>{R||u.current.history.redo()},G=()=>{if(!R){for(;u.current.history.undoStackSize>0;)z();R=!0}};return r?e.jsxs(P.Dialog,{onOpenChange:S,open:j,children:[e.jsx(P.DialogTrigger,{asChild:!0,children:e.jsx(re.ActionButton,{disabled:v,action:()=>{v||S(!0)},icon:"PencilRuler",tooltip:"Drawer"})}),e.jsxs(P.DialogContent,{className:"richtext-z-[99999] !richtext-max-w-[1300px]",children:[e.jsx(P.DialogTitle,{children:"Drawer"}),e.jsxs("div",{style:{height:"600px",width:"100%",borderWidth:1,background:"white",position:"relative"},children:[e.jsx("div",{className:"richtext-size-full",id:"easydrawer"}),e.jsx(Y,{changeBorderColorShape:V,changeColorShape:f,changeShape:T,onClear:G,onRedo:D,onThicknessChange:s,onUndo:z,refEditor:u,setColorHighlight:h,setColorPen:_,setThicknessPen:c})]}),e.jsx(P.DialogFooter,{children:e.jsx(le.Button,{onClick:b,type:"button",children:"Save changes"})})]})]}):e.jsx(e.Fragment,{})}const ee=$.index_default.extend({name:"richTextDrawer",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),inline:!1,content:"",marks:"",group:"block",draggable:!1,selectable:!0,atom:!0,HTMLAttributes:{class:"drawer"},button:({t:r,extension:o})=>{var n;return{componentProps:{action:()=>!0,isActive:()=>!1,disabled:!1,icon:"PencilRuler",tooltip:r("editor.drawer.tooltip"),upload:(n=o==null?void 0:o.options)==null?void 0:n.upload}}}}},addAttributes(){var t;return{...(t=this.parent)==null?void 0:t.call(this),width:{default:null,parseHTML:r=>{const o=r.querySelector("img"),n=o==null?void 0:o.getAttribute("width");return n?Number.parseInt(n,10):320},renderHTML:r=>({width:r.width})},height:{default:null,parseHTML:r=>{const o=r.querySelector("img"),n=o==null?void 0:o.getAttribute("height");return n?Number.parseInt(n,10):212},renderHTML:r=>({height:r.height})},align:{default:"center",parseHTML:r=>r.getAttribute("align"),renderHTML:r=>({align:r.align})}}},addNodeView(){return I.ReactNodeViewRenderer(ne)},addCommands(){return{setDrawer:(t,r)=>({commands:o,editor:n})=>r?o.insertContent({type:this.name,attrs:t}):o.insertContentAt(n.state.selection.anchor,{type:this.name,attrs:t}),setAlignImageDrawer:t=>({commands:r})=>r.updateAttributes(this.name,{align:t})}},renderHTML({HTMLAttributes:t}){const{align:r}=t;return["div",{style:r?`text-align: ${r};`:"",class:"imageDrawer"},["img",I.mergeAttributes(this.options.HTMLAttributes,t)]]},parseHTML(){return[{tag:"div[class=imageDrawer]",getAttrs:t=>{const r=t.querySelector("img"),o=r==null?void 0:r.getAttribute("width"),n=r==null?void 0:r.getAttribute("height");return{src:r==null?void 0:r.getAttribute("src"),alt:r==null?void 0:r.getAttribute("alt"),width:o?Number.parseInt(o,10):null,height:n?Number.parseInt(n,10):null,align:(r==null?void 0:r.getAttribute("align"))||t.style.textAlign||null}}}]}});exports.ControlDrawer=Y;exports.Drawer=ee;exports.RichTextDrawer=Ve;exports.i=Q;exports.shortId=J;
|
package/lib/Drawer.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./clsx-CXbNJWDD.cjs");require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./clsx-CXbNJWDD.cjs");require("./throttle-gTTvqDTW.cjs");const e=require("./Drawer-gz9U5ArC.cjs");exports.Drawer=e.Drawer;exports.RichTextDrawer=e.RichTextDrawer;
|
package/lib/Drawer.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import "./clsx-
|
|
2
|
-
import "./
|
|
3
|
-
import { D as t, R as i } from "./Drawer-
|
|
1
|
+
import "./clsx-m_C5j3RU.js";
|
|
2
|
+
import "./throttle-CRNq0z-O.js";
|
|
3
|
+
import { D as t, R as i } from "./Drawer-DvGh9aXG.js";
|
|
4
4
|
export {
|
|
5
5
|
t as Drawer,
|
|
6
6
|
i as RichTextDrawer
|