@react-fabric/lexical 1.0.0-beta.9 → 1.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/{src/editor/Lexical.module.css → css/_lexical.css} +79 -13
- package/css/styles.css +24 -0
- package/dist/cjs/{packages/lexical/src/editor → editor}/LexicalEditor.js +98 -45
- package/dist/cjs/{packages/lexical/src/hooks → hooks}/useFormatWatcher.js +147 -140
- package/dist/cjs/i18n/ar/lexical.json.js +30 -0
- package/dist/cjs/i18n/en/lexical.json.js +30 -0
- package/{src/plugins/StickyPlugin.ts → dist/cjs/i18n/index.js} +10 -15
- package/dist/cjs/index.js +36 -0
- package/dist/cjs/plugins/CommentPlugin.js +481 -0
- package/dist/cjs/{packages/lexical/src/plugins → plugins}/DraggableBlockPlugin.js +17 -20
- package/dist/cjs/{packages/lexical/src/plugins → plugins}/ToolbarPlugin.js +58 -37
- package/dist/esm/{packages/lexical/src/editor → editor}/LexicalEditor.js +101 -48
- package/dist/esm/{packages/lexical/src/hooks → hooks}/useFormatWatcher.js +95 -88
- package/dist/esm/i18n/ar/lexical.json.js +25 -0
- package/dist/esm/i18n/en/lexical.json.js +25 -0
- package/dist/esm/i18n/index.js +33 -0
- package/dist/esm/index.js +34 -0
- package/dist/esm/plugins/CommentPlugin.js +481 -0
- package/dist/esm/{packages/lexical/src/plugins → plugins}/DraggableBlockPlugin.js +15 -18
- package/dist/esm/{packages/lexical/src/plugins → plugins}/ToolbarPlugin.js +59 -38
- package/dist/types/editor/LexicalEditor.d.ts +33 -4
- package/dist/types/hooks/useFormatWatcher.d.ts +7 -4
- package/dist/types/i18n/index.d.ts +1 -0
- package/dist/types/index.d.ts +27 -0
- package/dist/types/plugins/CommentPlugin.d.ts +5 -0
- package/dist/types/plugins/DraggableBlockPlugin.d.ts +3 -2
- package/dist/types/plugins/ToolbarPlugin.d.ts +1 -1
- package/dist/types/utils/index.d.ts +3 -6
- package/package.json +18 -18
- package/src/editor/LexicalEditor.tsx +95 -55
- package/src/hooks/useFormatWatcher.ts +50 -74
- package/src/i18n/ar/lexical.json +18 -0
- package/src/i18n/en/lexical.json +18 -0
- package/src/i18n/index.ts +28 -0
- package/src/index.ts +24 -17
- package/src/plugins/CommentPlugin.tsx +523 -0
- package/src/plugins/DraggableBlockPlugin.tsx +23 -68
- package/src/plugins/ToolbarPlugin.tsx +83 -131
- package/src/utils/index.ts +12 -108
- package/dist/cjs/_virtual/prism.js +0 -5
- package/dist/cjs/editor/Lexical.module.css +0 -1
- package/dist/cjs/node_modules/@lexical/clipboard/LexicalClipboard.dev.js +0 -432
- package/dist/cjs/node_modules/@lexical/clipboard/LexicalClipboard.js +0 -21
- package/dist/cjs/node_modules/@lexical/clipboard/LexicalClipboard.prod.js +0 -27
- package/dist/cjs/node_modules/@lexical/code/LexicalCode.dev.js +0 -1139
- package/dist/cjs/node_modules/@lexical/code/LexicalCode.js +0 -25
- package/dist/cjs/node_modules/@lexical/code/LexicalCode.prod.js +0 -50
- package/dist/cjs/node_modules/@lexical/html/LexicalHtml.dev.js +0 -245
- package/dist/cjs/node_modules/@lexical/html/LexicalHtml.js +0 -19
- package/dist/cjs/node_modules/@lexical/html/LexicalHtml.prod.js +0 -18
- package/dist/cjs/node_modules/@lexical/link/LexicalLink.dev.js +0 -471
- package/dist/cjs/node_modules/@lexical/link/LexicalLink.js +0 -17
- package/dist/cjs/node_modules/@lexical/link/LexicalLink.prod.js +0 -24
- package/dist/cjs/node_modules/@lexical/list/LexicalList.dev.js +0 -1275
- package/dist/cjs/node_modules/@lexical/list/LexicalList.js +0 -29
- package/dist/cjs/node_modules/@lexical/list/LexicalList.prod.js +0 -29
- package/dist/cjs/node_modules/@lexical/rich-text/LexicalRichText.dev.js +0 -789
- package/dist/cjs/node_modules/@lexical/rich-text/LexicalRichText.js +0 -29
- package/dist/cjs/node_modules/@lexical/rich-text/LexicalRichText.prod.js +0 -26
- package/dist/cjs/node_modules/@lexical/selection/LexicalSelection.dev.js +0 -976
- package/dist/cjs/node_modules/@lexical/selection/LexicalSelection.js +0 -35
- package/dist/cjs/node_modules/@lexical/selection/LexicalSelection.prod.js +0 -35
- package/dist/cjs/node_modules/@lexical/table/LexicalTable.dev.js +0 -2792
- package/dist/cjs/node_modules/@lexical/table/LexicalTable.js +0 -23
- package/dist/cjs/node_modules/@lexical/table/LexicalTable.prod.js +0 -55
- package/dist/cjs/node_modules/@lexical/utils/LexicalUtils.dev.js +0 -888
- package/dist/cjs/node_modules/@lexical/utils/LexicalUtils.js +0 -35
- package/dist/cjs/node_modules/@lexical/utils/LexicalUtils.prod.js +0 -66
- package/dist/cjs/node_modules/@mdi/js/mdi.js +0 -8
- package/dist/cjs/node_modules/prismjs/components/prism-c.js +0 -82
- package/dist/cjs/node_modules/prismjs/components/prism-clike.js +0 -33
- package/dist/cjs/node_modules/prismjs/components/prism-cpp.js +0 -101
- package/dist/cjs/node_modules/prismjs/components/prism-css.js +0 -66
- package/dist/cjs/node_modules/prismjs/components/prism-java.js +0 -126
- package/dist/cjs/node_modules/prismjs/components/prism-javascript.js +0 -174
- package/dist/cjs/node_modules/prismjs/components/prism-markdown.js +0 -417
- package/dist/cjs/node_modules/prismjs/components/prism-markup.js +0 -188
- package/dist/cjs/node_modules/prismjs/components/prism-objectivec.js +0 -14
- package/dist/cjs/node_modules/prismjs/components/prism-powershell.js +0 -60
- package/dist/cjs/node_modules/prismjs/components/prism-python.js +0 -67
- package/dist/cjs/node_modules/prismjs/components/prism-rust.js +0 -130
- package/dist/cjs/node_modules/prismjs/components/prism-sql.js +0 -34
- package/dist/cjs/node_modules/prismjs/components/prism-swift.js +0 -150
- package/dist/cjs/node_modules/prismjs/components/prism-typescript.js +0 -62
- package/dist/cjs/node_modules/prismjs/prism.js +0 -1951
- package/dist/cjs/packages/lexical/src/components/StickyComponent.js +0 -221
- package/dist/cjs/packages/lexical/src/index.js +0 -7
- package/dist/cjs/packages/lexical/src/nodes/StickyNode.js +0 -218
- package/dist/cjs/packages/lexical/src/plugins/StickyPlugin.js +0 -20
- package/dist/esm/_virtual/prism.js +0 -5
- package/dist/esm/editor/Lexical.module.css +0 -1
- package/dist/esm/node_modules/@lexical/clipboard/LexicalClipboard.dev.js +0 -423
- package/dist/esm/node_modules/@lexical/clipboard/LexicalClipboard.js +0 -19
- package/dist/esm/node_modules/@lexical/clipboard/LexicalClipboard.prod.js +0 -18
- package/dist/esm/node_modules/@lexical/code/LexicalCode.dev.js +0 -1121
- package/dist/esm/node_modules/@lexical/code/LexicalCode.js +0 -21
- package/dist/esm/node_modules/@lexical/code/LexicalCode.prod.js +0 -32
- package/dist/esm/node_modules/@lexical/html/LexicalHtml.dev.js +0 -244
- package/dist/esm/node_modules/@lexical/html/LexicalHtml.js +0 -18
- package/dist/esm/node_modules/@lexical/html/LexicalHtml.prod.js +0 -17
- package/dist/esm/node_modules/@lexical/link/LexicalLink.dev.js +0 -463
- package/dist/esm/node_modules/@lexical/link/LexicalLink.js +0 -17
- package/dist/esm/node_modules/@lexical/link/LexicalLink.prod.js +0 -16
- package/dist/esm/node_modules/@lexical/list/LexicalList.dev.js +0 -1262
- package/dist/esm/node_modules/@lexical/list/LexicalList.js +0 -23
- package/dist/esm/node_modules/@lexical/list/LexicalList.prod.js +0 -16
- package/dist/esm/node_modules/@lexical/rich-text/LexicalRichText.dev.js +0 -781
- package/dist/esm/node_modules/@lexical/rich-text/LexicalRichText.js +0 -23
- package/dist/esm/node_modules/@lexical/rich-text/LexicalRichText.prod.js +0 -18
- package/dist/esm/node_modules/@lexical/selection/LexicalSelection.dev.js +0 -957
- package/dist/esm/node_modules/@lexical/selection/LexicalSelection.js +0 -26
- package/dist/esm/node_modules/@lexical/selection/LexicalSelection.prod.js +0 -16
- package/dist/esm/node_modules/@lexical/table/LexicalTable.dev.js +0 -2754
- package/dist/esm/node_modules/@lexical/table/LexicalTable.js +0 -20
- package/dist/esm/node_modules/@lexical/table/LexicalTable.prod.js +0 -17
- package/dist/esm/node_modules/@lexical/utils/LexicalUtils.dev.js +0 -839
- package/dist/esm/node_modules/@lexical/utils/LexicalUtils.js +0 -26
- package/dist/esm/node_modules/@lexical/utils/LexicalUtils.prod.js +0 -17
- package/dist/esm/node_modules/@mdi/js/mdi.js +0 -7
- package/dist/esm/node_modules/prismjs/components/prism-c.js +0 -82
- package/dist/esm/node_modules/prismjs/components/prism-clike.js +0 -33
- package/dist/esm/node_modules/prismjs/components/prism-cpp.js +0 -101
- package/dist/esm/node_modules/prismjs/components/prism-css.js +0 -66
- package/dist/esm/node_modules/prismjs/components/prism-java.js +0 -126
- package/dist/esm/node_modules/prismjs/components/prism-javascript.js +0 -174
- package/dist/esm/node_modules/prismjs/components/prism-markdown.js +0 -417
- package/dist/esm/node_modules/prismjs/components/prism-markup.js +0 -188
- package/dist/esm/node_modules/prismjs/components/prism-objectivec.js +0 -14
- package/dist/esm/node_modules/prismjs/components/prism-powershell.js +0 -60
- package/dist/esm/node_modules/prismjs/components/prism-python.js +0 -67
- package/dist/esm/node_modules/prismjs/components/prism-rust.js +0 -130
- package/dist/esm/node_modules/prismjs/components/prism-sql.js +0 -34
- package/dist/esm/node_modules/prismjs/components/prism-swift.js +0 -150
- package/dist/esm/node_modules/prismjs/components/prism-typescript.js +0 -62
- package/dist/esm/node_modules/prismjs/prism.js +0 -1951
- package/dist/esm/packages/lexical/src/components/StickyComponent.js +0 -221
- package/dist/esm/packages/lexical/src/index.js +0 -3
- package/dist/esm/packages/lexical/src/nodes/StickyNode.js +0 -216
- package/dist/esm/packages/lexical/src/plugins/StickyPlugin.js +0 -20
- package/dist/types/components/StickyComponent.d.ts +0 -9
- package/dist/types/nodes/StickyNode.d.ts +0 -35
- package/dist/types/plugins/StickyPlugin.d.ts +0 -1
- package/src/components/StickyComponent.tsx +0 -271
- package/src/nodes/StickyNode.tsx +0 -249
- /package/dist/cjs/{packages/lexical/src/editor → editor}/theme.js +0 -0
- /package/dist/cjs/{packages/lexical/src/utils → utils}/index.js +0 -0
- /package/dist/esm/{packages/lexical/src/editor → editor}/theme.js +0 -0
- /package/dist/esm/{packages/lexical/src/utils → utils}/index.js +0 -0
|
@@ -1,221 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
|
|
4
|
-
var LexicalAutoFocusPlugin = require('@lexical/react/LexicalAutoFocusPlugin');
|
|
5
|
-
var LexicalComposerContext = require('@lexical/react/LexicalComposerContext');
|
|
6
|
-
var LexicalContentEditable = require('@lexical/react/LexicalContentEditable');
|
|
7
|
-
var LexicalErrorBoundary = require('@lexical/react/LexicalErrorBoundary');
|
|
8
|
-
var LexicalNestedComposer = require('@lexical/react/LexicalNestedComposer');
|
|
9
|
-
var LexicalRichTextPlugin = require('@lexical/react/LexicalRichTextPlugin');
|
|
10
|
-
var mdi = require('../../../../node_modules/@mdi/js/mdi.js');
|
|
11
|
-
var core = require('@react-fabric/core');
|
|
12
|
-
var lexical = require('lexical');
|
|
13
|
-
var react = require('react');
|
|
14
|
-
var StickyNode = require('../nodes/StickyNode.js');
|
|
15
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
16
|
-
|
|
17
|
-
function positionSticky(stickyElem, positioning) {
|
|
18
|
-
var style = stickyElem.style;
|
|
19
|
-
style.top = "".concat(positioning.y, "px");
|
|
20
|
-
style.left = "".concat(positioning.x, "px");
|
|
21
|
-
}
|
|
22
|
-
var StickyComponent = function StickyComponent(_ref) {
|
|
23
|
-
var _ref$x = _ref.x,
|
|
24
|
-
x = _ref$x === void 0 ? 0 : _ref$x,
|
|
25
|
-
_ref$y = _ref.y,
|
|
26
|
-
y = _ref$y === void 0 ? 0 : _ref$y,
|
|
27
|
-
nodeKey = _ref.nodeKey,
|
|
28
|
-
color = _ref.color,
|
|
29
|
-
state = _ref.state,
|
|
30
|
-
user = _ref.user;
|
|
31
|
-
var _useLexicalComposerCo = LexicalComposerContext.useLexicalComposerContext(),
|
|
32
|
-
_useLexicalComposerCo2 = _slicedToArray(_useLexicalComposerCo, 1),
|
|
33
|
-
editor = _useLexicalComposerCo2[0];
|
|
34
|
-
var stickyContainerRef = react.useRef(null);
|
|
35
|
-
var positioningRef = react.useRef({
|
|
36
|
-
isDragging: false,
|
|
37
|
-
offsetX: 0,
|
|
38
|
-
offsetY: 0,
|
|
39
|
-
rootElementRect: {
|
|
40
|
-
left: 8,
|
|
41
|
-
top: 8
|
|
42
|
-
},
|
|
43
|
-
x: 8,
|
|
44
|
-
y: 8
|
|
45
|
-
});
|
|
46
|
-
react.useEffect(function () {
|
|
47
|
-
var position = positioningRef.current;
|
|
48
|
-
position.x = x;
|
|
49
|
-
position.y = y;
|
|
50
|
-
var stickyContainer = stickyContainerRef.current;
|
|
51
|
-
if (stickyContainer !== null) {
|
|
52
|
-
positioningRef.current.rootElementRect = {
|
|
53
|
-
left: x,
|
|
54
|
-
top: y
|
|
55
|
-
};
|
|
56
|
-
positionSticky(stickyContainer, position);
|
|
57
|
-
}
|
|
58
|
-
}, [x, y]);
|
|
59
|
-
react.useEffect(function () {
|
|
60
|
-
var stickyContainer = stickyContainerRef.current;
|
|
61
|
-
if (stickyContainer !== null) {
|
|
62
|
-
// Delay adding transition so we don't trigger the
|
|
63
|
-
// transition on load of the sticky.
|
|
64
|
-
setTimeout(function () {
|
|
65
|
-
stickyContainer.style.setProperty("transition", "top 300ms ease 0s, left 300ms ease 0s");
|
|
66
|
-
}, 500);
|
|
67
|
-
}
|
|
68
|
-
}, []);
|
|
69
|
-
var handlePointerMove = function handlePointerMove(event) {
|
|
70
|
-
var stickyContainer = stickyContainerRef.current;
|
|
71
|
-
var positioning = positioningRef.current;
|
|
72
|
-
var rootElementRect = positioning.rootElementRect;
|
|
73
|
-
if (stickyContainer !== null && positioning.isDragging && rootElementRect !== null) {
|
|
74
|
-
positioning.x = rootElementRect.left + (event.pageX - positioning.offsetX);
|
|
75
|
-
positioning.y = rootElementRect.top + (event.pageY - positioning.offsetY);
|
|
76
|
-
if (positioning.x < 0) positioning.x = 0;
|
|
77
|
-
if (positioning.x > 642) positioning.x = 642 - stickyContainer.offsetWidth;
|
|
78
|
-
if (positioning.y < 0) positioning.y = 0;
|
|
79
|
-
positionSticky(stickyContainer, positioning);
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
var handlePointerUp = function handlePointerUp(event) {
|
|
83
|
-
var stickyContainer = stickyContainerRef.current;
|
|
84
|
-
var positioning = positioningRef.current;
|
|
85
|
-
if (stickyContainer !== null) {
|
|
86
|
-
positioning.isDragging = false;
|
|
87
|
-
stickyContainer.classList.remove("dragging");
|
|
88
|
-
editor.update(function () {
|
|
89
|
-
var node = lexical.$getNodeByKey(nodeKey);
|
|
90
|
-
if (StickyNode.$isStickyNode(node)) {
|
|
91
|
-
node.setPosition(positioning.x, positioning.y);
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
document.removeEventListener("pointermove", handlePointerMove);
|
|
96
|
-
document.removeEventListener("pointerup", handlePointerUp);
|
|
97
|
-
};
|
|
98
|
-
var handleDelete = function handleDelete() {
|
|
99
|
-
editor.update(function () {
|
|
100
|
-
var node = lexical.$getNodeByKey(nodeKey);
|
|
101
|
-
if (StickyNode.$isStickyNode(node)) {
|
|
102
|
-
node.remove();
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
};
|
|
106
|
-
var handleColorChange = function handleColorChange() {
|
|
107
|
-
editor.update(function () {
|
|
108
|
-
var node = lexical.$getNodeByKey(nodeKey);
|
|
109
|
-
if (StickyNode.$isStickyNode(node)) {
|
|
110
|
-
node.toggleColor();
|
|
111
|
-
}
|
|
112
|
-
});
|
|
113
|
-
};
|
|
114
|
-
var innerEditor = react.useMemo(function () {
|
|
115
|
-
var editor = lexical.createEditor({
|
|
116
|
-
editable: true
|
|
117
|
-
});
|
|
118
|
-
if (state) {
|
|
119
|
-
var editorState = editor.parseEditorState(state);
|
|
120
|
-
editor.setEditorState(editorState);
|
|
121
|
-
}
|
|
122
|
-
return editor;
|
|
123
|
-
}, []);
|
|
124
|
-
react.useEffect(function () {
|
|
125
|
-
if (innerEditor._editable) {
|
|
126
|
-
var dispose = innerEditor.registerUpdateListener(function (_ref2) {
|
|
127
|
-
_ref2.editorState;
|
|
128
|
-
editor.update(function () {
|
|
129
|
-
var node = lexical.$getNodeByKey(nodeKey);
|
|
130
|
-
if (StickyNode.$isStickyNode(node)) {
|
|
131
|
-
node.updateState(innerEditor.getEditorState().toJSON());
|
|
132
|
-
}
|
|
133
|
-
});
|
|
134
|
-
});
|
|
135
|
-
return function () {
|
|
136
|
-
dispose();
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
}, [innerEditor._editable]);
|
|
140
|
-
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
141
|
-
ref: stickyContainerRef,
|
|
142
|
-
className: "sticky__container",
|
|
143
|
-
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
144
|
-
className: "sticky__handle",
|
|
145
|
-
onPointerDown: function onPointerDown(event) {
|
|
146
|
-
var stickyContainer = stickyContainerRef.current;
|
|
147
|
-
if (stickyContainer == null || event.button === 2 || event.target !== stickyContainer.firstChild) {
|
|
148
|
-
// Right click or click on editor should not work
|
|
149
|
-
return;
|
|
150
|
-
}
|
|
151
|
-
var stickContainer = stickyContainer;
|
|
152
|
-
var positioning = positioningRef.current;
|
|
153
|
-
if (stickContainer !== null) {
|
|
154
|
-
positioning.offsetX = event.clientX;
|
|
155
|
-
positioning.offsetY = event.clientY;
|
|
156
|
-
positioning.rootElementRect = {
|
|
157
|
-
left: positioning.x,
|
|
158
|
-
top: positioning.y
|
|
159
|
-
};
|
|
160
|
-
positioning.isDragging = true;
|
|
161
|
-
stickContainer.classList.add("dragging");
|
|
162
|
-
document.addEventListener("pointermove", handlePointerMove);
|
|
163
|
-
document.addEventListener("pointerup", handlePointerUp);
|
|
164
|
-
event.preventDefault();
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
168
|
-
className: "sticky-note ".concat(color),
|
|
169
|
-
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
170
|
-
className: "sticky__tools",
|
|
171
|
-
children: [/*#__PURE__*/jsxRuntime.jsx("button", {
|
|
172
|
-
onClick: handleColorChange,
|
|
173
|
-
className: "sticky--color",
|
|
174
|
-
"aria-label": "Change sticky note color",
|
|
175
|
-
title: "Color",
|
|
176
|
-
children: /*#__PURE__*/jsxRuntime.jsx(core.Icon, {
|
|
177
|
-
icon: mdi.mdiFormatColorFill
|
|
178
|
-
})
|
|
179
|
-
}), /*#__PURE__*/jsxRuntime.jsx("button", {
|
|
180
|
-
onClick: handleDelete,
|
|
181
|
-
className: "sticky--delete",
|
|
182
|
-
"aria-label": "Delete sticky note",
|
|
183
|
-
title: "Delete",
|
|
184
|
-
children: /*#__PURE__*/jsxRuntime.jsx(core.Icon, {
|
|
185
|
-
icon: mdi.mdiClose
|
|
186
|
-
})
|
|
187
|
-
})]
|
|
188
|
-
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
189
|
-
className: "text-sm font-semibold",
|
|
190
|
-
children: user
|
|
191
|
-
}), /*#__PURE__*/jsxRuntime.jsxs(LexicalNestedComposer.LexicalNestedComposer, {
|
|
192
|
-
initialEditor: innerEditor,
|
|
193
|
-
initialTheme: {
|
|
194
|
-
paragraph: "sticky__paragraph",
|
|
195
|
-
text: {
|
|
196
|
-
bold: "editor-textBold",
|
|
197
|
-
code: "editor-textCode",
|
|
198
|
-
italic: "editor-textItalic",
|
|
199
|
-
strikethrough: "editor-textStrikethrough",
|
|
200
|
-
subscript: "editor-textSubscript",
|
|
201
|
-
superscript: "editor-textSuperscript",
|
|
202
|
-
underline: "editor-textUnderline",
|
|
203
|
-
underlineStrikethrough: "editor-textUnderlineStrikethrough"
|
|
204
|
-
}
|
|
205
|
-
},
|
|
206
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(LexicalRichTextPlugin.RichTextPlugin, {
|
|
207
|
-
contentEditable: /*#__PURE__*/jsxRuntime.jsx(LexicalContentEditable.ContentEditable, {
|
|
208
|
-
className: "sticky__editor"
|
|
209
|
-
}),
|
|
210
|
-
placeholder: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
211
|
-
className: "sticky-placeholder",
|
|
212
|
-
children: "Sticky note..."
|
|
213
|
-
}),
|
|
214
|
-
ErrorBoundary: LexicalErrorBoundary
|
|
215
|
-
}), /*#__PURE__*/jsxRuntime.jsx(LexicalAutoFocusPlugin.AutoFocusPlugin, {})]
|
|
216
|
-
})]
|
|
217
|
-
})]
|
|
218
|
-
});
|
|
219
|
-
};
|
|
220
|
-
|
|
221
|
-
exports.StickyComponent = StickyComponent;
|
|
@@ -1,218 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var _classCallCheck = require('@babel/runtime/helpers/classCallCheck');
|
|
4
|
-
var _createClass = require('@babel/runtime/helpers/createClass');
|
|
5
|
-
var _possibleConstructorReturn = require('@babel/runtime/helpers/possibleConstructorReturn');
|
|
6
|
-
var _getPrototypeOf = require('@babel/runtime/helpers/getPrototypeOf');
|
|
7
|
-
var _inherits = require('@babel/runtime/helpers/inherits');
|
|
8
|
-
var _asyncToGenerator = require('@babel/runtime/helpers/asyncToGenerator');
|
|
9
|
-
var _regeneratorRuntime = require('@babel/runtime/regenerator');
|
|
10
|
-
var lexical = require('lexical');
|
|
11
|
-
var react = require('react');
|
|
12
|
-
var reactDom = require('react-dom');
|
|
13
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
14
|
-
|
|
15
|
-
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
16
|
-
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
17
|
-
var StickyComponent = /*#__PURE__*/react.lazy( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
18
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
19
|
-
while (1) switch (_context.prev = _context.next) {
|
|
20
|
-
case 0:
|
|
21
|
-
_context.next = 2;
|
|
22
|
-
return Promise.resolve().then(function () { return require('../components/StickyComponent.js'); }).then(function (_ref2) {
|
|
23
|
-
var StickyComponent = _ref2.StickyComponent;
|
|
24
|
-
return {
|
|
25
|
-
"default": StickyComponent
|
|
26
|
-
};
|
|
27
|
-
});
|
|
28
|
-
case 2:
|
|
29
|
-
return _context.abrupt("return", _context.sent);
|
|
30
|
-
case 3:
|
|
31
|
-
case "end":
|
|
32
|
-
return _context.stop();
|
|
33
|
-
}
|
|
34
|
-
}, _callee);
|
|
35
|
-
})));
|
|
36
|
-
var convertStickyElement = function convertStickyElement(domNode) {
|
|
37
|
-
var sticky = domNode.getAttribute("data-lexical-sticky") === "true";
|
|
38
|
-
if (sticky) {
|
|
39
|
-
var _domNode$getAttribute, _domNode$getAttribute2, _domNode$getAttribute3, _domNode$getAttribute4;
|
|
40
|
-
var node = $createStickyNode({
|
|
41
|
-
xOffset: +((_domNode$getAttribute = domNode.getAttribute("data-x")) !== null && _domNode$getAttribute !== void 0 ? _domNode$getAttribute : "8"),
|
|
42
|
-
yOffset: +((_domNode$getAttribute2 = domNode.getAttribute("data-y")) !== null && _domNode$getAttribute2 !== void 0 ? _domNode$getAttribute2 : "8"),
|
|
43
|
-
user: (_domNode$getAttribute3 = domNode.getAttribute("data-user")) !== null && _domNode$getAttribute3 !== void 0 ? _domNode$getAttribute3 : "",
|
|
44
|
-
color: domNode.getAttribute("data-color"),
|
|
45
|
-
state: (_domNode$getAttribute4 = domNode.getAttribute("data-state")) !== null && _domNode$getAttribute4 !== void 0 ? _domNode$getAttribute4 : ""
|
|
46
|
-
});
|
|
47
|
-
return {
|
|
48
|
-
node: node
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
return null;
|
|
52
|
-
};
|
|
53
|
-
var colors = {
|
|
54
|
-
yellow: "green",
|
|
55
|
-
green: "blue",
|
|
56
|
-
blue: "pink",
|
|
57
|
-
pink: "yellow"
|
|
58
|
-
};
|
|
59
|
-
var StickyNode = /*#__PURE__*/function (_DecoratorNode) {
|
|
60
|
-
function StickyNode(x, y) {
|
|
61
|
-
var _this;
|
|
62
|
-
var user = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "";
|
|
63
|
-
var color = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "yellow";
|
|
64
|
-
var state = arguments.length > 4 ? arguments[4] : undefined;
|
|
65
|
-
var key = arguments.length > 5 ? arguments[5] : undefined;
|
|
66
|
-
_classCallCheck(this, StickyNode);
|
|
67
|
-
_this = _callSuper(this, StickyNode, [key]);
|
|
68
|
-
_this.__x = x;
|
|
69
|
-
_this.__y = y;
|
|
70
|
-
_this.__user = user;
|
|
71
|
-
_this.__state = state;
|
|
72
|
-
_this.__color = color;
|
|
73
|
-
return _this;
|
|
74
|
-
}
|
|
75
|
-
_inherits(StickyNode, _DecoratorNode);
|
|
76
|
-
return _createClass(StickyNode, [{
|
|
77
|
-
key: "exportJSON",
|
|
78
|
-
value: function exportJSON() {
|
|
79
|
-
return {
|
|
80
|
-
state: this.__state,
|
|
81
|
-
color: this.__color,
|
|
82
|
-
user: this.__user,
|
|
83
|
-
type: "sticky",
|
|
84
|
-
version: 1,
|
|
85
|
-
xOffset: this.__x,
|
|
86
|
-
yOffset: this.__y
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
}, {
|
|
90
|
-
key: "createDOM",
|
|
91
|
-
value: function createDOM(config) {
|
|
92
|
-
var div = document.createElement("div");
|
|
93
|
-
div.style.display = "contents";
|
|
94
|
-
return div;
|
|
95
|
-
}
|
|
96
|
-
}, {
|
|
97
|
-
key: "updateDOM",
|
|
98
|
-
value: function updateDOM() {
|
|
99
|
-
return false;
|
|
100
|
-
}
|
|
101
|
-
}, {
|
|
102
|
-
key: "exportDOM",
|
|
103
|
-
value: function exportDOM() {
|
|
104
|
-
var writable = this.getWritable();
|
|
105
|
-
var element = document.createElement("div");
|
|
106
|
-
element.setAttribute("data-lexical-sticky", "true");
|
|
107
|
-
element.setAttribute("data-x", "".concat(writable.__x));
|
|
108
|
-
element.setAttribute("data-y", "".concat(writable.__y));
|
|
109
|
-
element.setAttribute("data-user", "".concat(writable.__user));
|
|
110
|
-
element.setAttribute("data-color", "".concat(writable.__color));
|
|
111
|
-
element.setAttribute("data-state", "".concat(writable.__state));
|
|
112
|
-
return {
|
|
113
|
-
element: element
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
}, {
|
|
117
|
-
key: "setPosition",
|
|
118
|
-
value: function setPosition(x, y) {
|
|
119
|
-
var writable = this.getWritable();
|
|
120
|
-
writable.__x = x;
|
|
121
|
-
writable.__y = y;
|
|
122
|
-
}
|
|
123
|
-
}, {
|
|
124
|
-
key: "toggleColor",
|
|
125
|
-
value: function toggleColor() {
|
|
126
|
-
var _writable$__color;
|
|
127
|
-
var writable = this.getWritable();
|
|
128
|
-
writable.__color = colors[(_writable$__color = writable.__color) !== null && _writable$__color !== void 0 ? _writable$__color : "yellow"];
|
|
129
|
-
}
|
|
130
|
-
}, {
|
|
131
|
-
key: "updateState",
|
|
132
|
-
value: function updateState(text) {
|
|
133
|
-
var writable = this.getWritable();
|
|
134
|
-
writable.__state = text;
|
|
135
|
-
}
|
|
136
|
-
}, {
|
|
137
|
-
key: "decorate",
|
|
138
|
-
value: function decorate(editor, config) {
|
|
139
|
-
var _document$querySelect;
|
|
140
|
-
return /*#__PURE__*/reactDom.createPortal( /*#__PURE__*/jsxRuntime.jsx(react.Suspense, {
|
|
141
|
-
fallback: null,
|
|
142
|
-
children: /*#__PURE__*/jsxRuntime.jsx(StickyComponent, {
|
|
143
|
-
x: this.__x,
|
|
144
|
-
y: this.__y,
|
|
145
|
-
user: this.__user,
|
|
146
|
-
state: this.__state,
|
|
147
|
-
nodeKey: this.getKey(),
|
|
148
|
-
color: this.__color
|
|
149
|
-
})
|
|
150
|
-
}), (_document$querySelect = document.querySelector(".lexical-container")) !== null && _document$querySelect !== void 0 ? _document$querySelect : document.body);
|
|
151
|
-
}
|
|
152
|
-
}, {
|
|
153
|
-
key: "isIsolated",
|
|
154
|
-
value: function isIsolated() {
|
|
155
|
-
return true;
|
|
156
|
-
}
|
|
157
|
-
}], [{
|
|
158
|
-
key: "getType",
|
|
159
|
-
value: function getType() {
|
|
160
|
-
return "sticky";
|
|
161
|
-
}
|
|
162
|
-
}, {
|
|
163
|
-
key: "clone",
|
|
164
|
-
value: function clone(node) {
|
|
165
|
-
return new StickyNode(node.__x, node.__y, node.__user, node.__color, node.__state, node.__key);
|
|
166
|
-
}
|
|
167
|
-
}, {
|
|
168
|
-
key: "importJSON",
|
|
169
|
-
value: function importJSON(serializedNode) {
|
|
170
|
-
var stickyNode = new StickyNode(serializedNode.xOffset, serializedNode.yOffset, serializedNode.user, serializedNode.color, serializedNode.state);
|
|
171
|
-
return stickyNode;
|
|
172
|
-
}
|
|
173
|
-
}, {
|
|
174
|
-
key: "importDOM",
|
|
175
|
-
value: function importDOM() {
|
|
176
|
-
return {
|
|
177
|
-
div: function div(domNode) {
|
|
178
|
-
if (!domNode.hasAttribute("data-lexical-sticky")) {
|
|
179
|
-
return null;
|
|
180
|
-
}
|
|
181
|
-
return {
|
|
182
|
-
conversion: convertStickyElement,
|
|
183
|
-
priority: 2
|
|
184
|
-
};
|
|
185
|
-
},
|
|
186
|
-
span: function span(domNode) {
|
|
187
|
-
if (!domNode.hasAttribute("data-lexical-sticky")) {
|
|
188
|
-
return null;
|
|
189
|
-
}
|
|
190
|
-
return {
|
|
191
|
-
conversion: convertStickyElement,
|
|
192
|
-
priority: 1
|
|
193
|
-
};
|
|
194
|
-
}
|
|
195
|
-
};
|
|
196
|
-
}
|
|
197
|
-
}]);
|
|
198
|
-
}(lexical.DecoratorNode);
|
|
199
|
-
function $isStickyNode(node) {
|
|
200
|
-
return node instanceof StickyNode;
|
|
201
|
-
}
|
|
202
|
-
function $createStickyNode(_ref3) {
|
|
203
|
-
var _ref3$xOffset = _ref3.xOffset,
|
|
204
|
-
xOffset = _ref3$xOffset === void 0 ? 650 : _ref3$xOffset,
|
|
205
|
-
_ref3$yOffset = _ref3.yOffset,
|
|
206
|
-
yOffset = _ref3$yOffset === void 0 ? 32 : _ref3$yOffset,
|
|
207
|
-
_ref3$user = _ref3.user,
|
|
208
|
-
user = _ref3$user === void 0 ? "" : _ref3$user,
|
|
209
|
-
_ref3$color = _ref3.color,
|
|
210
|
-
color = _ref3$color === void 0 ? "yellow" : _ref3$color,
|
|
211
|
-
state = _ref3.state;
|
|
212
|
-
var node = new StickyNode(xOffset, yOffset, user, color, state);
|
|
213
|
-
return lexical.$applyNodeReplacement(node);
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
exports.$createStickyNode = $createStickyNode;
|
|
217
|
-
exports.$isStickyNode = $isStickyNode;
|
|
218
|
-
exports.StickyNode = StickyNode;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
|
|
4
|
-
var LexicalComposerContext = require('@lexical/react/LexicalComposerContext');
|
|
5
|
-
var react = require('react');
|
|
6
|
-
var StickyNode = require('../nodes/StickyNode.js');
|
|
7
|
-
|
|
8
|
-
var StickyPlugin = function StickyPlugin() {
|
|
9
|
-
var _useLexicalComposerCo = LexicalComposerContext.useLexicalComposerContext(),
|
|
10
|
-
_useLexicalComposerCo2 = _slicedToArray(_useLexicalComposerCo, 1),
|
|
11
|
-
editor = _useLexicalComposerCo2[0];
|
|
12
|
-
react.useEffect(function () {
|
|
13
|
-
if (!editor.hasNodes([StickyNode.StickyNode])) {
|
|
14
|
-
throw new Error("StickyPlugin: StickyNode not registered on editor");
|
|
15
|
-
}
|
|
16
|
-
}, [editor]);
|
|
17
|
-
return null;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
exports.StickyPlugin = StickyPlugin;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
@layer util{.lexicalEditor,.lexicalToolbar{margin:0 auto;width:21cm}.lexicalEditor :global{.editor-container.editor-container.editor-container{background-color:#fff;color:#0f172a;font-family:Sakkal Majalla;font-size:18px}.editor-heading-h1{font-size:1.5em;margin-bottom:1.5em;text-transform:capitalize}.editor-heading-h1,.editor-heading-h2{font-weight:600;line-height:1.5;margin-top:1.5em;padding:0 4px}.editor-heading-h2{font-size:1.25em;margin-bottom:1em}.editor-heading-h6{color:#b45309;font-size:.875em;font-weight:600;line-height:1.25;margin-bottom:1.5em;margin-top:1.5em}.editor-paragraph{font-size:1em}.editor-paragraph,.editor-quote{line-height:1.5;margin-bottom:1.5em;margin-top:1.5em}.editor-quote{border-color:#64748b;padding-inline-start:1em}.editor-code,.editor-quote{border-inline-start-width:4px;color:#1e293b;display:block;font-size:1.125em}.editor-code{background-color:#e2e8f0;line-height:1.5;margin-bottom:1.5em;margin-top:1.5em;padding:1em}.editor-textUnderline{text-decoration:underline}.editor-textStrikethrough{text-decoration:line-through}.editor-textUnderlineStrikethrough{text-decoration:underline line-through}.editor-page-break{page-break-after:always}.editor-no-break{page-break-inside:avoid}.editor-textSmall{font-size:.875em}.editor-textBold{font-weight:600}.editor-textItalic{font-style:italic}.editor-textMuted{color:#4b5563}.editor-list-ul{list-style:disc;padding-inline-start:.5em}.editor-list-ol{list-style:decimal;padding-inline-start:.5em}.editor-listItem{margin-inline-start:1em;text-align:start}@media print{body,html{margin:0;min-height:100vh}div,h1,h2,h3,h4,h5,h6,p,span{box-sizing:border-box}body.report-template{background-size:0;min-height:100vh}body:after{background-image:inherit;content:"";height:100vh;inset:0;margin:0 auto;max-width:21cm;position:fixed;-webkit-print-color-adjust:exact;print-color-adjust:exact;width:100vw;z-index:10}.editor-page-break>div,.sticky__container{display:none}.editor-container{position:relative}.editor-editor{box-sizing:border-box;padding:0 2cm}}}}
|