@baasix/lexical 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/README.md +281 -0
- package/dist/DateTimeComponent-4MX2IKXK.css +45 -0
- package/dist/DateTimeComponent-4MX2IKXK.css.map +1 -0
- package/dist/DateTimeComponent-7V5RW3AE.js +2928 -0
- package/dist/DateTimeComponent-7V5RW3AE.js.map +1 -0
- package/dist/EquationComponent-3IW3ONJD.js +159 -0
- package/dist/EquationComponent-3IW3ONJD.js.map +1 -0
- package/dist/EquationComponent-C2C6477P.css +28 -0
- package/dist/EquationComponent-C2C6477P.css.map +1 -0
- package/dist/ExcalidrawComponent-GZYLHNOY.js +267 -0
- package/dist/ExcalidrawComponent-GZYLHNOY.js.map +1 -0
- package/dist/ExcalidrawComponent-U6BD7DUB.css +152 -0
- package/dist/ExcalidrawComponent-U6BD7DUB.css.map +1 -0
- package/dist/ImageComponent-IYUGOT6O.css +73 -0
- package/dist/ImageComponent-IYUGOT6O.css.map +1 -0
- package/dist/ImageComponent-TTUYUG3M.js +429 -0
- package/dist/ImageComponent-TTUYUG3M.js.map +1 -0
- package/dist/PollComponent-CWI5UJF5.css +187 -0
- package/dist/PollComponent-CWI5UJF5.css.map +1 -0
- package/dist/PollComponent-KLJZSW5O.js +199 -0
- package/dist/PollComponent-KLJZSW5O.js.map +1 -0
- package/dist/StickyComponent-MZSTQF47.css +774 -0
- package/dist/StickyComponent-MZSTQF47.css.map +1 -0
- package/dist/StickyComponent-ZED6LNTX.js +233 -0
- package/dist/StickyComponent-ZED6LNTX.js.map +1 -0
- package/dist/chunk-35UCX4ZT.js +168 -0
- package/dist/chunk-35UCX4ZT.js.map +1 -0
- package/dist/chunk-44LUNGL3.js +16608 -0
- package/dist/chunk-44LUNGL3.js.map +1 -0
- package/dist/chunk-BHROZTZU.js +42 -0
- package/dist/chunk-BHROZTZU.js.map +1 -0
- package/dist/chunk-FJ6COZ4H.js +275 -0
- package/dist/chunk-FJ6COZ4H.js.map +1 -0
- package/dist/chunk-GSFNU3JE.js +211 -0
- package/dist/chunk-GSFNU3JE.js.map +1 -0
- package/dist/chunk-I43VQAHW.js +918 -0
- package/dist/chunk-I43VQAHW.js.map +1 -0
- package/dist/chunk-N22RKA5D.js +402 -0
- package/dist/chunk-N22RKA5D.js.map +1 -0
- package/dist/chunk-OIMMC5C3.js +134 -0
- package/dist/chunk-OIMMC5C3.js.map +1 -0
- package/dist/chunk-PZ5AY32C.js +10 -0
- package/dist/chunk-PZ5AY32C.js.map +1 -0
- package/dist/chunk-TVF6V3BJ.js +41 -0
- package/dist/chunk-TVF6V3BJ.js.map +1 -0
- package/dist/chunk-XTKVR2JI.js +225 -0
- package/dist/chunk-XTKVR2JI.js.map +1 -0
- package/dist/emoji-list-MUV74SND.js +8 -0
- package/dist/emoji-list-MUV74SND.js.map +1 -0
- package/dist/index.css +4234 -0
- package/dist/index.css.map +1 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +16050 -0
- package/dist/index.js.map +1 -0
- package/dist/landscape-RJWVK6ET.jpg +0 -0
- package/dist/yellow-flower-R72KOP74.jpg +0 -0
- package/package.json +76 -0
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import {
|
|
2
|
+
$isEquationNode,
|
|
3
|
+
KatexRenderer
|
|
4
|
+
} from "./chunk-GSFNU3JE.js";
|
|
5
|
+
import "./chunk-PZ5AY32C.js";
|
|
6
|
+
|
|
7
|
+
// src/nodes/EquationComponent.tsx
|
|
8
|
+
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
9
|
+
import { useLexicalEditable } from "@lexical/react/useLexicalEditable";
|
|
10
|
+
import { mergeRegister } from "@lexical/utils";
|
|
11
|
+
import {
|
|
12
|
+
$getNodeByKey,
|
|
13
|
+
$getSelection,
|
|
14
|
+
$isNodeSelection,
|
|
15
|
+
COMMAND_PRIORITY_HIGH,
|
|
16
|
+
KEY_ESCAPE_COMMAND,
|
|
17
|
+
SELECTION_CHANGE_COMMAND
|
|
18
|
+
} from "lexical";
|
|
19
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
20
|
+
import { ErrorBoundary } from "react-error-boundary";
|
|
21
|
+
|
|
22
|
+
// src/ui/EquationEditor.tsx
|
|
23
|
+
import { isHTMLElement } from "lexical";
|
|
24
|
+
import { forwardRef } from "react";
|
|
25
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
26
|
+
function EquationEditor({ equation, setEquation, inline }, forwardedRef) {
|
|
27
|
+
const onChange = (event) => {
|
|
28
|
+
setEquation(event.target.value);
|
|
29
|
+
};
|
|
30
|
+
return inline && isHTMLElement(forwardedRef) ? /* @__PURE__ */ jsxs("span", { className: "EquationEditor_inputBackground", children: [
|
|
31
|
+
/* @__PURE__ */ jsx("span", { className: "EquationEditor_dollarSign", children: "$" }),
|
|
32
|
+
/* @__PURE__ */ jsx(
|
|
33
|
+
"input",
|
|
34
|
+
{
|
|
35
|
+
className: "EquationEditor_inlineEditor",
|
|
36
|
+
value: equation,
|
|
37
|
+
onChange,
|
|
38
|
+
autoFocus: true,
|
|
39
|
+
ref: forwardedRef
|
|
40
|
+
}
|
|
41
|
+
),
|
|
42
|
+
/* @__PURE__ */ jsx("span", { className: "EquationEditor_dollarSign", children: "$" })
|
|
43
|
+
] }) : /* @__PURE__ */ jsxs("div", { className: "EquationEditor_inputBackground", children: [
|
|
44
|
+
/* @__PURE__ */ jsx("span", { className: "EquationEditor_dollarSign", children: "$$\n" }),
|
|
45
|
+
/* @__PURE__ */ jsx(
|
|
46
|
+
"textarea",
|
|
47
|
+
{
|
|
48
|
+
className: "EquationEditor_blockEditor",
|
|
49
|
+
value: equation,
|
|
50
|
+
onChange,
|
|
51
|
+
ref: forwardedRef
|
|
52
|
+
}
|
|
53
|
+
),
|
|
54
|
+
/* @__PURE__ */ jsx("span", { className: "EquationEditor_dollarSign", children: "\n$$" })
|
|
55
|
+
] });
|
|
56
|
+
}
|
|
57
|
+
var EquationEditor_default = forwardRef(EquationEditor);
|
|
58
|
+
|
|
59
|
+
// src/nodes/EquationComponent.tsx
|
|
60
|
+
import { Fragment, jsx as jsx2 } from "react/jsx-runtime";
|
|
61
|
+
function EquationComponent({
|
|
62
|
+
equation,
|
|
63
|
+
inline,
|
|
64
|
+
nodeKey
|
|
65
|
+
}) {
|
|
66
|
+
const [editor] = useLexicalComposerContext();
|
|
67
|
+
const isEditable = useLexicalEditable();
|
|
68
|
+
const [equationValue, setEquationValue] = useState(equation);
|
|
69
|
+
const [showEquationEditor, setShowEquationEditor] = useState(false);
|
|
70
|
+
const inputRef = useRef(null);
|
|
71
|
+
const onHide = useCallback(
|
|
72
|
+
(restoreSelection) => {
|
|
73
|
+
setShowEquationEditor(false);
|
|
74
|
+
editor.update(() => {
|
|
75
|
+
const node = $getNodeByKey(nodeKey);
|
|
76
|
+
if ($isEquationNode(node)) {
|
|
77
|
+
node.setEquation(equationValue);
|
|
78
|
+
if (restoreSelection) {
|
|
79
|
+
node.selectNext(0, 0);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
},
|
|
84
|
+
[editor, equationValue, nodeKey]
|
|
85
|
+
);
|
|
86
|
+
useEffect(() => {
|
|
87
|
+
if (!showEquationEditor && equationValue !== equation) {
|
|
88
|
+
setEquationValue(equation);
|
|
89
|
+
}
|
|
90
|
+
}, [showEquationEditor, equation, equationValue]);
|
|
91
|
+
useEffect(() => {
|
|
92
|
+
if (!isEditable) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
if (showEquationEditor) {
|
|
96
|
+
return mergeRegister(
|
|
97
|
+
editor.registerCommand(
|
|
98
|
+
SELECTION_CHANGE_COMMAND,
|
|
99
|
+
(payload) => {
|
|
100
|
+
const activeElement = document.activeElement;
|
|
101
|
+
const inputElem = inputRef.current;
|
|
102
|
+
if (inputElem !== activeElement) {
|
|
103
|
+
onHide();
|
|
104
|
+
}
|
|
105
|
+
return false;
|
|
106
|
+
},
|
|
107
|
+
COMMAND_PRIORITY_HIGH
|
|
108
|
+
),
|
|
109
|
+
editor.registerCommand(
|
|
110
|
+
KEY_ESCAPE_COMMAND,
|
|
111
|
+
(payload) => {
|
|
112
|
+
const activeElement = document.activeElement;
|
|
113
|
+
const inputElem = inputRef.current;
|
|
114
|
+
if (inputElem === activeElement) {
|
|
115
|
+
onHide(true);
|
|
116
|
+
return true;
|
|
117
|
+
}
|
|
118
|
+
return false;
|
|
119
|
+
},
|
|
120
|
+
COMMAND_PRIORITY_HIGH
|
|
121
|
+
)
|
|
122
|
+
);
|
|
123
|
+
} else {
|
|
124
|
+
return editor.registerUpdateListener(({ editorState }) => {
|
|
125
|
+
const isSelected = editorState.read(() => {
|
|
126
|
+
const selection = $getSelection();
|
|
127
|
+
return $isNodeSelection(selection) && selection.has(nodeKey) && selection.getNodes().length === 1;
|
|
128
|
+
});
|
|
129
|
+
if (isSelected) {
|
|
130
|
+
setShowEquationEditor(true);
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
}, [editor, nodeKey, onHide, showEquationEditor, isEditable]);
|
|
135
|
+
return /* @__PURE__ */ jsx2(Fragment, { children: showEquationEditor && isEditable ? /* @__PURE__ */ jsx2(
|
|
136
|
+
EquationEditor_default,
|
|
137
|
+
{
|
|
138
|
+
equation: equationValue,
|
|
139
|
+
setEquation: setEquationValue,
|
|
140
|
+
inline,
|
|
141
|
+
ref: inputRef
|
|
142
|
+
}
|
|
143
|
+
) : /* @__PURE__ */ jsx2(ErrorBoundary, { onError: (e) => editor._onError(e instanceof Error ? e : new Error(String(e))), fallback: null, children: /* @__PURE__ */ jsx2(
|
|
144
|
+
KatexRenderer,
|
|
145
|
+
{
|
|
146
|
+
equation: equationValue,
|
|
147
|
+
inline,
|
|
148
|
+
onDoubleClick: () => {
|
|
149
|
+
if (isEditable) {
|
|
150
|
+
setShowEquationEditor(true);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
) }) });
|
|
155
|
+
}
|
|
156
|
+
export {
|
|
157
|
+
EquationComponent as default
|
|
158
|
+
};
|
|
159
|
+
//# sourceMappingURL=EquationComponent-3IW3ONJD.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/nodes/EquationComponent.tsx","../src/ui/EquationEditor.tsx"],"sourcesContent":["/**\r\n * Copyright (c) Meta Platforms, Inc. and affiliates.\r\n *\r\n * This source code is licensed under the MIT license found in the\r\n * LICENSE file in the root directory of this source tree.\r\n *\r\n */\r\n\r\nimport type {JSX} from 'react';\r\n\r\nimport {useLexicalComposerContext} from '@lexical/react/LexicalComposerContext';\r\nimport {useLexicalEditable} from '@lexical/react/useLexicalEditable';\r\nimport {mergeRegister} from '@lexical/utils';\r\nimport {\r\n $getNodeByKey,\r\n $getSelection,\r\n $isNodeSelection,\r\n COMMAND_PRIORITY_HIGH,\r\n KEY_ESCAPE_COMMAND,\r\n NodeKey,\r\n SELECTION_CHANGE_COMMAND,\r\n} from 'lexical';\r\nimport * as React from 'react';\r\nimport {useCallback, useEffect, useRef, useState} from 'react';\r\nimport {ErrorBoundary} from 'react-error-boundary';\r\n\r\nimport EquationEditor from '../ui/EquationEditor';\r\nimport KatexRenderer from '../ui/KatexRenderer';\r\nimport {$isEquationNode} from './EquationNode';\r\n\r\ntype EquationComponentProps = {\r\n equation: string;\r\n inline: boolean;\r\n nodeKey: NodeKey;\r\n};\r\n\r\nexport default function EquationComponent({\r\n equation,\r\n inline,\r\n nodeKey,\r\n}: EquationComponentProps): JSX.Element {\r\n const [editor] = useLexicalComposerContext();\r\n const isEditable = useLexicalEditable();\r\n const [equationValue, setEquationValue] = useState(equation);\r\n const [showEquationEditor, setShowEquationEditor] = useState<boolean>(false);\r\n const inputRef = useRef<HTMLTextAreaElement | HTMLInputElement>(null);\r\n\r\n const onHide = useCallback(\r\n (restoreSelection?: boolean) => {\r\n setShowEquationEditor(false);\r\n editor.update(() => {\r\n const node = $getNodeByKey(nodeKey);\r\n if ($isEquationNode(node)) {\r\n node.setEquation(equationValue);\r\n if (restoreSelection) {\r\n node.selectNext(0, 0);\r\n }\r\n }\r\n });\r\n },\r\n [editor, equationValue, nodeKey],\r\n );\r\n\r\n useEffect(() => {\r\n if (!showEquationEditor && equationValue !== equation) {\r\n setEquationValue(equation);\r\n }\r\n }, [showEquationEditor, equation, equationValue]);\r\n\r\n useEffect(() => {\r\n if (!isEditable) {\r\n return;\r\n }\r\n if (showEquationEditor) {\r\n return mergeRegister(\r\n editor.registerCommand(\r\n SELECTION_CHANGE_COMMAND,\r\n (payload) => {\r\n const activeElement = document.activeElement;\r\n const inputElem = inputRef.current;\r\n if (inputElem !== activeElement) {\r\n onHide();\r\n }\r\n return false;\r\n },\r\n COMMAND_PRIORITY_HIGH,\r\n ),\r\n editor.registerCommand(\r\n KEY_ESCAPE_COMMAND,\r\n (payload) => {\r\n const activeElement = document.activeElement;\r\n const inputElem = inputRef.current;\r\n if (inputElem === activeElement) {\r\n onHide(true);\r\n return true;\r\n }\r\n return false;\r\n },\r\n COMMAND_PRIORITY_HIGH,\r\n ),\r\n );\r\n } else {\r\n return editor.registerUpdateListener(({editorState}) => {\r\n const isSelected = editorState.read(() => {\r\n const selection = $getSelection();\r\n return (\r\n $isNodeSelection(selection) &&\r\n selection.has(nodeKey) &&\r\n selection.getNodes().length === 1\r\n );\r\n });\r\n if (isSelected) {\r\n setShowEquationEditor(true);\r\n }\r\n });\r\n }\r\n }, [editor, nodeKey, onHide, showEquationEditor, isEditable]);\r\n\r\n return (\r\n <>\r\n {showEquationEditor && isEditable ? (\r\n <EquationEditor\r\n equation={equationValue}\r\n setEquation={setEquationValue}\r\n inline={inline}\r\n ref={inputRef}\r\n />\r\n ) : (\r\n <ErrorBoundary onError={(e: unknown) => editor._onError(e instanceof Error ? e : new Error(String(e)))} fallback={null}>\r\n <KatexRenderer\r\n equation={equationValue}\r\n inline={inline}\r\n onDoubleClick={() => {\r\n if (isEditable) {\r\n setShowEquationEditor(true);\r\n }\r\n }}\r\n />\r\n </ErrorBoundary>\r\n )}\r\n </>\r\n );\r\n}\r\n","/**\r\n * Copyright (c) Meta Platforms, Inc. and affiliates.\r\n *\r\n * This source code is licensed under the MIT license found in the\r\n * LICENSE file in the root directory of this source tree.\r\n *\r\n */\r\n\r\nimport type {JSX, Ref, RefObject} from 'react';\r\n\r\nimport './EquationEditor.css';\r\n\r\nimport {isHTMLElement} from 'lexical';\r\nimport {ChangeEvent, forwardRef} from 'react';\r\n\r\ntype BaseEquationEditorProps = {\r\n equation: string;\r\n inline: boolean;\r\n setEquation: (equation: string) => void;\r\n};\r\n\r\nfunction EquationEditor(\r\n {equation, setEquation, inline}: BaseEquationEditorProps,\r\n forwardedRef: Ref<HTMLInputElement | HTMLTextAreaElement>,\r\n): JSX.Element {\r\n const onChange = (event: ChangeEvent) => {\r\n setEquation((event.target as HTMLInputElement).value);\r\n };\r\n\r\n return inline && isHTMLElement(forwardedRef) ? (\r\n <span className=\"EquationEditor_inputBackground\">\r\n <span className=\"EquationEditor_dollarSign\">$</span>\r\n <input\r\n className=\"EquationEditor_inlineEditor\"\r\n value={equation}\r\n onChange={onChange}\r\n autoFocus={true}\r\n ref={forwardedRef as RefObject<HTMLInputElement>}\r\n />\r\n <span className=\"EquationEditor_dollarSign\">$</span>\r\n </span>\r\n ) : (\r\n <div className=\"EquationEditor_inputBackground\">\r\n <span className=\"EquationEditor_dollarSign\">{'$$\\n'}</span>\r\n <textarea\r\n className=\"EquationEditor_blockEditor\"\r\n value={equation}\r\n onChange={onChange}\r\n ref={forwardedRef as RefObject<HTMLTextAreaElement>}\r\n />\r\n <span className=\"EquationEditor_dollarSign\">{'\\n$$'}</span>\r\n </div>\r\n );\r\n}\r\n\r\nexport default forwardRef(EquationEditor);\r\n"],"mappings":";;;;;;;AAUA,SAAQ,iCAAgC;AACxC,SAAQ,0BAAyB;AACjC,SAAQ,qBAAoB;AAC5B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EAC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F,GAAG,CAAC,QAAQ,SAAS,QAAQ,oBAAoB,UAAU,CAAC;AAE5D,SACE,gBAAAA,KAAA,YACG,gCAAsB,aACrB,gBAAAA;AAAA,IAAC;AAAA;AAAA,MACC,UAAU;AAAA,MACV,aAAa;AAAA,MACb;AAAA,MACA,KAAK;AAAA;AAAA,EACP,IAEA,gBAAAA,KAAC,iBAAc,SAAS,CAAC,MAAe,OAAO,SAAS,aAAa,QAAQ,IAAI,IAAI,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,UAAU,MAChH,0BAAAA;AAAA,IAAC;AAAA;AAAA,MACC,UAAU;AAAA,MACV;AAAA,MACA,eAAe,MAAM;AACnB,YAAI,YAAY;AACd,gCAAsB,IAAI;AAAA,QAC5B;AAAA,MACF;AAAA;AAAA,EACF,GACF,GAEJ;AAEJ;","names":["jsx"]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/* src/ui/EquationEditor.css */
|
|
2
|
+
.EquationEditor_inlineEditor {
|
|
3
|
+
padding: 0;
|
|
4
|
+
margin: 0;
|
|
5
|
+
border: 0;
|
|
6
|
+
outline: 0;
|
|
7
|
+
color: #8421a2;
|
|
8
|
+
background-color: inherit;
|
|
9
|
+
resize: none;
|
|
10
|
+
}
|
|
11
|
+
.EquationEditor_blockEditor {
|
|
12
|
+
padding: 0;
|
|
13
|
+
margin: 0;
|
|
14
|
+
border: 0;
|
|
15
|
+
outline: 0;
|
|
16
|
+
color: #8421a2;
|
|
17
|
+
background-color: inherit;
|
|
18
|
+
resize: none;
|
|
19
|
+
width: 100%;
|
|
20
|
+
}
|
|
21
|
+
.EquationEditor_inputBackground {
|
|
22
|
+
background-color: #eee;
|
|
23
|
+
}
|
|
24
|
+
.EquationEditor_dollarSign {
|
|
25
|
+
text-align: left;
|
|
26
|
+
color: #b0b0b0;
|
|
27
|
+
}
|
|
28
|
+
/*# sourceMappingURL=EquationComponent-C2C6477P.css.map */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/ui/EquationEditor.css"],"sourcesContent":["/**\r\n * Copyright (c) Meta Platforms, Inc. and affiliates.\r\n *\r\n * This source code is licensed under the MIT license found in the\r\n * LICENSE file in the root directory of this source tree.\r\n *\r\n *\r\n */\r\n\r\n.EquationEditor_inlineEditor {\r\n padding: 0;\r\n margin: 0;\r\n border: 0;\r\n outline: 0;\r\n color: #8421a2;\r\n background-color: inherit;\r\n resize: none;\r\n}\r\n\r\n.EquationEditor_blockEditor {\r\n padding: 0;\r\n margin: 0;\r\n border: 0;\r\n outline: 0;\r\n color: #8421a2;\r\n background-color: inherit;\r\n resize: none;\r\n width: 100%;\r\n}\r\n\r\n.EquationEditor_inputBackground {\r\n background-color: #eee;\r\n}\r\n\r\n.EquationEditor_dollarSign {\r\n text-align: left;\r\n color: #b0b0b0;\r\n}\r\n"],"mappings":";AASA,CAAC;AACC,WAAS;AACT,UAAQ;AACR,UAAQ;AACR,WAAS;AACT,SAAO;AACP,oBAAkB;AAClB,UAAQ;AACV;AAEA,CAAC;AACC,WAAS;AACT,UAAQ;AACR,UAAQ;AACR,WAAS;AACT,SAAO;AACP,oBAAkB;AAClB,UAAQ;AACR,SAAO;AACT;AAEA,CAAC;AACC,oBAAkB;AACpB;AAEA,CAAC;AACC,cAAY;AACZ,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
import {
|
|
2
|
+
$isExcalidrawNode,
|
|
3
|
+
ExcalidrawModal
|
|
4
|
+
} from "./chunk-N22RKA5D.js";
|
|
5
|
+
import {
|
|
6
|
+
ImageResizer
|
|
7
|
+
} from "./chunk-FJ6COZ4H.js";
|
|
8
|
+
import "./chunk-TVF6V3BJ.js";
|
|
9
|
+
import "./chunk-PZ5AY32C.js";
|
|
10
|
+
|
|
11
|
+
// src/nodes/ExcalidrawNode/ExcalidrawComponent.tsx
|
|
12
|
+
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
13
|
+
import { useLexicalEditable } from "@lexical/react/useLexicalEditable";
|
|
14
|
+
import { useLexicalNodeSelection } from "@lexical/react/useLexicalNodeSelection";
|
|
15
|
+
import { mergeRegister } from "@lexical/utils";
|
|
16
|
+
import {
|
|
17
|
+
$getNodeByKey,
|
|
18
|
+
CLICK_COMMAND,
|
|
19
|
+
COMMAND_PRIORITY_LOW,
|
|
20
|
+
isDOMNode
|
|
21
|
+
} from "lexical";
|
|
22
|
+
import { useCallback, useEffect as useEffect2, useMemo, useRef, useState as useState2 } from "react";
|
|
23
|
+
|
|
24
|
+
// src/nodes/ExcalidrawNode/ExcalidrawImage.tsx
|
|
25
|
+
import { useEffect, useState } from "react";
|
|
26
|
+
import { jsx } from "react/jsx-runtime";
|
|
27
|
+
var removeStyleFromSvg_HACK = (svg) => {
|
|
28
|
+
const styleTag = svg?.firstElementChild?.firstElementChild;
|
|
29
|
+
const viewBox = svg.getAttribute("viewBox");
|
|
30
|
+
if (viewBox != null) {
|
|
31
|
+
const viewBoxDimensions = viewBox.split(" ");
|
|
32
|
+
svg.setAttribute("width", viewBoxDimensions[2]);
|
|
33
|
+
svg.setAttribute("height", viewBoxDimensions[3]);
|
|
34
|
+
}
|
|
35
|
+
if (styleTag && styleTag.tagName === "style") {
|
|
36
|
+
styleTag.remove();
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
function ExcalidrawImage({
|
|
40
|
+
elements,
|
|
41
|
+
files,
|
|
42
|
+
imageContainerRef,
|
|
43
|
+
appState,
|
|
44
|
+
rootClassName = null,
|
|
45
|
+
width = "inherit",
|
|
46
|
+
height = "inherit"
|
|
47
|
+
}) {
|
|
48
|
+
const [Svg, setSvg] = useState(null);
|
|
49
|
+
useEffect(() => {
|
|
50
|
+
const setContent = async () => {
|
|
51
|
+
const { exportToSvg } = await import("@excalidraw/excalidraw");
|
|
52
|
+
const svg = await exportToSvg({
|
|
53
|
+
appState,
|
|
54
|
+
elements,
|
|
55
|
+
files
|
|
56
|
+
});
|
|
57
|
+
removeStyleFromSvg_HACK(svg);
|
|
58
|
+
svg.setAttribute("width", "100%");
|
|
59
|
+
svg.setAttribute("height", "100%");
|
|
60
|
+
svg.setAttribute("display", "block");
|
|
61
|
+
setSvg(svg);
|
|
62
|
+
};
|
|
63
|
+
setContent();
|
|
64
|
+
}, [elements, files, appState]);
|
|
65
|
+
const containerStyle = {};
|
|
66
|
+
if (width !== "inherit") {
|
|
67
|
+
containerStyle.width = `${width}px`;
|
|
68
|
+
}
|
|
69
|
+
if (height !== "inherit") {
|
|
70
|
+
containerStyle.height = `${height}px`;
|
|
71
|
+
}
|
|
72
|
+
return /* @__PURE__ */ jsx(
|
|
73
|
+
"div",
|
|
74
|
+
{
|
|
75
|
+
ref: (node) => {
|
|
76
|
+
if (node) {
|
|
77
|
+
if (imageContainerRef) {
|
|
78
|
+
imageContainerRef.current = node;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
className: rootClassName ?? "",
|
|
83
|
+
style: containerStyle,
|
|
84
|
+
dangerouslySetInnerHTML: { __html: Svg?.outerHTML ?? "" }
|
|
85
|
+
}
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// src/nodes/ExcalidrawNode/ExcalidrawComponent.tsx
|
|
90
|
+
import { Fragment, jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
91
|
+
function ExcalidrawComponent({
|
|
92
|
+
nodeKey,
|
|
93
|
+
data,
|
|
94
|
+
width,
|
|
95
|
+
height
|
|
96
|
+
}) {
|
|
97
|
+
const [editor] = useLexicalComposerContext();
|
|
98
|
+
const isEditable = useLexicalEditable();
|
|
99
|
+
const [isModalOpen, setModalOpen] = useState2(
|
|
100
|
+
data === "[]" && editor.isEditable()
|
|
101
|
+
);
|
|
102
|
+
const imageContainerRef = useRef(null);
|
|
103
|
+
const buttonRef = useRef(null);
|
|
104
|
+
const captionButtonRef = useRef(null);
|
|
105
|
+
const [isSelected, setSelected, clearSelection] = useLexicalNodeSelection(nodeKey);
|
|
106
|
+
const [isResizing, setIsResizing] = useState2(false);
|
|
107
|
+
useEffect2(() => {
|
|
108
|
+
if (!isEditable) {
|
|
109
|
+
if (isSelected) {
|
|
110
|
+
clearSelection();
|
|
111
|
+
}
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
return mergeRegister(
|
|
115
|
+
editor.registerCommand(
|
|
116
|
+
CLICK_COMMAND,
|
|
117
|
+
(event) => {
|
|
118
|
+
const buttonElem = buttonRef.current;
|
|
119
|
+
const eventTarget = event.target;
|
|
120
|
+
if (isResizing) {
|
|
121
|
+
return true;
|
|
122
|
+
}
|
|
123
|
+
if (buttonElem !== null && isDOMNode(eventTarget) && buttonElem.contains(eventTarget)) {
|
|
124
|
+
if (!event.shiftKey) {
|
|
125
|
+
clearSelection();
|
|
126
|
+
}
|
|
127
|
+
setSelected(!isSelected);
|
|
128
|
+
if (event.detail > 1) {
|
|
129
|
+
setModalOpen(true);
|
|
130
|
+
}
|
|
131
|
+
return true;
|
|
132
|
+
}
|
|
133
|
+
return false;
|
|
134
|
+
},
|
|
135
|
+
COMMAND_PRIORITY_LOW
|
|
136
|
+
)
|
|
137
|
+
);
|
|
138
|
+
}, [clearSelection, editor, isSelected, isResizing, setSelected, isEditable]);
|
|
139
|
+
const deleteNode = useCallback(() => {
|
|
140
|
+
setModalOpen(false);
|
|
141
|
+
return editor.update(() => {
|
|
142
|
+
const node = $getNodeByKey(nodeKey);
|
|
143
|
+
if (node) {
|
|
144
|
+
node.remove();
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
}, [editor, nodeKey]);
|
|
148
|
+
const setData = (els, aps, fls) => {
|
|
149
|
+
return editor.update(() => {
|
|
150
|
+
const node = $getNodeByKey(nodeKey);
|
|
151
|
+
if ($isExcalidrawNode(node)) {
|
|
152
|
+
if (els && els.length > 0 || Object.keys(fls).length > 0) {
|
|
153
|
+
node.setData(
|
|
154
|
+
JSON.stringify({
|
|
155
|
+
appState: aps,
|
|
156
|
+
elements: els,
|
|
157
|
+
files: fls
|
|
158
|
+
})
|
|
159
|
+
);
|
|
160
|
+
} else {
|
|
161
|
+
node.remove();
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
};
|
|
166
|
+
const onResizeStart = () => {
|
|
167
|
+
setIsResizing(true);
|
|
168
|
+
};
|
|
169
|
+
const onResizeEnd = (nextWidth, nextHeight) => {
|
|
170
|
+
setTimeout(() => {
|
|
171
|
+
setIsResizing(false);
|
|
172
|
+
}, 200);
|
|
173
|
+
editor.update(() => {
|
|
174
|
+
const node = $getNodeByKey(nodeKey);
|
|
175
|
+
if ($isExcalidrawNode(node)) {
|
|
176
|
+
node.setWidth(nextWidth);
|
|
177
|
+
node.setHeight(nextHeight);
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
};
|
|
181
|
+
const openModal = useCallback(() => {
|
|
182
|
+
setModalOpen(true);
|
|
183
|
+
}, []);
|
|
184
|
+
const {
|
|
185
|
+
elements = [],
|
|
186
|
+
files = {},
|
|
187
|
+
appState = {}
|
|
188
|
+
} = useMemo(() => JSON.parse(data), [data]);
|
|
189
|
+
const closeModal = useCallback(() => {
|
|
190
|
+
setModalOpen(false);
|
|
191
|
+
if (elements.length === 0) {
|
|
192
|
+
editor.update(() => {
|
|
193
|
+
const node = $getNodeByKey(nodeKey);
|
|
194
|
+
if (node) {
|
|
195
|
+
node.remove();
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
}, [editor, nodeKey, elements.length]);
|
|
200
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
201
|
+
isEditable && isModalOpen && /* @__PURE__ */ jsx2(
|
|
202
|
+
ExcalidrawModal,
|
|
203
|
+
{
|
|
204
|
+
initialElements: elements,
|
|
205
|
+
initialFiles: files,
|
|
206
|
+
initialAppState: appState,
|
|
207
|
+
isShown: isModalOpen,
|
|
208
|
+
onDelete: deleteNode,
|
|
209
|
+
onClose: closeModal,
|
|
210
|
+
onSave: (els, aps, fls) => {
|
|
211
|
+
setData(els, aps, fls);
|
|
212
|
+
setModalOpen(false);
|
|
213
|
+
},
|
|
214
|
+
closeOnClickOutside: false
|
|
215
|
+
}
|
|
216
|
+
),
|
|
217
|
+
elements.length > 0 && /* @__PURE__ */ jsxs(
|
|
218
|
+
"button",
|
|
219
|
+
{
|
|
220
|
+
type: "button",
|
|
221
|
+
ref: buttonRef,
|
|
222
|
+
className: `excalidraw-button ${isSelected ? "selected" : ""}`,
|
|
223
|
+
children: [
|
|
224
|
+
/* @__PURE__ */ jsx2(
|
|
225
|
+
ExcalidrawImage,
|
|
226
|
+
{
|
|
227
|
+
imageContainerRef,
|
|
228
|
+
className: "image",
|
|
229
|
+
elements,
|
|
230
|
+
files,
|
|
231
|
+
appState,
|
|
232
|
+
width,
|
|
233
|
+
height
|
|
234
|
+
}
|
|
235
|
+
),
|
|
236
|
+
isSelected && isEditable && /* @__PURE__ */ jsx2(
|
|
237
|
+
"div",
|
|
238
|
+
{
|
|
239
|
+
className: "image-edit-button",
|
|
240
|
+
role: "button",
|
|
241
|
+
tabIndex: 0,
|
|
242
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
243
|
+
onClick: openModal
|
|
244
|
+
}
|
|
245
|
+
),
|
|
246
|
+
(isSelected || isResizing) && isEditable && /* @__PURE__ */ jsx2(
|
|
247
|
+
ImageResizer,
|
|
248
|
+
{
|
|
249
|
+
buttonRef: captionButtonRef,
|
|
250
|
+
showCaption: true,
|
|
251
|
+
setShowCaption: () => null,
|
|
252
|
+
imageRef: imageContainerRef,
|
|
253
|
+
editor,
|
|
254
|
+
onResizeStart,
|
|
255
|
+
onResizeEnd,
|
|
256
|
+
captionsEnabled: true
|
|
257
|
+
}
|
|
258
|
+
)
|
|
259
|
+
]
|
|
260
|
+
}
|
|
261
|
+
)
|
|
262
|
+
] });
|
|
263
|
+
}
|
|
264
|
+
export {
|
|
265
|
+
ExcalidrawComponent as default
|
|
266
|
+
};
|
|
267
|
+
//# sourceMappingURL=ExcalidrawComponent-GZYLHNOY.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/nodes/ExcalidrawNode/ExcalidrawComponent.tsx","../src/nodes/ExcalidrawNode/ExcalidrawImage.tsx"],"sourcesContent":["/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport type {ExcalidrawInitialElements} from '../../ui/ExcalidrawModal';\nimport type {AppState, BinaryFiles} from '@excalidraw/excalidraw/types';\nimport type {NodeKey} from 'lexical';\nimport type {JSX} from 'react';\n\nimport {useLexicalComposerContext} from '@lexical/react/LexicalComposerContext';\nimport {useLexicalEditable} from '@lexical/react/useLexicalEditable';\nimport {useLexicalNodeSelection} from '@lexical/react/useLexicalNodeSelection';\nimport {mergeRegister} from '@lexical/utils';\nimport {\n $getNodeByKey,\n CLICK_COMMAND,\n COMMAND_PRIORITY_LOW,\n isDOMNode,\n} from 'lexical';\nimport {useCallback, useEffect, useMemo, useRef, useState} from 'react';\nimport * as React from 'react';\n\nimport ExcalidrawModal from '../../ui/ExcalidrawModal';\nimport ImageResizer from '../../ui/ImageResizer';\nimport {$isExcalidrawNode} from '.';\nimport ExcalidrawImage from './ExcalidrawImage';\n\nexport default function ExcalidrawComponent({\n nodeKey,\n data,\n width,\n height,\n}: {\n data: string;\n nodeKey: NodeKey;\n width: 'inherit' | number;\n height: 'inherit' | number;\n}): JSX.Element {\n const [editor] = useLexicalComposerContext();\n const isEditable = useLexicalEditable();\n const [isModalOpen, setModalOpen] = useState<boolean>(\n data === '[]' && editor.isEditable(),\n );\n const imageContainerRef = useRef<HTMLDivElement | null>(null);\n const buttonRef = useRef<HTMLButtonElement | null>(null);\n const captionButtonRef = useRef<HTMLButtonElement | null>(null);\n const [isSelected, setSelected, clearSelection] =\n useLexicalNodeSelection(nodeKey);\n const [isResizing, setIsResizing] = useState<boolean>(false);\n\n useEffect(() => {\n if (!isEditable) {\n if (isSelected) {\n clearSelection();\n }\n return;\n }\n return mergeRegister(\n editor.registerCommand(\n CLICK_COMMAND,\n (event: MouseEvent) => {\n const buttonElem = buttonRef.current;\n const eventTarget = event.target;\n\n if (isResizing) {\n return true;\n }\n\n if (\n buttonElem !== null &&\n isDOMNode(eventTarget) &&\n buttonElem.contains(eventTarget)\n ) {\n if (!event.shiftKey) {\n clearSelection();\n }\n setSelected(!isSelected);\n if (event.detail > 1) {\n setModalOpen(true);\n }\n return true;\n }\n\n return false;\n },\n COMMAND_PRIORITY_LOW,\n ),\n );\n }, [clearSelection, editor, isSelected, isResizing, setSelected, isEditable]);\n\n const deleteNode = useCallback(() => {\n setModalOpen(false);\n return editor.update(() => {\n const node = $getNodeByKey(nodeKey);\n if (node) {\n node.remove();\n }\n });\n }, [editor, nodeKey]);\n\n const setData = (\n els: ExcalidrawInitialElements,\n aps: Partial<AppState>,\n fls: BinaryFiles,\n ) => {\n return editor.update(() => {\n const node = $getNodeByKey(nodeKey);\n if ($isExcalidrawNode(node)) {\n if ((els && els.length > 0) || Object.keys(fls).length > 0) {\n node.setData(\n JSON.stringify({\n appState: aps,\n elements: els,\n files: fls,\n }),\n );\n } else {\n node.remove();\n }\n }\n });\n };\n\n const onResizeStart = () => {\n setIsResizing(true);\n };\n\n const onResizeEnd = (\n nextWidth: 'inherit' | number,\n nextHeight: 'inherit' | number,\n ) => {\n // Delay hiding the resize bars for click case\n setTimeout(() => {\n setIsResizing(false);\n }, 200);\n\n editor.update(() => {\n const node = $getNodeByKey(nodeKey);\n\n if ($isExcalidrawNode(node)) {\n node.setWidth(nextWidth);\n node.setHeight(nextHeight);\n }\n });\n };\n\n const openModal = useCallback(() => {\n setModalOpen(true);\n }, []);\n\n const {\n elements = [],\n files = {},\n appState = {},\n } = useMemo(() => JSON.parse(data), [data]);\n\n const closeModal = useCallback(() => {\n setModalOpen(false);\n if (elements.length === 0) {\n editor.update(() => {\n const node = $getNodeByKey(nodeKey);\n if (node) {\n node.remove();\n }\n });\n }\n }, [editor, nodeKey, elements.length]);\n\n return (\n <>\n {isEditable && isModalOpen && (\n <ExcalidrawModal\n initialElements={elements}\n initialFiles={files}\n initialAppState={appState}\n isShown={isModalOpen}\n onDelete={deleteNode}\n onClose={closeModal}\n onSave={(els, aps, fls) => {\n setData(els, aps, fls);\n setModalOpen(false);\n }}\n closeOnClickOutside={false}\n />\n )}\n {elements.length > 0 && (\n <button type=\"button\"\n ref={buttonRef}\n className={`excalidraw-button ${isSelected ? 'selected' : ''}`}>\n <ExcalidrawImage\n imageContainerRef={imageContainerRef}\n className=\"image\"\n elements={elements}\n files={files}\n appState={appState}\n width={width}\n height={height}\n />\n {isSelected && isEditable && (\n <div\n className=\"image-edit-button\"\n role=\"button\"\n tabIndex={0}\n onMouseDown={(event) => event.preventDefault()}\n onClick={openModal}\n />\n )}\n {(isSelected || isResizing) && isEditable && (\n <ImageResizer\n buttonRef={captionButtonRef}\n showCaption={true}\n setShowCaption={() => null}\n imageRef={imageContainerRef}\n editor={editor}\n onResizeStart={onResizeStart}\n onResizeEnd={onResizeEnd}\n captionsEnabled={true}\n />\n )}\n </button>\n )}\n </>\n );\n}\n","/**\r\n * Copyright (c) Meta Platforms, Inc. and affiliates.\r\n *\r\n * This source code is licensed under the MIT license found in the\r\n * LICENSE file in the root directory of this source tree.\r\n *\r\n */\r\n\r\nimport type {\r\n ExcalidrawElement,\r\n NonDeleted,\r\n} from '@excalidraw/excalidraw/element/types';\r\nimport type {AppState, BinaryFiles} from '@excalidraw/excalidraw/types';\r\nimport type {JSX} from 'react';\r\n\r\nimport * as React from 'react';\r\nimport {useEffect, useState} from 'react';\r\n\r\ntype ImageType = 'svg' | 'canvas';\r\n\r\ntype Dimension = 'inherit' | number;\r\n\r\ntype Props = {\r\n /**\r\n * Configures the export setting for SVG/Canvas\r\n */\r\n appState: AppState;\r\n /**\r\n * The css class applied to image to be rendered\r\n */\r\n className?: string;\r\n /**\r\n * The Excalidraw elements to be rendered as an image\r\n */\r\n elements: NonDeleted<ExcalidrawElement>[];\r\n /**\r\n * The Excalidraw files associated with the elements\r\n */\r\n files: BinaryFiles;\r\n /**\r\n * The height of the image to be rendered\r\n */\r\n height?: Dimension;\r\n /**\r\n * The ref object to be used to render the image\r\n */\r\n imageContainerRef: React.RefObject<HTMLDivElement | null>;\r\n /**\r\n * The type of image to be rendered\r\n */\r\n imageType?: ImageType;\r\n /**\r\n * The css class applied to the root element of this component\r\n */\r\n rootClassName?: string | null;\r\n /**\r\n * The width of the image to be rendered\r\n */\r\n width?: Dimension;\r\n};\r\n\r\n// exportToSvg has fonts from excalidraw.com\r\n// We don't want them to be used in open source\r\nconst removeStyleFromSvg_HACK = (svg: SVGElement) => {\r\n const styleTag = svg?.firstElementChild?.firstElementChild;\r\n\r\n // Generated SVG is getting double-sized by height and width attributes\r\n // We want to match the real size of the SVG element\r\n const viewBox = svg.getAttribute('viewBox');\r\n if (viewBox != null) {\r\n const viewBoxDimensions = viewBox.split(' ');\r\n svg.setAttribute('width', viewBoxDimensions[2]);\r\n svg.setAttribute('height', viewBoxDimensions[3]);\r\n }\r\n\r\n if (styleTag && styleTag.tagName === 'style') {\r\n styleTag.remove();\r\n }\r\n};\r\n\r\n/**\r\n * @explorer-desc\r\n * A component for rendering Excalidraw elements as a static image\r\n */\r\nexport default function ExcalidrawImage({\r\n elements,\r\n files,\r\n imageContainerRef,\r\n appState,\r\n rootClassName = null,\r\n width = 'inherit',\r\n height = 'inherit',\r\n}: Props): JSX.Element {\r\n const [Svg, setSvg] = useState<SVGElement | null>(null);\r\n\r\n useEffect(() => {\r\n const setContent = async () => {\r\n const {exportToSvg} = await import('@excalidraw/excalidraw');\r\n const svg: SVGElement = await exportToSvg({\r\n appState,\r\n elements,\r\n files,\r\n });\r\n removeStyleFromSvg_HACK(svg);\r\n\r\n svg.setAttribute('width', '100%');\r\n svg.setAttribute('height', '100%');\r\n svg.setAttribute('display', 'block');\r\n\r\n setSvg(svg);\r\n };\r\n setContent();\r\n }, [elements, files, appState]);\r\n\r\n const containerStyle: React.CSSProperties = {};\r\n if (width !== 'inherit') {\r\n containerStyle.width = `${width}px`;\r\n }\r\n if (height !== 'inherit') {\r\n containerStyle.height = `${height}px`;\r\n }\r\n\r\n return (\r\n <div\r\n ref={(node) => {\r\n if (node) {\r\n if (imageContainerRef) {\r\n (imageContainerRef as React.MutableRefObject<HTMLDivElement | null>).current = node;\r\n }\r\n }\r\n }}\r\n className={rootClassName ?? ''}\r\n style={containerStyle}\r\n dangerouslySetInnerHTML={{__html: Svg?.outerHTML ?? ''}}\r\n />\r\n );\r\n}\r\n"],"mappings":";;;;;;;;;;;AAaA,SAAQ,iCAAgC;AACxC,SAAQ,0BAAyB;AACjC,SAAQ,+BAA8B;AACtC,SAAQ,qBAAoB;AAC5B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAQ,aAAa,aAAAA,YAAW,SAAS,QAAQ,YAAAC,iBAAe;;;ACPhE,SAAQ,WAAW,gBAAe;AA2G9B;AA5DJ,IAAM,0BAA0B,CAAC,QAAoB;AACnD,QAAM,WAAW,KAAK,mBAAmB;AAIzC,QAAM,UAAU,IAAI,aAAa,SAAS;AAC1C,MAAI,WAAW,MAAM;AACnB,UAAM,oBAAoB,QAAQ,MAAM,GAAG;AAC3C,QAAI,aAAa,SAAS,kBAAkB,CAAC,CAAC;AAC9C,QAAI,aAAa,UAAU,kBAAkB,CAAC,CAAC;AAAA,EACjD;AAEA,MAAI,YAAY,SAAS,YAAY,SAAS;AAC5C,aAAS,OAAO;AAAA,EAClB;AACF;AAMe,SAAR,gBAAiC;AAAA,EACtC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,gBAAgB;AAAA,EAChB,QAAQ;AAAA,EACR,SAAS;AACX,GAAuB;AACrB,QAAM,CAAC,KAAK,MAAM,IAAI,SAA4B,IAAI;AAEtD,YAAU,MAAM;AACd,UAAM,aAAa,YAAY;AAC7B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KAAK;AAAA,QACL,WAAW,qBAAqB,aAAa,aAAa,EAAE;AAAA,QAC5D;AAAA,0BAAAA;AAAA,YAAC;AAAA;AAAA,cACC;AAAA,cACA,WAAU;AAAA,cACV;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA;AAAA,UACF;AAAA,UACC,cAAc,cACb,gBAAAA;AAAA,YAAC;AAAA;AAAA,cACC,WAAU;AAAA,cACV,MAAK;AAAA,cACL,UAAU;AAAA,cACV,aAAa,CAAC,UAAU,MAAM,eAAe;AAAA,cAC7C,SAAS;AAAA;AAAA,UACX;AAAA,WAEA,cAAc,eAAe,cAC7B,gBAAAA;AAAA,YAAC;AAAA;AAAA,cACC,WAAW;AAAA,cACX,aAAa;AAAA,cACb,gBAAgB,MAAM;AAAA,cACtB,UAAU;AAAA,cACV;AAAA,cACA;AAAA,cACA;AAAA,cACA,iBAAiB;AAAA;AAAA,UACnB;AAAA;AAAA;AAAA,IAEJ;AAAA,KAEJ;AAEJ;","names":["useEffect","useState","jsx","useState","useEffect"]}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
/* src/ui/ExcalidrawModal.css */
|
|
2
|
+
.ExcalidrawModal__overlay {
|
|
3
|
+
display: flex;
|
|
4
|
+
align-items: center;
|
|
5
|
+
position: fixed;
|
|
6
|
+
flex-direction: column;
|
|
7
|
+
top: 0px;
|
|
8
|
+
bottom: 0px;
|
|
9
|
+
left: 0px;
|
|
10
|
+
right: 0px;
|
|
11
|
+
flex-grow: 0px;
|
|
12
|
+
flex-shrink: 1px;
|
|
13
|
+
z-index: 10000;
|
|
14
|
+
background-color: rgba(40, 40, 40, 0.6);
|
|
15
|
+
pointer-events: auto;
|
|
16
|
+
}
|
|
17
|
+
.ExcalidrawModal__actions {
|
|
18
|
+
text-align: end;
|
|
19
|
+
position: absolute;
|
|
20
|
+
right: 5px;
|
|
21
|
+
top: 5px;
|
|
22
|
+
z-index: 1;
|
|
23
|
+
}
|
|
24
|
+
.ExcalidrawModal__actions button {
|
|
25
|
+
background-color: #fff;
|
|
26
|
+
border-radius: 5px;
|
|
27
|
+
}
|
|
28
|
+
.ExcalidrawModal__row {
|
|
29
|
+
position: relative;
|
|
30
|
+
padding: 40px 5px 5px;
|
|
31
|
+
width: 90vw;
|
|
32
|
+
height: 80vh;
|
|
33
|
+
border-radius: 8px;
|
|
34
|
+
box-shadow:
|
|
35
|
+
0 12px 28px 0 rgba(0, 0, 0, 0.2),
|
|
36
|
+
0 2px 4px 0 rgba(0, 0, 0, 0.1),
|
|
37
|
+
inset 0 0 0 1px rgba(255, 255, 255, 0.5);
|
|
38
|
+
}
|
|
39
|
+
.ExcalidrawModal__row > div {
|
|
40
|
+
border-radius: 5px;
|
|
41
|
+
}
|
|
42
|
+
.ExcalidrawModal__modal {
|
|
43
|
+
position: relative;
|
|
44
|
+
top: 50px;
|
|
45
|
+
width: auto;
|
|
46
|
+
left: 0;
|
|
47
|
+
display: flex;
|
|
48
|
+
justify-content: center;
|
|
49
|
+
align-items: center;
|
|
50
|
+
border-radius: 8px;
|
|
51
|
+
background-color: #eee;
|
|
52
|
+
}
|
|
53
|
+
.ExcalidrawModal__discardModal {
|
|
54
|
+
margin-top: 60px;
|
|
55
|
+
text-align: center;
|
|
56
|
+
}
|
|
57
|
+
.excalidraw-modal-container {
|
|
58
|
+
position: fixed !important;
|
|
59
|
+
z-index: 10001 !important;
|
|
60
|
+
inset: 0;
|
|
61
|
+
overflow: auto !important;
|
|
62
|
+
pointer-events: auto !important;
|
|
63
|
+
}
|
|
64
|
+
.excalidraw-modal-container .Modal {
|
|
65
|
+
pointer-events: auto !important;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/* src/ui/Button.css */
|
|
69
|
+
.Button__root {
|
|
70
|
+
padding-top: 10px;
|
|
71
|
+
padding-bottom: 10px;
|
|
72
|
+
padding-left: 15px;
|
|
73
|
+
padding-right: 15px;
|
|
74
|
+
border: 0px;
|
|
75
|
+
background-color: #eee;
|
|
76
|
+
border-radius: 5px;
|
|
77
|
+
cursor: pointer;
|
|
78
|
+
font-size: 14px;
|
|
79
|
+
}
|
|
80
|
+
.Button__root:hover {
|
|
81
|
+
background-color: #ddd;
|
|
82
|
+
}
|
|
83
|
+
.Button__small {
|
|
84
|
+
padding-top: 5px;
|
|
85
|
+
padding-bottom: 5px;
|
|
86
|
+
padding-left: 10px;
|
|
87
|
+
padding-right: 10px;
|
|
88
|
+
font-size: 13px;
|
|
89
|
+
}
|
|
90
|
+
.Button__disabled {
|
|
91
|
+
cursor: not-allowed;
|
|
92
|
+
}
|
|
93
|
+
.Button__disabled:hover {
|
|
94
|
+
background-color: #eee;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/* src/ui/Modal.css */
|
|
98
|
+
.Modal__overlay {
|
|
99
|
+
display: flex;
|
|
100
|
+
justify-content: center;
|
|
101
|
+
align-items: center;
|
|
102
|
+
position: fixed;
|
|
103
|
+
flex-direction: column;
|
|
104
|
+
top: 0px;
|
|
105
|
+
bottom: 0px;
|
|
106
|
+
left: 0px;
|
|
107
|
+
right: 0px;
|
|
108
|
+
background-color: rgba(40, 40, 40, 0.6);
|
|
109
|
+
flex-grow: 0px;
|
|
110
|
+
pointer-events: auto;
|
|
111
|
+
flex-shrink: 1px;
|
|
112
|
+
z-index: 10000;
|
|
113
|
+
}
|
|
114
|
+
.Modal__modal {
|
|
115
|
+
padding: 20px;
|
|
116
|
+
min-height: 100px;
|
|
117
|
+
min-width: 300px;
|
|
118
|
+
display: flex;
|
|
119
|
+
flex-grow: 0px;
|
|
120
|
+
background-color: #fff;
|
|
121
|
+
flex-direction: column;
|
|
122
|
+
position: relative;
|
|
123
|
+
box-shadow: 0 0 20px 0 #444;
|
|
124
|
+
border-radius: 10px;
|
|
125
|
+
}
|
|
126
|
+
.Modal__title {
|
|
127
|
+
color: #444;
|
|
128
|
+
margin: 0px;
|
|
129
|
+
padding-bottom: 10px;
|
|
130
|
+
border-bottom: 1px solid #ccc;
|
|
131
|
+
}
|
|
132
|
+
.Modal__closeButton {
|
|
133
|
+
border: 0px;
|
|
134
|
+
position: absolute;
|
|
135
|
+
right: 20px;
|
|
136
|
+
border-radius: 20px;
|
|
137
|
+
justify-content: center;
|
|
138
|
+
align-items: center;
|
|
139
|
+
display: flex;
|
|
140
|
+
width: 30px;
|
|
141
|
+
height: 30px;
|
|
142
|
+
text-align: center;
|
|
143
|
+
cursor: pointer;
|
|
144
|
+
background-color: #eee;
|
|
145
|
+
}
|
|
146
|
+
.Modal__closeButton:hover {
|
|
147
|
+
background-color: #ddd;
|
|
148
|
+
}
|
|
149
|
+
.Modal__content {
|
|
150
|
+
padding-top: 20px;
|
|
151
|
+
}
|
|
152
|
+
/*# sourceMappingURL=ExcalidrawComponent-U6BD7DUB.css.map */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/ui/ExcalidrawModal.css","../src/ui/Button.css","../src/ui/Modal.css"],"sourcesContent":["/**\r\n * Copyright (c) Meta Platforms, Inc. and affiliates.\r\n *\r\n * This source code is licensed under the MIT license found in the\r\n * LICENSE file in the root directory of this source tree.\r\n *\r\n *\r\n */\r\n\r\n.ExcalidrawModal__overlay {\r\n display: flex;\r\n align-items: center;\r\n position: fixed;\r\n flex-direction: column;\r\n top: 0px;\r\n bottom: 0px;\r\n left: 0px;\r\n right: 0px;\r\n flex-grow: 0px;\r\n flex-shrink: 1px;\r\n z-index: 10000;\r\n background-color: rgba(40, 40, 40, 0.6);\r\n pointer-events: auto;\r\n}\r\n.ExcalidrawModal__actions {\r\n text-align: end;\r\n position: absolute;\r\n right: 5px;\r\n top: 5px;\r\n z-index: 1;\r\n}\r\n.ExcalidrawModal__actions button {\r\n background-color: #fff;\r\n border-radius: 5px;\r\n}\r\n.ExcalidrawModal__row {\r\n position: relative;\r\n padding: 40px 5px 5px;\r\n width: 90vw;\r\n height: 80vh;\r\n border-radius: 8px;\r\n box-shadow:\r\n 0 12px 28px 0 rgba(0, 0, 0, 0.2),\r\n 0 2px 4px 0 rgba(0, 0, 0, 0.1),\r\n inset 0 0 0 1px rgba(255, 255, 255, 0.5);\r\n}\r\n.ExcalidrawModal__row > div {\r\n border-radius: 5px;\r\n}\r\n.ExcalidrawModal__modal {\r\n position: relative;\r\n top: 50px;\r\n width: auto;\r\n left: 0;\r\n display: flex;\r\n justify-content: center;\r\n align-items: center;\r\n border-radius: 8px;\r\n background-color: #eee;\r\n}\r\n.ExcalidrawModal__discardModal {\r\n margin-top: 60px;\r\n text-align: center;\r\n}\r\n\r\n/* Ensure Excalidraw's internal modal dialogs (Help, etc.) render above\r\n all other overlays. The modal-container is portaled to <body> as a sibling\r\n of .ExcalidrawModal__overlay (not a child), so target it directly.\r\n It uses position:absolute and z-index:1000 by default — override to fixed\r\n with a higher z-index so it renders above the Excalidraw overlay (10000). */\r\n.excalidraw-modal-container {\r\n position: fixed !important;\r\n z-index: 10001 !important;\r\n inset: 0;\r\n overflow: auto !important;\r\n pointer-events: auto !important;\r\n}\r\n\r\n/* Excalidraw sets pointer-events:none on .Modal when no dialog is\r\n actively shown. Override so the help/settings dialogs are interactive. */\r\n.excalidraw-modal-container .Modal {\r\n pointer-events: auto !important;\r\n}\r\n","/**\r\n * Copyright (c) Meta Platforms, Inc. and affiliates.\r\n *\r\n * This source code is licensed under the MIT license found in the\r\n * LICENSE file in the root directory of this source tree.\r\n *\r\n *\r\n */\r\n\r\n.Button__root {\r\n padding-top: 10px;\r\n padding-bottom: 10px;\r\n padding-left: 15px;\r\n padding-right: 15px;\r\n border: 0px;\r\n background-color: #eee;\r\n border-radius: 5px;\r\n cursor: pointer;\r\n font-size: 14px;\r\n}\r\n.Button__root:hover {\r\n background-color: #ddd;\r\n}\r\n.Button__small {\r\n padding-top: 5px;\r\n padding-bottom: 5px;\r\n padding-left: 10px;\r\n padding-right: 10px;\r\n font-size: 13px;\r\n}\r\n.Button__disabled {\r\n cursor: not-allowed;\r\n}\r\n.Button__disabled:hover {\r\n background-color: #eee;\r\n}\r\n","/**\r\n * Copyright (c) Meta Platforms, Inc. and affiliates.\r\n *\r\n * This source code is licensed under the MIT license found in the\r\n * LICENSE file in the root directory of this source tree.\r\n *\r\n *\r\n */\r\n\r\n.Modal__overlay {\r\n display: flex;\r\n justify-content: center;\r\n align-items: center;\r\n position: fixed;\r\n flex-direction: column;\r\n top: 0px;\r\n bottom: 0px;\r\n left: 0px;\r\n right: 0px;\r\n background-color: rgba(40, 40, 40, 0.6);\r\n flex-grow: 0px;\r\n pointer-events: auto;\r\n flex-shrink: 1px;\r\n z-index: 10000;\r\n}\r\n.Modal__modal {\r\n padding: 20px;\r\n min-height: 100px;\r\n min-width: 300px;\r\n display: flex;\r\n flex-grow: 0px;\r\n background-color: #fff;\r\n flex-direction: column;\r\n position: relative;\r\n box-shadow: 0 0 20px 0 #444;\r\n border-radius: 10px;\r\n}\r\n.Modal__title {\r\n color: #444;\r\n margin: 0px;\r\n padding-bottom: 10px;\r\n border-bottom: 1px solid #ccc;\r\n}\r\n.Modal__closeButton {\r\n border: 0px;\r\n position: absolute;\r\n right: 20px;\r\n border-radius: 20px;\r\n justify-content: center;\r\n align-items: center;\r\n display: flex;\r\n width: 30px;\r\n height: 30px;\r\n text-align: center;\r\n cursor: pointer;\r\n background-color: #eee;\r\n}\r\n.Modal__closeButton:hover {\r\n background-color: #ddd;\r\n}\r\n.Modal__content {\r\n padding-top: 20px;\r\n}\r\n"],"mappings":";AASA,CAAC;AACC,WAAS;AACT,eAAa;AACb,YAAU;AACV,kBAAgB;AAChB,OAAK;AACL,UAAQ;AACR,QAAM;AACN,SAAO;AACP,aAAW;AACX,eAAa;AACb,WAAS;AACT,oBAAkB,KAAK,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE;AACnC,kBAAgB;AAClB;AACA,CAAC;AACC,cAAY;AACZ,YAAU;AACV,SAAO;AACP,OAAK;AACL,WAAS;AACX;AACA,CAPC,yBAOyB;AACxB,oBAAkB;AAClB,iBAAe;AACjB;AACA,CAAC;AACC,YAAU;AACV,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