@lexical/react 0.13.0 → 0.14.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/LexicalAutoEmbedPlugin.dev.esm.js +131 -0
- package/LexicalAutoEmbedPlugin.esm.js +13 -0
- package/LexicalAutoEmbedPlugin.js +1 -1
- package/LexicalAutoEmbedPlugin.prod.esm.js +7 -0
- package/LexicalAutoFocusPlugin.dev.esm.js +42 -0
- package/LexicalAutoFocusPlugin.dev.js +0 -5
- package/LexicalAutoFocusPlugin.esm.js +10 -0
- package/LexicalAutoFocusPlugin.js +1 -1
- package/LexicalAutoFocusPlugin.prod.esm.js +7 -0
- package/LexicalAutoFocusPlugin.prod.js +1 -1
- package/LexicalAutoLinkPlugin.dev.esm.js +312 -0
- package/LexicalAutoLinkPlugin.dev.js +3 -1
- package/LexicalAutoLinkPlugin.esm.js +11 -0
- package/LexicalAutoLinkPlugin.js +1 -1
- package/LexicalAutoLinkPlugin.prod.esm.js +7 -0
- package/LexicalBlockWithAlignableContents.dev.esm.js +86 -0
- package/LexicalBlockWithAlignableContents.dev.js +1 -0
- package/LexicalBlockWithAlignableContents.esm.js +10 -0
- package/LexicalBlockWithAlignableContents.js +1 -1
- package/LexicalBlockWithAlignableContents.prod.esm.js +7 -0
- package/LexicalBlockWithAlignableContents.prod.js +1 -1
- package/LexicalCharacterLimitPlugin.d.ts +4 -1
- package/LexicalCharacterLimitPlugin.dev.esm.js +272 -0
- package/LexicalCharacterLimitPlugin.dev.js +12 -4
- package/LexicalCharacterLimitPlugin.esm.js +10 -0
- package/LexicalCharacterLimitPlugin.js +1 -1
- package/LexicalCharacterLimitPlugin.prod.esm.js +7 -0
- package/LexicalCharacterLimitPlugin.prod.js +9 -9
- package/LexicalCheckListPlugin.dev.esm.js +203 -0
- package/LexicalCheckListPlugin.esm.js +10 -0
- package/LexicalCheckListPlugin.js +1 -1
- package/LexicalCheckListPlugin.prod.esm.js +7 -0
- package/LexicalClearEditorPlugin.dev.esm.js +64 -0
- package/LexicalClearEditorPlugin.esm.js +10 -0
- package/LexicalClearEditorPlugin.js +1 -1
- package/LexicalClearEditorPlugin.prod.esm.js +7 -0
- package/LexicalClickableLinkPlugin.dev.esm.js +95 -0
- package/LexicalClickableLinkPlugin.esm.js +10 -0
- package/LexicalClickableLinkPlugin.js +1 -1
- package/LexicalClickableLinkPlugin.prod.esm.js +7 -0
- package/LexicalCollaborationContext.dev.esm.js +36 -0
- package/LexicalCollaborationContext.esm.js +11 -0
- package/LexicalCollaborationContext.js +1 -1
- package/LexicalCollaborationContext.prod.esm.js +7 -0
- package/LexicalCollaborationPlugin.dev.esm.js +308 -0
- package/LexicalCollaborationPlugin.esm.js +10 -0
- package/LexicalCollaborationPlugin.js +1 -1
- package/LexicalCollaborationPlugin.prod.esm.js +7 -0
- package/LexicalComposer.dev.esm.js +129 -0
- package/LexicalComposer.esm.js +10 -0
- package/LexicalComposer.js +1 -1
- package/LexicalComposer.prod.esm.js +7 -0
- package/LexicalComposerContext.dev.esm.js +42 -0
- package/LexicalComposerContext.esm.js +12 -0
- package/LexicalComposerContext.js +1 -1
- package/LexicalComposerContext.prod.esm.js +7 -0
- package/LexicalContentEditable.dev.esm.js +107 -0
- package/LexicalContentEditable.dev.js +5 -1
- package/LexicalContentEditable.esm.js +10 -0
- package/LexicalContentEditable.js +1 -1
- package/LexicalContentEditable.prod.esm.js +7 -0
- package/LexicalContentEditable.prod.js +3 -3
- package/LexicalContextMenuPlugin.dev.esm.js +455 -0
- package/LexicalContextMenuPlugin.dev.js +3 -1
- package/LexicalContextMenuPlugin.esm.js +11 -0
- package/LexicalContextMenuPlugin.js +1 -1
- package/LexicalContextMenuPlugin.prod.esm.js +7 -0
- package/LexicalDecoratorBlockNode.dev.esm.js +46 -0
- package/LexicalDecoratorBlockNode.esm.js +11 -0
- package/LexicalDecoratorBlockNode.js +1 -1
- package/LexicalDecoratorBlockNode.prod.esm.js +7 -0
- package/LexicalEditorRefPlugin.dev.esm.js +40 -0
- package/LexicalEditorRefPlugin.dev.js +10 -5
- package/LexicalEditorRefPlugin.esm.js +10 -0
- package/LexicalEditorRefPlugin.js +1 -1
- package/LexicalEditorRefPlugin.prod.esm.js +7 -0
- package/LexicalEditorRefPlugin.prod.js +1 -1
- package/LexicalErrorBoundary.dev.esm.js +157 -0
- package/LexicalErrorBoundary.esm.js +10 -0
- package/LexicalErrorBoundary.js +1 -1
- package/LexicalErrorBoundary.prod.esm.js +7 -0
- package/LexicalHashtagPlugin.dev.esm.js +163 -0
- package/LexicalHashtagPlugin.esm.js +10 -0
- package/LexicalHashtagPlugin.js +1 -1
- package/LexicalHashtagPlugin.prod.esm.js +7 -0
- package/LexicalHistoryPlugin.dev.esm.js +41 -0
- package/LexicalHistoryPlugin.esm.js +11 -0
- package/LexicalHistoryPlugin.js +1 -1
- package/LexicalHistoryPlugin.prod.esm.js +7 -0
- package/LexicalHorizontalRuleNode.dev.esm.js +118 -0
- package/LexicalHorizontalRuleNode.dev.js +1 -0
- package/LexicalHorizontalRuleNode.esm.js +13 -0
- package/LexicalHorizontalRuleNode.js +1 -1
- package/LexicalHorizontalRuleNode.prod.esm.js +7 -0
- package/LexicalHorizontalRuleNode.prod.js +1 -1
- package/LexicalHorizontalRulePlugin.dev.esm.js +39 -0
- package/LexicalHorizontalRulePlugin.esm.js +10 -0
- package/LexicalHorizontalRulePlugin.js +1 -1
- package/LexicalHorizontalRulePlugin.prod.esm.js +7 -0
- package/LexicalLinkPlugin.dev.esm.js +79 -0
- package/LexicalLinkPlugin.dev.js +6 -2
- package/LexicalLinkPlugin.esm.js +10 -0
- package/LexicalLinkPlugin.js +1 -1
- package/LexicalLinkPlugin.prod.esm.js +7 -0
- package/LexicalLinkPlugin.prod.js +1 -1
- package/LexicalListPlugin.dev.esm.js +59 -0
- package/LexicalListPlugin.esm.js +10 -0
- package/LexicalListPlugin.js +1 -1
- package/LexicalListPlugin.prod.esm.js +7 -0
- package/LexicalMarkdownShortcutPlugin.dev.esm.js +49 -0
- package/LexicalMarkdownShortcutPlugin.esm.js +11 -0
- package/LexicalMarkdownShortcutPlugin.js +1 -1
- package/LexicalMarkdownShortcutPlugin.prod.esm.js +7 -0
- package/LexicalNestedComposer.dev.esm.js +105 -0
- package/LexicalNestedComposer.esm.js +10 -0
- package/LexicalNestedComposer.js +1 -1
- package/LexicalNestedComposer.prod.esm.js +7 -0
- package/LexicalNodeEventPlugin.dev.esm.js +56 -0
- package/LexicalNodeEventPlugin.esm.js +10 -0
- package/LexicalNodeEventPlugin.js +1 -1
- package/LexicalNodeEventPlugin.prod.esm.js +7 -0
- package/LexicalNodeMenuPlugin.dev.esm.js +466 -0
- package/LexicalNodeMenuPlugin.dev.js +3 -1
- package/LexicalNodeMenuPlugin.esm.js +11 -0
- package/LexicalNodeMenuPlugin.js +1 -1
- package/LexicalNodeMenuPlugin.prod.esm.js +7 -0
- package/LexicalOnChangePlugin.dev.esm.js +62 -0
- package/LexicalOnChangePlugin.esm.js +10 -0
- package/LexicalOnChangePlugin.js +1 -1
- package/LexicalOnChangePlugin.prod.esm.js +7 -0
- package/LexicalPlainTextPlugin.dev.esm.js +161 -0
- package/LexicalPlainTextPlugin.esm.js +10 -0
- package/LexicalPlainTextPlugin.js +1 -1
- package/LexicalPlainTextPlugin.prod.esm.js +7 -0
- package/LexicalRichTextPlugin.dev.esm.js +161 -0
- package/LexicalRichTextPlugin.esm.js +10 -0
- package/LexicalRichTextPlugin.js +1 -1
- package/LexicalRichTextPlugin.prod.esm.js +7 -0
- package/LexicalTabIndentationPlugin.dev.esm.js +76 -0
- package/LexicalTabIndentationPlugin.esm.js +11 -0
- package/LexicalTabIndentationPlugin.js +1 -1
- package/LexicalTabIndentationPlugin.prod.esm.js +7 -0
- package/LexicalTableOfContents.dev.esm.js +157 -0
- package/LexicalTableOfContents.esm.js +10 -0
- package/LexicalTableOfContents.js +1 -1
- package/LexicalTableOfContents.prod.esm.js +7 -0
- package/LexicalTablePlugin.dev.esm.js +163 -0
- package/LexicalTablePlugin.esm.js +10 -0
- package/LexicalTablePlugin.js +1 -1
- package/LexicalTablePlugin.prod.esm.js +7 -0
- package/LexicalTreeView.dev.esm.js +483 -0
- package/LexicalTreeView.dev.js +3 -1
- package/LexicalTreeView.esm.js +10 -0
- package/LexicalTreeView.js +1 -1
- package/LexicalTreeView.prod.esm.js +7 -0
- package/LexicalTypeaheadMenuPlugin.dev.esm.js +569 -0
- package/LexicalTypeaheadMenuPlugin.dev.js +3 -1
- package/LexicalTypeaheadMenuPlugin.esm.js +16 -0
- package/LexicalTypeaheadMenuPlugin.js +1 -1
- package/LexicalTypeaheadMenuPlugin.prod.esm.js +7 -0
- package/package.json +583 -20
- package/useLexicalEditable.dev.esm.js +82 -0
- package/useLexicalEditable.esm.js +10 -0
- package/useLexicalEditable.js +1 -1
- package/useLexicalEditable.prod.esm.js +7 -0
- package/useLexicalIsTextContentEmpty.dev.esm.js +51 -0
- package/useLexicalIsTextContentEmpty.esm.js +10 -0
- package/useLexicalIsTextContentEmpty.js +1 -1
- package/useLexicalIsTextContentEmpty.prod.esm.js +7 -0
- package/useLexicalNodeSelection.dev.esm.js +69 -0
- package/useLexicalNodeSelection.esm.js +10 -0
- package/useLexicalNodeSelection.js +1 -1
- package/useLexicalNodeSelection.prod.esm.js +7 -0
- package/useLexicalSubscription.dev.esm.js +63 -0
- package/useLexicalSubscription.esm.js +10 -0
- package/useLexicalSubscription.js +1 -1
- package/useLexicalSubscription.prod.esm.js +7 -0
- package/useLexicalTextEntity.dev.esm.js +26 -0
- package/useLexicalTextEntity.esm.js +10 -0
- package/useLexicalTextEntity.js +1 -1
- package/useLexicalTextEntity.prod.esm.js +7 -0
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import { INSERT_CHECK_LIST_COMMAND, insertList, $isListItemNode, $isListNode } from '@lexical/list';
|
|
8
|
+
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
|
|
9
|
+
import { mergeRegister, $findMatchingParent, isHTMLElement } from '@lexical/utils';
|
|
10
|
+
import { COMMAND_PRIORITY_LOW, KEY_ARROW_DOWN_COMMAND, KEY_ARROW_UP_COMMAND, KEY_ESCAPE_COMMAND, KEY_SPACE_COMMAND, $getNearestNodeFromDOMNode, KEY_ARROW_LEFT_COMMAND, $getSelection, $isRangeSelection, $isElementNode } from 'lexical';
|
|
11
|
+
import { useEffect } from 'react';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
15
|
+
*
|
|
16
|
+
* This source code is licensed under the MIT license found in the
|
|
17
|
+
* LICENSE file in the root directory of this source tree.
|
|
18
|
+
*
|
|
19
|
+
*/
|
|
20
|
+
function CheckListPlugin() {
|
|
21
|
+
const [editor] = useLexicalComposerContext();
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
return mergeRegister(editor.registerCommand(INSERT_CHECK_LIST_COMMAND, () => {
|
|
24
|
+
insertList(editor, 'check');
|
|
25
|
+
return true;
|
|
26
|
+
}, COMMAND_PRIORITY_LOW), editor.registerCommand(KEY_ARROW_DOWN_COMMAND, event => {
|
|
27
|
+
return handleArrownUpOrDown(event, editor, false);
|
|
28
|
+
}, COMMAND_PRIORITY_LOW), editor.registerCommand(KEY_ARROW_UP_COMMAND, event => {
|
|
29
|
+
return handleArrownUpOrDown(event, editor, true);
|
|
30
|
+
}, COMMAND_PRIORITY_LOW), editor.registerCommand(KEY_ESCAPE_COMMAND, event => {
|
|
31
|
+
const activeItem = getActiveCheckListItem();
|
|
32
|
+
if (activeItem != null) {
|
|
33
|
+
const rootElement = editor.getRootElement();
|
|
34
|
+
if (rootElement != null) {
|
|
35
|
+
rootElement.focus();
|
|
36
|
+
}
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
return false;
|
|
40
|
+
}, COMMAND_PRIORITY_LOW), editor.registerCommand(KEY_SPACE_COMMAND, event => {
|
|
41
|
+
const activeItem = getActiveCheckListItem();
|
|
42
|
+
if (activeItem != null && editor.isEditable()) {
|
|
43
|
+
editor.update(() => {
|
|
44
|
+
const listItemNode = $getNearestNodeFromDOMNode(activeItem);
|
|
45
|
+
if ($isListItemNode(listItemNode)) {
|
|
46
|
+
event.preventDefault();
|
|
47
|
+
listItemNode.toggleChecked();
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
52
|
+
return false;
|
|
53
|
+
}, COMMAND_PRIORITY_LOW), editor.registerCommand(KEY_ARROW_LEFT_COMMAND, event => {
|
|
54
|
+
return editor.getEditorState().read(() => {
|
|
55
|
+
const selection = $getSelection();
|
|
56
|
+
if ($isRangeSelection(selection) && selection.isCollapsed()) {
|
|
57
|
+
const {
|
|
58
|
+
anchor
|
|
59
|
+
} = selection;
|
|
60
|
+
const isElement = anchor.type === 'element';
|
|
61
|
+
if (isElement || anchor.offset === 0) {
|
|
62
|
+
const anchorNode = anchor.getNode();
|
|
63
|
+
const elementNode = $findMatchingParent(anchorNode, node => $isElementNode(node) && !node.isInline());
|
|
64
|
+
if ($isListItemNode(elementNode)) {
|
|
65
|
+
const parent = elementNode.getParent();
|
|
66
|
+
if ($isListNode(parent) && parent.getListType() === 'check' && (isElement || elementNode.getFirstDescendant() === anchorNode)) {
|
|
67
|
+
const domNode = editor.getElementByKey(elementNode.__key);
|
|
68
|
+
if (domNode != null && document.activeElement !== domNode) {
|
|
69
|
+
domNode.focus();
|
|
70
|
+
event.preventDefault();
|
|
71
|
+
return true;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return false;
|
|
78
|
+
});
|
|
79
|
+
}, COMMAND_PRIORITY_LOW), editor.registerRootListener((rootElement, prevElement) => {
|
|
80
|
+
if (rootElement !== null) {
|
|
81
|
+
rootElement.addEventListener('click', handleClick);
|
|
82
|
+
rootElement.addEventListener('pointerdown', handlePointerDown);
|
|
83
|
+
}
|
|
84
|
+
if (prevElement !== null) {
|
|
85
|
+
prevElement.removeEventListener('click', handleClick);
|
|
86
|
+
prevElement.removeEventListener('pointerdown', handlePointerDown);
|
|
87
|
+
}
|
|
88
|
+
}));
|
|
89
|
+
});
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
function handleCheckItemEvent(event, callback) {
|
|
93
|
+
const target = event.target;
|
|
94
|
+
if (target === null || !isHTMLElement(target)) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// Ignore clicks on LI that have nested lists
|
|
99
|
+
const firstChild = target.firstChild;
|
|
100
|
+
if (firstChild != null && isHTMLElement(firstChild) && (firstChild.tagName === 'UL' || firstChild.tagName === 'OL')) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
const parentNode = target.parentNode;
|
|
104
|
+
|
|
105
|
+
// @ts-ignore internal field
|
|
106
|
+
if (!parentNode || parentNode.__lexicalListType !== 'check') {
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
const pageX = event.pageX;
|
|
110
|
+
const rect = target.getBoundingClientRect();
|
|
111
|
+
if (target.dir === 'rtl' ? pageX < rect.right && pageX > rect.right - 20 : pageX > rect.left && pageX < rect.left + 20) {
|
|
112
|
+
callback();
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
function handleClick(event) {
|
|
116
|
+
handleCheckItemEvent(event, () => {
|
|
117
|
+
const domNode = event.target;
|
|
118
|
+
const editor = findEditor(domNode);
|
|
119
|
+
if (editor != null && editor.isEditable()) {
|
|
120
|
+
editor.update(() => {
|
|
121
|
+
if (event.target) {
|
|
122
|
+
const node = $getNearestNodeFromDOMNode(domNode);
|
|
123
|
+
if ($isListItemNode(node)) {
|
|
124
|
+
domNode.focus();
|
|
125
|
+
node.toggleChecked();
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
function handlePointerDown(event) {
|
|
133
|
+
handleCheckItemEvent(event, () => {
|
|
134
|
+
// Prevents caret moving when clicking on check mark
|
|
135
|
+
event.preventDefault();
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
function findEditor(target) {
|
|
139
|
+
let node = target;
|
|
140
|
+
while (node) {
|
|
141
|
+
// @ts-ignore internal field
|
|
142
|
+
if (node.__lexicalEditor) {
|
|
143
|
+
// @ts-ignore internal field
|
|
144
|
+
return node.__lexicalEditor;
|
|
145
|
+
}
|
|
146
|
+
node = node.parentNode;
|
|
147
|
+
}
|
|
148
|
+
return null;
|
|
149
|
+
}
|
|
150
|
+
function getActiveCheckListItem() {
|
|
151
|
+
const activeElement = document.activeElement;
|
|
152
|
+
return activeElement != null && activeElement.tagName === 'LI' && activeElement.parentNode != null &&
|
|
153
|
+
// @ts-ignore internal field
|
|
154
|
+
activeElement.parentNode.__lexicalListType === 'check' ? activeElement : null;
|
|
155
|
+
}
|
|
156
|
+
function findCheckListItemSibling(node, backward) {
|
|
157
|
+
let sibling = backward ? node.getPreviousSibling() : node.getNextSibling();
|
|
158
|
+
let parent = node;
|
|
159
|
+
|
|
160
|
+
// Going up in a tree to get non-null sibling
|
|
161
|
+
while (sibling == null && $isListItemNode(parent)) {
|
|
162
|
+
// Get li -> parent ul/ol -> parent li
|
|
163
|
+
parent = parent.getParentOrThrow().getParent();
|
|
164
|
+
if (parent != null) {
|
|
165
|
+
sibling = backward ? parent.getPreviousSibling() : parent.getNextSibling();
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// Going down in a tree to get first non-nested list item
|
|
170
|
+
while ($isListItemNode(sibling)) {
|
|
171
|
+
const firstChild = backward ? sibling.getLastChild() : sibling.getFirstChild();
|
|
172
|
+
if (!$isListNode(firstChild)) {
|
|
173
|
+
return sibling;
|
|
174
|
+
}
|
|
175
|
+
sibling = backward ? firstChild.getLastChild() : firstChild.getFirstChild();
|
|
176
|
+
}
|
|
177
|
+
return null;
|
|
178
|
+
}
|
|
179
|
+
function handleArrownUpOrDown(event, editor, backward) {
|
|
180
|
+
const activeItem = getActiveCheckListItem();
|
|
181
|
+
if (activeItem != null) {
|
|
182
|
+
editor.update(() => {
|
|
183
|
+
const listItem = $getNearestNodeFromDOMNode(activeItem);
|
|
184
|
+
if (!$isListItemNode(listItem)) {
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
const nextListItem = findCheckListItemSibling(listItem, backward);
|
|
188
|
+
if (nextListItem != null) {
|
|
189
|
+
nextListItem.selectStart();
|
|
190
|
+
const dom = editor.getElementByKey(nextListItem.__key);
|
|
191
|
+
if (dom != null) {
|
|
192
|
+
event.preventDefault();
|
|
193
|
+
setTimeout(() => {
|
|
194
|
+
dom.focus();
|
|
195
|
+
}, 0);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
return false;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
export { CheckListPlugin };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import * as modDev from './LexicalCheckListPlugin.dev.esm.js';
|
|
8
|
+
import * as modProd from './LexicalCheckListPlugin.prod.esm.js';
|
|
9
|
+
const mod = process.env.NODE_ENV === 'development' ? modDev : modProd;
|
|
10
|
+
export const CheckListPlugin = mod.CheckListPlugin;
|
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
'use strict'
|
|
8
|
-
const LexicalCheckListPlugin = process.env.NODE_ENV === 'development' ? require('./LexicalCheckListPlugin.dev.js') : require('./LexicalCheckListPlugin.prod.js')
|
|
8
|
+
const LexicalCheckListPlugin = process.env.NODE_ENV === 'development' ? require('./LexicalCheckListPlugin.dev.js') : require('./LexicalCheckListPlugin.prod.js');
|
|
9
9
|
module.exports = LexicalCheckListPlugin;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import{INSERT_CHECK_LIST_COMMAND as e,insertList as t,$isListItemNode as n,$isListNode as r}from"@lexical/list";import{useLexicalComposerContext as i}from"@lexical/react/LexicalComposerContext";import{mergeRegister as l,$findMatchingParent as o,isHTMLElement as c}from"@lexical/utils";import{COMMAND_PRIORITY_LOW as u,KEY_ARROW_DOWN_COMMAND as s,KEY_ARROW_UP_COMMAND as a,KEY_ESCAPE_COMMAND as g,KEY_SPACE_COMMAND as f,$getNearestNodeFromDOMNode as d,KEY_ARROW_LEFT_COMMAND as m,$getSelection as p,$isRangeSelection as C,$isElementNode as h}from"lexical";import{useEffect as v}from"react";function E(){const[c]=i();return v((()=>l(c.registerCommand(e,(()=>(t(c,"check"),!0)),u),c.registerCommand(s,(e=>y(e,c,!1)),u),c.registerCommand(a,(e=>y(e,c,!0)),u),c.registerCommand(g,(e=>{if(null!=k()){const e=c.getRootElement();return null!=e&&e.focus(),!0}return!1}),u),c.registerCommand(f,(e=>{const t=k();return!(null==t||!c.isEditable())&&(c.update((()=>{const r=d(t);n(r)&&(e.preventDefault(),r.toggleChecked())})),!0)}),u),c.registerCommand(m,(e=>c.getEditorState().read((()=>{const t=p();if(C(t)&&t.isCollapsed()){const{anchor:i}=t,l="element"===i.type;if(l||0===i.offset){const t=i.getNode(),u=o(t,(e=>h(e)&&!e.isInline()));if(n(u)){const n=u.getParent();if(r(n)&&"check"===n.getListType()&&(l||u.getFirstDescendant()===t)){const t=c.getElementByKey(u.__key);if(null!=t&&document.activeElement!==t)return t.focus(),e.preventDefault(),!0}}}}return!1}))),u),c.registerRootListener(((e,t)=>{null!==e&&(e.addEventListener("click",x),e.addEventListener("pointerdown",_)),null!==t&&(t.removeEventListener("click",x),t.removeEventListener("pointerdown",_))}))))),null}function L(e,t){const n=e.target;if(null===n||!c(n))return;const r=n.firstChild;if(null!=r&&c(r)&&("UL"===r.tagName||"OL"===r.tagName))return;const i=n.parentNode;if(!i||"check"!==i.__lexicalListType)return;const l=e.pageX,o=n.getBoundingClientRect();("rtl"===n.dir?l<o.right&&l>o.right-20:l>o.left&&l<o.left+20)&&t()}function x(e){L(e,(()=>{const t=e.target,r=function(e){let t=e;for(;t;){if(t.__lexicalEditor)return t.__lexicalEditor;t=t.parentNode}return null}(t);null!=r&&r.isEditable()&&r.update((()=>{if(e.target){const e=d(t);n(e)&&(t.focus(),e.toggleChecked())}}))}))}function _(e){L(e,(()=>{e.preventDefault()}))}function k(){const e=document.activeElement;return null!=e&&"LI"===e.tagName&&null!=e.parentNode&&"check"===e.parentNode.__lexicalListType?e:null}function y(e,t,i){const l=k();return null!=l&&t.update((()=>{const o=d(l);if(!n(o))return;const c=function(e,t){let i=t?e.getPreviousSibling():e.getNextSibling(),l=e;for(;null==i&&n(l);)l=l.getParentOrThrow().getParent(),null!=l&&(i=t?l.getPreviousSibling():l.getNextSibling());for(;n(i);){const e=t?i.getLastChild():i.getFirstChild();if(!r(e))return i;i=t?e.getLastChild():e.getFirstChild()}return null}(o,i);if(null!=c){c.selectStart();const n=t.getElementByKey(c.__key);null!=n&&(e.preventDefault(),setTimeout((()=>{n.focus()}),0))}})),!1}export{E as CheckListPlugin};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
|
|
8
|
+
import { CLEAR_EDITOR_COMMAND, $getRoot, $getSelection, $createParagraphNode, COMMAND_PRIORITY_EDITOR } from 'lexical';
|
|
9
|
+
import { useLayoutEffect as useLayoutEffect$1, useEffect } from 'react';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
13
|
+
*
|
|
14
|
+
* This source code is licensed under the MIT license found in the
|
|
15
|
+
* LICENSE file in the root directory of this source tree.
|
|
16
|
+
*
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
const CAN_USE_DOM = typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined';
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
23
|
+
*
|
|
24
|
+
* This source code is licensed under the MIT license found in the
|
|
25
|
+
* LICENSE file in the root directory of this source tree.
|
|
26
|
+
*
|
|
27
|
+
*/
|
|
28
|
+
const useLayoutEffectImpl = CAN_USE_DOM ? useLayoutEffect$1 : useEffect;
|
|
29
|
+
var useLayoutEffect = useLayoutEffectImpl;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
33
|
+
*
|
|
34
|
+
* This source code is licensed under the MIT license found in the
|
|
35
|
+
* LICENSE file in the root directory of this source tree.
|
|
36
|
+
*
|
|
37
|
+
*/
|
|
38
|
+
function ClearEditorPlugin({
|
|
39
|
+
onClear
|
|
40
|
+
}) {
|
|
41
|
+
const [editor] = useLexicalComposerContext();
|
|
42
|
+
useLayoutEffect(() => {
|
|
43
|
+
return editor.registerCommand(CLEAR_EDITOR_COMMAND, payload => {
|
|
44
|
+
editor.update(() => {
|
|
45
|
+
if (onClear == null) {
|
|
46
|
+
const root = $getRoot();
|
|
47
|
+
const selection = $getSelection();
|
|
48
|
+
const paragraph = $createParagraphNode();
|
|
49
|
+
root.clear();
|
|
50
|
+
root.append(paragraph);
|
|
51
|
+
if (selection !== null) {
|
|
52
|
+
paragraph.select();
|
|
53
|
+
}
|
|
54
|
+
} else {
|
|
55
|
+
onClear();
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
return true;
|
|
59
|
+
}, COMMAND_PRIORITY_EDITOR);
|
|
60
|
+
}, [editor, onClear]);
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export { ClearEditorPlugin };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import * as modDev from './LexicalClearEditorPlugin.dev.esm.js';
|
|
8
|
+
import * as modProd from './LexicalClearEditorPlugin.prod.esm.js';
|
|
9
|
+
const mod = process.env.NODE_ENV === 'development' ? modDev : modProd;
|
|
10
|
+
export const ClearEditorPlugin = mod.ClearEditorPlugin;
|
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
'use strict'
|
|
8
|
-
const LexicalClearEditorPlugin = process.env.NODE_ENV === 'development' ? require('./LexicalClearEditorPlugin.dev.js') : require('./LexicalClearEditorPlugin.prod.js')
|
|
8
|
+
const LexicalClearEditorPlugin = process.env.NODE_ENV === 'development' ? require('./LexicalClearEditorPlugin.dev.js') : require('./LexicalClearEditorPlugin.prod.js');
|
|
9
9
|
module.exports = LexicalClearEditorPlugin;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import{useLexicalComposerContext as e}from"@lexical/react/LexicalComposerContext";import{CLEAR_EDITOR_COMMAND as o,$getRoot as t,$getSelection as n,$createParagraphNode as r,COMMAND_PRIORITY_EDITOR as l}from"lexical";import{useLayoutEffect as i,useEffect as a}from"react";var c="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?i:a;function d({onClear:i}){const[a]=e();return c((()=>a.registerCommand(o,(e=>(a.update((()=>{if(null==i){const e=t(),o=n(),l=r();e.clear(),e.append(l),null!==o&&l.select()}else i()})),!0)),l)),[a,i]),null}export{d as ClearEditorPlugin};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import { $isLinkNode } from '@lexical/link';
|
|
8
|
+
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
|
|
9
|
+
import { $findMatchingParent, isHTMLAnchorElement } from '@lexical/utils';
|
|
10
|
+
import { getNearestEditorFromDOMNode, $getNearestNodeFromDOMNode, $isElementNode, $getSelection, $isRangeSelection } from 'lexical';
|
|
11
|
+
import { useEffect } from 'react';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
15
|
+
*
|
|
16
|
+
* This source code is licensed under the MIT license found in the
|
|
17
|
+
* LICENSE file in the root directory of this source tree.
|
|
18
|
+
*
|
|
19
|
+
*/
|
|
20
|
+
function findMatchingDOM(startNode, predicate) {
|
|
21
|
+
let node = startNode;
|
|
22
|
+
while (node != null) {
|
|
23
|
+
if (predicate(node)) {
|
|
24
|
+
return node;
|
|
25
|
+
}
|
|
26
|
+
node = node.parentNode;
|
|
27
|
+
}
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
function LexicalClickableLinkPlugin({
|
|
31
|
+
newTab = true
|
|
32
|
+
}) {
|
|
33
|
+
const [editor] = useLexicalComposerContext();
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
const onClick = event => {
|
|
36
|
+
const target = event.target;
|
|
37
|
+
if (!(target instanceof Node)) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
const nearestEditor = getNearestEditorFromDOMNode(target);
|
|
41
|
+
if (nearestEditor === null) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
let url = null;
|
|
45
|
+
let urlTarget = null;
|
|
46
|
+
nearestEditor.update(() => {
|
|
47
|
+
const clickedNode = $getNearestNodeFromDOMNode(target);
|
|
48
|
+
if (clickedNode !== null) {
|
|
49
|
+
const maybeLinkNode = $findMatchingParent(clickedNode, $isElementNode);
|
|
50
|
+
if ($isLinkNode(maybeLinkNode)) {
|
|
51
|
+
url = maybeLinkNode.sanitizeUrl(maybeLinkNode.getURL());
|
|
52
|
+
urlTarget = maybeLinkNode.getTarget();
|
|
53
|
+
} else {
|
|
54
|
+
const a = findMatchingDOM(target, isHTMLAnchorElement);
|
|
55
|
+
if (a !== null) {
|
|
56
|
+
url = a.href;
|
|
57
|
+
urlTarget = a.target;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
if (url === null || url === '') {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// Allow user to select link text without follwing url
|
|
67
|
+
const selection = editor.getEditorState().read($getSelection);
|
|
68
|
+
if ($isRangeSelection(selection) && !selection.isCollapsed()) {
|
|
69
|
+
event.preventDefault();
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
const isMiddle = event.type === 'auxclick' && event.button === 1;
|
|
73
|
+
window.open(url, newTab || isMiddle || event.metaKey || event.ctrlKey || urlTarget === '_blank' ? '_blank' : '_self');
|
|
74
|
+
event.preventDefault();
|
|
75
|
+
};
|
|
76
|
+
const onMouseUp = event => {
|
|
77
|
+
if (event.button === 1 && editor.isEditable()) {
|
|
78
|
+
onClick(event);
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
return editor.registerRootListener((rootElement, prevRootElement) => {
|
|
82
|
+
if (prevRootElement !== null) {
|
|
83
|
+
prevRootElement.removeEventListener('click', onClick);
|
|
84
|
+
prevRootElement.removeEventListener('mouseup', onMouseUp);
|
|
85
|
+
}
|
|
86
|
+
if (rootElement !== null) {
|
|
87
|
+
rootElement.addEventListener('click', onClick);
|
|
88
|
+
rootElement.addEventListener('mouseup', onMouseUp);
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
}, [editor, newTab]);
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export { LexicalClickableLinkPlugin as default };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import * as modDev from './LexicalClickableLinkPlugin.dev.esm.js';
|
|
8
|
+
import * as modProd from './LexicalClickableLinkPlugin.prod.esm.js';
|
|
9
|
+
const mod = process.env.NODE_ENV === 'development' ? modDev : modProd;
|
|
10
|
+
export default mod.default;
|
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
'use strict'
|
|
8
|
-
const LexicalClickableLinkPlugin = process.env.NODE_ENV === 'development' ? require('./LexicalClickableLinkPlugin.dev.js') : require('./LexicalClickableLinkPlugin.prod.js')
|
|
8
|
+
const LexicalClickableLinkPlugin = process.env.NODE_ENV === 'development' ? require('./LexicalClickableLinkPlugin.dev.js') : require('./LexicalClickableLinkPlugin.prod.js');
|
|
9
9
|
module.exports = LexicalClickableLinkPlugin;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import{$isLinkNode as e}from"@lexical/link";import{useLexicalComposerContext as t}from"@lexical/react/LexicalComposerContext";import{$findMatchingParent as n,isHTMLAnchorElement as r}from"@lexical/utils";import{getNearestEditorFromDOMNode as l,$getNearestNodeFromDOMNode as o,$isElementNode as i,$getSelection as u,$isRangeSelection as a}from"lexical";import{useEffect as s}from"react";function c({newTab:c=!0}){const[f]=t();return s((()=>{const t=t=>{const s=t.target;if(!(s instanceof Node))return;const m=l(s);if(null===m)return;let p=null,d=null;if(m.update((()=>{const t=o(s);if(null!==t){const l=n(t,i);if(e(l))p=l.sanitizeUrl(l.getURL()),d=l.getTarget();else{const e=function(e,t){let n=e;for(;null!=n;){if(t(n))return n;n=n.parentNode}return null}(s,r);null!==e&&(p=e.href,d=e.target)}}})),null===p||""===p)return;const v=f.getEditorState().read(u);if(a(v)&&!v.isCollapsed())return void t.preventDefault();const x="auxclick"===t.type&&1===t.button;window.open(p,c||x||t.metaKey||t.ctrlKey||"_blank"===d?"_blank":"_self"),t.preventDefault()},s=e=>{1===e.button&&f.isEditable()&&t(e)};return f.registerRootListener(((e,n)=>{null!==n&&(n.removeEventListener("click",t),n.removeEventListener("mouseup",s)),null!==e&&(e.addEventListener("click",t),e.addEventListener("mouseup",s))}))}),[f,c]),null}export{c as default};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import { createContext, useContext } from 'react';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
11
|
+
*
|
|
12
|
+
* This source code is licensed under the MIT license found in the
|
|
13
|
+
* LICENSE file in the root directory of this source tree.
|
|
14
|
+
*
|
|
15
|
+
*/
|
|
16
|
+
const entries = [['Cat', 'rgb(125, 50, 0)'], ['Dog', 'rgb(100, 0, 0)'], ['Rabbit', 'rgb(150, 0, 0)'], ['Frog', 'rgb(200, 0, 0)'], ['Fox', 'rgb(200, 75, 0)'], ['Hedgehog', 'rgb(0, 75, 0)'], ['Pigeon', 'rgb(0, 125, 0)'], ['Squirrel', 'rgb(75, 100, 0)'], ['Bear', 'rgb(125, 100, 0)'], ['Tiger', 'rgb(0, 0, 150)'], ['Leopard', 'rgb(0, 0, 200)'], ['Zebra', 'rgb(0, 0, 250)'], ['Wolf', 'rgb(0, 100, 150)'], ['Owl', 'rgb(0, 100, 100)'], ['Gull', 'rgb(100, 0, 100)'], ['Squid', 'rgb(150, 0, 150)']];
|
|
17
|
+
const randomEntry = entries[Math.floor(Math.random() * entries.length)];
|
|
18
|
+
const CollaborationContext = /*#__PURE__*/createContext({
|
|
19
|
+
clientID: 0,
|
|
20
|
+
color: randomEntry[1],
|
|
21
|
+
isCollabActive: false,
|
|
22
|
+
name: randomEntry[0],
|
|
23
|
+
yjsDocMap: new Map()
|
|
24
|
+
});
|
|
25
|
+
function useCollaborationContext(username, color) {
|
|
26
|
+
const collabContext = useContext(CollaborationContext);
|
|
27
|
+
if (username != null) {
|
|
28
|
+
collabContext.name = username;
|
|
29
|
+
}
|
|
30
|
+
if (color != null) {
|
|
31
|
+
collabContext.color = color;
|
|
32
|
+
}
|
|
33
|
+
return collabContext;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export { CollaborationContext, useCollaborationContext };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import * as modDev from './LexicalCollaborationContext.dev.esm.js';
|
|
8
|
+
import * as modProd from './LexicalCollaborationContext.prod.esm.js';
|
|
9
|
+
const mod = process.env.NODE_ENV === 'development' ? modDev : modProd;
|
|
10
|
+
export const CollaborationContext = mod.CollaborationContext;
|
|
11
|
+
export const useCollaborationContext = mod.useCollaborationContext;
|
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
'use strict'
|
|
8
|
-
const LexicalCollaborationContext = process.env.NODE_ENV === 'development' ? require('./LexicalCollaborationContext.dev.js') : require('./LexicalCollaborationContext.prod.js')
|
|
8
|
+
const LexicalCollaborationContext = process.env.NODE_ENV === 'development' ? require('./LexicalCollaborationContext.dev.js') : require('./LexicalCollaborationContext.prod.js');
|
|
9
9
|
module.exports = LexicalCollaborationContext;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import{createContext as r,useContext as g}from"react";const o=[["Cat","rgb(125, 50, 0)"],["Dog","rgb(100, 0, 0)"],["Rabbit","rgb(150, 0, 0)"],["Frog","rgb(200, 0, 0)"],["Fox","rgb(200, 75, 0)"],["Hedgehog","rgb(0, 75, 0)"],["Pigeon","rgb(0, 125, 0)"],["Squirrel","rgb(75, 100, 0)"],["Bear","rgb(125, 100, 0)"],["Tiger","rgb(0, 0, 150)"],["Leopard","rgb(0, 0, 200)"],["Zebra","rgb(0, 0, 250)"],["Wolf","rgb(0, 100, 150)"],["Owl","rgb(0, 100, 100)"],["Gull","rgb(100, 0, 100)"],["Squid","rgb(150, 0, 150)"]],b=o[Math.floor(Math.random()*o.length)],e=r({clientID:0,color:b[1],isCollabActive:!1,name:b[0],yjsDocMap:new Map});function l(r,o){const b=g(e);return null!=r&&(b.name=r),null!=o&&(b.color=o),b}export{e as CollaborationContext,l as useCollaborationContext};
|