@lexical/react 0.2.9 → 0.3.0
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/DEPRECATED_useLexical.dev.js +55 -4
- package/DEPRECATED_useLexical.js.flow +23 -0
- package/DEPRECATED_useLexical.prod.js +3 -1
- package/DEPRECATED_useLexicalAutoFormatter.dev.js +1 -2
- package/DEPRECATED_useLexicalAutoFormatter.js.flow +12 -0
- package/DEPRECATED_useLexicalAutoFormatter.prod.js +1 -1
- package/DEPRECATED_useLexicalCanShowPlaceholder.dev.js +6 -8
- package/DEPRECATED_useLexicalCanShowPlaceholder.js.flow +12 -0
- package/DEPRECATED_useLexicalCanShowPlaceholder.prod.js +2 -1
- package/DEPRECATED_useLexicalCharacterLimit.dev.js +5 -3
- package/DEPRECATED_useLexicalCharacterLimit.js.flow +28 -0
- package/DEPRECATED_useLexicalCharacterLimit.prod.js +6 -6
- package/DEPRECATED_useLexicalDecorators.dev.js +7 -5
- package/DEPRECATED_useLexicalDecorators.js.flow +14 -0
- package/DEPRECATED_useLexicalDecorators.prod.js +2 -2
- package/DEPRECATED_useLexicalEditor.dev.js +55 -3
- package/DEPRECATED_useLexicalEditor.prod.js +2 -1
- package/DEPRECATED_useLexicalEditorEvents.dev.js +1 -5
- package/DEPRECATED_useLexicalEditorEvents.js.flow +19 -0
- package/DEPRECATED_useLexicalEditorEvents.prod.js +2 -2
- package/DEPRECATED_useLexicalHistory.dev.js +0 -2
- package/DEPRECATED_useLexicalHistory.js.flow +31 -0
- package/DEPRECATED_useLexicalHistory.prod.js +1 -1
- package/DEPRECATED_useLexicalList.dev.js +3 -5
- package/DEPRECATED_useLexicalList.js.flow +10 -0
- package/DEPRECATED_useLexicalList.prod.js +2 -2
- package/DEPRECATED_useLexicalPlainText.dev.js +1 -7
- package/DEPRECATED_useLexicalPlainText.js.flow +15 -0
- package/DEPRECATED_useLexicalPlainText.prod.js +2 -2
- package/DEPRECATED_useLexicalRichText.dev.js +1 -7
- package/DEPRECATED_useLexicalRichText.js.flow +15 -0
- package/DEPRECATED_useLexicalRichText.prod.js +2 -2
- package/LexicalAutoFocusPlugin.d.ts +1 -1
- package/LexicalAutoFocusPlugin.dev.js +17 -4
- package/LexicalAutoFocusPlugin.js.flow +1 -1
- package/LexicalAutoFocusPlugin.prod.js +1 -1
- package/LexicalAutoLinkPlugin.d.ts +1 -1
- package/LexicalAutoLinkPlugin.dev.js +4 -5
- package/LexicalAutoLinkPlugin.js.flow +2 -1
- package/LexicalAutoLinkPlugin.prod.js +5 -5
- package/LexicalAutoScrollPlugin.d.ts +1 -1
- package/LexicalAutoScrollPlugin.dev.js +2 -5
- package/LexicalAutoScrollPlugin.js.flow +1 -3
- package/LexicalAutoScrollPlugin.prod.js +2 -2
- package/LexicalBlockWithAlignableContents.d.ts +1 -3
- package/LexicalBlockWithAlignableContents.dev.js +7 -9
- package/LexicalBlockWithAlignableContents.prod.js +4 -4
- package/LexicalCharacterLimitPlugin.d.ts +1 -1
- package/LexicalCharacterLimitPlugin.dev.js +6 -5
- package/LexicalCharacterLimitPlugin.js.flow +1 -1
- package/LexicalCharacterLimitPlugin.prod.js +8 -8
- package/LexicalCheckListPlugin.d.ts +1 -1
- package/LexicalCheckListPlugin.dev.js +7 -15
- package/LexicalCheckListPlugin.js.flow +1 -1
- package/LexicalCheckListPlugin.prod.js +7 -7
- package/LexicalClearEditorPlugin.d.ts +2 -6
- package/LexicalClearEditorPlugin.dev.js +2 -5
- package/LexicalClearEditorPlugin.js.flow +1 -1
- package/LexicalClearEditorPlugin.prod.js +2 -2
- package/LexicalCollaborationPlugin.d.ts +1 -0
- package/LexicalCollaborationPlugin.dev.js +9 -5
- package/LexicalCollaborationPlugin.prod.js +9 -9
- package/LexicalComposer.d.ts +2 -2
- package/LexicalComposer.dev.js +1 -6
- package/LexicalComposer.js.flow +1 -1
- package/LexicalComposer.prod.js +2 -2
- package/LexicalComposerContext.dev.js +0 -1
- package/LexicalComposerContext.prod.js +1 -1
- package/LexicalContentEditable.d.ts +2 -5
- package/LexicalContentEditable.dev.js +5 -7
- package/LexicalContentEditable.js.flow +1 -3
- package/LexicalContentEditable.prod.js +3 -3
- package/LexicalDecoratorBlockNode.d.ts +11 -2
- package/LexicalDecoratorBlockNode.dev.js +8 -1
- package/LexicalDecoratorBlockNode.prod.js +1 -1
- package/LexicalHashtagPlugin.d.ts +1 -1
- package/LexicalHashtagPlugin.dev.js +2 -3
- package/LexicalHashtagPlugin.js.flow +1 -1
- package/LexicalHashtagPlugin.prod.js +3 -3
- package/LexicalHistoryPlugin.d.ts +1 -0
- package/LexicalHistoryPlugin.dev.js +0 -2
- package/LexicalHistoryPlugin.prod.js +1 -1
- package/LexicalHorizontalRuleNode.d.ts +1 -1
- package/LexicalHorizontalRuleNode.dev.js +11 -1
- package/LexicalHorizontalRuleNode.prod.js +3 -3
- package/LexicalLinkPlugin.d.ts +1 -1
- package/LexicalLinkPlugin.dev.js +3 -107
- package/LexicalLinkPlugin.js.flow +1 -1
- package/LexicalLinkPlugin.prod.js +1 -4
- package/LexicalListPlugin.d.ts +1 -1
- package/LexicalListPlugin.dev.js +9 -6
- package/LexicalListPlugin.js.flow +1 -1
- package/LexicalListPlugin.prod.js +3 -3
- package/LexicalMarkdownShortcutPlugin.d.ts +2 -2
- package/LexicalMarkdownShortcutPlugin.dev.js +7 -83
- package/LexicalMarkdownShortcutPlugin.js.flow +2 -2
- package/LexicalMarkdownShortcutPlugin.prod.js +2 -3
- package/LexicalNestedComposer.d.ts +1 -1
- package/LexicalNestedComposer.dev.js +1 -2
- package/LexicalNestedComposer.js.flow +1 -1
- package/LexicalNestedComposer.prod.js +3 -3
- package/LexicalOnChangePlugin.d.ts +2 -1
- package/LexicalOnChangePlugin.dev.js +1 -4
- package/LexicalOnChangePlugin.js.flow +1 -1
- package/LexicalOnChangePlugin.prod.js +2 -2
- package/LexicalPlainTextPlugin.d.ts +3 -2
- package/LexicalPlainTextPlugin.dev.js +12 -10
- package/LexicalPlainTextPlugin.js.flow +1 -1
- package/LexicalPlainTextPlugin.prod.js +4 -4
- package/LexicalRichTextPlugin.d.ts +3 -2
- package/LexicalRichTextPlugin.dev.js +12 -10
- package/LexicalRichTextPlugin.js.flow +1 -1
- package/LexicalRichTextPlugin.prod.js +4 -4
- package/LexicalTablePlugin.d.ts +1 -1
- package/LexicalTablePlugin.dev.js +7 -8
- package/LexicalTablePlugin.js.flow +1 -1
- package/LexicalTablePlugin.prod.js +4 -4
- package/LexicalTreeView.d.ts +2 -1
- package/LexicalTreeView.dev.js +4 -5
- package/LexicalTreeView.js.flow +1 -1
- package/LexicalTreeView.prod.js +11 -11
- package/README.md +10 -6
- package/package.json +19 -19
- package/useLexicalIsTextContentEmpty.d.ts +2 -1
- package/useLexicalIsTextContentEmpty.dev.js +2 -5
- package/useLexicalIsTextContentEmpty.js.flow +1 -1
- package/useLexicalIsTextContentEmpty.prod.js +1 -1
- package/useLexicalNodeSelection.d.ts +2 -1
- package/useLexicalNodeSelection.dev.js +1 -2
- package/useLexicalNodeSelection.js.flow +1 -1
- package/useLexicalNodeSelection.prod.js +2 -2
- package/useLexicalTextEntity.d.ts +2 -1
- package/useLexicalTextEntity.dev.js +1 -2
- package/useLexicalTextEntity.js.flow +1 -1
- package/useLexicalTextEntity.prod.js +1 -1
|
@@ -18,9 +18,8 @@ var react = require('react');
|
|
|
18
18
|
* This source code is licensed under the MIT license found in the
|
|
19
19
|
* LICENSE file in the root directory of this source tree.
|
|
20
20
|
*
|
|
21
|
-
*
|
|
22
21
|
*/
|
|
23
|
-
function
|
|
22
|
+
function CheckListPlugin() {
|
|
24
23
|
const [editor] = LexicalComposerContext.useLexicalComposerContext();
|
|
25
24
|
react.useEffect(() => {
|
|
26
25
|
return utils.mergeRegister(editor.registerCommand(list.INSERT_CHECK_LIST_COMMAND, () => {
|
|
@@ -96,17 +95,13 @@ let listenersCount = 0;
|
|
|
96
95
|
|
|
97
96
|
function listenPointerDown() {
|
|
98
97
|
if (listenersCount++ === 0) {
|
|
99
|
-
|
|
100
|
-
document.addEventListener('click', handleClick); // $FlowFixMe[speculation-ambiguous]
|
|
101
|
-
|
|
98
|
+
document.addEventListener('click', handleClick);
|
|
102
99
|
document.addEventListener('pointerdown', handlePointerDown);
|
|
103
100
|
}
|
|
104
101
|
|
|
105
102
|
return () => {
|
|
106
103
|
if (--listenersCount === 0) {
|
|
107
|
-
|
|
108
|
-
document.removeEventListener('click', handleClick); // $FlowFixMe[speculation-ambiguous]
|
|
109
|
-
|
|
104
|
+
document.removeEventListener('click', handleClick);
|
|
110
105
|
document.removeEventListener('pointerdown', handlePointerDown);
|
|
111
106
|
}
|
|
112
107
|
};
|
|
@@ -118,7 +113,6 @@ function handleCheckItemEvent(event, callback) {
|
|
|
118
113
|
if (!(target instanceof HTMLElement)) {
|
|
119
114
|
return;
|
|
120
115
|
} // Ignore clicks on LI that have nested lists
|
|
121
|
-
// $FlowFixMe
|
|
122
116
|
|
|
123
117
|
|
|
124
118
|
const firstChild = target.firstChild;
|
|
@@ -127,7 +121,7 @@ function handleCheckItemEvent(event, callback) {
|
|
|
127
121
|
return;
|
|
128
122
|
}
|
|
129
123
|
|
|
130
|
-
const parentNode = target.parentNode; //
|
|
124
|
+
const parentNode = target.parentNode; // @ts-ignore internal field
|
|
131
125
|
|
|
132
126
|
if (!parentNode || parentNode.__lexicalListType !== 'check') {
|
|
133
127
|
return;
|
|
@@ -180,10 +174,8 @@ function findEditor(target) {
|
|
|
180
174
|
}
|
|
181
175
|
|
|
182
176
|
function getActiveCheckListItem() {
|
|
183
|
-
const
|
|
184
|
-
|
|
185
|
-
} = document;
|
|
186
|
-
return activeElement != null && activeElement.tagName === 'LI' && activeElement.parentNode != null && // $FlowFixMe[prop-missing] internal field
|
|
177
|
+
const activeElement = document.activeElement;
|
|
178
|
+
return activeElement != null && activeElement.tagName === 'LI' && activeElement.parentNode != null && // @ts-ignore internal field
|
|
187
179
|
activeElement.parentNode.__lexicalListType === 'check' ? activeElement : null;
|
|
188
180
|
}
|
|
189
181
|
|
|
@@ -244,4 +236,4 @@ function handleArrownUpOrDown(event, editor, backward) {
|
|
|
244
236
|
return false;
|
|
245
237
|
}
|
|
246
238
|
|
|
247
|
-
|
|
239
|
+
exports.CheckListPlugin = CheckListPlugin;
|
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
var e=require("@lexical/list"),g=require("@lexical/react/LexicalComposerContext"),k=require("@lexical/utils"),l=require("lexical"),m=require("react");let n=0;function p(){0===n++&&(document.addEventListener("click",q),document.addEventListener("pointerdown",r));return()=>{0===--n&&(document.removeEventListener("click",q),document.removeEventListener("pointerdown",r))}}
|
|
8
|
-
function t(a,c){
|
|
9
|
-
function
|
|
7
|
+
'use strict';var e=require("@lexical/list"),g=require("@lexical/react/LexicalComposerContext"),k=require("@lexical/utils"),l=require("lexical"),m=require("react");let n=0;function p(){0===n++&&(document.addEventListener("click",q),document.addEventListener("pointerdown",r));return()=>{0===--n&&(document.removeEventListener("click",q),document.removeEventListener("pointerdown",r))}}
|
|
8
|
+
function t(a,c){let b=a.target;if(b instanceof HTMLElement){var d=b.firstChild;(null==d||"UL"!==d.tagName&&"OL"!==d.tagName)&&(d=b.parentNode)&&"check"===d.__lexicalListType&&(a=a.pageX,d=b.getBoundingClientRect(),("rtl"===b.dir?a<d.right&&a>d.right-20:a>d.left&&a<d.left+20)&&c())}}function q(a){t(a,()=>{let c=u(a.target);null!=c&&c.update(()=>{let b=l.$getNearestNodeFromDOMNode(a.target);e.$isListItemNode(b)&&(a.target.focus(),b.toggleChecked())})})}function r(a){t(a,()=>{a.preventDefault()})}
|
|
9
|
+
function u(a){for(;a;){if(a.__lexicalEditor)return a.__lexicalEditor;a=a.parentNode}return null}function v(){let a=document.activeElement;return null!=a&&"LI"===a.tagName&&null!=a.parentNode&&"check"===a.parentNode.__lexicalListType?a:null}
|
|
10
10
|
function w(a,c){let b=c?a.getPreviousSibling():a.getNextSibling();for(;null==b&&e.$isListItemNode(a);)a=a.getParentOrThrow().getParent(),null!=a&&(b=c?a.getPreviousSibling():a.getNextSibling());for(;e.$isListItemNode(b);){a=c?b.getLastChild():b.getFirstChild();if(!e.$isListNode(a))return b;b=c?a.getLastChild():a.getFirstChild()}return null}
|
|
11
|
-
function x(a,c,b){
|
|
12
|
-
|
|
13
|
-
a.registerCommand(l.KEY_SPACE_COMMAND,c=>{
|
|
14
|
-
|
|
11
|
+
function x(a,c,b){let d=v();null!=d&&c.update(()=>{var f=l.$getNearestNodeFromDOMNode(d);if(e.$isListItemNode(f)&&(f=w(f,b),null!=f)){f.selectStart();let h=c.getElementByKey(f.__key);null!=h&&(a.preventDefault(),setTimeout(()=>{h.focus()},0))}});return!1}
|
|
12
|
+
exports.CheckListPlugin=function(){let [a]=g.useLexicalComposerContext();m.useEffect(()=>k.mergeRegister(a.registerCommand(e.INSERT_CHECK_LIST_COMMAND,()=>{e.insertList(a,"check");return!0},l.COMMAND_PRIORITY_LOW),a.registerCommand(l.KEY_ARROW_DOWN_COMMAND,c=>x(c,a,!1),l.COMMAND_PRIORITY_LOW),a.registerCommand(l.KEY_ARROW_UP_COMMAND,c=>x(c,a,!0),l.COMMAND_PRIORITY_LOW),a.registerCommand(l.KEY_ESCAPE_COMMAND,()=>{if(null!=v()){let c=a.getRootElement();null!=c&&c.focus();return!0}return!1},l.COMMAND_PRIORITY_LOW),
|
|
13
|
+
a.registerCommand(l.KEY_SPACE_COMMAND,c=>{let b=v();return null!=b?(a.update(()=>{let d=l.$getNearestNodeFromDOMNode(b);e.$isListItemNode(d)&&(c.preventDefault(),d.toggleChecked())}),!0):!1},l.COMMAND_PRIORITY_LOW),a.registerCommand(l.KEY_ARROW_LEFT_COMMAND,c=>a.getEditorState().read(()=>{var b=l.$getSelection();if(l.$isRangeSelection(b)&&b.isCollapsed()){var {anchor:d}=b;if((b="element"===d.type)||0===d.offset){d=d.getNode();let f=k.$findMatchingParent(d,h=>l.$isElementNode(h)&&!h.isInline());if(e.$isListItemNode(f)&&
|
|
14
|
+
(b||f.getFirstDescendant()===d)&&(b=a.getElementByKey(f.__key),null!=b&&document.activeElement!==b))return b.focus(),c.preventDefault(),!0}}return!1}),l.COMMAND_PRIORITY_LOW),p()));return null}
|
|
@@ -4,13 +4,9 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
|
-
* @flow strict
|
|
8
7
|
*/
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
type Props = $ReadOnly<{
|
|
9
|
+
type Props = Readonly<{
|
|
12
10
|
onClear?: () => void;
|
|
13
11
|
}>;
|
|
14
|
-
export
|
|
15
|
-
arg0: Props,
|
|
16
|
-
): JSX.Element | null;
|
|
12
|
+
export function ClearEditorPlugin(arg0: Props): JSX.Element | null;
|
|
@@ -16,7 +16,6 @@ var react = require('react');
|
|
|
16
16
|
* This source code is licensed under the MIT license found in the
|
|
17
17
|
* LICENSE file in the root directory of this source tree.
|
|
18
18
|
*
|
|
19
|
-
*
|
|
20
19
|
*/
|
|
21
20
|
const CAN_USE_DOM = typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined';
|
|
22
21
|
|
|
@@ -26,7 +25,6 @@ const CAN_USE_DOM = typeof window !== 'undefined' && typeof window.document !==
|
|
|
26
25
|
* This source code is licensed under the MIT license found in the
|
|
27
26
|
* LICENSE file in the root directory of this source tree.
|
|
28
27
|
*
|
|
29
|
-
*
|
|
30
28
|
*/
|
|
31
29
|
const useLayoutEffectImpl = CAN_USE_DOM ? react.useLayoutEffect : react.useEffect;
|
|
32
30
|
var useLayoutEffect = useLayoutEffectImpl;
|
|
@@ -37,9 +35,8 @@ var useLayoutEffect = useLayoutEffectImpl;
|
|
|
37
35
|
* This source code is licensed under the MIT license found in the
|
|
38
36
|
* LICENSE file in the root directory of this source tree.
|
|
39
37
|
*
|
|
40
|
-
*
|
|
41
38
|
*/
|
|
42
|
-
function
|
|
39
|
+
function ClearEditorPlugin({
|
|
43
40
|
onClear
|
|
44
41
|
}) {
|
|
45
42
|
const [editor] = LexicalComposerContext.useLexicalComposerContext();
|
|
@@ -66,4 +63,4 @@ function LexicalClearEditorPlugin({
|
|
|
66
63
|
return null;
|
|
67
64
|
}
|
|
68
65
|
|
|
69
|
-
|
|
66
|
+
exports.ClearEditorPlugin = ClearEditorPlugin;
|
|
@@ -4,5 +4,5 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
var a=require("@lexical/react/LexicalComposerContext"),d=require("lexical"),g=require("react"),h="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement?g.useLayoutEffect:g.useEffect;
|
|
8
|
-
|
|
7
|
+
'use strict';var a=require("@lexical/react/LexicalComposerContext"),d=require("lexical"),g=require("react"),h="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement?g.useLayoutEffect:g.useEffect;
|
|
8
|
+
exports.ClearEditorPlugin=function({onClear:b}){let [c]=a.useLexicalComposerContext();h(()=>c.registerCommand(d.CLEAR_EDITOR_COMMAND,()=>{c.update(()=>{if(null==b){let e=d.$getRoot(),k=d.$getSelection(),f=d.$createParagraphNode();e.clear();e.append(f);null!==k&&f.select()}else b()});return!0},d.COMMAND_PRIORITY_EDITOR),[c,b]);return null}
|
|
@@ -19,7 +19,6 @@ var reactDom = require('react-dom');
|
|
|
19
19
|
* This source code is licensed under the MIT license found in the
|
|
20
20
|
* LICENSE file in the root directory of this source tree.
|
|
21
21
|
*
|
|
22
|
-
*
|
|
23
22
|
*/
|
|
24
23
|
function useYjsCollaboration(editor, id, provider, docMap, name, color, shouldBootstrap) {
|
|
25
24
|
const isReloadingDoc = React.useRef(false);
|
|
@@ -205,6 +204,12 @@ function clearEditorSkipCollab(editor, binding) {
|
|
|
205
204
|
return;
|
|
206
205
|
}
|
|
207
206
|
|
|
207
|
+
const cursors = binding.cursors;
|
|
208
|
+
|
|
209
|
+
if (cursors == null) {
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
|
|
208
213
|
const cursorsContainer = binding.cursorsContainer;
|
|
209
214
|
|
|
210
215
|
if (cursorsContainer == null) {
|
|
@@ -212,10 +217,10 @@ function clearEditorSkipCollab(editor, binding) {
|
|
|
212
217
|
} // reset cursors in dom
|
|
213
218
|
|
|
214
219
|
|
|
215
|
-
const
|
|
220
|
+
const cursorsArr = Array.from(cursors.values());
|
|
216
221
|
|
|
217
|
-
for (let i = 0; i <
|
|
218
|
-
const cursor =
|
|
222
|
+
for (let i = 0; i < cursorsArr.length; i++) {
|
|
223
|
+
const cursor = cursorsArr[i];
|
|
219
224
|
const selection = cursor.selection;
|
|
220
225
|
|
|
221
226
|
if (selection && selection.selections != null) {
|
|
@@ -234,7 +239,6 @@ function clearEditorSkipCollab(editor, binding) {
|
|
|
234
239
|
* This source code is licensed under the MIT license found in the
|
|
235
240
|
* LICENSE file in the root directory of this source tree.
|
|
236
241
|
*
|
|
237
|
-
*
|
|
238
242
|
*/
|
|
239
243
|
const entries = [['Cat', '255,165,0'], ['Dog', '0,200,55'], ['Rabbit', '160,0,200'], ['Frog', '0,172,200'], ['Fox', '197,200,0'], ['Hedgehog', '31,200,0'], ['Pigeon', '200,0,0'], ['Squirrel', '200,0,148'], ['Bear', '255,235,0'], ['Tiger', '86,255,0'], ['Leopard', '0,255,208'], ['Zebra', '0,243,255'], ['Wolf', '0,102,255'], ['Owl', '147,0,255'], ['Gull', '255,0,153'], ['Squid', '0,220,255']];
|
|
240
244
|
const randomEntry = entries[Math.floor(Math.random() * entries.length)];
|
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
var e=require("@lexical/react/LexicalComposerContext"),f=require("react"),h=require("@lexical/utils"),x=require("@lexical/yjs"),F=require("lexical"),G=require("react-dom");
|
|
8
|
-
function H(b,c,a,d,l,p,q){
|
|
9
|
-
a,k)};x.initLocalState(a,l,p,document.activeElement===b.getRootElement());
|
|
10
|
-
|
|
7
|
+
'use strict';var e=require("@lexical/react/LexicalComposerContext"),f=require("react"),h=require("@lexical/utils"),x=require("@lexical/yjs"),F=require("lexical"),G=require("react-dom");
|
|
8
|
+
function H(b,c,a,d,l,p,q){let n=f.useRef(!1),[r,v]=f.useState(d.get(c)),g=f.useMemo(()=>x.createBinding(b,a,c,r,d),[b,a,c,d,r]),t=f.useCallback(()=>{a.connect()},[a]),u=f.useCallback(()=>{try{a.disconnect()}catch(m){}},[a]);f.useEffect(()=>{let {root:m}=g,{awareness:y}=a,z=({status:k})=>{b.dispatchCommand(x.CONNECTED_COMMAND,"connected"===k)},A=k=>{q&&k&&m.isEmpty()&&0===m._xmlText._length&&!1===n.current&&I(b);n.current=!1},B=()=>{x.syncCursorPositions(g,a)},C=(k,w)=>{w.origin!==g&&x.syncYjsChangesToLexical(g,
|
|
9
|
+
a,k)};x.initLocalState(a,l,p,document.activeElement===b.getRootElement());let D=k=>{J(b,g);v(k);d.set(c,k);n.current=!0};a.on("reload",D);a.on("status",z);a.on("sync",A);y.on("update",B);m.getSharedType().observeDeep(C);let R=b.registerUpdateListener(({prevEditorState:k,editorState:w,dirtyLeaves:O,dirtyElements:P,normalizedNodes:Q,tags:E})=>{!1===E.has("skip-collab")&&x.syncLexicalUpdateToYjs(g,a,k,w,P,O,Q,E)});t();return()=>{!1===n.current&&u();a.off("sync",A);a.off("status",z);a.off("reload",D);
|
|
10
|
+
y.off("update",B);m.getSharedType().unobserveDeep(C);R()}},[g,p,t,u,d,b,c,l,a,q]);let S=f.useMemo(()=>G.createPortal(f.createElement("div",{ref:m=>{g.cursorsContainer=m}}),document.body),[g]);f.useEffect(()=>b.registerCommand(x.TOGGLE_CONNECT_COMMAND,m=>{void 0!==t&&void 0!==u&&(m?(console.log("Collaboration connected!"),t()):(console.log("Collaboration disconnected!"),u()));return!0},F.COMMAND_PRIORITY_EDITOR),[t,u,b]);return[S,g]}
|
|
11
11
|
function K(b,c,a,d){f.useEffect(()=>h.mergeRegister(b.registerCommand(F.FOCUS_COMMAND,()=>{x.setLocalStateFocus(c,a,d,!0);return!0},F.COMMAND_PRIORITY_EDITOR),b.registerCommand(F.BLUR_COMMAND,()=>{x.setLocalStateFocus(c,a,d,!1);return!0},F.COMMAND_PRIORITY_EDITOR)),[d,b,a,c])}
|
|
12
|
-
function L(b,c){
|
|
13
|
-
function I(b){b.update(()=>{var c=F.$getRoot();if(null===c.getFirstChild()){
|
|
14
|
-
function J(b,c){b.update(()=>{
|
|
15
|
-
|
|
16
|
-
function U(b){
|
|
12
|
+
function L(b,c){let a=f.useMemo(()=>x.createUndoManager(c,c.root.getSharedType()),[c]);f.useEffect(()=>h.mergeRegister(b.registerCommand(F.UNDO_COMMAND,()=>{a.undo();return!0},F.COMMAND_PRIORITY_EDITOR),b.registerCommand(F.REDO_COMMAND,()=>{a.redo();return!0},F.COMMAND_PRIORITY_EDITOR)));return f.useCallback(()=>{a.clear()},[a])}
|
|
13
|
+
function I(b){b.update(()=>{var c=F.$getRoot();if(null===c.getFirstChild()){let a=F.$createParagraphNode();c.append(a);c=document.activeElement;(null!==F.$getSelection()||null!==c&&c===b.getRootElement())&&a.select()}},{tag:"history-merge"})}
|
|
14
|
+
function J(b,c){b.update(()=>{let d=F.$getRoot();d.clear();d.select()},{tag:"skip-collab"});if(null!=c.cursors&&(b=c.cursors,null!=b&&(c=c.cursorsContainer,null!=c))){b=Array.from(b.values());for(let d=0;d<b.length;d++){var a=b[d].selection;if(a&&null!=a.selections){a=a.selections;for(let l=0;l<a.length;l++)c.removeChild(a[d])}}}}
|
|
15
|
+
let M=[["Cat","255,165,0"],["Dog","0,200,55"],["Rabbit","160,0,200"],["Frog","0,172,200"],["Fox","197,200,0"],["Hedgehog","31,200,0"],["Pigeon","200,0,0"],["Squirrel","200,0,148"],["Bear","255,235,0"],["Tiger","86,255,0"],["Leopard","0,255,208"],["Zebra","0,243,255"],["Wolf","0,102,255"],["Owl","147,0,255"],["Gull","255,0,153"],["Squid","0,220,255"]],N=M[Math.floor(Math.random()*M.length)],T=f.createContext({clientID:0,color:N[1],name:N[0],yjsDocMap:new Map});
|
|
16
|
+
function U(b){let c=f.useContext(T);null!=b&&(c.name=b);return c}exports.CollaborationContext=T;exports.CollaborationPlugin=function({id:b,providerFactory:c,shouldBootstrap:a,username:d}){d=U(d);let {yjsDocMap:l,name:p,color:q}=d,[n]=e.useLexicalComposerContext(),r=f.useMemo(()=>c(b,l),[b,c,l]),[v,g]=H(n,b,r,l,p,q,a);d.clientID=g.clientID;L(n,g);K(n,r,p,q);return v};exports.useCollaborationContext=U
|
package/LexicalComposer.d.ts
CHANGED
|
@@ -8,15 +8,15 @@
|
|
|
8
8
|
|
|
9
9
|
import {Class} from 'utility-types';
|
|
10
10
|
import type {EditorThemeClasses, LexicalEditor, LexicalNode} from 'lexical';
|
|
11
|
+
|
|
11
12
|
type Props = {
|
|
12
13
|
initialConfig: {
|
|
13
14
|
editor__DEPRECATED?: LexicalEditor | null;
|
|
14
15
|
readOnly?: boolean;
|
|
15
|
-
namespace?: string;
|
|
16
16
|
nodes?: Array<Class<LexicalNode>>;
|
|
17
17
|
theme?: EditorThemeClasses;
|
|
18
18
|
onError: (error: Error, editor: LexicalEditor) => void;
|
|
19
19
|
};
|
|
20
20
|
children: JSX.Element | JSX.Element[] | null;
|
|
21
21
|
};
|
|
22
|
-
export
|
|
22
|
+
export function LexicalComposer(arg0: Props): JSX.Element | null;
|
package/LexicalComposer.dev.js
CHANGED
|
@@ -16,7 +16,6 @@ var React = require('react');
|
|
|
16
16
|
* This source code is licensed under the MIT license found in the
|
|
17
17
|
* LICENSE file in the root directory of this source tree.
|
|
18
18
|
*
|
|
19
|
-
*
|
|
20
19
|
*/
|
|
21
20
|
const CAN_USE_DOM = typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined';
|
|
22
21
|
|
|
@@ -26,7 +25,6 @@ const CAN_USE_DOM = typeof window !== 'undefined' && typeof window.document !==
|
|
|
26
25
|
* This source code is licensed under the MIT license found in the
|
|
27
26
|
* LICENSE file in the root directory of this source tree.
|
|
28
27
|
*
|
|
29
|
-
*
|
|
30
28
|
*/
|
|
31
29
|
const useLayoutEffectImpl = CAN_USE_DOM ? React.useLayoutEffect : React.useEffect;
|
|
32
30
|
var useLayoutEffect = useLayoutEffectImpl;
|
|
@@ -37,7 +35,6 @@ var useLayoutEffect = useLayoutEffectImpl;
|
|
|
37
35
|
* This source code is licensed under the MIT license found in the
|
|
38
36
|
* LICENSE file in the root directory of this source tree.
|
|
39
37
|
*
|
|
40
|
-
*
|
|
41
38
|
*/
|
|
42
39
|
function LexicalComposer({
|
|
43
40
|
initialConfig,
|
|
@@ -46,7 +43,6 @@ function LexicalComposer({
|
|
|
46
43
|
const composerContext = React.useMemo(() => {
|
|
47
44
|
const {
|
|
48
45
|
theme,
|
|
49
|
-
namespace,
|
|
50
46
|
editor__DEPRECATED: initialEditor,
|
|
51
47
|
nodes,
|
|
52
48
|
onError
|
|
@@ -56,7 +52,6 @@ function LexicalComposer({
|
|
|
56
52
|
|
|
57
53
|
if (editor === null) {
|
|
58
54
|
const newEditor = lexical.createEditor({
|
|
59
|
-
namespace,
|
|
60
55
|
nodes,
|
|
61
56
|
onError: error => onError(error, newEditor),
|
|
62
57
|
readOnly: true,
|
|
@@ -80,4 +75,4 @@ function LexicalComposer({
|
|
|
80
75
|
}, children);
|
|
81
76
|
}
|
|
82
77
|
|
|
83
|
-
|
|
78
|
+
exports.LexicalComposer = LexicalComposer;
|
package/LexicalComposer.js.flow
CHANGED
package/LexicalComposer.prod.js
CHANGED
|
@@ -4,5 +4,5 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
var a=require("@lexical/react/LexicalComposerContext"),e=require("lexical"),k=require("react"),l="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement?k.useLayoutEffect:k.useEffect;
|
|
8
|
-
|
|
7
|
+
'use strict';var a=require("@lexical/react/LexicalComposerContext"),e=require("lexical"),k=require("react"),l="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement?k.useLayoutEffect:k.useEffect;
|
|
8
|
+
exports.LexicalComposer=function({initialConfig:f,children:m}){let h=k.useMemo(()=>{const {theme:b,editor__DEPRECATED:c,nodes:n,onError:p}=f,q=a.createLexicalComposerContext(null,b);let d=c||null;if(null===d){const g=e.createEditor({nodes:n,onError:r=>p(r,g),readOnly:!0,theme:b});d=g}return[d,q]},[]);l(()=>{let b=f.readOnly,[c]=h;c.setReadOnly(b||!1)},[]);return k.createElement(a.LexicalComposerContext.Provider,{value:h},m)}
|
|
@@ -14,7 +14,6 @@ var react = require('react');
|
|
|
14
14
|
* This source code is licensed under the MIT license found in the
|
|
15
15
|
* LICENSE file in the root directory of this source tree.
|
|
16
16
|
*
|
|
17
|
-
*
|
|
18
17
|
*/
|
|
19
18
|
const LexicalComposerContext = /*#__PURE__*/react.createContext(null);
|
|
20
19
|
function createLexicalComposerContext(parent, theme) {
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
var c=require("react");
|
|
7
|
+
'use strict';var c=require("react");let d=c.createContext(null);exports.LexicalComposerContext=d;exports.createLexicalComposerContext=function(a,e){let b=null;null!=a&&(b=a[1]);return{getTheme:function(){return null!=e?e:null!=b?b.getTheme():null}}};exports.useLexicalComposerContext=function(){let a=c.useContext(d);if(null==a)throw Error("Minified Lexical error #8; see codes.json for the full message or use the non-minified dev environment for full errors and additional helpful warnings.");return a}
|
|
@@ -6,8 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
export type Props = $ReadOnly<{
|
|
9
|
+
export type Props = Readonly<{
|
|
11
10
|
ariaActiveDescendantID?: string;
|
|
12
11
|
ariaAutoComplete?: string;
|
|
13
12
|
ariaControls?: string;
|
|
@@ -29,6 +28,4 @@ export type Props = $ReadOnly<{
|
|
|
29
28
|
tabIndex?: number;
|
|
30
29
|
testid?: string;
|
|
31
30
|
}>;
|
|
32
|
-
export
|
|
33
|
-
props: Props,
|
|
34
|
-
): JSX.Element | null;
|
|
31
|
+
export function ContentEditable(props: Props): JSX.Element | null;
|
|
@@ -15,7 +15,6 @@ var React = require('react');
|
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
17
|
*
|
|
18
|
-
*
|
|
19
18
|
*/
|
|
20
19
|
const CAN_USE_DOM = typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined';
|
|
21
20
|
|
|
@@ -25,7 +24,6 @@ const CAN_USE_DOM = typeof window !== 'undefined' && typeof window.document !==
|
|
|
25
24
|
* This source code is licensed under the MIT license found in the
|
|
26
25
|
* LICENSE file in the root directory of this source tree.
|
|
27
26
|
*
|
|
28
|
-
*
|
|
29
27
|
*/
|
|
30
28
|
const useLayoutEffectImpl = CAN_USE_DOM ? React.useLayoutEffect : React.useEffect;
|
|
31
29
|
var useLayoutEffect = useLayoutEffectImpl;
|
|
@@ -36,9 +34,8 @@ var useLayoutEffect = useLayoutEffectImpl;
|
|
|
36
34
|
* This source code is licensed under the MIT license found in the
|
|
37
35
|
* LICENSE file in the root directory of this source tree.
|
|
38
36
|
*
|
|
39
|
-
*
|
|
40
37
|
*/
|
|
41
|
-
function
|
|
38
|
+
function ContentEditable({
|
|
42
39
|
ariaActiveDescendantID,
|
|
43
40
|
ariaAutoComplete,
|
|
44
41
|
ariaControls,
|
|
@@ -82,9 +79,10 @@ function LexicalContentEditable({
|
|
|
82
79
|
"aria-multiline": ariaMultiline,
|
|
83
80
|
"aria-owns": isReadOnly ? null : ariaOwneeID,
|
|
84
81
|
"aria-required": ariaRequired,
|
|
85
|
-
autoCapitalize: autoCapitalize
|
|
82
|
+
autoCapitalize: autoCapitalize !== undefined ? String(autoCapitalize) : null // @ts-ignore This is a valid attribute
|
|
83
|
+
,
|
|
86
84
|
autoComplete: autoComplete,
|
|
87
|
-
autoCorrect: autoCorrect,
|
|
85
|
+
autoCorrect: autoCorrect !== undefined ? String(autoCorrect) : null,
|
|
88
86
|
className: className,
|
|
89
87
|
contentEditable: !isReadOnly,
|
|
90
88
|
"data-testid": testid,
|
|
@@ -97,4 +95,4 @@ function LexicalContentEditable({
|
|
|
97
95
|
});
|
|
98
96
|
}
|
|
99
97
|
|
|
100
|
-
|
|
98
|
+
exports.ContentEditable = ContentEditable;
|
|
@@ -4,6 +4,6 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
var b=require("@lexical/react/LexicalComposerContext"),
|
|
8
|
-
|
|
9
|
-
{"aria-activedescendant":a?null:
|
|
7
|
+
'use strict';var b=require("@lexical/react/LexicalComposerContext"),k=require("react"),l="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement?k.useLayoutEffect:k.useEffect;
|
|
8
|
+
exports.ContentEditable=function({ariaActiveDescendantID:m,ariaAutoComplete:n,ariaControls:p,ariaDescribedBy:q,ariaExpanded:r,ariaLabel:t,ariaLabelledBy:u,ariaMultiline:v,ariaOwneeID:w,ariaRequired:x,autoCapitalize:e,autoComplete:y,autoCorrect:f,className:z,id:A,role:g="textbox",spellCheck:B=!0,style:C,tabIndex:D,testid:E}){let [c]=b.useLexicalComposerContext(),[a,h]=k.useState(!0),F=k.useCallback(d=>{c.setRootElement(d)},[c]);l(()=>{h(c.isReadOnly());return c.registerReadOnlyListener(d=>{h(d)})},
|
|
9
|
+
[c]);return k.createElement("div",{"aria-activedescendant":a?null:m,"aria-autocomplete":a?null:n,"aria-controls":a?null:p,"aria-describedby":q,"aria-expanded":a?null:"combobox"===g?!!r:null,"aria-label":t,"aria-labelledby":u,"aria-multiline":v,"aria-owns":a?null:w,"aria-required":x,autoCapitalize:void 0!==e?String(e):null,autoComplete:y,autoCorrect:void 0!==f?String(f):null,className:z,contentEditable:!a,"data-testid":E,id:A,ref:F,role:a?null:g,spellCheck:B,style:C,tabIndex:D})}
|
|
@@ -4,18 +4,27 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
|
-
* @flow strict
|
|
8
7
|
*/
|
|
9
8
|
|
|
10
|
-
import type {
|
|
9
|
+
import type {
|
|
10
|
+
ElementFormatType,
|
|
11
|
+
LexicalNode,
|
|
12
|
+
NodeKey,
|
|
13
|
+
SerializedLexicalNode,
|
|
14
|
+
} from 'lexical';
|
|
11
15
|
|
|
12
16
|
import {DecoratorNode} from 'lexical';
|
|
13
17
|
|
|
18
|
+
export type SerializedDecoratorBlockNode = SerializedLexicalNode & {
|
|
19
|
+
format: ElementFormatType;
|
|
20
|
+
};
|
|
21
|
+
|
|
14
22
|
declare class DecoratorBlockNode<T> extends DecoratorNode<T> {
|
|
15
23
|
__format: ElementFormatType;
|
|
16
24
|
constructor(format?: ElementFormatType | null, key?: NodeKey);
|
|
17
25
|
createDOM(): HTMLElement;
|
|
18
26
|
setFormat(format: ElementFormatType): void;
|
|
27
|
+
exportJSON(): SerializedDecoratorBlockNode;
|
|
19
28
|
}
|
|
20
29
|
|
|
21
30
|
declare function $isDecoratorBlockNode<T>(
|
|
@@ -14,7 +14,6 @@ var lexical = require('lexical');
|
|
|
14
14
|
* This source code is licensed under the MIT license found in the
|
|
15
15
|
* LICENSE file in the root directory of this source tree.
|
|
16
16
|
*
|
|
17
|
-
*
|
|
18
17
|
*/
|
|
19
18
|
class DecoratorBlockNode extends lexical.DecoratorNode {
|
|
20
19
|
constructor(format, key) {
|
|
@@ -22,6 +21,14 @@ class DecoratorBlockNode extends lexical.DecoratorNode {
|
|
|
22
21
|
this.__format = format;
|
|
23
22
|
}
|
|
24
23
|
|
|
24
|
+
exportJSON() {
|
|
25
|
+
return {
|
|
26
|
+
format: this.__format || '',
|
|
27
|
+
type: 'decorator-block',
|
|
28
|
+
version: 1
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
|
|
25
32
|
createDOM() {
|
|
26
33
|
return document.createElement('div');
|
|
27
34
|
}
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
var b=require("lexical");class c extends b.DecoratorNode{constructor(a,d){super(d);this.__format=a}createDOM(){return document.createElement("div")}updateDOM(){return!1}setFormat(a){this.getWritable().__format=a}}exports.$isDecoratorBlockNode=function(a){return a instanceof c};exports.DecoratorBlockNode=c
|
|
7
|
+
'use strict';var b=require("lexical");class c extends b.DecoratorNode{constructor(a,d){super(d);this.__format=a}exportJSON(){return{format:this.__format||"",type:"decorator-block",version:1}}createDOM(){return document.createElement("div")}updateDOM(){return!1}setFormat(a){this.getWritable().__format=a}}exports.$isDecoratorBlockNode=function(a){return a instanceof c};exports.DecoratorBlockNode=c
|
|
@@ -17,7 +17,6 @@ var react = require('react');
|
|
|
17
17
|
* This source code is licensed under the MIT license found in the
|
|
18
18
|
* LICENSE file in the root directory of this source tree.
|
|
19
19
|
*
|
|
20
|
-
*
|
|
21
20
|
*/
|
|
22
21
|
|
|
23
22
|
function getHashtagRegexStringChars() {
|
|
@@ -129,8 +128,8 @@ function HashtagPlugin() {
|
|
|
129
128
|
start: startOffset
|
|
130
129
|
};
|
|
131
130
|
}, []);
|
|
132
|
-
useLexicalTextEntity(getHashtagMatch, hashtag.HashtagNode, createHashtagNode);
|
|
131
|
+
useLexicalTextEntity.useLexicalTextEntity(getHashtagMatch, hashtag.HashtagNode, createHashtagNode);
|
|
133
132
|
return null;
|
|
134
133
|
}
|
|
135
134
|
|
|
136
|
-
|
|
135
|
+
exports.HashtagPlugin = HashtagPlugin;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
var b=require("@lexical/hashtag"),c=require("@lexical/react/LexicalComposerContext"),d=require("@lexical/react/useLexicalTextEntity"),e=require("react"),f=RegExp;
|
|
8
|
-
|
|
7
|
+
'use strict';var b=require("@lexical/hashtag"),c=require("@lexical/react/LexicalComposerContext"),d=require("@lexical/react/useLexicalTextEntity"),e=require("react"),f=RegExp;
|
|
8
|
+
let g=String.fromCharCode,l="A-Za-z\u00aa\u00b5\u00ba\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u0241\u0250-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ee\u037a\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03ce\u03d0-\u03f5\u03f7-\u0481\u048a-\u04ce\u04d0-\u04f9\u0500-\u050f\u0531-\u0556\u0559\u0561-\u0587\u05d0-\u05ea\u05f0-\u05f2\u0621-\u063a\u0640-\u064a\u066e-\u066f\u0671-\u06d3\u06d5\u06e5-\u06e6\u06ee-\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u076d\u0780-\u07a5\u07b1\u0904-\u0939\u093d\u0950\u0958-\u0961\u097d\u0985-\u098c\u098f-\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc-\u09dd\u09df-\u09e1\u09f0-\u09f1\u0a05-\u0a0a\u0a0f-\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32-\u0a33\u0a35-\u0a36\u0a38-\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2-\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0-\u0ae1\u0b05-\u0b0c\u0b0f-\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32-\u0b33\u0b35-\u0b39\u0b3d\u0b5c-\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99-\u0b9a\u0b9c\u0b9e-\u0b9f\u0ba3-\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c33\u0c35-\u0c39\u0c60-\u0c61\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cde\u0ce0-\u0ce1\u0d05-\u0d0c\u0d0e-\u0d10\u0d12-\u0d28\u0d2a-\u0d39\u0d60-\u0d61\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32-\u0e33\u0e40-\u0e46\u0e81-\u0e82\u0e84\u0e87-\u0e88\u0e8a\u0e8d\u0e94-\u0e97\u0e99-\u0e9f\u0ea1-\u0ea3\u0ea5\u0ea7\u0eaa-\u0eab\u0ead-\u0eb0\u0eb2-\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edd\u0f00\u0f40-\u0f47\u0f49-\u0f6a\u0f88-\u0f8b\u1000-\u1021\u1023-\u1027\u1029-\u102a\u1050-\u1055\u10a0-\u10c5\u10d0-\u10fa\u10fc\u1100-\u1159\u115f-\u11a2\u11a8-\u11f9\u1200-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f4\u1401-\u166c\u166f-\u1676\u1681-\u169a\u16a0-\u16ea\u1700-\u170c\u170e-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1877\u1880-\u18a8\u1900-\u191c\u1950-\u196d\u1970-\u1974\u1980-\u19a9\u19c1-\u19c7\u1a00-\u1a16\u1d00-\u1dbf\u1e00-\u1e9b\u1ea0-\u1ef9\u1f00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u2094\u2102\u2107\u210a-\u2113\u2115\u2119-\u211d\u2124\u2126\u2128\u212a-\u212d\u212f-\u2131\u2133-\u2139\u213c-\u213f\u2145-\u2149\u2c00-\u2c2e\u2c30-\u2c5e\u2c80-\u2ce4\u2d00-\u2d25\u2d30-\u2d65\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u3005-\u3006\u3031-\u3035\u303b-\u303c\u3041-\u3096\u309d-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312c\u3131-\u318e\u31a0-\u31b7\u31f0-\u31ff\u3400-\u4db5\u4e00-\u9fbb\ua000-\ua48c\ua800-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\uac00-\ud7a3\uf900-\ufa2d\ufa30-\ufa6a\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc\u0300-\u036f\u0483-\u0486\u0591-\u05b9\u05bb-\u05bd\u05bf\u05c1-\u05c2\u05c4-\u05c5\u05c7\u0610-\u0615\u064b-\u065e\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7-\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u0901-\u0903\u093c\u093e-\u094d\u0951-\u0954\u0962-\u0963\u0981-\u0983\u09bc\u09be-\u09c4\u09c7-\u09c8\u09cb-\u09cd\u09d7\u09e2-\u09e3\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47-\u0a48\u0a4b-\u0a4d\u0a70-\u0a71\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2-\u0ae3\u0b01-\u0b03\u0b3c\u0b3e-\u0b43\u0b47-\u0b48\u0b4b-\u0b4d\u0b56-\u0b57\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0c01-\u0c03\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55-\u0c56\u0c82-\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5-\u0cd6\u0d02-\u0d03\u0d3e-\u0d43\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d82-\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0df2-\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb-\u0ebc\u0ec8-\u0ecd\u0f18-\u0f19\u0f35\u0f37\u0f39\u0f3e-\u0f3f\u0f71-\u0f84\u0f86-\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102c-\u1032\u1036-\u1039\u1056-\u1059\u135f\u1712-\u1714\u1732-\u1734\u1752-\u1753\u1772-\u1773\u17b6-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u192b\u1930-\u193b\u19b0-\u19c0\u19c8-\u19c9\u1a17-\u1a1b\u1dc0-\u1dc3\u20d0-\u20dc\u20e1\u20e5-\u20eb\u302a-\u302f\u3099-\u309a\ua802\ua806\ua80b\ua823-\ua827\ufb1e\ufe00-\ufe0f\ufe20-\ufe23\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u00ff\u0100-\u024f\u0253-\u0254\u0256-\u0257\u0259\u025b\u0263\u0268\u026f\u0272\u0289\u028b\u02bb\u0300-\u036f\u1e00-\u1eff\u0400-\u04ff\u0500-\u0527\u2de0-\u2dff\ua640-\ua69f\u0591-\u05bf\u05c1-\u05c2\u05c4-\u05c5\u05c7\u05d0-\u05ea\u05f0-\u05f4\ufb12-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufb4f\u0610-\u061a\u0620-\u065f\u066e-\u06d3\u06d5-\u06dc\u06de-\u06e8\u06ea-\u06ef\u06fa-\u06fc\u06ff\u0750-\u077f\u08a0\u08a2-\u08ac\u08e4-\u08fe\ufb50-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\u200c-\u200c\u0e01-\u0e3a\u0e40-\u0e4e\u1100-\u11ff\u3130-\u3185\ua960-\ua97f\uac00-\ud7af\ud7b0-\ud7ff\uffa1-\uffdc\u30a1-\u30fa\u30fc-\u30fe\uff66-\uff9f\uff10-\uff19\uff21-\uff3a\uff41-\uff5a\u3041-\u3096\u3099-\u309e\u3400-\u4dbf\u4e00-\u9fff"+(g(173824)+
|
|
9
9
|
"-"+g(177983)+g(177984)+"-"+g(178207)+g(194560)+"-"+g(195103)+"\u3003\u3005\u303b"),{alpha:m,alphanumeric:n,hashChars:p}={alpha:l,alphanumeric:l+"0-9\u0660-\u0669\u06f0-\u06f9\u0966-\u096f\u09e6-\u09ef\u0a66-\u0a6f\u0ae6-\u0aef\u0b66-\u0b6f\u0be6-\u0bef\u0c66-\u0c6f\u0ce6-\u0cef\u0d66-\u0d6f\u0e50-\u0e59\u0ed0-\u0ed9\u0f20-\u0f29\u1040-\u1049\u17e0-\u17e9\u1810-\u1819\u1946-\u194f\u19d0-\u19d9\uff10-\uff19_",hashChars:"#\\uFF03"},q="["+n+"]",r=new f("(^|$|[^&/"+(n+"])([")+(p+"])(")+q+"*["+(m+"]")+
|
|
10
|
-
q+"*)","i");
|
|
10
|
+
q+"*)","i");exports.HashtagPlugin=function(){let [h]=c.useLexicalComposerContext();e.useEffect(()=>{if(!h.hasNodes([b.HashtagNode]))throw Error("HashtagPlugin: HashtagNode not registered on editor");},[h]);let t=e.useCallback(a=>b.$createHashtagNode(a.getTextContent()),[]),u=e.useCallback(a=>{a=r.exec(a);if(null===a)return null;const k=a.index+a[1].length;return{end:k+(a[3].length+1),start:k}},[]);d.useLexicalTextEntity(u,b.HashtagNode,t);return null}
|
|
@@ -16,7 +16,6 @@ var react = require('react');
|
|
|
16
16
|
* This source code is licensed under the MIT license found in the
|
|
17
17
|
* LICENSE file in the root directory of this source tree.
|
|
18
18
|
*
|
|
19
|
-
*
|
|
20
19
|
*/
|
|
21
20
|
function useHistory(editor, externalHistoryState, delay = 1000) {
|
|
22
21
|
const historyState = react.useMemo(() => externalHistoryState || history.createEmptyHistoryState(), [externalHistoryState]);
|
|
@@ -31,7 +30,6 @@ function useHistory(editor, externalHistoryState, delay = 1000) {
|
|
|
31
30
|
* This source code is licensed under the MIT license found in the
|
|
32
31
|
* LICENSE file in the root directory of this source tree.
|
|
33
32
|
*
|
|
34
|
-
*
|
|
35
33
|
*/
|
|
36
34
|
function HistoryPlugin({
|
|
37
35
|
externalHistoryState
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
var c=require("@lexical/react/LexicalComposerContext"),
|
|
7
|
+
'use strict';var c=require("@lexical/react/LexicalComposerContext"),history=require("@lexical/history"),f=require("react");function g(a,b,d=1E3){let e=f.useMemo(()=>b||history.createEmptyHistoryState(),[b]);f.useEffect(()=>history.registerHistory(a,e,d),[d,a,e])}exports.createEmptyHistoryState=history.createEmptyHistoryState;exports.HistoryPlugin=function({externalHistoryState:a}){let [b]=c.useLexicalComposerContext();g(b,a);return null}
|