@dxos/react-ui-editor 0.8.2-main.fbd8ed0 → 0.8.2-staging.4d6ad0f
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/dist/lib/browser/index.mjs +1731 -926
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +3 -64
- package/dist/lib/browser/testing/index.mjs.map +4 -4
- package/dist/lib/node/index.cjs +1912 -1111
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +3 -75
- package/dist/lib/node/testing/index.cjs.map +4 -4
- package/dist/lib/node-esm/index.mjs +1731 -926
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/testing/index.mjs +3 -64
- package/dist/lib/node-esm/testing/index.mjs.map +4 -4
- package/dist/types/src/components/EditorToolbar/EditorToolbar.d.ts.map +1 -1
- package/dist/types/src/components/EditorToolbar/index.d.ts +1 -1
- package/dist/types/src/components/EditorToolbar/index.d.ts.map +1 -1
- package/dist/types/src/components/EditorToolbar/util.d.ts +4 -6
- package/dist/types/src/components/EditorToolbar/util.d.ts.map +1 -1
- package/dist/types/src/components/Popover/RefDropdownMenu.d.ts +21 -0
- package/dist/types/src/components/Popover/RefDropdownMenu.d.ts.map +1 -0
- package/dist/types/src/{testing → components/Popover}/RefPopover.d.ts +1 -1
- package/dist/types/src/components/Popover/RefPopover.d.ts.map +1 -0
- package/dist/types/src/components/Popover/index.d.ts +3 -0
- package/dist/types/src/components/Popover/index.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +1 -0
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/defaults.d.ts +2 -5
- package/dist/types/src/defaults.d.ts.map +1 -1
- package/dist/types/src/extensions/annotations.d.ts +4 -1
- package/dist/types/src/extensions/annotations.d.ts.map +1 -1
- package/dist/types/src/extensions/autocomplete.d.ts +1 -2
- package/dist/types/src/extensions/autocomplete.d.ts.map +1 -1
- package/dist/types/src/extensions/automerge/automerge.stories.d.ts.map +1 -1
- package/dist/types/src/extensions/automerge/sync.d.ts.map +1 -1
- package/dist/types/src/extensions/awareness/awareness-provider.d.ts.map +1 -1
- package/dist/types/src/extensions/awareness/awareness.d.ts.map +1 -1
- package/dist/types/src/extensions/command/command.d.ts +1 -2
- package/dist/types/src/extensions/command/command.d.ts.map +1 -1
- package/dist/types/src/extensions/command/hint.d.ts +14 -2
- package/dist/types/src/extensions/command/hint.d.ts.map +1 -1
- package/dist/types/src/extensions/command/index.d.ts +2 -0
- package/dist/types/src/extensions/command/index.d.ts.map +1 -1
- package/dist/types/src/extensions/command/menu.d.ts +7 -8
- package/dist/types/src/extensions/command/menu.d.ts.map +1 -1
- package/dist/types/src/extensions/command/state.d.ts +1 -1
- package/dist/types/src/extensions/command/state.d.ts.map +1 -1
- package/dist/types/src/extensions/command/typeahead.d.ts +17 -0
- package/dist/types/src/extensions/command/typeahead.d.ts.map +1 -0
- package/dist/types/src/extensions/comments.d.ts +2 -12
- package/dist/types/src/extensions/comments.d.ts.map +1 -1
- package/dist/types/src/extensions/factories.d.ts +4 -0
- package/dist/types/src/extensions/factories.d.ts.map +1 -1
- package/dist/types/src/extensions/index.d.ts +2 -0
- package/dist/types/src/extensions/index.d.ts.map +1 -1
- package/dist/types/src/extensions/json.d.ts +7 -0
- package/dist/types/src/extensions/json.d.ts.map +1 -0
- package/dist/types/src/extensions/markdown/{editorAction.d.ts → action.d.ts} +1 -1
- package/dist/types/src/extensions/markdown/action.d.ts.map +1 -0
- package/dist/types/src/extensions/markdown/bundle.d.ts +2 -1
- package/dist/types/src/extensions/markdown/bundle.d.ts.map +1 -1
- package/dist/types/src/extensions/markdown/index.d.ts +1 -2
- package/dist/types/src/extensions/markdown/index.d.ts.map +1 -1
- package/dist/types/src/extensions/markdown/styles.d.ts.map +1 -1
- package/dist/types/src/extensions/outliner/commands.d.ts +9 -0
- package/dist/types/src/extensions/outliner/commands.d.ts.map +1 -0
- package/dist/types/src/extensions/outliner/editor.d.ts +5 -0
- package/dist/types/src/extensions/outliner/editor.d.ts.map +1 -0
- package/dist/types/src/extensions/outliner/editor.test.d.ts +2 -0
- package/dist/types/src/extensions/outliner/editor.test.d.ts.map +1 -0
- package/dist/types/src/extensions/outliner/index.d.ts +3 -0
- package/dist/types/src/extensions/outliner/index.d.ts.map +1 -0
- package/dist/types/src/extensions/outliner/outliner.d.ts +10 -0
- package/dist/types/src/extensions/outliner/outliner.d.ts.map +1 -0
- package/dist/types/src/extensions/outliner/outliner.test.d.ts +2 -0
- package/dist/types/src/extensions/outliner/outliner.test.d.ts.map +1 -0
- package/dist/types/src/extensions/outliner/selection.d.ts +12 -0
- package/dist/types/src/extensions/outliner/selection.d.ts.map +1 -0
- package/dist/types/src/extensions/outliner/tree.d.ts +79 -0
- package/dist/types/src/extensions/outliner/tree.d.ts.map +1 -0
- package/dist/types/src/extensions/outliner/tree.test.d.ts +2 -0
- package/dist/types/src/extensions/outliner/tree.test.d.ts.map +1 -0
- package/dist/types/src/stories/Command.stories.d.ts +7 -0
- package/dist/types/src/stories/Command.stories.d.ts.map +1 -0
- package/dist/types/src/stories/{TextEditorComments.stories.d.ts → Comments.stories.d.ts} +3 -3
- package/dist/types/src/stories/Comments.stories.d.ts.map +1 -0
- package/dist/types/src/stories/EditorToolbar.stories.d.ts +12 -0
- package/dist/types/src/stories/EditorToolbar.stories.d.ts.map +1 -0
- package/dist/types/src/stories/{TextEditorSpecial.stories.d.ts → Experimental.stories.d.ts} +3 -6
- package/dist/types/src/stories/Experimental.stories.d.ts.map +1 -0
- package/dist/types/src/stories/Markdown.stories.d.ts +46 -0
- package/dist/types/src/stories/Markdown.stories.d.ts.map +1 -0
- package/dist/types/src/stories/Outliner.stories.d.ts +26 -0
- package/dist/types/src/stories/Outliner.stories.d.ts.map +1 -0
- package/dist/types/src/stories/Preview.stories.d.ts +10 -0
- package/dist/types/src/stories/Preview.stories.d.ts.map +1 -0
- package/dist/types/src/stories/{TextEditorBasic.stories.d.ts → TextEditor.stories.d.ts} +9 -39
- package/dist/types/src/stories/TextEditor.stories.d.ts.map +1 -0
- package/dist/types/src/stories/{story-utils.d.ts → util.d.ts} +6 -6
- package/dist/types/src/stories/util.d.ts.map +1 -0
- package/dist/types/src/styles/theme.d.ts.map +1 -1
- package/dist/types/src/styles/tokens.d.ts.map +1 -1
- package/dist/types/src/testing/index.d.ts +1 -1
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/testing/util.d.ts +2 -0
- package/dist/types/src/testing/util.d.ts.map +1 -0
- package/package.json +40 -34
- package/src/components/EditorToolbar/EditorToolbar.tsx +81 -57
- package/src/components/EditorToolbar/index.ts +7 -1
- package/src/components/EditorToolbar/util.ts +3 -4
- package/src/components/Popover/RefDropdownMenu.tsx +77 -0
- package/src/{testing → components/Popover}/RefPopover.tsx +5 -4
- package/src/components/Popover/index.ts +6 -0
- package/src/components/index.ts +1 -0
- package/src/defaults.ts +10 -13
- package/src/extensions/annotations.ts +41 -64
- package/src/extensions/autocomplete.ts +5 -6
- package/src/extensions/automerge/automerge.stories.tsx +2 -7
- package/src/extensions/automerge/automerge.test.tsx +3 -2
- package/src/extensions/automerge/sync.ts +3 -3
- package/src/extensions/awareness/awareness-provider.ts +4 -4
- package/src/extensions/awareness/awareness.ts +7 -7
- package/src/extensions/blast.ts +9 -9
- package/src/extensions/command/command.ts +1 -3
- package/src/extensions/command/hint.ts +7 -7
- package/src/extensions/command/index.ts +2 -0
- package/src/extensions/command/menu.ts +43 -49
- package/src/extensions/command/typeahead.ts +116 -0
- package/src/extensions/comments.ts +4 -69
- package/src/extensions/factories.ts +13 -0
- package/src/extensions/index.ts +2 -0
- package/src/extensions/json.ts +56 -0
- package/src/extensions/markdown/bundle.ts +13 -9
- package/src/extensions/markdown/decorate.ts +7 -7
- package/src/extensions/markdown/image.ts +2 -2
- package/src/extensions/markdown/index.ts +1 -2
- package/src/extensions/markdown/styles.ts +2 -1
- package/src/extensions/markdown/table.ts +3 -3
- package/src/extensions/outliner/commands.ts +242 -0
- package/src/extensions/outliner/editor.test.ts +33 -0
- package/src/extensions/outliner/editor.ts +180 -0
- package/src/extensions/outliner/index.ts +6 -0
- package/src/extensions/outliner/outliner.test.ts +99 -0
- package/src/extensions/outliner/outliner.ts +162 -0
- package/src/extensions/outliner/selection.ts +50 -0
- package/src/extensions/outliner/tree.test.ts +164 -0
- package/src/extensions/outliner/tree.ts +315 -0
- package/src/extensions/preview/preview.ts +5 -5
- package/src/stories/Command.stories.tsx +97 -0
- package/src/stories/{TextEditorComments.stories.tsx → Comments.stories.tsx} +13 -14
- package/src/{components/EditorToolbar → stories}/EditorToolbar.stories.tsx +26 -20
- package/src/stories/{TextEditorSpecial.stories.tsx → Experimental.stories.tsx} +9 -30
- package/src/stories/Markdown.stories.tsx +121 -0
- package/src/stories/Outliner.stories.tsx +108 -0
- package/src/stories/{TextEditorPreview.stories.tsx → Preview.stories.tsx} +46 -136
- package/src/stories/TextEditor.stories.tsx +256 -0
- package/src/stories/{story-utils.tsx → util.tsx} +21 -22
- package/src/styles/theme.ts +12 -5
- package/src/styles/tokens.ts +1 -2
- package/src/testing/index.ts +1 -1
- package/src/testing/util.ts +5 -0
- package/dist/types/src/components/EditorToolbar/EditorToolbar.stories.d.ts +0 -53
- package/dist/types/src/components/EditorToolbar/EditorToolbar.stories.d.ts.map +0 -1
- package/dist/types/src/components/EditorToolbar/comment.d.ts +0 -18
- package/dist/types/src/components/EditorToolbar/comment.d.ts.map +0 -1
- package/dist/types/src/extensions/markdown/editorAction.d.ts.map +0 -1
- package/dist/types/src/extensions/markdown/outliner.d.ts +0 -12
- package/dist/types/src/extensions/markdown/outliner.d.ts.map +0 -1
- package/dist/types/src/stories/TextEditorBasic.stories.d.ts.map +0 -1
- package/dist/types/src/stories/TextEditorComments.stories.d.ts.map +0 -1
- package/dist/types/src/stories/TextEditorPreview.stories.d.ts +0 -13
- package/dist/types/src/stories/TextEditorPreview.stories.d.ts.map +0 -1
- package/dist/types/src/stories/TextEditorSpecial.stories.d.ts.map +0 -1
- package/dist/types/src/stories/story-utils.d.ts.map +0 -1
- package/dist/types/src/testing/RefPopover.d.ts.map +0 -1
- package/src/components/EditorToolbar/comment.ts +0 -30
- package/src/extensions/markdown/outliner.ts +0 -235
- package/src/stories/TextEditorBasic.stories.tsx +0 -333
- /package/src/extensions/markdown/{editorAction.ts → action.ts} +0 -0
package/dist/lib/node/index.cjs
CHANGED
@@ -39,9 +39,12 @@ __export(node_exports, {
|
|
39
39
|
Inline: () => Inline,
|
40
40
|
InputModeExtensions: () => InputModeExtensions,
|
41
41
|
List: () => List,
|
42
|
+
RefDropdownMenu: () => RefDropdownMenu,
|
43
|
+
RefPopover: () => RefPopover,
|
42
44
|
RemoteSelectionsDecorator: () => RemoteSelectionsDecorator,
|
43
45
|
SpaceAwarenessProvider: () => SpaceAwarenessProvider,
|
44
46
|
TextKind: () => import_text.TextKind,
|
47
|
+
Tree: () => Tree,
|
45
48
|
addBlockquote: () => addBlockquote,
|
46
49
|
addCodeblock: () => addCodeblock,
|
47
50
|
addLink: () => addLink,
|
@@ -59,6 +62,7 @@ __export(node_exports, {
|
|
59
62
|
closeEffect: () => closeEffect,
|
60
63
|
command: () => command,
|
61
64
|
commandKeyBindings: () => commandKeyBindings,
|
65
|
+
commentClickedEffect: () => commentClickedEffect,
|
62
66
|
comments: () => comments,
|
63
67
|
commentsState: () => commentsState,
|
64
68
|
convertTreeToJson: () => convertTreeToJson,
|
@@ -71,6 +75,7 @@ __export(node_exports, {
|
|
71
75
|
createEditorStateTransaction: () => createEditorStateTransaction,
|
72
76
|
createElement: () => createElement,
|
73
77
|
createExternalCommentSync: () => createExternalCommentSync,
|
78
|
+
createJsonExtensions: () => createJsonExtensions,
|
74
79
|
createMarkdownExtensions: () => createMarkdownExtensions,
|
75
80
|
createRenderer: () => createRenderer,
|
76
81
|
createThemeExtensions: () => createThemeExtensions,
|
@@ -81,33 +86,39 @@ __export(node_exports, {
|
|
81
86
|
defaultOptions: () => defaultOptions,
|
82
87
|
documentId: () => documentId,
|
83
88
|
dropFile: () => dropFile,
|
84
|
-
editorContent: () => editorContent,
|
85
|
-
editorFullWidth: () => editorFullWidth,
|
86
89
|
editorGutter: () => editorGutter,
|
87
90
|
editorInputMode: () => editorInputMode,
|
88
91
|
editorMonospace: () => editorMonospace,
|
92
|
+
editorSlots: () => editorSlots,
|
89
93
|
editorWidth: () => editorWidth,
|
90
94
|
editorWithToolbarLayout: () => editorWithToolbarLayout,
|
91
95
|
flattenRect: () => flattenRect,
|
96
|
+
floatingMenu: () => floatingMenu,
|
92
97
|
focus: () => focus,
|
93
98
|
focusField: () => focusField,
|
94
99
|
folding: () => folding,
|
95
100
|
formattingEquals: () => formattingEquals,
|
96
101
|
formattingKeymap: () => formattingKeymap,
|
97
102
|
getFormatting: () => getFormatting,
|
103
|
+
getListItemContent: () => getListItemContent,
|
104
|
+
getRange: () => getRange,
|
98
105
|
image: () => image,
|
99
106
|
insertTable: () => insertTable,
|
107
|
+
itemToJSON: () => itemToJSON,
|
100
108
|
keymap: () => import_view.keymap,
|
101
109
|
linkTooltip: () => linkTooltip,
|
110
|
+
listItemToString: () => listItemToString,
|
102
111
|
listener: () => listener,
|
103
112
|
logChanges: () => logChanges,
|
104
113
|
markdownHighlightStyle: () => markdownHighlightStyle,
|
105
114
|
markdownTags: () => markdownTags,
|
106
115
|
markdownTagsExtensions: () => markdownTagsExtensions,
|
116
|
+
matchCompletion: () => matchCompletion,
|
107
117
|
mention: () => mention,
|
108
118
|
openCommand: () => openCommand,
|
109
119
|
openEffect: () => openEffect,
|
110
120
|
outliner: () => outliner,
|
121
|
+
outlinerTree: () => outlinerTree,
|
111
122
|
overlap: () => overlap,
|
112
123
|
preventNewline: () => preventNewline,
|
113
124
|
preview: () => preview,
|
@@ -119,7 +130,6 @@ __export(node_exports, {
|
|
119
130
|
removeStyle: () => removeStyle,
|
120
131
|
renderRoot: () => renderRoot,
|
121
132
|
scrollThreadIntoView: () => scrollThreadIntoView,
|
122
|
-
selectionOverlapsComment: () => selectionOverlapsComment,
|
123
133
|
selectionState: () => selectionState,
|
124
134
|
setBlockquote: () => setBlockquote,
|
125
135
|
setComments: () => setComments,
|
@@ -129,6 +139,7 @@ __export(node_exports, {
|
|
129
139
|
singleValueFacet: () => singleValueFacet,
|
130
140
|
stackItemContentEditorClassNames: () => stackItemContentEditorClassNames,
|
131
141
|
stackItemContentToolbarClassNames: () => stackItemContentToolbarClassNames,
|
142
|
+
staticCompletion: () => staticCompletion,
|
132
143
|
table: () => table,
|
133
144
|
tags: () => import_highlight.tags,
|
134
145
|
textRange: () => textRange,
|
@@ -141,12 +152,15 @@ __export(node_exports, {
|
|
141
152
|
toggleStrong: () => toggleStrong,
|
142
153
|
toggleStyle: () => toggleStyle,
|
143
154
|
translations: () => translations_default,
|
155
|
+
traverse: () => traverse,
|
156
|
+
treeFacet: () => treeFacet,
|
157
|
+
typeahead: () => typeahead,
|
144
158
|
typewriter: () => typewriter,
|
145
|
-
useCommentClickListener: () => useCommentClickListener,
|
146
|
-
useCommentState: () => useCommentState,
|
147
159
|
useComments: () => useComments,
|
148
160
|
useEditorToolbarState: () => useEditorToolbarState,
|
149
161
|
useFormattingState: () => useFormattingState,
|
162
|
+
useRefDropdownMenu: () => useRefDropdownMenu,
|
163
|
+
useRefPopover: () => useRefPopover,
|
150
164
|
useTextEditor: () => useTextEditor,
|
151
165
|
wrapWithCatch: () => wrapWithCatch
|
152
166
|
});
|
@@ -155,7 +169,10 @@ var import_state = require("@codemirror/state");
|
|
155
169
|
var import_view = require("@codemirror/view");
|
156
170
|
var import_highlight = require("@lezer/highlight");
|
157
171
|
var import_text = require("@dxos/protocols/proto/dxos/echo/model/text");
|
172
|
+
var import_tracking = require("@preact-signals/safe-react/tracking");
|
173
|
+
var import_rx_react = require("@effect-rx/rx-react");
|
158
174
|
var import_react = __toESM(require("react"));
|
175
|
+
var import_app_graph = require("@dxos/app-graph");
|
159
176
|
var import_react_ui = require("@dxos/react-ui");
|
160
177
|
var import_react_ui_menu = require("@dxos/react-ui-menu");
|
161
178
|
var import_react_ui_theme = require("@dxos/react-ui-theme");
|
@@ -164,25 +181,24 @@ var import_live_object = require("@dxos/live-object");
|
|
164
181
|
var import_react_ui_menu2 = require("@dxos/react-ui-menu");
|
165
182
|
var import_state2 = require("@codemirror/state");
|
166
183
|
var import_view2 = require("@codemirror/view");
|
167
|
-
var import_util = require("@dxos/util");
|
168
|
-
var import_state3 = require("@codemirror/state");
|
169
|
-
var import_log = require("@dxos/log");
|
170
|
-
var import_react3 = __toESM(require("react"));
|
171
|
-
var import_client = require("react-dom/client");
|
172
|
-
var import_react_ui2 = require("@dxos/react-ui");
|
173
|
-
var import_react_ui_theme2 = require("@dxos/react-ui-theme");
|
174
184
|
var import_autocomplete = require("@codemirror/autocomplete");
|
175
185
|
var import_lang_markdown = require("@codemirror/lang-markdown");
|
176
186
|
var import_view3 = require("@codemirror/view");
|
177
187
|
var import_automerge = require("@automerge/automerge");
|
178
|
-
var
|
188
|
+
var import_state3 = require("@codemirror/state");
|
179
189
|
var import_view4 = require("@codemirror/view");
|
180
|
-
var
|
190
|
+
var import_log = require("@dxos/log");
|
181
191
|
var import_echo = require("@dxos/react-client/echo");
|
182
|
-
var
|
192
|
+
var import_state4 = require("@codemirror/state");
|
183
193
|
var import_automerge2 = require("@automerge/automerge");
|
184
194
|
var import_automerge3 = require("@automerge/automerge");
|
195
|
+
var import_state5 = require("@codemirror/state");
|
185
196
|
var import_state6 = require("@codemirror/state");
|
197
|
+
var import_log2 = require("@dxos/log");
|
198
|
+
var import_react3 = __toESM(require("react"));
|
199
|
+
var import_client = require("react-dom/client");
|
200
|
+
var import_react_ui2 = require("@dxos/react-ui");
|
201
|
+
var import_react_ui_theme2 = require("@dxos/react-ui-theme");
|
186
202
|
var import_state7 = require("@codemirror/state");
|
187
203
|
var import_view5 = require("@codemirror/view");
|
188
204
|
var import_async = require("@dxos/async");
|
@@ -201,105 +217,131 @@ var import_view8 = require("@codemirror/view");
|
|
201
217
|
var import_state10 = require("@codemirror/state");
|
202
218
|
var import_view9 = require("@codemirror/view");
|
203
219
|
var import_view10 = require("@codemirror/view");
|
204
|
-
var import_commands = require("@codemirror/commands");
|
205
220
|
var import_state11 = require("@codemirror/state");
|
206
221
|
var import_view11 = require("@codemirror/view");
|
222
|
+
var import_commands = require("@codemirror/commands");
|
223
|
+
var import_state12 = require("@codemirror/state");
|
224
|
+
var import_view12 = require("@codemirror/view");
|
207
225
|
var import_lodash2 = __toESM(require("lodash.sortby"));
|
208
226
|
var import_react4 = require("react");
|
209
227
|
var import_async3 = require("@dxos/async");
|
210
228
|
var import_log4 = require("@dxos/log");
|
211
|
-
var
|
212
|
-
var
|
213
|
-
var
|
229
|
+
var import_util = require("@dxos/util");
|
230
|
+
var import_state13 = require("@codemirror/state");
|
231
|
+
var import_view13 = require("@codemirror/view");
|
214
232
|
var import_async4 = require("@dxos/async");
|
215
233
|
var import_invariant3 = require("@dxos/invariant");
|
216
|
-
var
|
234
|
+
var import_util2 = require("@dxos/util");
|
217
235
|
var import_language = require("@codemirror/language");
|
218
|
-
var
|
219
|
-
var
|
236
|
+
var import_state14 = require("@codemirror/state");
|
237
|
+
var import_view14 = require("@codemirror/view");
|
220
238
|
var import_autocomplete2 = require("@codemirror/autocomplete");
|
221
239
|
var import_commands2 = require("@codemirror/commands");
|
222
240
|
var import_language2 = require("@codemirror/language");
|
223
241
|
var import_search = require("@codemirror/search");
|
224
|
-
var
|
242
|
+
var import_state15 = require("@codemirror/state");
|
225
243
|
var import_theme_one_dark = require("@codemirror/theme-one-dark");
|
226
|
-
var
|
244
|
+
var import_view15 = require("@codemirror/view");
|
227
245
|
var import_lodash3 = __toESM(require("lodash.defaultsdeep"));
|
228
246
|
var import_lodash4 = __toESM(require("lodash.merge"));
|
229
247
|
var import_display_name = require("@dxos/display-name");
|
230
248
|
var import_log5 = require("@dxos/log");
|
231
|
-
var
|
232
|
-
var
|
233
|
-
var
|
249
|
+
var import_util3 = require("@dxos/util");
|
250
|
+
var import_state16 = require("@codemirror/state");
|
251
|
+
var import_view16 = require("@codemirror/view");
|
234
252
|
var import_react_ui_theme3 = require("@dxos/react-ui-theme");
|
235
|
-
var import_lodash5 = __toESM(require("lodash.get"));
|
236
253
|
var import_react_ui_theme4 = require("@dxos/react-ui-theme");
|
254
|
+
var import_util4 = require("@dxos/util");
|
237
255
|
var import_language3 = require("@codemirror/language");
|
238
|
-
var
|
256
|
+
var import_view17 = require("@codemirror/view");
|
239
257
|
var import_react5 = __toESM(require("react"));
|
240
258
|
var import_react_ui3 = require("@dxos/react-ui");
|
241
|
-
var
|
259
|
+
var import_lang_json = require("@codemirror/lang-json");
|
260
|
+
var import_lint = require("@codemirror/lint");
|
261
|
+
var import_ajv = __toESM(require("ajv"));
|
262
|
+
var import_view18 = require("@codemirror/view");
|
242
263
|
var import_autocomplete3 = require("@codemirror/autocomplete");
|
243
264
|
var import_language4 = require("@codemirror/language");
|
244
|
-
var
|
245
|
-
var
|
265
|
+
var import_state17 = require("@codemirror/state");
|
266
|
+
var import_view19 = require("@codemirror/view");
|
246
267
|
var import_react6 = require("react");
|
247
268
|
var import_autocomplete4 = require("@codemirror/autocomplete");
|
248
269
|
var import_commands3 = require("@codemirror/commands");
|
249
270
|
var import_lang_markdown2 = require("@codemirror/lang-markdown");
|
250
271
|
var import_language5 = require("@codemirror/language");
|
251
272
|
var import_language_data = require("@codemirror/language-data");
|
252
|
-
var
|
253
|
-
var
|
273
|
+
var import_lint2 = require("@codemirror/lint");
|
274
|
+
var import_view20 = require("@codemirror/view");
|
275
|
+
var import_util5 = require("@dxos/util");
|
254
276
|
var import_lang_markdown3 = require("@codemirror/lang-markdown");
|
255
277
|
var import_language6 = require("@codemirror/language");
|
256
278
|
var import_highlight2 = require("@lezer/highlight");
|
257
279
|
var import_markdown = require("@lezer/markdown");
|
258
280
|
var import_language7 = require("@codemirror/language");
|
259
|
-
var import_state17 = require("@codemirror/state");
|
260
|
-
var import_language8 = require("@codemirror/language");
|
261
281
|
var import_state18 = require("@codemirror/state");
|
262
|
-
var
|
282
|
+
var import_language8 = require("@codemirror/language");
|
283
|
+
var import_state19 = require("@codemirror/state");
|
284
|
+
var import_view21 = require("@codemirror/view");
|
263
285
|
var import_invariant4 = require("@dxos/invariant");
|
264
286
|
var import_react_ui_theme5 = require("@dxos/react-ui-theme");
|
265
287
|
var import_language9 = require("@codemirror/language");
|
266
|
-
var import_state19 = require("@codemirror/state");
|
267
|
-
var import_view21 = require("@codemirror/view");
|
268
|
-
var import_language10 = require("@codemirror/language");
|
269
288
|
var import_state20 = require("@codemirror/state");
|
270
289
|
var import_view22 = require("@codemirror/view");
|
271
|
-
var
|
272
|
-
var import_language11 = require("@codemirror/language");
|
290
|
+
var import_language10 = require("@codemirror/language");
|
273
291
|
var import_state21 = require("@codemirror/state");
|
292
|
+
var import_view23 = require("@codemirror/view");
|
274
293
|
var import_view24 = require("@codemirror/view");
|
275
|
-
var
|
276
|
-
var import_view25 = require("@codemirror/view");
|
277
|
-
var import_react_ui_theme6 = require("@dxos/react-ui-theme");
|
278
|
-
var import_language13 = require("@codemirror/language");
|
294
|
+
var import_language11 = require("@codemirror/language");
|
279
295
|
var import_state22 = require("@codemirror/state");
|
296
|
+
var import_view25 = require("@codemirror/view");
|
297
|
+
var import_language12 = require("@codemirror/language");
|
280
298
|
var import_view26 = require("@codemirror/view");
|
281
|
-
var
|
282
|
-
var import_react_ui_theme7 = require("@dxos/react-ui-theme");
|
299
|
+
var import_react_ui_theme6 = require("@dxos/react-ui-theme");
|
283
300
|
var import_autocomplete5 = require("@codemirror/autocomplete");
|
284
|
-
var
|
301
|
+
var import_log6 = require("@dxos/log");
|
285
302
|
var import_view27 = require("@codemirror/view");
|
286
303
|
var import_codemirror_vim = require("@replit/codemirror-vim");
|
287
304
|
var import_codemirror_vscode_keymap = require("@replit/codemirror-vscode-keymap");
|
288
305
|
var import_effect = require("effect");
|
289
|
-
var import_dx_ref_tag = require("@dxos/lit-ui/dx-ref-tag.pcss");
|
290
|
-
var import_language14 = require("@codemirror/language");
|
291
306
|
var import_state23 = require("@codemirror/state");
|
292
307
|
var import_view28 = require("@codemirror/view");
|
308
|
+
var import_react_ui_theme7 = require("@dxos/react-ui-theme");
|
309
|
+
var import_commands4 = require("@codemirror/commands");
|
310
|
+
var import_language13 = require("@codemirror/language");
|
311
|
+
var import_state24 = require("@codemirror/state");
|
293
312
|
var import_view29 = require("@codemirror/view");
|
294
|
-
var
|
313
|
+
var import_state25 = require("@codemirror/state");
|
314
|
+
var import_language14 = require("@codemirror/language");
|
315
|
+
var import_state26 = require("@codemirror/state");
|
316
|
+
var import_state27 = require("@codemirror/state");
|
317
|
+
var import_invariant5 = require("@dxos/invariant");
|
318
|
+
var import_state28 = require("@codemirror/state");
|
295
319
|
var import_view30 = require("@codemirror/view");
|
296
|
-
var
|
297
|
-
var
|
320
|
+
var import_log7 = require("@dxos/log");
|
321
|
+
var import_dx_ref_tag = require("@dxos/lit-ui/dx-ref-tag.pcss");
|
322
|
+
var import_language15 = require("@codemirror/language");
|
323
|
+
var import_state29 = require("@codemirror/state");
|
298
324
|
var import_view31 = require("@codemirror/view");
|
325
|
+
var import_view32 = require("@codemirror/view");
|
326
|
+
var import_search2 = require("@codemirror/search");
|
327
|
+
var import_view33 = require("@codemirror/view");
|
328
|
+
var import_react_ui_theme8 = require("@dxos/react-ui-theme");
|
329
|
+
var import_tracking2 = require("@preact-signals/safe-react/tracking");
|
330
|
+
var import_react_context = require("@radix-ui/react-context");
|
331
|
+
var import_react7 = __toESM(require("react"));
|
332
|
+
var import_async5 = require("@dxos/async");
|
333
|
+
var import_react_ui4 = require("@dxos/react-ui");
|
334
|
+
var import_tracking3 = require("@preact-signals/safe-react/tracking");
|
335
|
+
var import_react_context2 = require("@radix-ui/react-context");
|
336
|
+
var import_react8 = __toESM(require("react"));
|
337
|
+
var import_async6 = require("@dxos/async");
|
338
|
+
var import_react_ui5 = require("@dxos/react-ui");
|
339
|
+
var import_state30 = require("@codemirror/state");
|
340
|
+
var import_view34 = require("@codemirror/view");
|
299
341
|
var import_react_tabster = require("@fluentui/react-tabster");
|
300
|
-
var
|
342
|
+
var import_react9 = require("react");
|
301
343
|
var import_log8 = require("@dxos/log");
|
302
|
-
var
|
344
|
+
var import_util6 = require("@dxos/util");
|
303
345
|
var translationKey = "react-ui-editor";
|
304
346
|
var translations_default = [
|
305
347
|
{
|
@@ -353,50 +395,80 @@ var createEditorActionGroup = (id, props, icon) => (0, import_react_ui_menu2.cre
|
|
353
395
|
iconOnly: true,
|
354
396
|
...props
|
355
397
|
});
|
356
|
-
var
|
357
|
-
|
358
|
-
combine: (providers) => {
|
359
|
-
return providers[0] ?? defaultValue;
|
360
|
-
}
|
398
|
+
var annotationMark = import_view2.Decoration.mark({
|
399
|
+
class: "cm-annotation"
|
361
400
|
});
|
362
|
-
var
|
363
|
-
|
364
|
-
|
365
|
-
|
401
|
+
var annotations = ({ match } = {}) => {
|
402
|
+
return [
|
403
|
+
import_view2.ViewPlugin.fromClass(class {
|
404
|
+
constructor() {
|
405
|
+
this.decorations = import_view2.Decoration.none;
|
406
|
+
}
|
407
|
+
update(update2) {
|
408
|
+
const builder = new import_state2.RangeSetBuilder();
|
409
|
+
if (match) {
|
410
|
+
const { from, to } = update2.view.viewport;
|
411
|
+
const text = update2.state.doc.sliceString(from, to);
|
412
|
+
const matches = text.matchAll(match);
|
413
|
+
for (const m of matches) {
|
414
|
+
if (m.index !== void 0) {
|
415
|
+
const start = from + m.index;
|
416
|
+
const end = start + m[0].length;
|
417
|
+
builder.add(start, end, annotationMark);
|
418
|
+
}
|
419
|
+
}
|
420
|
+
}
|
421
|
+
this.decorations = builder.finish();
|
422
|
+
}
|
423
|
+
}, {
|
424
|
+
decorations: (v) => v.decorations
|
425
|
+
}),
|
426
|
+
import_view2.EditorView.theme({
|
427
|
+
".cm-annotation": {
|
428
|
+
textDecoration: "underline",
|
429
|
+
textDecorationStyle: "wavy",
|
430
|
+
textDecorationColor: "var(--dx-errorText)"
|
431
|
+
}
|
432
|
+
})
|
433
|
+
];
|
366
434
|
};
|
367
|
-
var
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
435
|
+
var autocomplete = ({ activateOnTyping, override, onSearch } = {}) => {
|
436
|
+
const extensions = [
|
437
|
+
// https://codemirror.net/docs/ref/#view.keymap
|
438
|
+
// https://discuss.codemirror.net/t/how-can-i-replace-the-default-autocompletion-keymap-v6/3322
|
439
|
+
// TODO(burdon): Set custom keymap.
|
440
|
+
import_view3.keymap.of(import_autocomplete.completionKeymap),
|
441
|
+
// https://codemirror.net/examples/autocompletion
|
442
|
+
// https://codemirror.net/docs/ref/#autocomplete.autocompletion
|
443
|
+
(0, import_autocomplete.autocompletion)({
|
444
|
+
override,
|
445
|
+
activateOnTyping
|
446
|
+
})
|
447
|
+
];
|
448
|
+
if (onSearch) {
|
449
|
+
extensions.push(
|
450
|
+
// TODO(burdon): Optional decoration via addToOptions.
|
451
|
+
import_lang_markdown.markdownLanguage.data.of({
|
452
|
+
autocomplete: (context) => {
|
453
|
+
const match = context.matchBefore(/\w*/);
|
454
|
+
if (!match || match.from === match.to && !context.explicit) {
|
455
|
+
return null;
|
456
|
+
}
|
457
|
+
return {
|
458
|
+
from: match.from,
|
459
|
+
options: onSearch(match.text.toLowerCase())
|
460
|
+
};
|
461
|
+
}
|
462
|
+
})
|
463
|
+
);
|
393
464
|
}
|
465
|
+
return extensions;
|
394
466
|
};
|
395
|
-
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/ui/react-ui-editor/src/
|
396
|
-
var
|
397
|
-
|
467
|
+
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/ui/react-ui-editor/src/extensions/automerge/cursor.ts";
|
468
|
+
var cursorConverter = (accessor) => ({
|
469
|
+
toCursor: (pos, assoc) => {
|
398
470
|
try {
|
399
|
-
return
|
471
|
+
return (0, import_echo.toCursor)(accessor, pos, assoc);
|
400
472
|
} catch (err) {
|
401
473
|
import_log.log.catch(err, void 0, {
|
402
474
|
F: __dxlog_file,
|
@@ -404,266 +476,71 @@ var wrapWithCatch = (fn) => {
|
|
404
476
|
S: void 0,
|
405
477
|
C: (f, a) => f(...a)
|
406
478
|
});
|
479
|
+
return "";
|
407
480
|
}
|
408
|
-
}
|
481
|
+
},
|
482
|
+
fromCursor: (cursor) => {
|
483
|
+
try {
|
484
|
+
return (0, import_echo.fromCursor)(accessor, cursor);
|
485
|
+
} catch (err) {
|
486
|
+
import_log.log.catch(err, void 0, {
|
487
|
+
F: __dxlog_file,
|
488
|
+
L: 24,
|
489
|
+
S: void 0,
|
490
|
+
C: (f, a) => f(...a)
|
491
|
+
});
|
492
|
+
return 0;
|
493
|
+
}
|
494
|
+
}
|
495
|
+
});
|
496
|
+
var getPath = (state, field) => state.field(field).path;
|
497
|
+
var getLastHeads = (state, field) => state.field(field).lastHeads;
|
498
|
+
var updateHeadsEffect = import_state4.StateEffect.define({});
|
499
|
+
var updateHeads = (newHeads) => updateHeadsEffect.of({
|
500
|
+
newHeads
|
501
|
+
});
|
502
|
+
var reconcileAnnotation = import_state4.Annotation.define();
|
503
|
+
var isReconcile = (tr) => {
|
504
|
+
return !!tr.annotation(reconcileAnnotation);
|
409
505
|
};
|
410
|
-
var
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
L: 29,
|
417
|
-
S: void 0,
|
418
|
-
C: (f, a) => f(...a)
|
506
|
+
var updateAutomerge = (field, handle, transactions, state) => {
|
507
|
+
const { lastHeads, path } = state.field(field);
|
508
|
+
let hasChanges = false;
|
509
|
+
for (const tr of transactions) {
|
510
|
+
tr.changes.iterChanges(() => {
|
511
|
+
hasChanges = true;
|
419
512
|
});
|
420
513
|
}
|
514
|
+
if (!hasChanges) {
|
515
|
+
return void 0;
|
516
|
+
}
|
517
|
+
const newHeads = handle.changeAt(lastHeads, (doc) => {
|
518
|
+
const invertedTransactions = [];
|
519
|
+
for (const tr of transactions) {
|
520
|
+
tr.changes.iterChanges((fromA, toA, _fromB, _toB, insert) => {
|
521
|
+
invertedTransactions.push({
|
522
|
+
from: fromA,
|
523
|
+
del: toA - fromA,
|
524
|
+
insert
|
525
|
+
});
|
526
|
+
});
|
527
|
+
}
|
528
|
+
invertedTransactions.reverse().forEach(({ from, del, insert }) => {
|
529
|
+
import_automerge3.next.splice(doc, path.slice(), from, del, insert.toString());
|
530
|
+
});
|
531
|
+
});
|
532
|
+
return newHeads ?? void 0;
|
421
533
|
};
|
422
|
-
var
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
tr.changes.iterChanges((fromA, toA, fromB, toB, inserted) => changes2.push(JSON.stringify({
|
433
|
-
fromA,
|
434
|
-
toA,
|
435
|
-
fromB,
|
436
|
-
toB,
|
437
|
-
inserted: inserted.toString()
|
438
|
-
})));
|
439
|
-
return changes2;
|
440
|
-
}).filter(Boolean);
|
441
|
-
if (changes.length) {
|
442
|
-
(0, import_log.log)("changes", {
|
443
|
-
changes
|
444
|
-
}, {
|
445
|
-
F: __dxlog_file,
|
446
|
-
L: 62,
|
447
|
-
S: void 0,
|
448
|
-
C: (f, a) => f(...a)
|
449
|
-
});
|
450
|
-
}
|
451
|
-
};
|
452
|
-
var flattenRect = (rect, left) => {
|
453
|
-
const x = left ? rect.left : rect.right;
|
454
|
-
return {
|
455
|
-
left: x,
|
456
|
-
right: x,
|
457
|
-
top: rect.top,
|
458
|
-
bottom: rect.bottom
|
459
|
-
};
|
460
|
-
};
|
461
|
-
var scratchRange;
|
462
|
-
var textRange = (node, from, to = from) => {
|
463
|
-
const range = scratchRange || (scratchRange = document.createRange());
|
464
|
-
range.setEnd(node, to);
|
465
|
-
range.setStart(node, from);
|
466
|
-
return range;
|
467
|
-
};
|
468
|
-
var clientRectsFor = (dom) => {
|
469
|
-
if (dom.nodeType === 3) {
|
470
|
-
return textRange(dom, 0, dom.nodeValue.length).getClientRects();
|
471
|
-
} else if (dom.nodeType === 1) {
|
472
|
-
return dom.getClientRects();
|
473
|
-
} else {
|
474
|
-
return [];
|
475
|
-
}
|
476
|
-
};
|
477
|
-
var createElement = (tag, options, children) => {
|
478
|
-
const el = document.createElement(tag);
|
479
|
-
if (options?.className) {
|
480
|
-
el.className = options.className;
|
481
|
-
}
|
482
|
-
if (children) {
|
483
|
-
el.append(...Array.isArray(children) ? children : [
|
484
|
-
children
|
485
|
-
]);
|
486
|
-
}
|
487
|
-
return el;
|
488
|
-
};
|
489
|
-
var renderRoot = (root, node) => {
|
490
|
-
(0, import_client.createRoot)(root).render(/* @__PURE__ */ import_react3.default.createElement(import_react_ui2.ThemeProvider, {
|
491
|
-
tx: import_react_ui_theme2.defaultTx
|
492
|
-
}, node));
|
493
|
-
return root;
|
494
|
-
};
|
495
|
-
var createRenderer = (Component) => (el, props) => {
|
496
|
-
renderRoot(el, /* @__PURE__ */ import_react3.default.createElement(import_react_ui2.ThemeProvider, {
|
497
|
-
tx: import_react_ui_theme2.defaultTx
|
498
|
-
}, /* @__PURE__ */ import_react3.default.createElement(import_react_ui2.Tooltip.Provider, null, /* @__PURE__ */ import_react3.default.createElement(Component, props))));
|
499
|
-
};
|
500
|
-
var annotationMark = import_view2.Decoration.mark({
|
501
|
-
class: "cm-annotation"
|
502
|
-
});
|
503
|
-
var annotations = (options = {}) => {
|
504
|
-
const match = (state) => {
|
505
|
-
const annotations2 = [];
|
506
|
-
const text = state.doc.toString();
|
507
|
-
if (options.match) {
|
508
|
-
const matches = text.matchAll(options.match);
|
509
|
-
for (const match2 of matches) {
|
510
|
-
const from = match2.index;
|
511
|
-
const to = from + match2[0].length;
|
512
|
-
const cursor = Cursor.getCursorFromRange(state, {
|
513
|
-
from,
|
514
|
-
to
|
515
|
-
});
|
516
|
-
annotations2.push({
|
517
|
-
cursor
|
518
|
-
});
|
519
|
-
}
|
520
|
-
}
|
521
|
-
return annotations2;
|
522
|
-
};
|
523
|
-
const annotationsState = import_state2.StateField.define({
|
524
|
-
create: (state) => {
|
525
|
-
return match(state);
|
526
|
-
},
|
527
|
-
update: (value, tr) => {
|
528
|
-
if (!tr.changes.empty) {
|
529
|
-
return match(tr.state);
|
530
|
-
}
|
531
|
-
return value;
|
532
|
-
}
|
533
|
-
});
|
534
|
-
return [
|
535
|
-
annotationsState,
|
536
|
-
import_view2.EditorView.decorations.compute([
|
537
|
-
annotationsState
|
538
|
-
], (state) => {
|
539
|
-
const annotations2 = state.field(annotationsState);
|
540
|
-
const decorations = annotations2.map((annotation) => {
|
541
|
-
const range = Cursor.getRangeFromCursor(state, annotation.cursor);
|
542
|
-
return range && annotationMark.range(range.from, range.to);
|
543
|
-
}).filter(import_util.isNotFalsy);
|
544
|
-
return import_view2.Decoration.set(decorations);
|
545
|
-
}),
|
546
|
-
styles
|
547
|
-
];
|
548
|
-
};
|
549
|
-
var styles = import_view2.EditorView.theme({
|
550
|
-
".cm-annotation": {
|
551
|
-
textDecoration: "underline",
|
552
|
-
textDecorationStyle: "wavy",
|
553
|
-
textDecorationColor: "var(--dx-error)"
|
554
|
-
}
|
555
|
-
});
|
556
|
-
var autocomplete = ({ debug, activateOnTyping, override, onSearch } = {}) => {
|
557
|
-
const extensions = [
|
558
|
-
// https://codemirror.net/docs/ref/#view.keymap
|
559
|
-
// https://discuss.codemirror.net/t/how-can-i-replace-the-default-autocompletion-keymap-v6/3322
|
560
|
-
// TODO(burdon): Set custom keymap.
|
561
|
-
import_view3.keymap.of(import_autocomplete.completionKeymap),
|
562
|
-
// https://codemirror.net/examples/autocompletion
|
563
|
-
// https://codemirror.net/docs/ref/#autocomplete.autocompletion
|
564
|
-
(0, import_autocomplete.autocompletion)({
|
565
|
-
activateOnTyping,
|
566
|
-
override,
|
567
|
-
closeOnBlur: !debug,
|
568
|
-
tooltipClass: () => "shadow rounded"
|
569
|
-
})
|
570
|
-
];
|
571
|
-
if (onSearch) {
|
572
|
-
extensions.push(
|
573
|
-
// TODO(burdon): Optional decoration via addToOptions
|
574
|
-
import_lang_markdown.markdownLanguage.data.of({
|
575
|
-
autocomplete: (context) => {
|
576
|
-
const match = context.matchBefore(/\w*/);
|
577
|
-
if (!match || match.from === match.to && !context.explicit) {
|
578
|
-
return null;
|
579
|
-
}
|
580
|
-
return {
|
581
|
-
from: match.from,
|
582
|
-
options: onSearch(match.text.toLowerCase())
|
583
|
-
};
|
584
|
-
}
|
585
|
-
})
|
586
|
-
);
|
587
|
-
}
|
588
|
-
return extensions;
|
589
|
-
};
|
590
|
-
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-editor/src/extensions/automerge/cursor.ts";
|
591
|
-
var cursorConverter = (accessor) => ({
|
592
|
-
toCursor: (pos, assoc) => {
|
593
|
-
try {
|
594
|
-
return (0, import_echo.toCursor)(accessor, pos, assoc);
|
595
|
-
} catch (err) {
|
596
|
-
import_log2.log.catch(err, void 0, {
|
597
|
-
F: __dxlog_file2,
|
598
|
-
L: 15,
|
599
|
-
S: void 0,
|
600
|
-
C: (f, a) => f(...a)
|
601
|
-
});
|
602
|
-
return "";
|
603
|
-
}
|
604
|
-
},
|
605
|
-
fromCursor: (cursor) => {
|
606
|
-
try {
|
607
|
-
return (0, import_echo.fromCursor)(accessor, cursor);
|
608
|
-
} catch (err) {
|
609
|
-
import_log2.log.catch(err, void 0, {
|
610
|
-
F: __dxlog_file2,
|
611
|
-
L: 24,
|
612
|
-
S: void 0,
|
613
|
-
C: (f, a) => f(...a)
|
614
|
-
});
|
615
|
-
return 0;
|
616
|
-
}
|
617
|
-
}
|
618
|
-
});
|
619
|
-
var getPath = (state, field) => state.field(field).path;
|
620
|
-
var getLastHeads = (state, field) => state.field(field).lastHeads;
|
621
|
-
var updateHeadsEffect = import_state5.StateEffect.define({});
|
622
|
-
var updateHeads = (newHeads) => updateHeadsEffect.of({
|
623
|
-
newHeads
|
624
|
-
});
|
625
|
-
var reconcileAnnotation = import_state5.Annotation.define();
|
626
|
-
var isReconcile = (tr) => {
|
627
|
-
return !!tr.annotation(reconcileAnnotation);
|
628
|
-
};
|
629
|
-
var updateAutomerge = (field, handle, transactions, state) => {
|
630
|
-
const { lastHeads, path } = state.field(field);
|
631
|
-
let hasChanges = false;
|
632
|
-
for (const tr of transactions) {
|
633
|
-
tr.changes.iterChanges(() => {
|
634
|
-
hasChanges = true;
|
635
|
-
});
|
636
|
-
}
|
637
|
-
if (!hasChanges) {
|
638
|
-
return void 0;
|
639
|
-
}
|
640
|
-
const newHeads = handle.changeAt(lastHeads, (doc) => {
|
641
|
-
const invertedTransactions = [];
|
642
|
-
for (const tr of transactions) {
|
643
|
-
tr.changes.iterChanges((fromA, toA, _fromB, _toB, insert) => {
|
644
|
-
invertedTransactions.push({
|
645
|
-
from: fromA,
|
646
|
-
del: toA - fromA,
|
647
|
-
insert
|
648
|
-
});
|
649
|
-
});
|
650
|
-
}
|
651
|
-
invertedTransactions.reverse().forEach(({ from, del, insert }) => {
|
652
|
-
import_automerge3.next.splice(doc, path.slice(), from, del, insert.toString());
|
653
|
-
});
|
654
|
-
});
|
655
|
-
return newHeads ?? void 0;
|
656
|
-
};
|
657
|
-
var updateCodeMirror = (view, selection, target, patches) => {
|
658
|
-
for (const patch of patches) {
|
659
|
-
const changeSpec = handlePatch(patch, target, view.state);
|
660
|
-
if (changeSpec != null) {
|
661
|
-
const changeSet = import_state6.ChangeSet.of(changeSpec, view.state.doc.length, "\n");
|
662
|
-
selection = selection.map(changeSet, 1);
|
663
|
-
view.dispatch({
|
664
|
-
changes: changeSet,
|
665
|
-
annotations: reconcileAnnotation.of(false)
|
666
|
-
});
|
534
|
+
var updateCodeMirror = (view, selection, target, patches) => {
|
535
|
+
for (const patch of patches) {
|
536
|
+
const changeSpec = handlePatch(patch, target, view.state);
|
537
|
+
if (changeSpec != null) {
|
538
|
+
const changeSet = import_state5.ChangeSet.of(changeSpec, view.state.doc.length, "\n");
|
539
|
+
selection = selection.map(changeSet, 1);
|
540
|
+
view.dispatch({
|
541
|
+
changes: changeSet,
|
542
|
+
annotations: reconcileAnnotation.of(false)
|
543
|
+
});
|
667
544
|
}
|
668
545
|
}
|
669
546
|
view.dispatch({
|
@@ -765,12 +642,12 @@ var Syncer = class {
|
|
765
642
|
this._state = _state;
|
766
643
|
this._pending = false;
|
767
644
|
}
|
768
|
-
reconcile(view,
|
645
|
+
reconcile(view, editor2) {
|
769
646
|
if (this._pending) {
|
770
647
|
return;
|
771
648
|
}
|
772
649
|
this._pending = true;
|
773
|
-
if (
|
650
|
+
if (editor2) {
|
774
651
|
this.onEditorChange(view);
|
775
652
|
} else {
|
776
653
|
this.onAutomergeChange(view);
|
@@ -800,74 +677,218 @@ var Syncer = class {
|
|
800
677
|
});
|
801
678
|
}
|
802
679
|
};
|
803
|
-
var
|
804
|
-
|
805
|
-
|
806
|
-
|
807
|
-
lastHeads: import_automerge.next.getHeads(accessor.handle.doc()),
|
808
|
-
unreconciledTransactions: []
|
809
|
-
}),
|
810
|
-
update: (value, tr) => {
|
811
|
-
const result = {
|
812
|
-
path: accessor.path.slice(),
|
813
|
-
lastHeads: value.lastHeads,
|
814
|
-
unreconciledTransactions: value.unreconciledTransactions.slice()
|
815
|
-
};
|
816
|
-
let clearUnreconciled = false;
|
817
|
-
for (const effect of tr.effects) {
|
818
|
-
if (effect.is(updateHeadsEffect)) {
|
819
|
-
result.lastHeads = effect.value.newHeads;
|
820
|
-
clearUnreconciled = true;
|
821
|
-
}
|
822
|
-
}
|
823
|
-
if (clearUnreconciled) {
|
824
|
-
result.unreconciledTransactions = [];
|
825
|
-
} else {
|
826
|
-
if (!isReconcile(tr)) {
|
827
|
-
result.unreconciledTransactions.push(tr);
|
828
|
-
}
|
829
|
-
}
|
830
|
-
return result;
|
831
|
-
}
|
832
|
-
});
|
833
|
-
const syncer = new Syncer(accessor.handle, syncState);
|
834
|
-
return [
|
835
|
-
Cursor.converter.of(cursorConverter(accessor)),
|
836
|
-
// Track heads.
|
837
|
-
syncState,
|
838
|
-
// Reconcile external updates.
|
839
|
-
import_view4.ViewPlugin.fromClass(class {
|
840
|
-
constructor(_view) {
|
841
|
-
this._view = _view;
|
842
|
-
this._handleChange = () => {
|
843
|
-
syncer.reconcile(this._view, false);
|
844
|
-
};
|
845
|
-
accessor.handle.addListener("change", this._handleChange);
|
846
|
-
}
|
847
|
-
destroy() {
|
848
|
-
accessor.handle.removeListener("change", this._handleChange);
|
849
|
-
}
|
850
|
-
}),
|
851
|
-
// Reconcile local updates.
|
852
|
-
import_view4.EditorView.updateListener.of(({ view, changes }) => {
|
853
|
-
if (!changes.empty) {
|
854
|
-
syncer.reconcile(view, true);
|
855
|
-
}
|
856
|
-
})
|
857
|
-
];
|
858
|
-
};
|
859
|
-
var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-editor/src/extensions/awareness/awareness.ts";
|
860
|
-
var dummyProvider = {
|
861
|
-
remoteStateChange: new import_async.Event(),
|
862
|
-
open: () => {
|
863
|
-
},
|
864
|
-
close: () => {
|
865
|
-
},
|
866
|
-
getRemoteStates: () => [],
|
867
|
-
update: () => {
|
680
|
+
var singleValueFacet = (defaultValue) => import_state6.Facet.define({
|
681
|
+
// Called immediately.
|
682
|
+
combine: (providers) => {
|
683
|
+
return providers[0] ?? defaultValue;
|
868
684
|
}
|
869
|
-
};
|
870
|
-
var
|
685
|
+
});
|
686
|
+
var overlap = (a, b) => a.from <= b.to && a.to >= b.from;
|
687
|
+
var defaultCursorConverter = {
|
688
|
+
toCursor: (position) => position.toString(),
|
689
|
+
fromCursor: (cursor) => parseInt(cursor)
|
690
|
+
};
|
691
|
+
var Cursor = class _Cursor {
|
692
|
+
static {
|
693
|
+
this.converter = singleValueFacet(defaultCursorConverter);
|
694
|
+
}
|
695
|
+
static {
|
696
|
+
this.getCursorFromRange = (state, range) => {
|
697
|
+
const cursorConverter2 = state.facet(_Cursor.converter);
|
698
|
+
const from = cursorConverter2.toCursor(range.from);
|
699
|
+
const to = cursorConverter2.toCursor(range.to, -1);
|
700
|
+
return [
|
701
|
+
from,
|
702
|
+
to
|
703
|
+
].join(":");
|
704
|
+
};
|
705
|
+
}
|
706
|
+
static {
|
707
|
+
this.getRangeFromCursor = (state, cursor) => {
|
708
|
+
const cursorConverter2 = state.facet(_Cursor.converter);
|
709
|
+
const parts = cursor.split(":");
|
710
|
+
const from = cursorConverter2.fromCursor(parts[0]);
|
711
|
+
const to = cursorConverter2.fromCursor(parts[1]);
|
712
|
+
return from !== void 0 && to !== void 0 ? {
|
713
|
+
from,
|
714
|
+
to
|
715
|
+
} : void 0;
|
716
|
+
};
|
717
|
+
}
|
718
|
+
};
|
719
|
+
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-editor/src/util/debug.ts";
|
720
|
+
var wrapWithCatch = (fn) => {
|
721
|
+
return (...args) => {
|
722
|
+
try {
|
723
|
+
return fn(...args);
|
724
|
+
} catch (err) {
|
725
|
+
import_log2.log.catch(err, void 0, {
|
726
|
+
F: __dxlog_file2,
|
727
|
+
L: 15,
|
728
|
+
S: void 0,
|
729
|
+
C: (f, a) => f(...a)
|
730
|
+
});
|
731
|
+
}
|
732
|
+
};
|
733
|
+
};
|
734
|
+
var callbackWrapper = (fn) => (...args) => {
|
735
|
+
try {
|
736
|
+
return fn(...args);
|
737
|
+
} catch (err) {
|
738
|
+
import_log2.log.catch(err, void 0, {
|
739
|
+
F: __dxlog_file2,
|
740
|
+
L: 29,
|
741
|
+
S: void 0,
|
742
|
+
C: (f, a) => f(...a)
|
743
|
+
});
|
744
|
+
}
|
745
|
+
};
|
746
|
+
var debugDispatcher = (trs, view) => {
|
747
|
+
logChanges(trs);
|
748
|
+
view.update(trs);
|
749
|
+
};
|
750
|
+
var logChanges = (trs) => {
|
751
|
+
const changes = trs.flatMap((tr) => {
|
752
|
+
if (tr.changes.empty) {
|
753
|
+
return void 0;
|
754
|
+
}
|
755
|
+
const changes2 = [];
|
756
|
+
tr.changes.iterChanges((fromA, toA, fromB, toB, inserted) => changes2.push(JSON.stringify({
|
757
|
+
fromA,
|
758
|
+
toA,
|
759
|
+
fromB,
|
760
|
+
toB,
|
761
|
+
inserted: inserted.toString()
|
762
|
+
})));
|
763
|
+
return changes2;
|
764
|
+
}).filter(Boolean);
|
765
|
+
if (changes.length) {
|
766
|
+
(0, import_log2.log)("changes", {
|
767
|
+
changes
|
768
|
+
}, {
|
769
|
+
F: __dxlog_file2,
|
770
|
+
L: 62,
|
771
|
+
S: void 0,
|
772
|
+
C: (f, a) => f(...a)
|
773
|
+
});
|
774
|
+
}
|
775
|
+
};
|
776
|
+
var flattenRect = (rect, left) => {
|
777
|
+
const x = left ? rect.left : rect.right;
|
778
|
+
return {
|
779
|
+
left: x,
|
780
|
+
right: x,
|
781
|
+
top: rect.top,
|
782
|
+
bottom: rect.bottom
|
783
|
+
};
|
784
|
+
};
|
785
|
+
var scratchRange;
|
786
|
+
var textRange = (node, from, to = from) => {
|
787
|
+
const range = scratchRange || (scratchRange = document.createRange());
|
788
|
+
range.setEnd(node, to);
|
789
|
+
range.setStart(node, from);
|
790
|
+
return range;
|
791
|
+
};
|
792
|
+
var clientRectsFor = (dom) => {
|
793
|
+
if (dom.nodeType === 3) {
|
794
|
+
return textRange(dom, 0, dom.nodeValue.length).getClientRects();
|
795
|
+
} else if (dom.nodeType === 1) {
|
796
|
+
return dom.getClientRects();
|
797
|
+
} else {
|
798
|
+
return [];
|
799
|
+
}
|
800
|
+
};
|
801
|
+
var createElement = (tag, options, children) => {
|
802
|
+
const el = document.createElement(tag);
|
803
|
+
if (options?.className) {
|
804
|
+
el.className = options.className;
|
805
|
+
}
|
806
|
+
if (children) {
|
807
|
+
el.append(...Array.isArray(children) ? children : [
|
808
|
+
children
|
809
|
+
]);
|
810
|
+
}
|
811
|
+
return el;
|
812
|
+
};
|
813
|
+
var renderRoot = (root, node) => {
|
814
|
+
(0, import_client.createRoot)(root).render(/* @__PURE__ */ import_react3.default.createElement(import_react_ui2.ThemeProvider, {
|
815
|
+
tx: import_react_ui_theme2.defaultTx
|
816
|
+
}, node));
|
817
|
+
return root;
|
818
|
+
};
|
819
|
+
var createRenderer = (Component) => (el, props) => {
|
820
|
+
renderRoot(el, /* @__PURE__ */ import_react3.default.createElement(import_react_ui2.ThemeProvider, {
|
821
|
+
tx: import_react_ui_theme2.defaultTx
|
822
|
+
}, /* @__PURE__ */ import_react3.default.createElement(import_react_ui2.Tooltip.Provider, null, /* @__PURE__ */ import_react3.default.createElement(Component, props))));
|
823
|
+
};
|
824
|
+
var automerge = (accessor) => {
|
825
|
+
const syncState = import_state3.StateField.define({
|
826
|
+
create: () => ({
|
827
|
+
path: accessor.path.slice(),
|
828
|
+
lastHeads: import_automerge.next.getHeads(accessor.handle.doc()),
|
829
|
+
unreconciledTransactions: []
|
830
|
+
}),
|
831
|
+
update: (value, tr) => {
|
832
|
+
const result = {
|
833
|
+
path: accessor.path.slice(),
|
834
|
+
lastHeads: value.lastHeads,
|
835
|
+
unreconciledTransactions: value.unreconciledTransactions.slice()
|
836
|
+
};
|
837
|
+
let clearUnreconciled = false;
|
838
|
+
for (const effect of tr.effects) {
|
839
|
+
if (effect.is(updateHeadsEffect)) {
|
840
|
+
result.lastHeads = effect.value.newHeads;
|
841
|
+
clearUnreconciled = true;
|
842
|
+
}
|
843
|
+
}
|
844
|
+
if (clearUnreconciled) {
|
845
|
+
result.unreconciledTransactions = [];
|
846
|
+
} else {
|
847
|
+
if (!isReconcile(tr)) {
|
848
|
+
result.unreconciledTransactions.push(tr);
|
849
|
+
}
|
850
|
+
}
|
851
|
+
return result;
|
852
|
+
}
|
853
|
+
});
|
854
|
+
const syncer = new Syncer(accessor.handle, syncState);
|
855
|
+
return [
|
856
|
+
Cursor.converter.of(cursorConverter(accessor)),
|
857
|
+
// Track heads.
|
858
|
+
syncState,
|
859
|
+
// Reconcile external updates.
|
860
|
+
import_view4.ViewPlugin.fromClass(class {
|
861
|
+
constructor(_view) {
|
862
|
+
this._view = _view;
|
863
|
+
this._handleChange = () => {
|
864
|
+
syncer.reconcile(this._view, false);
|
865
|
+
};
|
866
|
+
accessor.handle.addListener("change", this._handleChange);
|
867
|
+
}
|
868
|
+
destroy() {
|
869
|
+
accessor.handle.removeListener("change", this._handleChange);
|
870
|
+
}
|
871
|
+
}),
|
872
|
+
// Reconcile local updates.
|
873
|
+
import_view4.EditorView.updateListener.of(({ view, changes }) => {
|
874
|
+
if (!changes.empty) {
|
875
|
+
syncer.reconcile(view, true);
|
876
|
+
}
|
877
|
+
})
|
878
|
+
];
|
879
|
+
};
|
880
|
+
var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-editor/src/extensions/awareness/awareness.ts";
|
881
|
+
var dummyProvider = {
|
882
|
+
remoteStateChange: new import_async.Event(),
|
883
|
+
open: () => {
|
884
|
+
},
|
885
|
+
close: () => {
|
886
|
+
},
|
887
|
+
getRemoteStates: () => [],
|
888
|
+
update: () => {
|
889
|
+
}
|
890
|
+
};
|
891
|
+
var awarenessProvider = singleValueFacet(dummyProvider);
|
871
892
|
var RemoteSelectionChangedAnnotation = import_state7.Annotation.define();
|
872
893
|
var awareness = (provider = dummyProvider) => {
|
873
894
|
return [
|
@@ -875,7 +896,7 @@ var awareness = (provider = dummyProvider) => {
|
|
875
896
|
import_view5.ViewPlugin.fromClass(RemoteSelectionsDecorator, {
|
876
897
|
decorations: (value) => value.decorations
|
877
898
|
}),
|
878
|
-
|
899
|
+
styles
|
879
900
|
];
|
880
901
|
};
|
881
902
|
var RemoteSelectionsDecorator = class {
|
@@ -918,7 +939,7 @@ var RemoteSelectionsDecorator = class {
|
|
918
939
|
} : void 0);
|
919
940
|
}
|
920
941
|
_updateRemoteSelections(view) {
|
921
|
-
const
|
942
|
+
const decorations2 = [];
|
922
943
|
const awarenessStates = this._provider.getRemoteStates();
|
923
944
|
for (const state of awarenessStates) {
|
924
945
|
const anchor = state.position?.anchor ? this._cursorConverter.fromCursor(state.position.anchor) : null;
|
@@ -933,7 +954,7 @@ var RemoteSelectionsDecorator = class {
|
|
933
954
|
const darkColor = state.info.darkColor;
|
934
955
|
const lightColor = state.info.lightColor;
|
935
956
|
if (startLine.number === endLine.number) {
|
936
|
-
|
957
|
+
decorations2.push({
|
937
958
|
from: start,
|
938
959
|
to: end,
|
939
960
|
value: import_view5.Decoration.mark({
|
@@ -944,7 +965,7 @@ var RemoteSelectionsDecorator = class {
|
|
944
965
|
})
|
945
966
|
});
|
946
967
|
} else {
|
947
|
-
|
968
|
+
decorations2.push({
|
948
969
|
from: start,
|
949
970
|
to: startLine.from + startLine.length,
|
950
971
|
value: import_view5.Decoration.mark({
|
@@ -954,7 +975,7 @@ var RemoteSelectionsDecorator = class {
|
|
954
975
|
class: "cm-collab-selection"
|
955
976
|
})
|
956
977
|
});
|
957
|
-
|
978
|
+
decorations2.push({
|
958
979
|
from: endLine.from,
|
959
980
|
to: end,
|
960
981
|
value: import_view5.Decoration.mark({
|
@@ -966,7 +987,7 @@ var RemoteSelectionsDecorator = class {
|
|
966
987
|
});
|
967
988
|
for (let i = startLine.number + 1; i < endLine.number; i++) {
|
968
989
|
const linePos = view.state.doc.line(i).from;
|
969
|
-
|
990
|
+
decorations2.push({
|
970
991
|
from: linePos,
|
971
992
|
to: linePos,
|
972
993
|
value: import_view5.Decoration.line({
|
@@ -978,7 +999,7 @@ var RemoteSelectionsDecorator = class {
|
|
978
999
|
});
|
979
1000
|
}
|
980
1001
|
}
|
981
|
-
|
1002
|
+
decorations2.push({
|
982
1003
|
from: head,
|
983
1004
|
to: head,
|
984
1005
|
value: import_view5.Decoration.widget({
|
@@ -988,14 +1009,12 @@ var RemoteSelectionsDecorator = class {
|
|
988
1009
|
})
|
989
1010
|
});
|
990
1011
|
}
|
991
|
-
this.decorations = import_view5.Decoration.set(
|
1012
|
+
this.decorations = import_view5.Decoration.set(decorations2, true);
|
992
1013
|
}
|
993
1014
|
};
|
994
1015
|
var RemoteCaretWidget = class extends import_view5.WidgetType {
|
995
1016
|
constructor(_name, _color) {
|
996
|
-
super();
|
997
|
-
this._name = _name;
|
998
|
-
this._color = _color;
|
1017
|
+
super(), this._name = _name, this._color = _color;
|
999
1018
|
}
|
1000
1019
|
toDOM() {
|
1001
1020
|
const span = document.createElement("span");
|
@@ -1027,7 +1046,7 @@ var RemoteCaretWidget = class extends import_view5.WidgetType {
|
|
1027
1046
|
return true;
|
1028
1047
|
}
|
1029
1048
|
};
|
1030
|
-
var
|
1049
|
+
var styles = import_view5.EditorView.theme({
|
1031
1050
|
".cm-collab-selection": {},
|
1032
1051
|
".cm-collab-selectionLine": {
|
1033
1052
|
padding: 0,
|
@@ -1595,7 +1614,7 @@ var commandKeyBindings = [
|
|
1595
1614
|
];
|
1596
1615
|
var hintViewPlugin = ({ onHint }) => import_view9.ViewPlugin.fromClass(class {
|
1597
1616
|
constructor() {
|
1598
|
-
this.
|
1617
|
+
this.decorations = import_view9.Decoration.none;
|
1599
1618
|
}
|
1600
1619
|
update(update2) {
|
1601
1620
|
const builder = new import_state10.RangeSetBuilder();
|
@@ -1607,22 +1626,21 @@ var hintViewPlugin = ({ onHint }) => import_view9.ViewPlugin.fromClass(class {
|
|
1607
1626
|
const hint = onHint();
|
1608
1627
|
if (hint) {
|
1609
1628
|
builder.add(selection.from, selection.to, import_view9.Decoration.widget({
|
1610
|
-
widget: new
|
1629
|
+
widget: new Hint(hint)
|
1611
1630
|
}));
|
1612
1631
|
}
|
1613
1632
|
}
|
1614
1633
|
}
|
1615
|
-
this.
|
1634
|
+
this.decorations = builder.finish();
|
1616
1635
|
}
|
1617
1636
|
}, {
|
1618
1637
|
provide: (plugin) => [
|
1619
|
-
import_view9.EditorView.decorations.of((view) => view.plugin(plugin)?.
|
1638
|
+
import_view9.EditorView.decorations.of((view) => view.plugin(plugin)?.decorations ?? import_view9.Decoration.none)
|
1620
1639
|
]
|
1621
1640
|
});
|
1622
|
-
var
|
1641
|
+
var Hint = class extends import_view9.WidgetType {
|
1623
1642
|
constructor(content) {
|
1624
|
-
super();
|
1625
|
-
this.content = content;
|
1643
|
+
super(), this.content = content;
|
1626
1644
|
}
|
1627
1645
|
toDOM() {
|
1628
1646
|
const wrap = document.createElement("span");
|
@@ -1658,75 +1676,11 @@ var CommandHint = class extends import_view9.WidgetType {
|
|
1658
1676
|
return false;
|
1659
1677
|
}
|
1660
1678
|
};
|
1661
|
-
var floatingMenu = (options) => import_view10.ViewPlugin.fromClass(class {
|
1662
|
-
constructor(view) {
|
1663
|
-
this.rafId = null;
|
1664
|
-
this.view = view;
|
1665
|
-
const container = view.scrollDOM;
|
1666
|
-
if (getComputedStyle(container).position === "static") {
|
1667
|
-
container.style.position = "relative";
|
1668
|
-
}
|
1669
|
-
this.button = document.createElement("div");
|
1670
|
-
this.button.style.position = "absolute";
|
1671
|
-
this.button.style.zIndex = "10";
|
1672
|
-
this.button.style.display = "none";
|
1673
|
-
options.renderMenu(this.button, {
|
1674
|
-
onAction: () => openCommand(view)
|
1675
|
-
}, view);
|
1676
|
-
container.appendChild(this.button);
|
1677
|
-
container.addEventListener("scroll", this.scheduleUpdate.bind(this));
|
1678
|
-
this.scheduleUpdate();
|
1679
|
-
}
|
1680
|
-
update(update2) {
|
1681
|
-
if (update2.transactions.some((tr) => tr.effects.some((effect) => effect.is(openEffect)))) {
|
1682
|
-
this.button.style.display = "none";
|
1683
|
-
} else if (update2.transactions.some((tr) => tr.effects.some((effect) => effect.is(closeEffect)))) {
|
1684
|
-
this.button.style.display = "block";
|
1685
|
-
} else if (update2.selectionSet || update2.viewportChanged || update2.docChanged || update2.geometryChanged) {
|
1686
|
-
this.scheduleUpdate();
|
1687
|
-
}
|
1688
|
-
}
|
1689
|
-
scheduleUpdate() {
|
1690
|
-
if (this.rafId != null) {
|
1691
|
-
cancelAnimationFrame(this.rafId);
|
1692
|
-
}
|
1693
|
-
this.rafId = requestAnimationFrame(this.updateButtonPosition.bind(this));
|
1694
|
-
}
|
1695
|
-
updateButtonPosition() {
|
1696
|
-
const pos = this.view.state.selection.main.head;
|
1697
|
-
const lineBlock = this.view.lineBlockAt(pos);
|
1698
|
-
const domInfo = this.view.domAtPos(lineBlock.from);
|
1699
|
-
let node = domInfo.node;
|
1700
|
-
while (node && !(node instanceof HTMLElement)) {
|
1701
|
-
node = node.parentNode;
|
1702
|
-
}
|
1703
|
-
if (!node) {
|
1704
|
-
this.button.style.display = "none";
|
1705
|
-
return;
|
1706
|
-
}
|
1707
|
-
const lineRect = node.getBoundingClientRect();
|
1708
|
-
const containerRect = this.view.scrollDOM.getBoundingClientRect();
|
1709
|
-
const offsetTop = lineRect.top - containerRect.top + this.view.scrollDOM.scrollTop;
|
1710
|
-
const offsetLeft = this.view.scrollDOM.clientWidth + this.view.scrollDOM.scrollLeft - lineRect.x;
|
1711
|
-
this.button.style.top = `${offsetTop}px`;
|
1712
|
-
this.button.style.left = `${offsetLeft}px`;
|
1713
|
-
this.button.style.display = "block";
|
1714
|
-
}
|
1715
|
-
destroy() {
|
1716
|
-
this.button.remove();
|
1717
|
-
if (this.rafId != null) {
|
1718
|
-
cancelAnimationFrame(this.rafId);
|
1719
|
-
}
|
1720
|
-
}
|
1721
|
-
});
|
1722
1679
|
var command = (options = {}) => {
|
1723
1680
|
return [
|
1724
1681
|
import_view8.keymap.of(commandKeyBindings),
|
1725
1682
|
commandConfig.of(options),
|
1726
1683
|
commandState,
|
1727
|
-
options.renderMenu ? floatingMenu({
|
1728
|
-
renderMenu: options.renderMenu
|
1729
|
-
}) : [],
|
1730
1684
|
options.onHint ? hintViewPlugin({
|
1731
1685
|
onHint: options.onHint
|
1732
1686
|
}) : [],
|
@@ -1740,21 +1694,160 @@ var command = (options = {}) => {
|
|
1740
1694
|
})
|
1741
1695
|
];
|
1742
1696
|
};
|
1743
|
-
var
|
1744
|
-
|
1745
|
-
|
1746
|
-
|
1747
|
-
|
1748
|
-
|
1749
|
-
|
1750
|
-
|
1751
|
-
|
1752
|
-
|
1753
|
-
|
1697
|
+
var floatingMenu = (options = {}) => [
|
1698
|
+
import_view10.ViewPlugin.fromClass(class {
|
1699
|
+
constructor(view) {
|
1700
|
+
this.rafId = null;
|
1701
|
+
this.view = view;
|
1702
|
+
const container = view.scrollDOM;
|
1703
|
+
if (getComputedStyle(container).position === "static") {
|
1704
|
+
container.style.position = "relative";
|
1705
|
+
}
|
1706
|
+
const icon = document.createElement("dx-icon");
|
1707
|
+
icon.setAttribute("icon", options.icon ?? "ph--dots-three-outline--regular");
|
1708
|
+
const button = document.createElement("button");
|
1709
|
+
button.appendChild(icon);
|
1710
|
+
button.classList.add("grid", "items-center", "justify-center", "w-8", "h-8");
|
1711
|
+
this.tag = document.createElement("dx-ref-tag");
|
1712
|
+
this.tag.classList.add("border-none", "fixed", "p-0");
|
1713
|
+
this.tag.appendChild(button);
|
1714
|
+
container.appendChild(this.tag);
|
1715
|
+
container.addEventListener("scroll", this.scheduleUpdate.bind(this));
|
1716
|
+
this.scheduleUpdate();
|
1717
|
+
}
|
1718
|
+
update(update2) {
|
1719
|
+
if (update2.transactions.some((tr) => tr.effects.some((effect) => effect.is(openEffect)))) {
|
1720
|
+
this.tag.style.display = "none";
|
1721
|
+
} else if (update2.transactions.some((tr) => tr.effects.some((effect) => effect.is(closeEffect)))) {
|
1722
|
+
this.tag.style.display = "block";
|
1723
|
+
} else if (update2.selectionSet || update2.viewportChanged || update2.docChanged || update2.geometryChanged) {
|
1724
|
+
this.scheduleUpdate();
|
1725
|
+
}
|
1726
|
+
}
|
1727
|
+
updateButtonPosition() {
|
1728
|
+
const { x, width } = this.view.contentDOM.getBoundingClientRect();
|
1729
|
+
const pos = this.view.state.selection.main.head;
|
1730
|
+
const line = this.view.lineBlockAt(pos);
|
1731
|
+
const coords = this.view.coordsAtPos(line.from);
|
1732
|
+
if (!coords) {
|
1733
|
+
return;
|
1734
|
+
}
|
1735
|
+
const lineHeight = coords.bottom - coords.top;
|
1736
|
+
const dy = (lineHeight - (options.height ?? 32)) / 2;
|
1737
|
+
const offsetTop = coords.top + dy;
|
1738
|
+
const offsetLeft = x + width + (options.padding ?? 8);
|
1739
|
+
this.tag.style.top = `${offsetTop}px`;
|
1740
|
+
this.tag.style.left = `${offsetLeft}px`;
|
1741
|
+
this.tag.style.display = "block";
|
1742
|
+
}
|
1743
|
+
scheduleUpdate() {
|
1744
|
+
if (this.rafId != null) {
|
1745
|
+
cancelAnimationFrame(this.rafId);
|
1746
|
+
}
|
1747
|
+
this.rafId = requestAnimationFrame(this.updateButtonPosition.bind(this));
|
1748
|
+
}
|
1749
|
+
destroy() {
|
1750
|
+
this.tag.remove();
|
1751
|
+
if (this.rafId != null) {
|
1752
|
+
cancelAnimationFrame(this.rafId);
|
1753
|
+
}
|
1754
|
+
}
|
1755
|
+
})
|
1756
|
+
];
|
1757
|
+
var typeahead = ({ onComplete } = {}) => {
|
1758
|
+
let hint;
|
1759
|
+
const complete = (view) => {
|
1760
|
+
if (!hint) {
|
1761
|
+
return false;
|
1762
|
+
}
|
1763
|
+
const selection = view.state.selection.main;
|
1764
|
+
view.dispatch({
|
1765
|
+
changes: [
|
1766
|
+
{
|
1767
|
+
from: selection.from,
|
1768
|
+
to: selection.to,
|
1769
|
+
insert: hint
|
1770
|
+
}
|
1771
|
+
],
|
1772
|
+
selection: import_state11.EditorSelection.cursor(selection.from + hint.length)
|
1773
|
+
});
|
1774
|
+
return true;
|
1754
1775
|
};
|
1755
|
-
|
1756
|
-
|
1757
|
-
|
1776
|
+
return [
|
1777
|
+
import_view11.ViewPlugin.fromClass(class {
|
1778
|
+
constructor() {
|
1779
|
+
this.decorations = import_view11.Decoration.none;
|
1780
|
+
}
|
1781
|
+
update(update2) {
|
1782
|
+
const builder = new import_state11.RangeSetBuilder();
|
1783
|
+
const selection = update2.view.state.selection.main;
|
1784
|
+
const line = update2.view.state.doc.lineAt(selection.from);
|
1785
|
+
if (selection.from === selection.to && selection.from === line.to) {
|
1786
|
+
const str = update2.state.sliceDoc(line.from, selection.from);
|
1787
|
+
hint = onComplete?.({
|
1788
|
+
line: str
|
1789
|
+
});
|
1790
|
+
if (hint) {
|
1791
|
+
builder.add(selection.from, selection.to, import_view11.Decoration.widget({
|
1792
|
+
widget: new Hint(hint)
|
1793
|
+
}));
|
1794
|
+
}
|
1795
|
+
}
|
1796
|
+
this.decorations = builder.finish();
|
1797
|
+
}
|
1798
|
+
}, {
|
1799
|
+
decorations: (v) => v.decorations
|
1800
|
+
}),
|
1801
|
+
// Keys.
|
1802
|
+
import_state11.Prec.highest(import_view11.keymap.of([
|
1803
|
+
{
|
1804
|
+
key: "Tab",
|
1805
|
+
preventDefault: true,
|
1806
|
+
run: complete
|
1807
|
+
},
|
1808
|
+
{
|
1809
|
+
key: "ArrowRight",
|
1810
|
+
preventDefault: true,
|
1811
|
+
run: complete
|
1812
|
+
}
|
1813
|
+
]))
|
1814
|
+
];
|
1815
|
+
};
|
1816
|
+
var staticCompletion = (completions, defaultCompletion) => ({ line }) => {
|
1817
|
+
if (line.length === 0 && defaultCompletion) {
|
1818
|
+
return defaultCompletion;
|
1819
|
+
}
|
1820
|
+
const words = line.split(/\s+/).filter(Boolean);
|
1821
|
+
if (words.length) {
|
1822
|
+
const word = words.at(-1);
|
1823
|
+
for (const completion of completions) {
|
1824
|
+
const match = matchCompletion(completion, word);
|
1825
|
+
if (match) {
|
1826
|
+
return match;
|
1827
|
+
}
|
1828
|
+
}
|
1829
|
+
}
|
1830
|
+
};
|
1831
|
+
var matchCompletion = (completion, word) => {
|
1832
|
+
if (completion.length > word.length && completion.startsWith(word)) {
|
1833
|
+
return completion.slice(word.length);
|
1834
|
+
}
|
1835
|
+
};
|
1836
|
+
var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-editor/src/extensions/selection.ts";
|
1837
|
+
var documentId = singleValueFacet();
|
1838
|
+
var stateRestoreAnnotation = "dxos.org/cm/state-restore";
|
1839
|
+
var createEditorStateTransaction = ({ scrollTo, selection }) => {
|
1840
|
+
return {
|
1841
|
+
selection,
|
1842
|
+
scrollIntoView: !scrollTo,
|
1843
|
+
effects: scrollTo ? import_view13.EditorView.scrollIntoView(scrollTo, {
|
1844
|
+
yMargin: 96
|
1845
|
+
}) : void 0,
|
1846
|
+
annotations: import_state13.Transaction.userEvent.of(stateRestoreAnnotation)
|
1847
|
+
};
|
1848
|
+
};
|
1849
|
+
var createEditorStateStore = (keyPrefix) => ({
|
1850
|
+
getState: (id) => {
|
1758
1851
|
(0, import_invariant3.invariant)(id, void 0, {
|
1759
1852
|
F: __dxlog_file6,
|
1760
1853
|
L: 47,
|
@@ -1789,7 +1882,7 @@ var selectionState = ({ getState, setState } = {}) => {
|
|
1789
1882
|
// setStateDebounced(id, {});
|
1790
1883
|
// },
|
1791
1884
|
// }),
|
1792
|
-
|
1885
|
+
import_view13.EditorView.updateListener.of(({ view, transactions }) => {
|
1793
1886
|
const id = view.state.facet(documentId);
|
1794
1887
|
if (!id || transactions.some((tr) => tr.isUserEvent(stateRestoreAnnotation))) {
|
1795
1888
|
return;
|
@@ -1812,7 +1905,7 @@ var selectionState = ({ getState, setState } = {}) => {
|
|
1812
1905
|
}
|
1813
1906
|
}
|
1814
1907
|
}),
|
1815
|
-
getState &&
|
1908
|
+
getState && import_view13.keymap.of([
|
1816
1909
|
{
|
1817
1910
|
key: "ctrl-r",
|
1818
1911
|
run: (view) => {
|
@@ -1824,13 +1917,13 @@ var selectionState = ({ getState, setState } = {}) => {
|
|
1824
1917
|
}
|
1825
1918
|
}
|
1826
1919
|
])
|
1827
|
-
].filter(
|
1920
|
+
].filter(import_util2.isNotFalsy);
|
1828
1921
|
};
|
1829
1922
|
var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-editor/src/extensions/comments.ts";
|
1830
|
-
var setComments =
|
1831
|
-
var setSelection =
|
1832
|
-
var setCommentState =
|
1833
|
-
var commentsState =
|
1923
|
+
var setComments = import_state12.StateEffect.define();
|
1924
|
+
var setSelection = import_state12.StateEffect.define();
|
1925
|
+
var setCommentState = import_state12.StateEffect.define();
|
1926
|
+
var commentsState = import_state12.StateField.define({
|
1834
1927
|
create: (state) => ({
|
1835
1928
|
id: state.facet(documentId),
|
1836
1929
|
comments: [],
|
@@ -1855,7 +1948,7 @@ var commentsState = import_state11.StateField.define({
|
|
1855
1948
|
comment,
|
1856
1949
|
range
|
1857
1950
|
};
|
1858
|
-
}).filter(
|
1951
|
+
}).filter(import_util.isNonNullable);
|
1859
1952
|
return {
|
1860
1953
|
...value,
|
1861
1954
|
comments: commentStates
|
@@ -1868,7 +1961,7 @@ var commentsState = import_state11.StateField.define({
|
|
1868
1961
|
return value;
|
1869
1962
|
}
|
1870
1963
|
});
|
1871
|
-
var
|
1964
|
+
var styles2 = import_view12.EditorView.theme({
|
1872
1965
|
".cm-comment, .cm-comment-current": {
|
1873
1966
|
margin: "0 -3px",
|
1874
1967
|
padding: "3px",
|
@@ -1881,23 +1974,23 @@ var styles3 = import_view11.EditorView.theme({
|
|
1881
1974
|
textDecoration: "underline"
|
1882
1975
|
}
|
1883
1976
|
});
|
1884
|
-
var createCommentMark = (id, isCurrent) =>
|
1977
|
+
var createCommentMark = (id, isCurrent) => import_view12.Decoration.mark({
|
1885
1978
|
class: isCurrent ? "cm-comment-current" : "cm-comment",
|
1886
1979
|
attributes: {
|
1887
1980
|
"data-testid": "cm-comment",
|
1888
1981
|
"data-comment-id": id
|
1889
1982
|
}
|
1890
1983
|
});
|
1891
|
-
var commentsDecorations =
|
1984
|
+
var commentsDecorations = import_view12.EditorView.decorations.compute([
|
1892
1985
|
commentsState
|
1893
1986
|
], (state) => {
|
1894
1987
|
const { selection: { current }, comments: comments2 } = state.field(commentsState);
|
1895
|
-
const
|
1988
|
+
const decorations2 = (0, import_lodash2.default)(comments2 ?? [], (range) => range.range.from)?.flatMap((comment) => {
|
1896
1989
|
const range = comment.range;
|
1897
1990
|
if (!range) {
|
1898
1991
|
import_log4.log.warn("Invalid range:", range, {
|
1899
1992
|
F: __dxlog_file7,
|
1900
|
-
L:
|
1993
|
+
L: 135,
|
1901
1994
|
S: void 0,
|
1902
1995
|
C: (f, a) => f(...a)
|
1903
1996
|
});
|
@@ -1907,11 +2000,11 @@ var commentsDecorations = import_view11.EditorView.decorations.compute([
|
|
1907
2000
|
}
|
1908
2001
|
const mark = createCommentMark(comment.comment.id, comment.comment.id === current);
|
1909
2002
|
return mark.range(range.from, range.to);
|
1910
|
-
}).filter(
|
1911
|
-
return
|
2003
|
+
}).filter(import_util.isNonNullable);
|
2004
|
+
return import_view12.Decoration.set(decorations2);
|
1912
2005
|
});
|
1913
|
-
var commentClickedEffect =
|
1914
|
-
var handleCommentClick =
|
2006
|
+
var commentClickedEffect = import_state12.StateEffect.define();
|
2007
|
+
var handleCommentClick = import_view12.EditorView.domEventHandlers({
|
1915
2008
|
click: (event, view) => {
|
1916
2009
|
let target = event.target;
|
1917
2010
|
const editorRoot = view.dom;
|
@@ -1950,7 +2043,7 @@ var trackPastedComments = (onUpdate) => {
|
|
1950
2043
|
}
|
1951
2044
|
};
|
1952
2045
|
return [
|
1953
|
-
|
2046
|
+
import_view12.EditorView.domEventHandlers({
|
1954
2047
|
cut: handleTrack,
|
1955
2048
|
copy: handleTrack
|
1956
2049
|
}),
|
@@ -1972,7 +2065,7 @@ var trackPastedComments = (onUpdate) => {
|
|
1972
2065
|
return effects;
|
1973
2066
|
}),
|
1974
2067
|
// Handle paste or the undo of comment deletion.
|
1975
|
-
|
2068
|
+
import_view12.EditorView.updateListener.of((update2) => {
|
1976
2069
|
const restore = [];
|
1977
2070
|
for (let i = 0; i < update2.transactions.length; i++) {
|
1978
2071
|
const tr = update2.transactions[i];
|
@@ -2028,7 +2121,7 @@ var mapTrackedComment = (comment, changes) => ({
|
|
2028
2121
|
from: changes.mapPos(comment.from, 1),
|
2029
2122
|
to: changes.mapPos(comment.to, 1)
|
2030
2123
|
});
|
2031
|
-
var restoreCommentEffect =
|
2124
|
+
var restoreCommentEffect = import_state12.StateEffect.define({
|
2032
2125
|
map: mapTrackedComment
|
2033
2126
|
});
|
2034
2127
|
var createComment = (view) => {
|
@@ -2069,11 +2162,11 @@ var comments = (options = {}) => {
|
|
2069
2162
|
commentsState,
|
2070
2163
|
commentsDecorations,
|
2071
2164
|
handleCommentClick,
|
2072
|
-
|
2165
|
+
styles2,
|
2073
2166
|
//
|
2074
2167
|
// Keymap.
|
2075
2168
|
//
|
2076
|
-
options.onCreate &&
|
2169
|
+
options.onCreate && import_view12.keymap.of([
|
2077
2170
|
{
|
2078
2171
|
key: shortcut,
|
2079
2172
|
run: callbackWrapper(createComment)
|
@@ -2083,7 +2176,7 @@ var comments = (options = {}) => {
|
|
2083
2176
|
// Hover tooltip (for key shortcut hints, etc.)
|
2084
2177
|
// TODO(burdon): Factor out to generic hints extension for current selection/line.
|
2085
2178
|
//
|
2086
|
-
options.renderTooltip && (0,
|
2179
|
+
options.renderTooltip && (0, import_view12.hoverTooltip)((view, pos) => {
|
2087
2180
|
const selection = view.state.selection.main;
|
2088
2181
|
if (selection && pos >= selection.from && pos <= selection.to) {
|
2089
2182
|
return {
|
@@ -2114,7 +2207,7 @@ var comments = (options = {}) => {
|
|
2114
2207
|
//
|
2115
2208
|
// Track deleted ranges and update ranges for decorations.
|
2116
2209
|
//
|
2117
|
-
|
2210
|
+
import_view12.EditorView.updateListener.of(({ view, state, changes }) => {
|
2118
2211
|
let mod = false;
|
2119
2212
|
const { comments: comments2, ...value } = state.field(commentsState);
|
2120
2213
|
changes.iterChanges((from, to, from2, to2) => {
|
@@ -2146,7 +2239,7 @@ var comments = (options = {}) => {
|
|
2146
2239
|
//
|
2147
2240
|
// Track selection/proximity.
|
2148
2241
|
//
|
2149
|
-
|
2242
|
+
import_view12.EditorView.updateListener.of(({ view, state }) => {
|
2150
2243
|
let min = Infinity;
|
2151
2244
|
const { selection: { current, closest }, comments: comments2 } = state.field(commentsState);
|
2152
2245
|
const { head } = state.selection.main;
|
@@ -2180,7 +2273,7 @@ var comments = (options = {}) => {
|
|
2180
2273
|
}
|
2181
2274
|
}),
|
2182
2275
|
options.onUpdate && trackPastedComments(options.onUpdate)
|
2183
|
-
].filter(
|
2276
|
+
].filter(import_util.isNonNullable);
|
2184
2277
|
};
|
2185
2278
|
var scrollThreadIntoView = (view, id, center = true) => {
|
2186
2279
|
const comment = view.state.field(commentsState).comments.find((range2) => range2.comment.id === id);
|
@@ -2200,7 +2293,7 @@ var scrollThreadIntoView = (view, id, center = true) => {
|
|
2200
2293
|
anchor: range.from
|
2201
2294
|
} : void 0,
|
2202
2295
|
effects: [
|
2203
|
-
needsScroll ?
|
2296
|
+
needsScroll ? import_view12.EditorView.scrollIntoView(range.from, center ? {
|
2204
2297
|
y: "center"
|
2205
2298
|
} : void 0) : [],
|
2206
2299
|
needsSelectionUpdate ? setSelection.of({
|
@@ -2211,22 +2304,6 @@ var scrollThreadIntoView = (view, id, center = true) => {
|
|
2211
2304
|
}
|
2212
2305
|
}
|
2213
2306
|
};
|
2214
|
-
var selectionOverlapsComment = (state) => {
|
2215
|
-
const commentState = state.field(commentsState, false);
|
2216
|
-
if (commentState === void 0) {
|
2217
|
-
return false;
|
2218
|
-
}
|
2219
|
-
const { selection } = state;
|
2220
|
-
for (const range of selection.ranges) {
|
2221
|
-
if (commentState.comments.some(({ range: commentRange }) => overlap(commentRange, range))) {
|
2222
|
-
return true;
|
2223
|
-
}
|
2224
|
-
}
|
2225
|
-
return false;
|
2226
|
-
};
|
2227
|
-
var hasActiveSelection = (state) => {
|
2228
|
-
return state.selection.ranges.some((range) => !range.empty);
|
2229
|
-
};
|
2230
2307
|
var ExternalCommentSync = class {
|
2231
2308
|
constructor(view, id, subscribe, getComments) {
|
2232
2309
|
this.destroy = () => {
|
@@ -2246,21 +2323,11 @@ var ExternalCommentSync = class {
|
|
2246
2323
|
this.unsubscribe = subscribe(updateComments);
|
2247
2324
|
}
|
2248
2325
|
};
|
2249
|
-
var createExternalCommentSync = (id, subscribe, getComments) =>
|
2326
|
+
var createExternalCommentSync = (id, subscribe, getComments) => import_view12.ViewPlugin.fromClass(class {
|
2250
2327
|
constructor(view) {
|
2251
2328
|
return new ExternalCommentSync(view, id, subscribe, getComments);
|
2252
2329
|
}
|
2253
2330
|
});
|
2254
|
-
var useCommentState = (state) => {
|
2255
|
-
return (0, import_react4.useMemo)(() => import_view11.EditorView.updateListener.of((update2) => {
|
2256
|
-
if (update2.docChanged || update2.selectionSet) {
|
2257
|
-
state.comment = selectionOverlapsComment(update2.state);
|
2258
|
-
state.selection = hasActiveSelection(update2.state);
|
2259
|
-
}
|
2260
|
-
}), [
|
2261
|
-
state
|
2262
|
-
]);
|
2263
|
-
};
|
2264
2331
|
var useComments = (view, id, comments2) => {
|
2265
2332
|
(0, import_react4.useEffect)(() => {
|
2266
2333
|
if (view) {
|
@@ -2275,29 +2342,16 @@ var useComments = (view, id, comments2) => {
|
|
2275
2342
|
}
|
2276
2343
|
});
|
2277
2344
|
};
|
2278
|
-
var useCommentClickListener = (onCommentClick) => {
|
2279
|
-
return (0, import_react4.useMemo)(() => import_view11.EditorView.updateListener.of((update2) => {
|
2280
|
-
update2.transactions.forEach((transaction) => {
|
2281
|
-
transaction.effects.forEach((effect) => {
|
2282
|
-
if (effect.is(commentClickedEffect)) {
|
2283
|
-
onCommentClick(effect.value);
|
2284
|
-
}
|
2285
|
-
});
|
2286
|
-
});
|
2287
|
-
}), [
|
2288
|
-
onCommentClick
|
2289
|
-
]);
|
2290
|
-
};
|
2291
2345
|
var debugNodeLogger = (log9 = console.log) => {
|
2292
2346
|
const logTokens = (state) => (0, import_language.syntaxTree)(state).iterate({
|
2293
2347
|
enter: (node) => log9(node.type)
|
2294
2348
|
});
|
2295
|
-
return
|
2349
|
+
return import_state14.StateField.define({
|
2296
2350
|
create: (state) => logTokens(state),
|
2297
2351
|
update: (_, tr) => logTokens(tr.state)
|
2298
2352
|
});
|
2299
2353
|
};
|
2300
|
-
var
|
2354
|
+
var styles3 = import_view14.EditorView.theme({
|
2301
2355
|
".cm-dropCursor": {
|
2302
2356
|
borderLeft: "2px solid var(--dx-accentText)",
|
2303
2357
|
color: "var(--dx-accentText)",
|
@@ -2309,9 +2363,9 @@ var styles4 = import_view13.EditorView.theme({
|
|
2309
2363
|
});
|
2310
2364
|
var dropFile = (options = {}) => {
|
2311
2365
|
return [
|
2312
|
-
|
2313
|
-
(0,
|
2314
|
-
|
2366
|
+
styles3,
|
2367
|
+
(0, import_view14.dropCursor)(),
|
2368
|
+
import_view14.EditorView.domEventHandlers({
|
2315
2369
|
drop: (event, view) => {
|
2316
2370
|
event.preventDefault();
|
2317
2371
|
const files = event.dataTransfer?.files;
|
@@ -2330,8 +2384,8 @@ var dropFile = (options = {}) => {
|
|
2330
2384
|
})
|
2331
2385
|
];
|
2332
2386
|
};
|
2333
|
-
var focusEffect =
|
2334
|
-
var focusField =
|
2387
|
+
var focusEffect = import_state16.StateEffect.define();
|
2388
|
+
var focusField = import_state16.StateField.define({
|
2335
2389
|
create: () => false,
|
2336
2390
|
update: (value, tr) => {
|
2337
2391
|
for (const effect of tr.effects) {
|
@@ -2344,7 +2398,7 @@ var focusField = import_state15.StateField.define({
|
|
2344
2398
|
});
|
2345
2399
|
var focus = [
|
2346
2400
|
focusField,
|
2347
|
-
|
2401
|
+
import_view16.EditorView.domEventHandlers({
|
2348
2402
|
focus: (event, view) => {
|
2349
2403
|
setTimeout(() => view.dispatch({
|
2350
2404
|
effects: focusEffect.of(true)
|
@@ -2374,7 +2428,7 @@ var theme = {
|
|
2374
2428
|
}
|
2375
2429
|
};
|
2376
2430
|
var getToken = (path, defaultValue) => {
|
2377
|
-
const value = (0,
|
2431
|
+
const value = (0, import_util4.get)(import_react_ui_theme4.tokens, path, defaultValue);
|
2378
2432
|
return value?.toString() ?? "";
|
2379
2433
|
};
|
2380
2434
|
var fontBody = getToken("fontFamily.body");
|
@@ -2493,19 +2547,25 @@ var defaultTheme = {
|
|
2493
2547
|
*/
|
2494
2548
|
".cm-tooltip.cm-tooltip-autocomplete": {
|
2495
2549
|
marginTop: "4px",
|
2496
|
-
marginLeft: "-3px"
|
2550
|
+
marginLeft: "-3px",
|
2551
|
+
borderColor: "var(--dx-separator)",
|
2552
|
+
borderTop: "none"
|
2497
2553
|
},
|
2498
2554
|
".cm-tooltip.cm-tooltip-autocomplete > ul": {
|
2499
2555
|
maxHeight: "20em"
|
2500
2556
|
},
|
2501
|
-
".cm-tooltip.cm-tooltip-autocomplete > ul > li": {
|
2502
|
-
|
2557
|
+
".cm-tooltip.cm-tooltip-autocomplete > ul > li": {
|
2558
|
+
padding: "4px"
|
2559
|
+
},
|
2560
|
+
".cm-tooltip.cm-tooltip-autocomplete > ul > li[aria-selected]": {
|
2561
|
+
background: "var(--dx-hoverSurface)"
|
2562
|
+
},
|
2503
2563
|
".cm-tooltip.cm-tooltip-autocomplete > ul > completion-section": {
|
2504
2564
|
paddingLeft: "4px !important",
|
2505
2565
|
borderBottom: "none !important",
|
2506
2566
|
color: "var(--dx-accentText)"
|
2507
2567
|
},
|
2508
|
-
".cm-
|
2568
|
+
".cm-completionInfo": {
|
2509
2569
|
width: "360px !important",
|
2510
2570
|
margin: "-10px 1px 0 1px",
|
2511
2571
|
padding: "8px !important",
|
@@ -2555,7 +2615,7 @@ var defaultTheme = {
|
|
2555
2615
|
backgroundColor: "var(--dx-input)"
|
2556
2616
|
},
|
2557
2617
|
".cm-panel input:focus, .cm-panel button:focus": {
|
2558
|
-
outline: "1px solid var(--dx-
|
2618
|
+
outline: "1px solid var(--dx-neutralFocusIndicator)"
|
2559
2619
|
},
|
2560
2620
|
".cm-panel label": {
|
2561
2621
|
display: "inline-flex",
|
@@ -2568,7 +2628,7 @@ var defaultTheme = {
|
|
2568
2628
|
height: "8px",
|
2569
2629
|
marginRight: "6px !important",
|
2570
2630
|
padding: "2px !important",
|
2571
|
-
color: "var(--dx-
|
2631
|
+
color: "var(--dx-neutralFocusIndicator)"
|
2572
2632
|
},
|
2573
2633
|
".cm-panel button": {
|
2574
2634
|
"&:hover": {
|
@@ -2584,7 +2644,7 @@ var defaultTheme = {
|
|
2584
2644
|
}
|
2585
2645
|
};
|
2586
2646
|
var __dxlog_file8 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-editor/src/extensions/factories.ts";
|
2587
|
-
var preventNewline =
|
2647
|
+
var preventNewline = import_state15.EditorState.transactionFilter.of((tr) => tr.newDoc.lines > 1 ? [] : tr);
|
2588
2648
|
var defaultBasicOptions = {
|
2589
2649
|
allowMultipleSelections: true,
|
2590
2650
|
bracketMatching: true,
|
@@ -2606,33 +2666,33 @@ var createBasicExtensions = (_props) => {
|
|
2606
2666
|
const props = (0, import_lodash3.default)({}, _props, defaultBasicOptions);
|
2607
2667
|
return [
|
2608
2668
|
// NOTE: Doesn't catch errors in keymap functions.
|
2609
|
-
|
2669
|
+
import_view15.EditorView.exceptionSink.of((err) => {
|
2610
2670
|
import_log5.log.catch(err, void 0, {
|
2611
2671
|
F: __dxlog_file8,
|
2612
|
-
L:
|
2672
|
+
L: 98,
|
2613
2673
|
S: void 0,
|
2614
2674
|
C: (f, a) => f(...a)
|
2615
2675
|
});
|
2616
2676
|
}),
|
2617
|
-
props.allowMultipleSelections &&
|
2677
|
+
props.allowMultipleSelections && import_state15.EditorState.allowMultipleSelections.of(true),
|
2618
2678
|
props.bracketMatching && (0, import_language2.bracketMatching)(),
|
2619
2679
|
props.closeBrackets && (0, import_autocomplete2.closeBrackets)(),
|
2620
|
-
props.dropCursor && (0,
|
2621
|
-
props.drawSelection && (0,
|
2680
|
+
props.dropCursor && (0, import_view15.dropCursor)(),
|
2681
|
+
props.drawSelection && (0, import_view15.drawSelection)({
|
2622
2682
|
cursorBlinkRate: 1200
|
2623
2683
|
}),
|
2624
|
-
props.editable !== void 0 &&
|
2684
|
+
props.editable !== void 0 && import_view15.EditorView.editable.of(props.editable),
|
2625
2685
|
props.focus && focus,
|
2626
|
-
props.highlightActiveLine && (0,
|
2686
|
+
props.highlightActiveLine && (0, import_view15.highlightActiveLine)(),
|
2627
2687
|
props.history && (0, import_commands2.history)(),
|
2628
|
-
props.lineNumbers && (0,
|
2629
|
-
props.lineWrapping &&
|
2630
|
-
props.placeholder && (0,
|
2631
|
-
props.readOnly !== void 0 &&
|
2632
|
-
props.scrollPastEnd && (0,
|
2633
|
-
props.tabSize &&
|
2688
|
+
props.lineNumbers && (0, import_view15.lineNumbers)(),
|
2689
|
+
props.lineWrapping && import_view15.EditorView.lineWrapping,
|
2690
|
+
props.placeholder && (0, import_view15.placeholder)(props.placeholder),
|
2691
|
+
props.readOnly !== void 0 && import_state15.EditorState.readOnly.of(props.readOnly),
|
2692
|
+
props.scrollPastEnd && (0, import_view15.scrollPastEnd)(),
|
2693
|
+
props.tabSize && import_state15.EditorState.tabSize.of(props.tabSize),
|
2634
2694
|
// https://codemirror.net/docs/ref/#view.KeyBinding
|
2635
|
-
|
2695
|
+
import_view15.keymap.of([
|
2636
2696
|
...(props.keymap && keymaps[props.keymap]) ?? [],
|
2637
2697
|
// NOTE: Tabs are also configured by markdown extension.
|
2638
2698
|
// https://codemirror.net/docs/ref/#commands.indentWithTab
|
@@ -2652,28 +2712,33 @@ var createBasicExtensions = (_props) => {
|
|
2652
2712
|
preventDefault: true,
|
2653
2713
|
run: () => true
|
2654
2714
|
}
|
2655
|
-
].filter(
|
2656
|
-
].filter(
|
2715
|
+
].filter(import_util3.isNotFalsy))
|
2716
|
+
].filter(import_util3.isNotFalsy);
|
2657
2717
|
};
|
2658
2718
|
var defaultThemeSlots = {
|
2659
2719
|
editor: {
|
2660
2720
|
className: "w-full bs-full"
|
2661
2721
|
}
|
2662
2722
|
};
|
2663
|
-
var createThemeExtensions = ({ themeMode, styles:
|
2723
|
+
var createThemeExtensions = ({ themeMode, styles: styles4, syntaxHighlighting: _syntaxHighlighting, slots: _slots } = {}) => {
|
2664
2724
|
const slots = (0, import_lodash3.default)({}, _slots, defaultThemeSlots);
|
2665
2725
|
return [
|
2666
|
-
|
2667
|
-
|
2726
|
+
import_view15.EditorView.darkTheme.of(themeMode === "dark"),
|
2727
|
+
import_view15.EditorView.baseTheme(styles4 ? (0, import_lodash4.default)({}, defaultTheme, styles4) : defaultTheme),
|
2668
2728
|
// https://github.com/codemirror/theme-one-dark
|
2669
2729
|
_syntaxHighlighting && (themeMode === "dark" ? (0, import_language2.syntaxHighlighting)(import_theme_one_dark.oneDarkHighlightStyle) : (0, import_language2.syntaxHighlighting)(import_language2.defaultHighlightStyle)),
|
2670
|
-
slots.editor?.className &&
|
2730
|
+
slots.editor?.className && import_view15.EditorView.editorAttributes.of({
|
2671
2731
|
class: slots.editor.className
|
2672
2732
|
}),
|
2673
|
-
slots.content?.className &&
|
2733
|
+
slots.content?.className && import_view15.EditorView.contentAttributes.of({
|
2674
2734
|
class: slots.content.className
|
2735
|
+
}),
|
2736
|
+
slots.scroll?.className && import_view15.ViewPlugin.fromClass(class {
|
2737
|
+
constructor(view) {
|
2738
|
+
view.scrollDOM.classList.add(slots.scroll.className);
|
2739
|
+
}
|
2675
2740
|
})
|
2676
|
-
].filter(
|
2741
|
+
].filter(import_util3.isNotFalsy);
|
2677
2742
|
};
|
2678
2743
|
var createDataExtensions = ({ id, text, space, identity }) => {
|
2679
2744
|
const extensions = [];
|
@@ -2682,7 +2747,7 @@ var createDataExtensions = ({ id, text, space, identity }) => {
|
|
2682
2747
|
}
|
2683
2748
|
if (space && identity) {
|
2684
2749
|
const peerId = identity?.identityKey.toHex();
|
2685
|
-
const hue = identity?.profile?.data?.hue ?? (0,
|
2750
|
+
const hue = identity?.profile?.data?.hue ?? (0, import_util3.hexToHue)(peerId ?? "0");
|
2686
2751
|
extensions.push(awareness(new SpaceAwarenessProvider({
|
2687
2752
|
space,
|
2688
2753
|
channel: `awareness.${id}`,
|
@@ -2717,7 +2782,7 @@ var folding = (_props = {}) => [
|
|
2717
2782
|
}));
|
2718
2783
|
}
|
2719
2784
|
}),
|
2720
|
-
|
2785
|
+
import_view17.EditorView.theme({
|
2721
2786
|
".cm-foldGutter": {
|
2722
2787
|
opacity: 0.3,
|
2723
2788
|
transition: "opacity 0.3s",
|
@@ -2728,31 +2793,70 @@ var folding = (_props = {}) => [
|
|
2728
2793
|
}
|
2729
2794
|
})
|
2730
2795
|
];
|
2796
|
+
var createJsonExtensions = ({ schema } = {}) => {
|
2797
|
+
let lintSource = (0, import_lang_json.jsonParseLinter)();
|
2798
|
+
if (schema) {
|
2799
|
+
const ajv = new import_ajv.default({
|
2800
|
+
allErrors: false
|
2801
|
+
});
|
2802
|
+
const validate = ajv.compile(schema);
|
2803
|
+
lintSource = schemaLinter(validate);
|
2804
|
+
}
|
2805
|
+
return [
|
2806
|
+
(0, import_lang_json.json)(),
|
2807
|
+
(0, import_lint.linter)(lintSource)
|
2808
|
+
];
|
2809
|
+
};
|
2810
|
+
var schemaLinter = (validate) => (view) => {
|
2811
|
+
try {
|
2812
|
+
const jsonText = view.state.doc.toString();
|
2813
|
+
const jsonData = JSON.parse(jsonText);
|
2814
|
+
const valid = validate(jsonData);
|
2815
|
+
if (valid) {
|
2816
|
+
return [];
|
2817
|
+
}
|
2818
|
+
return validate.errors?.map((err) => ({
|
2819
|
+
from: 0,
|
2820
|
+
to: jsonText.length,
|
2821
|
+
severity: "error",
|
2822
|
+
message: `${err.instancePath || "(root)"} ${err.message}`
|
2823
|
+
})) ?? [];
|
2824
|
+
} catch (err) {
|
2825
|
+
return [
|
2826
|
+
{
|
2827
|
+
from: 0,
|
2828
|
+
to: view.state.doc.length,
|
2829
|
+
severity: "error",
|
2830
|
+
message: "Invalid JSON: " + err.message
|
2831
|
+
}
|
2832
|
+
];
|
2833
|
+
}
|
2834
|
+
};
|
2731
2835
|
var listener = ({ onFocus, onChange }) => {
|
2732
2836
|
const extensions = [];
|
2733
|
-
onFocus && extensions.push(
|
2837
|
+
onFocus && extensions.push(import_view18.EditorView.focusChangeEffect.of((_, focusing) => {
|
2734
2838
|
onFocus(focusing);
|
2735
2839
|
return null;
|
2736
2840
|
}));
|
2737
|
-
onChange && extensions.push(
|
2841
|
+
onChange && extensions.push(import_view18.EditorView.updateListener.of((update2) => {
|
2738
2842
|
onChange(update2.state.doc.toString(), update2.state.facet(documentId));
|
2739
2843
|
}));
|
2740
2844
|
return extensions;
|
2741
2845
|
};
|
2742
2846
|
var formattingEquals = (a, b) => a.blockType === b.blockType && a.strong === b.strong && a.emphasis === b.emphasis && a.strikethrough === b.strikethrough && a.code === b.code && a.link === b.link && a.listStyle === b.listStyle && a.blockQuote === b.blockQuote;
|
2743
|
-
var Inline
|
2744
|
-
(function(Inline2) {
|
2847
|
+
var Inline = /* @__PURE__ */ function(Inline2) {
|
2745
2848
|
Inline2[Inline2["Strong"] = 0] = "Strong";
|
2746
2849
|
Inline2[Inline2["Emphasis"] = 1] = "Emphasis";
|
2747
2850
|
Inline2[Inline2["Strikethrough"] = 2] = "Strikethrough";
|
2748
2851
|
Inline2[Inline2["Code"] = 3] = "Code";
|
2749
|
-
|
2750
|
-
|
2751
|
-
|
2852
|
+
return Inline2;
|
2853
|
+
}({});
|
2854
|
+
var List = /* @__PURE__ */ function(List2) {
|
2752
2855
|
List2[List2["Ordered"] = 0] = "Ordered";
|
2753
2856
|
List2[List2["Bullet"] = 1] = "Bullet";
|
2754
2857
|
List2[List2["Task"] = 2] = "Task";
|
2755
|
-
|
2858
|
+
return List2;
|
2859
|
+
}({});
|
2756
2860
|
var setHeading = (level) => {
|
2757
2861
|
return ({ state, dispatch }) => {
|
2758
2862
|
const { selection: { ranges }, doc } = state;
|
@@ -2857,7 +2961,7 @@ var setStyle = (type, enable) => {
|
|
2857
2961
|
to: range.head + found + marker.length
|
2858
2962
|
}
|
2859
2963
|
],
|
2860
|
-
range:
|
2964
|
+
range: import_state17.EditorSelection.cursor(range.from - marker.length)
|
2861
2965
|
};
|
2862
2966
|
}
|
2863
2967
|
}
|
@@ -2985,13 +3089,13 @@ var setStyle = (type, enable) => {
|
|
2985
3089
|
from: range.head,
|
2986
3090
|
insert: marker + marker
|
2987
3091
|
},
|
2988
|
-
range:
|
3092
|
+
range: import_state17.EditorSelection.cursor(range.head + marker.length)
|
2989
3093
|
};
|
2990
3094
|
}
|
2991
3095
|
const changeSet = state.changes(changes2.concat(changesAtEnd));
|
2992
3096
|
return {
|
2993
3097
|
changes: changeSet,
|
2994
|
-
range: range.empty && !changeSet.empty ?
|
3098
|
+
range: range.empty && !changeSet.empty ? import_state17.EditorSelection.cursor(range.head + marker.length) : import_state17.EditorSelection.range(changeSet.mapPos(range.from, 1), changeSet.mapPos(range.to, -1))
|
2995
3099
|
};
|
2996
3100
|
});
|
2997
3101
|
dispatch(state.update(changes, {
|
@@ -3191,7 +3295,7 @@ var addLink = ({ url, image: image2 } = {}) => {
|
|
3191
3295
|
const changeSet = state.changes(changes2.concat(changesAfter));
|
3192
3296
|
return {
|
3193
3297
|
changes: changeSet,
|
3194
|
-
range:
|
3298
|
+
range: import_state17.EditorSelection.cursor(changeSet.mapPos(to, 1) - cursorOffset - (url ? url.length + 2 : 0))
|
3195
3299
|
};
|
3196
3300
|
});
|
3197
3301
|
if (changes.changes.empty) {
|
@@ -3625,7 +3729,7 @@ var toggleCodeblock = (target) => {
|
|
3625
3729
|
};
|
3626
3730
|
var formattingKeymap = (_options = {}) => {
|
3627
3731
|
return [
|
3628
|
-
|
3732
|
+
import_view19.keymap.of([
|
3629
3733
|
{
|
3630
3734
|
key: "meta-b",
|
3631
3735
|
run: toggleStrong
|
@@ -3826,7 +3930,7 @@ var getFormatting = (state) => {
|
|
3826
3930
|
};
|
3827
3931
|
};
|
3828
3932
|
var useFormattingState = (state) => {
|
3829
|
-
return (0, import_react6.useMemo)(() =>
|
3933
|
+
return (0, import_react6.useMemo)(() => import_view19.EditorView.updateListener.of((update2) => {
|
3830
3934
|
if (update2.docChanged || update2.selectionSet) {
|
3831
3935
|
Object.entries(getFormatting(update2.state)).forEach(([key, active]) => {
|
3832
3936
|
state[key] = active;
|
@@ -4054,7 +4158,7 @@ var markdownHighlightStyle = (_options = {}) => {
|
|
4054
4158
|
}
|
4055
4159
|
});
|
4056
4160
|
};
|
4057
|
-
var createMarkdownExtensions = (
|
4161
|
+
var createMarkdownExtensions = (options = {}) => {
|
4058
4162
|
return [
|
4059
4163
|
// Main extension.
|
4060
4164
|
// https://github.com/codemirror/lang-markdown
|
@@ -4078,17 +4182,17 @@ var createMarkdownExtensions = ({ themeMode } = {}) => {
|
|
4078
4182
|
}),
|
4079
4183
|
// Custom styles.
|
4080
4184
|
(0, import_language5.syntaxHighlighting)(markdownHighlightStyle()),
|
4081
|
-
|
4185
|
+
import_view20.keymap.of([
|
4082
4186
|
// https://codemirror.net/docs/ref/#commands.indentWithTab
|
4083
|
-
import_commands3.indentWithTab,
|
4187
|
+
options.indentWithTab !== false && import_commands3.indentWithTab,
|
4084
4188
|
// https://codemirror.net/docs/ref/#commands.defaultKeymap
|
4085
4189
|
...import_commands3.defaultKeymap,
|
4086
4190
|
...import_autocomplete4.completionKeymap,
|
4087
|
-
...
|
4088
|
-
])
|
4191
|
+
...import_lint2.lintKeymap
|
4192
|
+
].filter(import_util5.isNotFalsy))
|
4089
4193
|
];
|
4090
4194
|
};
|
4091
|
-
var debugTree = (cb) =>
|
4195
|
+
var debugTree = (cb) => import_state18.StateField.define({
|
4092
4196
|
create: (state) => cb(convertTreeToJson(state)),
|
4093
4197
|
update: (value, tr) => cb(convertTreeToJson(tr.state))
|
4094
4198
|
});
|
@@ -4112,12 +4216,12 @@ var convertTreeToJson = (state) => {
|
|
4112
4216
|
return treeToJson((0, import_language7.syntaxTree)(state).cursor());
|
4113
4217
|
};
|
4114
4218
|
var adjustChanges = () => {
|
4115
|
-
return
|
4219
|
+
return import_view22.ViewPlugin.fromClass(class {
|
4116
4220
|
update(update2) {
|
4117
4221
|
const tree = (0, import_language9.syntaxTree)(update2.state);
|
4118
4222
|
const adjustments = [];
|
4119
4223
|
for (const tr of update2.transactions) {
|
4120
|
-
const event = tr.annotation(
|
4224
|
+
const event = tr.annotation(import_state20.Transaction.userEvent);
|
4121
4225
|
switch (event) {
|
4122
4226
|
//
|
4123
4227
|
// Enter
|
@@ -4252,9 +4356,9 @@ var getValidUrl = (str) => {
|
|
4252
4356
|
};
|
4253
4357
|
var image = (_options = {}) => {
|
4254
4358
|
return [
|
4255
|
-
|
4359
|
+
import_state21.StateField.define({
|
4256
4360
|
create: (state) => {
|
4257
|
-
return
|
4361
|
+
return import_view23.Decoration.set(buildDecorations(0, state.doc.length, state));
|
4258
4362
|
},
|
4259
4363
|
update: (value, tr) => {
|
4260
4364
|
if (!tr.docChanged && !tr.selection) {
|
@@ -4277,12 +4381,12 @@ var image = (_options = {}) => {
|
|
4277
4381
|
add: buildDecorations(from, to, tr.state)
|
4278
4382
|
});
|
4279
4383
|
},
|
4280
|
-
provide: (field) =>
|
4384
|
+
provide: (field) => import_view23.EditorView.decorations.from(field)
|
4281
4385
|
})
|
4282
4386
|
];
|
4283
4387
|
};
|
4284
4388
|
var buildDecorations = (from, to, state) => {
|
4285
|
-
const
|
4389
|
+
const decorations2 = [];
|
4286
4390
|
const cursor = state.selection.main.head;
|
4287
4391
|
(0, import_language10.syntaxTree)(state).iterate({
|
4288
4392
|
enter: (node) => {
|
@@ -4295,7 +4399,7 @@ var buildDecorations = (from, to, state) => {
|
|
4295
4399
|
return;
|
4296
4400
|
}
|
4297
4401
|
preloadImage(url);
|
4298
|
-
|
4402
|
+
decorations2.push(import_view23.Decoration.replace({
|
4299
4403
|
block: true,
|
4300
4404
|
widget: new ImageWidget(url)
|
4301
4405
|
}).range(hide2 ? node.from : node.to, node.to));
|
@@ -4305,7 +4409,7 @@ var buildDecorations = (from, to, state) => {
|
|
4305
4409
|
from,
|
4306
4410
|
to
|
4307
4411
|
});
|
4308
|
-
return
|
4412
|
+
return decorations2;
|
4309
4413
|
};
|
4310
4414
|
var preloaded = /* @__PURE__ */ new Set();
|
4311
4415
|
var preloadImage = (url) => {
|
@@ -4315,10 +4419,9 @@ var preloadImage = (url) => {
|
|
4315
4419
|
preloaded.add(url);
|
4316
4420
|
}
|
4317
4421
|
};
|
4318
|
-
var ImageWidget = class extends
|
4422
|
+
var ImageWidget = class extends import_view23.WidgetType {
|
4319
4423
|
constructor(_url) {
|
4320
|
-
super();
|
4321
|
-
this._url = _url;
|
4424
|
+
super(), this._url = _url;
|
4322
4425
|
}
|
4323
4426
|
eq(other) {
|
4324
4427
|
return this._url === other._url;
|
@@ -4337,7 +4440,7 @@ var ImageWidget = class extends import_view22.WidgetType {
|
|
4337
4440
|
};
|
4338
4441
|
var bulletListIndentationWidth = 24;
|
4339
4442
|
var orderedListIndentationWidth = 36;
|
4340
|
-
var formattingStyles =
|
4443
|
+
var formattingStyles = import_view24.EditorView.theme({
|
4341
4444
|
/**
|
4342
4445
|
* Horizontal rule.
|
4343
4446
|
*/
|
@@ -4396,8 +4499,9 @@ var formattingStyles = import_view23.EditorView.theme({
|
|
4396
4499
|
* Task list.
|
4397
4500
|
*/
|
4398
4501
|
"& .cm-task": {
|
4399
|
-
display: "inline-
|
4400
|
-
width: `${bulletListIndentationWidth}px
|
4502
|
+
display: "inline-flex",
|
4503
|
+
width: `${bulletListIndentationWidth}px`,
|
4504
|
+
height: "20px"
|
4401
4505
|
},
|
4402
4506
|
"& .cm-task-checkbox": {
|
4403
4507
|
display: "grid",
|
@@ -4455,14 +4559,14 @@ var formattingStyles = import_view23.EditorView.theme({
|
|
4455
4559
|
}
|
4456
4560
|
});
|
4457
4561
|
var table = (options = {}) => {
|
4458
|
-
return
|
4562
|
+
return import_state22.StateField.define({
|
4459
4563
|
create: (state) => update(state, options),
|
4460
4564
|
update: (_, tr) => update(tr.state, options),
|
4461
|
-
provide: (field) =>
|
4565
|
+
provide: (field) => import_view25.EditorView.decorations.from(field)
|
4462
4566
|
});
|
4463
4567
|
};
|
4464
4568
|
var update = (state, _options) => {
|
4465
|
-
const builder = new
|
4569
|
+
const builder = new import_state22.RangeSetBuilder();
|
4466
4570
|
const cursor = state.selection.main.head;
|
4467
4571
|
const tables = [];
|
4468
4572
|
const getTable = () => tables[tables.length - 1];
|
@@ -4503,22 +4607,21 @@ var update = (state, _options) => {
|
|
4503
4607
|
tables.forEach((table2) => {
|
4504
4608
|
const replace = state.readOnly || cursor < table2.from || cursor > table2.to;
|
4505
4609
|
if (replace) {
|
4506
|
-
builder.add(table2.from, table2.to,
|
4610
|
+
builder.add(table2.from, table2.to, import_view25.Decoration.replace({
|
4507
4611
|
block: true,
|
4508
4612
|
widget: new TableWidget(table2)
|
4509
4613
|
}));
|
4510
4614
|
} else {
|
4511
|
-
builder.add(table2.from, table2.to,
|
4615
|
+
builder.add(table2.from, table2.to, import_view25.Decoration.mark({
|
4512
4616
|
class: "cm-table"
|
4513
4617
|
}));
|
4514
4618
|
}
|
4515
4619
|
});
|
4516
4620
|
return builder.finish();
|
4517
4621
|
};
|
4518
|
-
var TableWidget = class extends
|
4622
|
+
var TableWidget = class extends import_view25.WidgetType {
|
4519
4623
|
constructor(_table) {
|
4520
|
-
super();
|
4521
|
-
this._table = _table;
|
4624
|
+
super(), this._table = _table;
|
4522
4625
|
}
|
4523
4626
|
eq(other) {
|
4524
4627
|
return this._table.header?.join() === other._table.header?.join() && this._table.rows?.join() === other._table.rows?.join();
|
@@ -4555,18 +4658,16 @@ var Unicode = {
|
|
4555
4658
|
bulletSmall: "\u2219",
|
4556
4659
|
bulletSquare: "\u2B1D"
|
4557
4660
|
};
|
4558
|
-
var HorizontalRuleWidget = class extends
|
4661
|
+
var HorizontalRuleWidget = class extends import_view21.WidgetType {
|
4559
4662
|
toDOM() {
|
4560
4663
|
const el = document.createElement("span");
|
4561
4664
|
el.className = "cm-hr";
|
4562
4665
|
return el;
|
4563
4666
|
}
|
4564
4667
|
};
|
4565
|
-
var LinkButton = class extends
|
4668
|
+
var LinkButton = class extends import_view21.WidgetType {
|
4566
4669
|
constructor(url, render) {
|
4567
|
-
super();
|
4568
|
-
this.url = url;
|
4569
|
-
this.render = render;
|
4670
|
+
super(), this.url = url, this.render = render;
|
4570
4671
|
}
|
4571
4672
|
eq(other) {
|
4572
4673
|
return this.url === other.url;
|
@@ -4580,10 +4681,9 @@ var LinkButton = class extends import_view20.WidgetType {
|
|
4580
4681
|
return el;
|
4581
4682
|
}
|
4582
4683
|
};
|
4583
|
-
var CheckboxWidget = class extends
|
4684
|
+
var CheckboxWidget = class extends import_view21.WidgetType {
|
4584
4685
|
constructor(_checked) {
|
4585
|
-
super();
|
4586
|
-
this._checked = _checked;
|
4686
|
+
super(), this._checked = _checked;
|
4587
4687
|
}
|
4588
4688
|
eq(other) {
|
4589
4689
|
return this._checked === other._checked;
|
@@ -4625,11 +4725,9 @@ var CheckboxWidget = class extends import_view20.WidgetType {
|
|
4625
4725
|
return false;
|
4626
4726
|
}
|
4627
4727
|
};
|
4628
|
-
var TextWidget = class extends
|
4728
|
+
var TextWidget = class extends import_view21.WidgetType {
|
4629
4729
|
constructor(text, className) {
|
4630
|
-
super();
|
4631
|
-
this.text = text;
|
4632
|
-
this.className = className;
|
4730
|
+
super(), this.text = text, this.className = className;
|
4633
4731
|
}
|
4634
4732
|
toDOM() {
|
4635
4733
|
const el = document.createElement("span");
|
@@ -4640,29 +4738,29 @@ var TextWidget = class extends import_view20.WidgetType {
|
|
4640
4738
|
return el;
|
4641
4739
|
}
|
4642
4740
|
};
|
4643
|
-
var hide =
|
4644
|
-
var blockQuote =
|
4741
|
+
var hide = import_view21.Decoration.replace({});
|
4742
|
+
var blockQuote = import_view21.Decoration.line({
|
4645
4743
|
class: "cm-blockquote"
|
4646
4744
|
});
|
4647
|
-
var fencedCodeLine =
|
4745
|
+
var fencedCodeLine = import_view21.Decoration.line({
|
4648
4746
|
class: "cm-code cm-codeblock-line"
|
4649
4747
|
});
|
4650
|
-
var fencedCodeLineFirst =
|
4748
|
+
var fencedCodeLineFirst = import_view21.Decoration.line({
|
4651
4749
|
class: (0, import_react_ui_theme5.mx)("cm-code cm-codeblock-line", "cm-codeblock-start")
|
4652
4750
|
});
|
4653
|
-
var fencedCodeLineLast =
|
4751
|
+
var fencedCodeLineLast = import_view21.Decoration.line({
|
4654
4752
|
class: (0, import_react_ui_theme5.mx)("cm-code cm-codeblock-line", "cm-codeblock-end")
|
4655
4753
|
});
|
4656
4754
|
var commentBlockLine = fencedCodeLine;
|
4657
4755
|
var commentBlockLineFirst = fencedCodeLineFirst;
|
4658
4756
|
var commentBlockLineLast = fencedCodeLineLast;
|
4659
|
-
var horizontalRule =
|
4757
|
+
var horizontalRule = import_view21.Decoration.replace({
|
4660
4758
|
widget: new HorizontalRuleWidget()
|
4661
4759
|
});
|
4662
|
-
var checkedTask =
|
4760
|
+
var checkedTask = import_view21.Decoration.replace({
|
4663
4761
|
widget: new CheckboxWidget(true)
|
4664
4762
|
});
|
4665
|
-
var uncheckedTask =
|
4763
|
+
var uncheckedTask = import_view21.Decoration.replace({
|
4666
4764
|
widget: new CheckboxWidget(false)
|
4667
4765
|
});
|
4668
4766
|
var editingRange = (state, range, focus2) => {
|
@@ -4678,8 +4776,8 @@ var autoHideTags = /* @__PURE__ */ new Set([
|
|
4678
4776
|
"SuperscriptMark"
|
4679
4777
|
]);
|
4680
4778
|
var buildDecorations2 = (view, options, focus2) => {
|
4681
|
-
const deco = new
|
4682
|
-
const atomicDeco = new
|
4779
|
+
const deco = new import_state19.RangeSetBuilder();
|
4780
|
+
const atomicDeco = new import_state19.RangeSetBuilder();
|
4683
4781
|
const { state } = view;
|
4684
4782
|
const headerLevels = [];
|
4685
4783
|
const getHeaderLevels = (node, level) => {
|
@@ -4766,7 +4864,7 @@ var buildDecorations2 = (view, options, focus2) => {
|
|
4766
4864
|
} else {
|
4767
4865
|
const num = headers.slice(from - 1).map((level2) => level2?.number ?? 0).join(".") + " ";
|
4768
4866
|
if (num.length) {
|
4769
|
-
atomicDeco.add(mark.from, mark.from + len,
|
4867
|
+
atomicDeco.add(mark.from, mark.from + len, import_view21.Decoration.replace({
|
4770
4868
|
widget: new TextWidget(num, theme.heading(level))
|
4771
4869
|
}));
|
4772
4870
|
}
|
@@ -4791,7 +4889,7 @@ var buildDecorations2 = (view, options, focus2) => {
|
|
4791
4889
|
if (node.from === line.to - 1) {
|
4792
4890
|
return false;
|
4793
4891
|
}
|
4794
|
-
deco.add(line.from, line.from,
|
4892
|
+
deco.add(line.from, line.from, import_view21.Decoration.line({
|
4795
4893
|
class: "cm-list-item",
|
4796
4894
|
attributes: {
|
4797
4895
|
style: `padding-left: ${offset}px; text-indent: -${width}px;`
|
@@ -4808,7 +4906,7 @@ var buildDecorations2 = (view, options, focus2) => {
|
|
4808
4906
|
const label = list.type === "OrderedList" ? `${++list.number}.` : Unicode.bulletSmall;
|
4809
4907
|
const line = state.doc.lineAt(node.from);
|
4810
4908
|
const to = state.doc.sliceString(node.to, node.to + 1) === " " ? node.to + 1 : node.to;
|
4811
|
-
atomicDeco.add(line.from, to,
|
4909
|
+
atomicDeco.add(line.from, to, import_view21.Decoration.replace({
|
4812
4910
|
widget: new TextWidget(label, list.type === "OrderedList" ? "cm-list-mark cm-list-mark-ordered" : "cm-list-mark cm-list-mark-bullet")
|
4813
4911
|
}));
|
4814
4912
|
break;
|
@@ -4895,7 +4993,7 @@ var buildDecorations2 = (view, options, focus2) => {
|
|
4895
4993
|
if (!editing) {
|
4896
4994
|
atomicDeco.add(node.from, marks[0].to, hide);
|
4897
4995
|
}
|
4898
|
-
deco.add(marks[0].to, marks[1].from,
|
4996
|
+
deco.add(marks[0].to, marks[1].from, import_view21.Decoration.mark({
|
4899
4997
|
tagName: "a",
|
4900
4998
|
attributes: {
|
4901
4999
|
class: "cm-link",
|
@@ -4905,7 +5003,7 @@ var buildDecorations2 = (view, options, focus2) => {
|
|
4905
5003
|
}
|
4906
5004
|
}));
|
4907
5005
|
if (!editing) {
|
4908
|
-
atomicDeco.add(marks[1].from, node.to, options.renderLinkButton ?
|
5006
|
+
atomicDeco.add(marks[1].from, node.to, options.renderLinkButton ? import_view21.Decoration.replace({
|
4909
5007
|
widget: new LinkButton(url, options.renderLinkButton)
|
4910
5008
|
}) : hide);
|
4911
5009
|
}
|
@@ -4960,10 +5058,10 @@ var buildDecorations2 = (view, options, focus2) => {
|
|
4960
5058
|
atomicDeco: atomicDeco.finish()
|
4961
5059
|
};
|
4962
5060
|
};
|
4963
|
-
var forceUpdate =
|
5061
|
+
var forceUpdate = import_state19.StateEffect.define();
|
4964
5062
|
var decorateMarkdown = (options = {}) => {
|
4965
5063
|
return [
|
4966
|
-
|
5064
|
+
import_view21.ViewPlugin.fromClass(class {
|
4967
5065
|
constructor(view) {
|
4968
5066
|
({ deco: this.deco, atomicDeco: this.atomicDeco } = buildDecorations2(view, options, view.hasFocus));
|
4969
5067
|
}
|
@@ -4982,113 +5080,764 @@ var decorateMarkdown = (options = {}) => {
|
|
4982
5080
|
view.dispatch({
|
4983
5081
|
effects: forceUpdate.of(null)
|
4984
5082
|
});
|
4985
|
-
}, options.selectionChangeDelay);
|
4986
|
-
}
|
4987
|
-
clearUpdate() {
|
4988
|
-
if (this.pendingUpdate) {
|
4989
|
-
clearTimeout(this.pendingUpdate);
|
4990
|
-
this.pendingUpdate = void 0;
|
4991
|
-
}
|
4992
|
-
}
|
4993
|
-
destroy() {
|
4994
|
-
this.clearUpdate();
|
5083
|
+
}, options.selectionChangeDelay);
|
5084
|
+
}
|
5085
|
+
clearUpdate() {
|
5086
|
+
if (this.pendingUpdate) {
|
5087
|
+
clearTimeout(this.pendingUpdate);
|
5088
|
+
this.pendingUpdate = void 0;
|
5089
|
+
}
|
5090
|
+
}
|
5091
|
+
destroy() {
|
5092
|
+
this.clearUpdate();
|
5093
|
+
}
|
5094
|
+
}, {
|
5095
|
+
provide: (plugin) => [
|
5096
|
+
import_view21.EditorView.atomicRanges.of((view) => view.plugin(plugin)?.atomicDeco ?? import_view21.Decoration.none),
|
5097
|
+
import_view21.EditorView.decorations.of((view) => view.plugin(plugin)?.atomicDeco ?? import_view21.Decoration.none),
|
5098
|
+
import_view21.EditorView.decorations.of((view) => view.plugin(plugin)?.deco ?? import_view21.Decoration.none)
|
5099
|
+
]
|
5100
|
+
}),
|
5101
|
+
image(),
|
5102
|
+
table(),
|
5103
|
+
adjustChanges(),
|
5104
|
+
formattingStyles
|
5105
|
+
];
|
5106
|
+
};
|
5107
|
+
var linkTooltip = (renderTooltip) => {
|
5108
|
+
return (0, import_view26.hoverTooltip)((view, pos, side) => {
|
5109
|
+
const syntax = (0, import_language12.syntaxTree)(view.state).resolveInner(pos, side);
|
5110
|
+
let link = null;
|
5111
|
+
for (let i = 0, node = syntax; !link && node && i < 5; node = node.parent, i++) {
|
5112
|
+
link = node.name === "Link" ? node : null;
|
5113
|
+
}
|
5114
|
+
const url = link && link.getChild("URL");
|
5115
|
+
if (!url || !link) {
|
5116
|
+
return null;
|
5117
|
+
}
|
5118
|
+
const urlText = view.state.sliceDoc(url.from, url.to);
|
5119
|
+
return {
|
5120
|
+
pos: link.from,
|
5121
|
+
end: link.to,
|
5122
|
+
// NOTE: Forcing above causes the tooltip to flicker.
|
5123
|
+
// above: true,
|
5124
|
+
create: () => {
|
5125
|
+
const el = document.createElement("div");
|
5126
|
+
el.className = (0, import_react_ui_theme6.tooltipContent)({});
|
5127
|
+
renderTooltip(el, {
|
5128
|
+
url: urlText
|
5129
|
+
}, view);
|
5130
|
+
return {
|
5131
|
+
dom: el,
|
5132
|
+
offset: {
|
5133
|
+
x: 0,
|
5134
|
+
y: 4
|
5135
|
+
}
|
5136
|
+
};
|
5137
|
+
}
|
5138
|
+
};
|
5139
|
+
}, {
|
5140
|
+
// NOTE: 0 = default of 300ms.
|
5141
|
+
hoverTime: 1
|
5142
|
+
});
|
5143
|
+
};
|
5144
|
+
var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-editor/src/extensions/mention.ts";
|
5145
|
+
var mention = ({ debug, onSearch }) => {
|
5146
|
+
return (0, import_autocomplete5.autocompletion)({
|
5147
|
+
// TODO(burdon): Not working.
|
5148
|
+
activateOnTyping: true,
|
5149
|
+
// activateOnTypingDelay: 100,
|
5150
|
+
// selectOnOpen: true,
|
5151
|
+
closeOnBlur: !debug,
|
5152
|
+
// defaultKeymap: false,
|
5153
|
+
icons: false,
|
5154
|
+
override: [
|
5155
|
+
(context) => {
|
5156
|
+
import_log6.log.info("completion context", {
|
5157
|
+
context
|
5158
|
+
}, {
|
5159
|
+
F: __dxlog_file10,
|
5160
|
+
L: 27,
|
5161
|
+
S: void 0,
|
5162
|
+
C: (f, a) => f(...a)
|
5163
|
+
});
|
5164
|
+
const match = context.matchBefore(/@(\w+)?/);
|
5165
|
+
if (!match || match.from === match.to && !context.explicit) {
|
5166
|
+
return null;
|
5167
|
+
}
|
5168
|
+
return {
|
5169
|
+
from: match.from,
|
5170
|
+
options: onSearch(match.text.slice(1).toLowerCase()).map((value) => ({
|
5171
|
+
label: `@${value}`
|
5172
|
+
}))
|
5173
|
+
};
|
5174
|
+
}
|
5175
|
+
]
|
5176
|
+
});
|
5177
|
+
};
|
5178
|
+
var EditorViewModes = [
|
5179
|
+
"preview",
|
5180
|
+
"readonly",
|
5181
|
+
"source"
|
5182
|
+
];
|
5183
|
+
var EditorViewMode = import_effect.Schema.Union(...EditorViewModes.map((mode) => import_effect.Schema.Literal(mode)));
|
5184
|
+
var EditorInputModes = [
|
5185
|
+
"default",
|
5186
|
+
"vim",
|
5187
|
+
"vscode"
|
5188
|
+
];
|
5189
|
+
var EditorInputMode = import_effect.Schema.Union(...EditorInputModes.map((mode) => import_effect.Schema.Literal(mode)));
|
5190
|
+
var editorInputMode = singleValueFacet({});
|
5191
|
+
var InputModeExtensions = {
|
5192
|
+
default: [],
|
5193
|
+
vscode: [
|
5194
|
+
// https://github.com/replit/codemirror-vscode-keymap
|
5195
|
+
editorInputMode.of({
|
5196
|
+
type: "vscode"
|
5197
|
+
}),
|
5198
|
+
import_view27.keymap.of(import_codemirror_vscode_keymap.vscodeKeymap)
|
5199
|
+
],
|
5200
|
+
vim: [
|
5201
|
+
// https://github.com/replit/codemirror-vim
|
5202
|
+
(0, import_codemirror_vim.vim)(),
|
5203
|
+
editorInputMode.of({
|
5204
|
+
type: "vim",
|
5205
|
+
noTabster: true
|
5206
|
+
}),
|
5207
|
+
import_view27.keymap.of([
|
5208
|
+
{
|
5209
|
+
key: "Alt-Escape",
|
5210
|
+
run: (view) => {
|
5211
|
+
view.dom.parentElement?.focus();
|
5212
|
+
return true;
|
5213
|
+
}
|
5214
|
+
}
|
5215
|
+
])
|
5216
|
+
]
|
5217
|
+
};
|
5218
|
+
var __dxlog_file11 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-editor/src/extensions/outliner/tree.ts";
|
5219
|
+
var itemToJSON = ({ type, index, level, lineRange, contentRange, children }) => {
|
5220
|
+
return {
|
5221
|
+
type,
|
5222
|
+
index,
|
5223
|
+
level,
|
5224
|
+
lineRange,
|
5225
|
+
contentRange,
|
5226
|
+
children: children.map(itemToJSON)
|
5227
|
+
};
|
5228
|
+
};
|
5229
|
+
var Tree = class {
|
5230
|
+
constructor(node) {
|
5231
|
+
this.type = "root";
|
5232
|
+
this.index = -1;
|
5233
|
+
this.level = -1;
|
5234
|
+
this.children = [];
|
5235
|
+
this.node = node;
|
5236
|
+
this.lineRange = {
|
5237
|
+
from: node.from,
|
5238
|
+
to: node.to
|
5239
|
+
};
|
5240
|
+
this.contentRange = this.lineRange;
|
5241
|
+
}
|
5242
|
+
toJSON() {
|
5243
|
+
return itemToJSON(this);
|
5244
|
+
}
|
5245
|
+
get root() {
|
5246
|
+
return this;
|
5247
|
+
}
|
5248
|
+
traverse(itemOrCb, maybeCb) {
|
5249
|
+
if (typeof itemOrCb === "function") {
|
5250
|
+
return traverse(this, itemOrCb);
|
5251
|
+
} else {
|
5252
|
+
return traverse(itemOrCb, maybeCb);
|
5253
|
+
}
|
5254
|
+
}
|
5255
|
+
/**
|
5256
|
+
* Return the closest item.
|
5257
|
+
*/
|
5258
|
+
find(pos) {
|
5259
|
+
return this.traverse((item) => item.lineRange.from <= pos && item.lineRange.to >= pos ? item : void 0);
|
5260
|
+
}
|
5261
|
+
/**
|
5262
|
+
* Return the first child, next sibling, or parent's next sibling.
|
5263
|
+
*/
|
5264
|
+
next(item, enter = true) {
|
5265
|
+
if (enter && item.children.length > 0) {
|
5266
|
+
return item.children[0];
|
5267
|
+
}
|
5268
|
+
if (item.nextSibling) {
|
5269
|
+
return item.nextSibling;
|
5270
|
+
}
|
5271
|
+
if (item.parent) {
|
5272
|
+
return this.next(item.parent, false);
|
5273
|
+
}
|
5274
|
+
return void 0;
|
5275
|
+
}
|
5276
|
+
/**
|
5277
|
+
* Return the previous sibling, or parent.
|
5278
|
+
*/
|
5279
|
+
prev(item) {
|
5280
|
+
if (item.prevSibling) {
|
5281
|
+
return this.lastDescendant(item.prevSibling);
|
5282
|
+
}
|
5283
|
+
return item.parent?.type === "root" ? void 0 : item.parent;
|
5284
|
+
}
|
5285
|
+
/**
|
5286
|
+
* Return the last descendant of the item, or the item itself if it has no children.
|
5287
|
+
*/
|
5288
|
+
lastDescendant(item) {
|
5289
|
+
return item.children.length > 0 ? this.lastDescendant(item.children.at(-1)) : item;
|
5290
|
+
}
|
5291
|
+
};
|
5292
|
+
var getRange = (tree, item) => {
|
5293
|
+
const lastDescendant = tree.lastDescendant(item);
|
5294
|
+
return [
|
5295
|
+
item.lineRange.from,
|
5296
|
+
lastDescendant.lineRange.to
|
5297
|
+
];
|
5298
|
+
};
|
5299
|
+
var traverse = (root, cb) => {
|
5300
|
+
const t = (item, level) => {
|
5301
|
+
if (item.type !== "root") {
|
5302
|
+
const value = cb(item, level);
|
5303
|
+
if (value != null) {
|
5304
|
+
return value;
|
5305
|
+
}
|
5306
|
+
}
|
5307
|
+
for (const child of item.children) {
|
5308
|
+
const value = t(child, level + 1);
|
5309
|
+
if (value != null) {
|
5310
|
+
return value;
|
5311
|
+
}
|
5312
|
+
}
|
5313
|
+
};
|
5314
|
+
return t(root, root.type === "root" ? -1 : 0);
|
5315
|
+
};
|
5316
|
+
var getListItemContent = (state, item) => {
|
5317
|
+
return state.doc.sliceString(item.contentRange.from, item.contentRange.to);
|
5318
|
+
};
|
5319
|
+
var listItemToString = (item, level = 0) => {
|
5320
|
+
const indent = " ".repeat(level);
|
5321
|
+
const data = {
|
5322
|
+
i: item.index,
|
5323
|
+
n: item.nextSibling?.index ?? "\u2205",
|
5324
|
+
p: item.prevSibling?.index ?? "\u2205",
|
5325
|
+
level: item.level,
|
5326
|
+
node: format([
|
5327
|
+
item.node.from,
|
5328
|
+
item.node.to
|
5329
|
+
]),
|
5330
|
+
line: format([
|
5331
|
+
item.lineRange.from,
|
5332
|
+
item.lineRange.to
|
5333
|
+
]),
|
5334
|
+
content: format([
|
5335
|
+
item.contentRange.from,
|
5336
|
+
item.contentRange.to
|
5337
|
+
])
|
5338
|
+
};
|
5339
|
+
return `${indent}${item.type[0].toUpperCase()}(${Object.entries(data).map(([k, v]) => `${k}=${v}`).join(", ")})`;
|
5340
|
+
};
|
5341
|
+
var format = (value) => JSON.stringify(value, (key, value2) => {
|
5342
|
+
if (typeof value2 === "number") {
|
5343
|
+
return value2.toString().padStart(3, " ");
|
5344
|
+
}
|
5345
|
+
return value2;
|
5346
|
+
}).replaceAll('"', "");
|
5347
|
+
var treeFacet = import_state27.Facet.define({
|
5348
|
+
combine: (values) => values[0]
|
5349
|
+
});
|
5350
|
+
var outlinerTree = (options = {}) => {
|
5351
|
+
const buildTree = (state) => {
|
5352
|
+
let tree;
|
5353
|
+
let parent;
|
5354
|
+
let current;
|
5355
|
+
let prev;
|
5356
|
+
let level = -1;
|
5357
|
+
let index = -1;
|
5358
|
+
const prevSiblings = [];
|
5359
|
+
(0, import_language14.syntaxTree)(state).iterate({
|
5360
|
+
enter: (node) => {
|
5361
|
+
switch (node.name) {
|
5362
|
+
case "Document": {
|
5363
|
+
tree = new Tree(node.node);
|
5364
|
+
current = tree;
|
5365
|
+
break;
|
5366
|
+
}
|
5367
|
+
case "BulletList": {
|
5368
|
+
(0, import_invariant5.invariant)(current, void 0, {
|
5369
|
+
F: __dxlog_file11,
|
5370
|
+
L: 217,
|
5371
|
+
S: void 0,
|
5372
|
+
A: [
|
5373
|
+
"current",
|
5374
|
+
""
|
5375
|
+
]
|
5376
|
+
});
|
5377
|
+
parent = current;
|
5378
|
+
if (current) {
|
5379
|
+
current.lineRange.to = current.node.from;
|
5380
|
+
}
|
5381
|
+
prevSiblings[++level] = void 0;
|
5382
|
+
break;
|
5383
|
+
}
|
5384
|
+
case "ListItem": {
|
5385
|
+
(0, import_invariant5.invariant)(parent, void 0, {
|
5386
|
+
F: __dxlog_file11,
|
5387
|
+
L: 226,
|
5388
|
+
S: void 0,
|
5389
|
+
A: [
|
5390
|
+
"parent",
|
5391
|
+
""
|
5392
|
+
]
|
5393
|
+
});
|
5394
|
+
const nextSibling = node.node.nextSibling ?? node.node.parent?.nextSibling;
|
5395
|
+
const docRange = {
|
5396
|
+
from: state.doc.lineAt(node.from).from,
|
5397
|
+
to: nextSibling ? nextSibling.from - 1 : state.doc.length
|
5398
|
+
};
|
5399
|
+
current = {
|
5400
|
+
type: "unknown",
|
5401
|
+
index: ++index,
|
5402
|
+
level,
|
5403
|
+
node: node.node,
|
5404
|
+
lineRange: docRange,
|
5405
|
+
contentRange: {
|
5406
|
+
...docRange
|
5407
|
+
},
|
5408
|
+
parent,
|
5409
|
+
prevSibling: prevSiblings[level],
|
5410
|
+
children: []
|
5411
|
+
};
|
5412
|
+
if (current.prevSibling) {
|
5413
|
+
current.prevSibling.nextSibling = current;
|
5414
|
+
}
|
5415
|
+
prevSiblings[level] = current;
|
5416
|
+
if (prev) {
|
5417
|
+
prev.lineRange.to = prev.contentRange.to = current.lineRange.from - 1;
|
5418
|
+
}
|
5419
|
+
prev = current;
|
5420
|
+
parent.children.push(current);
|
5421
|
+
if (parent.lineRange.to === parent.node.from) {
|
5422
|
+
parent.lineRange.to = parent.contentRange.to = current.lineRange.from - 1;
|
5423
|
+
}
|
5424
|
+
break;
|
5425
|
+
}
|
5426
|
+
case "ListMark": {
|
5427
|
+
(0, import_invariant5.invariant)(current, void 0, {
|
5428
|
+
F: __dxlog_file11,
|
5429
|
+
L: 270,
|
5430
|
+
S: void 0,
|
5431
|
+
A: [
|
5432
|
+
"current",
|
5433
|
+
""
|
5434
|
+
]
|
5435
|
+
});
|
5436
|
+
current.type = "bullet";
|
5437
|
+
current.contentRange.from = node.from + "- ".length;
|
5438
|
+
break;
|
5439
|
+
}
|
5440
|
+
case "Task": {
|
5441
|
+
(0, import_invariant5.invariant)(current, void 0, {
|
5442
|
+
F: __dxlog_file11,
|
5443
|
+
L: 276,
|
5444
|
+
S: void 0,
|
5445
|
+
A: [
|
5446
|
+
"current",
|
5447
|
+
""
|
5448
|
+
]
|
5449
|
+
});
|
5450
|
+
current.type = "task";
|
5451
|
+
break;
|
5452
|
+
}
|
5453
|
+
case "TaskMarker": {
|
5454
|
+
(0, import_invariant5.invariant)(current, void 0, {
|
5455
|
+
F: __dxlog_file11,
|
5456
|
+
L: 281,
|
5457
|
+
S: void 0,
|
5458
|
+
A: [
|
5459
|
+
"current",
|
5460
|
+
""
|
5461
|
+
]
|
5462
|
+
});
|
5463
|
+
current.contentRange.from = node.from + "[ ] ".length;
|
5464
|
+
break;
|
5465
|
+
}
|
5466
|
+
}
|
5467
|
+
},
|
5468
|
+
leave: (node) => {
|
5469
|
+
if (node.name === "BulletList") {
|
5470
|
+
(0, import_invariant5.invariant)(parent, void 0, {
|
5471
|
+
F: __dxlog_file11,
|
5472
|
+
L: 289,
|
5473
|
+
S: void 0,
|
5474
|
+
A: [
|
5475
|
+
"parent",
|
5476
|
+
""
|
5477
|
+
]
|
5478
|
+
});
|
5479
|
+
prevSiblings[level--] = void 0;
|
5480
|
+
parent = parent.parent;
|
5481
|
+
}
|
5482
|
+
}
|
5483
|
+
});
|
5484
|
+
(0, import_invariant5.invariant)(tree, void 0, {
|
5485
|
+
F: __dxlog_file11,
|
5486
|
+
L: 296,
|
5487
|
+
S: void 0,
|
5488
|
+
A: [
|
5489
|
+
"tree",
|
5490
|
+
""
|
5491
|
+
]
|
5492
|
+
});
|
5493
|
+
return tree;
|
5494
|
+
};
|
5495
|
+
return [
|
5496
|
+
import_state26.StateField.define({
|
5497
|
+
create: (state) => {
|
5498
|
+
return buildTree(state);
|
5499
|
+
},
|
5500
|
+
update: (value, tr) => {
|
5501
|
+
if (!tr.docChanged) {
|
5502
|
+
return value;
|
5503
|
+
}
|
5504
|
+
return buildTree(tr.state);
|
5505
|
+
},
|
5506
|
+
provide: (field) => treeFacet.from(field)
|
5507
|
+
})
|
5508
|
+
];
|
5509
|
+
};
|
5510
|
+
var getSelection = (state) => state.selection.main;
|
5511
|
+
var selectionEquals = (a, b) => a.length === b.length && a.every((i) => b.includes(i));
|
5512
|
+
var selectionFacet = import_state25.Facet.define({
|
5513
|
+
combine: (values) => values[0]
|
5514
|
+
});
|
5515
|
+
var selectionCompartment = new import_state25.Compartment();
|
5516
|
+
var selectNone = (view) => {
|
5517
|
+
view.dispatch({
|
5518
|
+
effects: selectionCompartment.reconfigure(selectionFacet.of([]))
|
5519
|
+
});
|
5520
|
+
return true;
|
5521
|
+
};
|
5522
|
+
var selectAll = (view) => {
|
5523
|
+
const tree = view.state.facet(treeFacet);
|
5524
|
+
const selection = view.state.facet(selectionFacet);
|
5525
|
+
const items = [];
|
5526
|
+
tree.traverse((item) => items.push(item.index));
|
5527
|
+
view.dispatch({
|
5528
|
+
effects: selectionCompartment.reconfigure(selectionFacet.of(selectionEquals(selection, items) ? [] : items))
|
5529
|
+
});
|
5530
|
+
return true;
|
5531
|
+
};
|
5532
|
+
var selectUp = (view) => {
|
5533
|
+
return true;
|
5534
|
+
};
|
5535
|
+
var selectDown = (view) => {
|
5536
|
+
return true;
|
5537
|
+
};
|
5538
|
+
var indentItemMore = (view) => {
|
5539
|
+
const pos = getSelection(view.state).from;
|
5540
|
+
const tree = view.state.facet(treeFacet);
|
5541
|
+
const current = tree.find(pos);
|
5542
|
+
if (current) {
|
5543
|
+
const previous = tree.prev(current);
|
5544
|
+
if (previous && current.level <= previous.level) {
|
5545
|
+
(0, import_commands4.indentMore)(view);
|
5546
|
+
}
|
5547
|
+
}
|
5548
|
+
return true;
|
5549
|
+
};
|
5550
|
+
var indentItemLess = (view) => {
|
5551
|
+
const pos = getSelection(view.state).from;
|
5552
|
+
const tree = view.state.facet(treeFacet);
|
5553
|
+
const current = tree.find(pos);
|
5554
|
+
if (current) {
|
5555
|
+
if (current.level > 0) {
|
5556
|
+
const indentUnit = (0, import_language13.getIndentUnit)(view.state);
|
5557
|
+
const changes = [];
|
5558
|
+
tree.traverse(current, (item) => {
|
5559
|
+
const line = view.state.doc.lineAt(item.lineRange.from);
|
5560
|
+
changes.push({
|
5561
|
+
from: line.from,
|
5562
|
+
to: line.from + indentUnit
|
5563
|
+
});
|
5564
|
+
});
|
5565
|
+
if (changes.length > 0) {
|
5566
|
+
view.dispatch({
|
5567
|
+
changes
|
5568
|
+
});
|
5569
|
+
}
|
5570
|
+
}
|
5571
|
+
}
|
5572
|
+
return true;
|
5573
|
+
};
|
5574
|
+
var moveItemDown = (view) => {
|
5575
|
+
const pos = getSelection(view.state)?.from;
|
5576
|
+
const tree = view.state.facet(treeFacet);
|
5577
|
+
const current = tree.find(pos);
|
5578
|
+
if (current && current.nextSibling) {
|
5579
|
+
const next = current.nextSibling;
|
5580
|
+
const currentContent = view.state.doc.sliceString(...getRange(tree, current));
|
5581
|
+
const nextContent = view.state.doc.sliceString(...getRange(tree, next));
|
5582
|
+
const changes = [
|
5583
|
+
{
|
5584
|
+
from: current.lineRange.from,
|
5585
|
+
to: current.lineRange.from + currentContent.length,
|
5586
|
+
insert: nextContent
|
5587
|
+
},
|
5588
|
+
{
|
5589
|
+
from: next.lineRange.from,
|
5590
|
+
to: next.lineRange.from + nextContent.length,
|
5591
|
+
insert: currentContent
|
5592
|
+
}
|
5593
|
+
];
|
5594
|
+
view.dispatch({
|
5595
|
+
changes,
|
5596
|
+
selection: import_state24.EditorSelection.cursor(pos + nextContent.length + 1),
|
5597
|
+
scrollIntoView: true
|
5598
|
+
});
|
5599
|
+
}
|
5600
|
+
return true;
|
5601
|
+
};
|
5602
|
+
var moveItemUp = (view) => {
|
5603
|
+
const pos = getSelection(view.state)?.from;
|
5604
|
+
const tree = view.state.facet(treeFacet);
|
5605
|
+
const current = tree.find(pos);
|
5606
|
+
if (current && current.prevSibling) {
|
5607
|
+
const prev = current.prevSibling;
|
5608
|
+
const currentContent = view.state.doc.sliceString(...getRange(tree, current));
|
5609
|
+
const prevContent = view.state.doc.sliceString(...getRange(tree, prev));
|
5610
|
+
const changes = [
|
5611
|
+
{
|
5612
|
+
from: prev.lineRange.from,
|
5613
|
+
to: prev.lineRange.from + prevContent.length,
|
5614
|
+
insert: currentContent
|
5615
|
+
},
|
5616
|
+
{
|
5617
|
+
from: current.lineRange.from,
|
5618
|
+
to: current.lineRange.from + currentContent.length,
|
5619
|
+
insert: prevContent
|
5620
|
+
}
|
5621
|
+
];
|
5622
|
+
view.dispatch({
|
5623
|
+
changes,
|
5624
|
+
selection: import_state24.EditorSelection.cursor(pos - prevContent.length - 1),
|
5625
|
+
scrollIntoView: true
|
5626
|
+
});
|
5627
|
+
}
|
5628
|
+
return true;
|
5629
|
+
};
|
5630
|
+
var toggleTask = (view) => {
|
5631
|
+
const pos = getSelection(view.state)?.from;
|
5632
|
+
const tree = view.state.facet(treeFacet);
|
5633
|
+
const current = tree.find(pos);
|
5634
|
+
if (current) {
|
5635
|
+
const type = current.type === "task" ? "bullet" : "task";
|
5636
|
+
const indent = " ".repeat((0, import_language13.getIndentUnit)(view.state) * current.level);
|
5637
|
+
view.dispatch({
|
5638
|
+
changes: [
|
5639
|
+
{
|
5640
|
+
from: current.lineRange.from,
|
5641
|
+
to: current.contentRange.from,
|
5642
|
+
insert: indent + (type === "task" ? "- [ ] " : "- ")
|
5643
|
+
}
|
5644
|
+
]
|
5645
|
+
});
|
5646
|
+
}
|
5647
|
+
return true;
|
5648
|
+
};
|
5649
|
+
var commands = () => import_view29.keymap.of([
|
5650
|
+
//
|
5651
|
+
// Indentation.
|
5652
|
+
//
|
5653
|
+
{
|
5654
|
+
key: "Tab",
|
5655
|
+
preventDefault: true,
|
5656
|
+
run: indentItemMore,
|
5657
|
+
shift: indentItemLess
|
5658
|
+
},
|
5659
|
+
//
|
5660
|
+
// Continuation.
|
5661
|
+
//
|
5662
|
+
{
|
5663
|
+
key: "Enter",
|
5664
|
+
shift: (view) => {
|
5665
|
+
const pos = getSelection(view.state).from;
|
5666
|
+
const insert = "\n ";
|
5667
|
+
view.dispatch({
|
5668
|
+
changes: [
|
5669
|
+
{
|
5670
|
+
from: pos,
|
5671
|
+
to: pos,
|
5672
|
+
insert
|
5673
|
+
}
|
5674
|
+
],
|
5675
|
+
selection: import_state24.EditorSelection.cursor(pos + insert.length)
|
5676
|
+
});
|
5677
|
+
return true;
|
5678
|
+
}
|
5679
|
+
},
|
5680
|
+
//
|
5681
|
+
// Navigation.
|
5682
|
+
//
|
5683
|
+
{
|
5684
|
+
key: "ArrowDown",
|
5685
|
+
// Jump to next item (default moves to end of currentline).
|
5686
|
+
run: (view) => {
|
5687
|
+
const tree = view.state.facet(treeFacet);
|
5688
|
+
const item = tree.find(getSelection(view.state).from);
|
5689
|
+
if (item && view.state.doc.lineAt(item.lineRange.to).number - view.state.doc.lineAt(item.lineRange.from).number === 0) {
|
5690
|
+
const next = tree.next(item);
|
5691
|
+
if (next) {
|
5692
|
+
view.dispatch({
|
5693
|
+
selection: import_state24.EditorSelection.cursor(next.contentRange.from)
|
5694
|
+
});
|
5695
|
+
return true;
|
5696
|
+
}
|
5697
|
+
}
|
5698
|
+
return false;
|
5699
|
+
}
|
5700
|
+
},
|
5701
|
+
//
|
5702
|
+
// Line selection.
|
5703
|
+
// TODO(burdon): Shortcut to select current item?
|
5704
|
+
//
|
5705
|
+
{
|
5706
|
+
key: "Mod-a",
|
5707
|
+
preventDefault: true,
|
5708
|
+
run: selectAll
|
5709
|
+
},
|
5710
|
+
{
|
5711
|
+
key: "Escape",
|
5712
|
+
preventDefault: true,
|
5713
|
+
run: selectNone
|
5714
|
+
},
|
5715
|
+
{
|
5716
|
+
key: "ArrowUp",
|
5717
|
+
shift: selectUp
|
5718
|
+
},
|
5719
|
+
{
|
5720
|
+
key: "ArrowDown",
|
5721
|
+
shift: selectDown
|
5722
|
+
},
|
5723
|
+
//
|
5724
|
+
// Move.
|
5725
|
+
//
|
5726
|
+
{
|
5727
|
+
key: "Alt-ArrowDown",
|
5728
|
+
preventDefault: true,
|
5729
|
+
run: moveItemDown
|
5730
|
+
},
|
5731
|
+
{
|
5732
|
+
key: "Alt-ArrowUp",
|
5733
|
+
preventDefault: true,
|
5734
|
+
run: moveItemUp
|
5735
|
+
},
|
5736
|
+
//
|
5737
|
+
// Misc.
|
5738
|
+
//
|
5739
|
+
{
|
5740
|
+
key: "Alt-t",
|
5741
|
+
run: toggleTask
|
5742
|
+
}
|
5743
|
+
]);
|
5744
|
+
var __dxlog_file12 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-editor/src/extensions/outliner/editor.ts";
|
5745
|
+
var LIST_ITEM_REGEX = /^\s*- (\[ \]|\[x\])? /;
|
5746
|
+
var initialize = () => {
|
5747
|
+
return import_view30.ViewPlugin.fromClass(class {
|
5748
|
+
constructor(view) {
|
5749
|
+
const first = view.state.doc.lineAt(0);
|
5750
|
+
const text = view.state.sliceDoc(first.from, first.to);
|
5751
|
+
const match = text.match(LIST_ITEM_REGEX);
|
5752
|
+
if (!match) {
|
5753
|
+
setTimeout(() => {
|
5754
|
+
const insert = "- [ ] ";
|
5755
|
+
view.dispatch({
|
5756
|
+
changes: [
|
5757
|
+
{
|
5758
|
+
from: 0,
|
5759
|
+
to: 0,
|
5760
|
+
insert
|
5761
|
+
}
|
5762
|
+
],
|
5763
|
+
selection: import_state28.EditorSelection.cursor(insert.length)
|
5764
|
+
});
|
5765
|
+
});
|
4995
5766
|
}
|
4996
|
-
}, {
|
4997
|
-
provide: (plugin) => [
|
4998
|
-
import_view20.EditorView.atomicRanges.of((view) => view.plugin(plugin)?.atomicDeco ?? import_view20.Decoration.none),
|
4999
|
-
import_view20.EditorView.decorations.of((view) => view.plugin(plugin)?.atomicDeco ?? import_view20.Decoration.none),
|
5000
|
-
import_view20.EditorView.decorations.of((view) => view.plugin(plugin)?.deco ?? import_view20.Decoration.none)
|
5001
|
-
]
|
5002
|
-
}),
|
5003
|
-
image(),
|
5004
|
-
table(),
|
5005
|
-
adjustChanges(),
|
5006
|
-
formattingStyles
|
5007
|
-
];
|
5008
|
-
};
|
5009
|
-
var linkTooltip = (renderTooltip) => {
|
5010
|
-
return (0, import_view25.hoverTooltip)((view, pos, side) => {
|
5011
|
-
const syntax = (0, import_language12.syntaxTree)(view.state).resolveInner(pos, side);
|
5012
|
-
let link = null;
|
5013
|
-
for (let i = 0, node = syntax; !link && node && i < 5; node = node.parent, i++) {
|
5014
|
-
link = node.name === "Link" ? node : null;
|
5015
|
-
}
|
5016
|
-
const url = link && link.getChild("URL");
|
5017
|
-
if (!url || !link) {
|
5018
|
-
return null;
|
5019
5767
|
}
|
5020
|
-
const urlText = view.state.sliceDoc(url.from, url.to);
|
5021
|
-
return {
|
5022
|
-
pos: link.from,
|
5023
|
-
end: link.to,
|
5024
|
-
// NOTE: Forcing above causes the tooltip to flicker.
|
5025
|
-
// above: true,
|
5026
|
-
create: () => {
|
5027
|
-
const el = document.createElement("div");
|
5028
|
-
el.className = (0, import_react_ui_theme6.tooltipContent)({});
|
5029
|
-
renderTooltip(el, {
|
5030
|
-
url: urlText
|
5031
|
-
}, view);
|
5032
|
-
return {
|
5033
|
-
dom: el,
|
5034
|
-
offset: {
|
5035
|
-
x: 0,
|
5036
|
-
y: 4
|
5037
|
-
}
|
5038
|
-
};
|
5039
|
-
}
|
5040
|
-
};
|
5041
|
-
}, {
|
5042
|
-
// NOTE: 0 = default of 300ms.
|
5043
|
-
hoverTime: 1
|
5044
5768
|
});
|
5045
5769
|
};
|
5046
|
-
var
|
5047
|
-
|
5048
|
-
|
5049
|
-
|
5050
|
-
const match = line.text.match(matchTaskMarker);
|
5051
|
-
const start = line.from + (match?.[0]?.length ?? 0);
|
5052
|
-
return {
|
5053
|
-
match,
|
5054
|
-
start
|
5055
|
-
};
|
5056
|
-
};
|
5057
|
-
var outliner = () => [
|
5058
|
-
import_state22.EditorState.transactionFilter.of((tr) => {
|
5770
|
+
var editor = () => [
|
5771
|
+
initialize(),
|
5772
|
+
import_state28.EditorState.transactionFilter.of((tr) => {
|
5773
|
+
const tree = tr.state.facet(treeFacet);
|
5059
5774
|
if (!tr.docChanged) {
|
5060
|
-
const
|
5061
|
-
if (
|
5062
|
-
const
|
5063
|
-
if (
|
5064
|
-
|
5775
|
+
const current = getSelection(tr.state).from;
|
5776
|
+
if (current != null) {
|
5777
|
+
const currentItem = tree.find(current);
|
5778
|
+
if (!currentItem) {
|
5779
|
+
return [];
|
5780
|
+
}
|
5781
|
+
if (current < currentItem.contentRange.from || current > currentItem.contentRange.to) {
|
5782
|
+
const prev = getSelection(tr.startState).from;
|
5783
|
+
const prevItem = prev != null ? tree.find(prev) : void 0;
|
5784
|
+
if (!prevItem) {
|
5065
5785
|
return [
|
5066
5786
|
{
|
5067
|
-
selection:
|
5068
|
-
anchor: start,
|
5069
|
-
head: start
|
5070
|
-
}
|
5787
|
+
selection: import_state28.EditorSelection.cursor(currentItem.contentRange.from)
|
5071
5788
|
}
|
5072
5789
|
];
|
5790
|
+
} else {
|
5791
|
+
if (currentItem.index < prevItem.index) {
|
5792
|
+
return [
|
5793
|
+
{
|
5794
|
+
selection: import_state28.EditorSelection.cursor(currentItem.contentRange.to)
|
5795
|
+
}
|
5796
|
+
];
|
5797
|
+
} else if (currentItem.index > prevItem.index) {
|
5798
|
+
return [
|
5799
|
+
{
|
5800
|
+
selection: import_state28.EditorSelection.cursor(currentItem.contentRange.from)
|
5801
|
+
}
|
5802
|
+
];
|
5803
|
+
} else {
|
5804
|
+
if (current < prev) {
|
5805
|
+
if (currentItem.index === 0) {
|
5806
|
+
return [];
|
5807
|
+
} else {
|
5808
|
+
return [
|
5809
|
+
{
|
5810
|
+
selection: import_state28.EditorSelection.cursor(currentItem.lineRange.from - 1)
|
5811
|
+
}
|
5812
|
+
];
|
5813
|
+
}
|
5814
|
+
} else {
|
5815
|
+
return [
|
5816
|
+
{
|
5817
|
+
selection: import_state28.EditorSelection.cursor(currentItem.contentRange.to)
|
5818
|
+
}
|
5819
|
+
];
|
5820
|
+
}
|
5821
|
+
}
|
5073
5822
|
}
|
5074
5823
|
}
|
5075
5824
|
}
|
5076
5825
|
return tr;
|
5077
5826
|
}
|
5827
|
+
let cancel = false;
|
5078
5828
|
const changes = [];
|
5079
5829
|
tr.changes.iterChanges((fromA, toA, fromB, toB, insert) => {
|
5080
5830
|
const line = tr.startState.doc.lineAt(fromA);
|
5081
|
-
const
|
5082
|
-
if (
|
5083
|
-
const
|
5831
|
+
const match = line.text.match(LIST_ITEM_REGEX);
|
5832
|
+
if (match) {
|
5833
|
+
const currentItem = tree.find(tr.state.selection.main.from);
|
5834
|
+
if (!currentItem?.contentRange) {
|
5835
|
+
cancel = true;
|
5836
|
+
return;
|
5837
|
+
}
|
5838
|
+
const start = line.from + (match?.[0]?.length ?? 0);
|
5084
5839
|
const replace = start === toA && toA - fromA === insert.length;
|
5085
5840
|
if (replace) {
|
5086
|
-
import_log6.log.info("delete line", void 0, {
|
5087
|
-
F: __dxlog_file10,
|
5088
|
-
L: 82,
|
5089
|
-
S: void 0,
|
5090
|
-
C: (f, a) => f(...a)
|
5091
|
-
});
|
5092
5841
|
changes.push({
|
5093
5842
|
from: line.from - 1,
|
5094
5843
|
to: toA
|
@@ -5100,24 +5849,9 @@ var outliner = () => [
|
|
5100
5849
|
const line2 = tr.state.doc.lineAt(fromA);
|
5101
5850
|
if (line2.text.match(/^\s*$/)) {
|
5102
5851
|
if (line2.from === 0) {
|
5103
|
-
|
5104
|
-
F: __dxlog_file10,
|
5105
|
-
L: 94,
|
5106
|
-
S: void 0,
|
5107
|
-
C: (f, a) => f(...a)
|
5108
|
-
});
|
5109
|
-
changes.push({
|
5110
|
-
from: 0,
|
5111
|
-
to: 0
|
5112
|
-
});
|
5852
|
+
cancel = true;
|
5113
5853
|
return;
|
5114
5854
|
} else {
|
5115
|
-
import_log6.log.info("delete line", void 0, {
|
5116
|
-
F: __dxlog_file10,
|
5117
|
-
L: 99,
|
5118
|
-
S: void 0,
|
5119
|
-
C: (f, a) => f(...a)
|
5120
|
-
});
|
5121
5855
|
changes.push({
|
5122
5856
|
from: line2.from - 1,
|
5123
5857
|
to: toA
|
@@ -5128,44 +5862,17 @@ var outliner = () => [
|
|
5128
5862
|
}
|
5129
5863
|
return;
|
5130
5864
|
}
|
5131
|
-
|
5132
|
-
|
5133
|
-
|
5134
|
-
|
5135
|
-
L: 111,
|
5136
|
-
S: void 0,
|
5137
|
-
C: (f, a) => f(...a)
|
5138
|
-
});
|
5139
|
-
changes.push({
|
5140
|
-
from: 0,
|
5141
|
-
to: 0
|
5142
|
-
});
|
5143
|
-
return;
|
5144
|
-
} else {
|
5145
|
-
const getIndent = (text) => (text.match(/^\s*/)?.[0]?.length ?? 0) / indentLevel;
|
5146
|
-
const currentIndent = getIndent(line.text);
|
5147
|
-
const indentPrevious = getIndent(tr.state.doc.lineAt(fromA - 1).text);
|
5148
|
-
if (currentIndent > indentPrevious) {
|
5149
|
-
import_log6.log.info("skip", void 0, {
|
5150
|
-
F: __dxlog_file10,
|
5151
|
-
L: 119,
|
5152
|
-
S: void 0,
|
5153
|
-
C: (f, a) => f(...a)
|
5154
|
-
});
|
5155
|
-
changes.push({
|
5156
|
-
from: 0,
|
5157
|
-
to: 0
|
5158
|
-
});
|
5159
|
-
return;
|
5160
|
-
}
|
5161
|
-
}
|
5865
|
+
const item = tree.find(fromA);
|
5866
|
+
if (item?.contentRange.from === item?.contentRange.to && fromA === toA) {
|
5867
|
+
cancel = true;
|
5868
|
+
return;
|
5162
5869
|
}
|
5163
|
-
|
5870
|
+
(0, import_log7.log)("change", {
|
5871
|
+
item,
|
5164
5872
|
line: {
|
5165
5873
|
from: line.from,
|
5166
5874
|
to: line.to
|
5167
5875
|
},
|
5168
|
-
start,
|
5169
5876
|
a: [
|
5170
5877
|
fromA,
|
5171
5878
|
toA
|
@@ -5179,184 +5886,142 @@ var outliner = () => [
|
|
5179
5886
|
length: insert.length
|
5180
5887
|
}
|
5181
5888
|
}, {
|
5182
|
-
F:
|
5183
|
-
L:
|
5889
|
+
F: __dxlog_file12,
|
5890
|
+
L: 160,
|
5184
5891
|
S: void 0,
|
5185
5892
|
C: (f, a) => f(...a)
|
5186
5893
|
});
|
5187
5894
|
}
|
5188
5895
|
});
|
5189
5896
|
if (changes.length > 0) {
|
5897
|
+
(0, import_log7.log)("modified,", {
|
5898
|
+
changes
|
5899
|
+
}, {
|
5900
|
+
F: __dxlog_file12,
|
5901
|
+
L: 171,
|
5902
|
+
S: void 0,
|
5903
|
+
C: (f, a) => f(...a)
|
5904
|
+
});
|
5190
5905
|
return [
|
5191
5906
|
{
|
5192
5907
|
changes
|
5193
5908
|
}
|
5194
5909
|
];
|
5910
|
+
} else if (cancel) {
|
5911
|
+
(0, import_log7.log)("cancel", void 0, {
|
5912
|
+
F: __dxlog_file12,
|
5913
|
+
L: 174,
|
5914
|
+
S: void 0,
|
5915
|
+
C: (f, a) => f(...a)
|
5916
|
+
});
|
5917
|
+
return [];
|
5195
5918
|
}
|
5196
5919
|
return tr;
|
5920
|
+
})
|
5921
|
+
];
|
5922
|
+
var outliner = () => [
|
5923
|
+
// Commands.
|
5924
|
+
import_state23.Prec.highest(commands()),
|
5925
|
+
// Selection.
|
5926
|
+
selectionCompartment.of(selectionFacet.of([])),
|
5927
|
+
// State.
|
5928
|
+
outlinerTree(),
|
5929
|
+
// Filter and possibly modify changes.
|
5930
|
+
editor(),
|
5931
|
+
// Floating menu.
|
5932
|
+
floatingMenu(),
|
5933
|
+
// Line decorations.
|
5934
|
+
decorations(),
|
5935
|
+
// Default markdown decorations.
|
5936
|
+
decorateMarkdown({
|
5937
|
+
listPaddingLeft: 8
|
5938
|
+
}),
|
5939
|
+
// Researve space for menu.
|
5940
|
+
import_view28.EditorView.contentAttributes.of({
|
5941
|
+
class: "is-full !mr-[3rem]"
|
5942
|
+
})
|
5943
|
+
];
|
5944
|
+
var decorations = () => [
|
5945
|
+
import_view28.ViewPlugin.fromClass(class {
|
5946
|
+
constructor(view) {
|
5947
|
+
this.decorations = import_view28.Decoration.none;
|
5948
|
+
this.updateDecorations(view.state, view);
|
5949
|
+
}
|
5950
|
+
update(update2) {
|
5951
|
+
const selectionChanged = !selectionEquals(update2.state.facet(selectionFacet), update2.startState.facet(selectionFacet));
|
5952
|
+
if (update2.focusChanged || update2.docChanged || update2.viewportChanged || update2.selectionSet || selectionChanged) {
|
5953
|
+
this.updateDecorations(update2.state, update2.view);
|
5954
|
+
}
|
5955
|
+
}
|
5956
|
+
updateDecorations(state, { viewport: { from, to }, hasFocus }) {
|
5957
|
+
const selection = state.facet(selectionFacet);
|
5958
|
+
const tree = state.facet(treeFacet);
|
5959
|
+
const current = tree.find(state.selection.ranges[state.selection.mainIndex]?.from);
|
5960
|
+
const doc = state.doc;
|
5961
|
+
const decorations2 = [];
|
5962
|
+
for (let lineNum = doc.lineAt(from).number; lineNum <= doc.lineAt(to).number; lineNum++) {
|
5963
|
+
const line = doc.line(lineNum);
|
5964
|
+
const item = tree.find(line.from);
|
5965
|
+
if (item) {
|
5966
|
+
const lineFrom = doc.lineAt(item.contentRange.from);
|
5967
|
+
const lineTo = doc.lineAt(item.contentRange.to);
|
5968
|
+
const isSelected = selection.includes(item.index) || item === current;
|
5969
|
+
decorations2.push(import_view28.Decoration.line({
|
5970
|
+
class: (0, import_react_ui_theme7.mx)("cm-list-item", lineFrom.number === line.number && "cm-list-item-start", lineTo.number === line.number && "cm-list-item-end", isSelected && (hasFocus ? "cm-list-item-focused" : "cm-list-item-selected"))
|
5971
|
+
}).range(line.from, line.from));
|
5972
|
+
}
|
5973
|
+
}
|
5974
|
+
this.decorations = import_view28.Decoration.set(decorations2);
|
5975
|
+
}
|
5976
|
+
}, {
|
5977
|
+
decorations: (v) => v.decorations
|
5197
5978
|
}),
|
5198
|
-
|
5199
|
-
|
5200
|
-
|
5979
|
+
// Theme.
|
5980
|
+
import_view28.EditorView.theme({
|
5981
|
+
".cm-list-item": {
|
5982
|
+
borderLeftWidth: "1px",
|
5983
|
+
borderRightWidth: "1px",
|
5984
|
+
paddingLeft: "32px",
|
5985
|
+
borderColor: "transparent"
|
5201
5986
|
},
|
5202
|
-
|
5203
|
-
|
5204
|
-
const to = tr.state.doc.length;
|
5205
|
-
return value.map(tr.changes).update({
|
5206
|
-
filterFrom: 0,
|
5207
|
-
filterTo: tr.state.doc.length,
|
5208
|
-
filter: () => false,
|
5209
|
-
add: buildDecorations3(from, to, tr.state)
|
5210
|
-
});
|
5987
|
+
".cm-list-item.cm-codeblock-start": {
|
5988
|
+
borderRadius: "0"
|
5211
5989
|
},
|
5212
|
-
provide: (field) => import_view26.EditorView.decorations.from(field)
|
5213
|
-
}),
|
5214
|
-
// TODO(burdon): Increase indent padding by configuring decorate extension.
|
5215
|
-
// TODO(burdon): Hover to select entire group.
|
5216
|
-
import_view26.EditorView.theme({
|
5217
5990
|
".cm-list-item-start": {
|
5218
|
-
|
5219
|
-
borderLeft: "1px solid var(--dx-separator)",
|
5220
|
-
borderRight: "1px solid var(--dx-separator)",
|
5991
|
+
borderTopWidth: "1px",
|
5221
5992
|
borderTopLeftRadius: "4px",
|
5222
5993
|
borderTopRightRadius: "4px",
|
5223
5994
|
paddingTop: "4px",
|
5224
5995
|
marginTop: "8px"
|
5225
5996
|
},
|
5226
5997
|
".cm-list-item-end": {
|
5227
|
-
|
5228
|
-
borderRight: "1px solid var(--dx-separator)",
|
5229
|
-
borderBottom: "1px solid var(--dx-separator)",
|
5998
|
+
borderBottomWidth: "1px",
|
5230
5999
|
borderBottomLeftRadius: "4px",
|
5231
6000
|
borderBottomRightRadius: "4px",
|
5232
6001
|
paddingBottom: "4px",
|
5233
6002
|
marginBottom: "8px"
|
5234
6003
|
},
|
5235
|
-
".cm-list-item-
|
5236
|
-
|
5237
|
-
borderRight: "1px solid var(--dx-separator)",
|
5238
|
-
// TODO(burdon): Should match parent indentation.
|
5239
|
-
paddingLeft: "24px"
|
6004
|
+
".cm-list-item-selected": {
|
6005
|
+
borderColor: "var(--dx-separator)"
|
5240
6006
|
},
|
5241
|
-
|
5242
|
-
|
5243
|
-
borderRadius: "0"
|
6007
|
+
".cm-list-item-focused": {
|
6008
|
+
borderColor: "var(--dx-accentFocusIndicator)"
|
5244
6009
|
}
|
5245
6010
|
})
|
5246
6011
|
];
|
5247
|
-
var buildDecorations3 = (from, to, state) => {
|
5248
|
-
const decorations = [];
|
5249
|
-
(0, import_language13.syntaxTree)(state).iterate({
|
5250
|
-
enter: (node) => {
|
5251
|
-
if (node.name === "ListItem") {
|
5252
|
-
const sub = node.node.getChild("BulletList");
|
5253
|
-
const lineStart = state.doc.lineAt(node.from);
|
5254
|
-
const lineEnd = sub ? state.doc.lineAt(state.doc.lineAt(sub.from).from - 1) : state.doc.lineAt(node.to);
|
5255
|
-
decorations.push(import_view26.Decoration.line({
|
5256
|
-
class: (0, import_react_ui_theme7.mx)("cm-list-item-start", lineStart.number === lineEnd.number && "cm-list-item-end")
|
5257
|
-
}).range(lineStart.from, lineStart.from));
|
5258
|
-
for (let i = lineStart.from + 1; i < lineEnd.from; i++) {
|
5259
|
-
decorations.push(import_view26.Decoration.line({
|
5260
|
-
class: (0, import_react_ui_theme7.mx)("cm-list-item-continuation")
|
5261
|
-
}).range(i, i));
|
5262
|
-
}
|
5263
|
-
if (lineStart.number !== lineEnd.number) {
|
5264
|
-
decorations.push(import_view26.Decoration.line({
|
5265
|
-
class: (0, import_react_ui_theme7.mx)("cm-list-item-end")
|
5266
|
-
}).range(lineEnd.from, lineEnd.from));
|
5267
|
-
}
|
5268
|
-
}
|
5269
|
-
}
|
5270
|
-
});
|
5271
|
-
return decorations;
|
5272
|
-
};
|
5273
|
-
var __dxlog_file11 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-editor/src/extensions/mention.ts";
|
5274
|
-
var mention = ({ debug, onSearch }) => {
|
5275
|
-
return (0, import_autocomplete5.autocompletion)({
|
5276
|
-
// TODO(burdon): Not working.
|
5277
|
-
activateOnTyping: true,
|
5278
|
-
// activateOnTypingDelay: 100,
|
5279
|
-
// selectOnOpen: true,
|
5280
|
-
closeOnBlur: !debug,
|
5281
|
-
// defaultKeymap: false,
|
5282
|
-
icons: false,
|
5283
|
-
override: [
|
5284
|
-
(context) => {
|
5285
|
-
import_log7.log.info("completion context", {
|
5286
|
-
context
|
5287
|
-
}, {
|
5288
|
-
F: __dxlog_file11,
|
5289
|
-
L: 27,
|
5290
|
-
S: void 0,
|
5291
|
-
C: (f, a) => f(...a)
|
5292
|
-
});
|
5293
|
-
const match = context.matchBefore(/@(\w+)?/);
|
5294
|
-
if (!match || match.from === match.to && !context.explicit) {
|
5295
|
-
return null;
|
5296
|
-
}
|
5297
|
-
return {
|
5298
|
-
from: match.from,
|
5299
|
-
options: onSearch(match.text.slice(1).toLowerCase()).map((value) => ({
|
5300
|
-
label: `@${value}`
|
5301
|
-
}))
|
5302
|
-
};
|
5303
|
-
}
|
5304
|
-
]
|
5305
|
-
});
|
5306
|
-
};
|
5307
|
-
var EditorViewModes = [
|
5308
|
-
"preview",
|
5309
|
-
"readonly",
|
5310
|
-
"source"
|
5311
|
-
];
|
5312
|
-
var EditorViewMode = import_effect.Schema.Union(...EditorViewModes.map((mode) => import_effect.Schema.Literal(mode)));
|
5313
|
-
var EditorInputModes = [
|
5314
|
-
"default",
|
5315
|
-
"vim",
|
5316
|
-
"vscode"
|
5317
|
-
];
|
5318
|
-
var EditorInputMode = import_effect.Schema.Union(...EditorInputModes.map((mode) => import_effect.Schema.Literal(mode)));
|
5319
|
-
var editorInputMode = singleValueFacet({});
|
5320
|
-
var InputModeExtensions = {
|
5321
|
-
default: [],
|
5322
|
-
vscode: [
|
5323
|
-
// https://github.com/replit/codemirror-vscode-keymap
|
5324
|
-
editorInputMode.of({
|
5325
|
-
type: "vscode"
|
5326
|
-
}),
|
5327
|
-
import_view27.keymap.of(import_codemirror_vscode_keymap.vscodeKeymap)
|
5328
|
-
],
|
5329
|
-
vim: [
|
5330
|
-
// https://github.com/replit/codemirror-vim
|
5331
|
-
(0, import_codemirror_vim.vim)(),
|
5332
|
-
editorInputMode.of({
|
5333
|
-
type: "vim",
|
5334
|
-
noTabster: true
|
5335
|
-
}),
|
5336
|
-
import_view27.keymap.of([
|
5337
|
-
{
|
5338
|
-
key: "Alt-Escape",
|
5339
|
-
run: (view) => {
|
5340
|
-
view.dom.parentElement?.focus();
|
5341
|
-
return true;
|
5342
|
-
}
|
5343
|
-
}
|
5344
|
-
])
|
5345
|
-
]
|
5346
|
-
};
|
5347
6012
|
var preview = (options = {}) => {
|
5348
6013
|
return [
|
5349
6014
|
// NOTE: Atomic block decorations must be created from a state field, now a widget, otherwise it results in the following error:
|
5350
6015
|
// "Block decorations may not be specified via plugins"
|
5351
|
-
|
5352
|
-
create: (state) =>
|
5353
|
-
update: (_, tr) =>
|
6016
|
+
import_state29.StateField.define({
|
6017
|
+
create: (state) => buildDecorations3(state, options),
|
6018
|
+
update: (_, tr) => buildDecorations3(tr.state, options),
|
5354
6019
|
provide: (field) => [
|
5355
|
-
|
5356
|
-
|
6020
|
+
import_view31.EditorView.decorations.from(field),
|
6021
|
+
import_view31.EditorView.atomicRanges.of((view) => view.state.field(field))
|
5357
6022
|
]
|
5358
6023
|
}),
|
5359
|
-
|
6024
|
+
import_view31.EditorView.theme({
|
5360
6025
|
".cm-preview-block": {
|
5361
6026
|
marginLeft: "-1rem",
|
5362
6027
|
marginRight: "-1rem",
|
@@ -5381,9 +6046,9 @@ var getLinkRef = (state, node) => {
|
|
5381
6046
|
};
|
5382
6047
|
}
|
5383
6048
|
};
|
5384
|
-
var
|
5385
|
-
const builder = new
|
5386
|
-
(0,
|
6049
|
+
var buildDecorations3 = (state, options) => {
|
6050
|
+
const builder = new import_state29.RangeSetBuilder();
|
6051
|
+
(0, import_language15.syntaxTree)(state).iterate({
|
5387
6052
|
enter: (node) => {
|
5388
6053
|
switch (node.name) {
|
5389
6054
|
//
|
@@ -5393,7 +6058,7 @@ var buildDecorations4 = (state, options) => {
|
|
5393
6058
|
case "Link": {
|
5394
6059
|
const link = getLinkRef(state, node.node);
|
5395
6060
|
if (link) {
|
5396
|
-
builder.add(node.from, node.to,
|
6061
|
+
builder.add(node.from, node.to, import_view31.Decoration.replace({
|
5397
6062
|
widget: new PreviewInlineWidget(options, link)
|
5398
6063
|
}));
|
5399
6064
|
}
|
@@ -5406,7 +6071,7 @@ var buildDecorations4 = (state, options) => {
|
|
5406
6071
|
case "Image": {
|
5407
6072
|
const link = getLinkRef(state, node.node);
|
5408
6073
|
if (options.renderBlock && link) {
|
5409
|
-
builder.add(node.from, node.to,
|
6074
|
+
builder.add(node.from, node.to, import_view31.Decoration.replace({
|
5410
6075
|
block: true,
|
5411
6076
|
// atomic: true,
|
5412
6077
|
widget: new PreviewBlockWidget(options, link)
|
@@ -5419,11 +6084,9 @@ var buildDecorations4 = (state, options) => {
|
|
5419
6084
|
});
|
5420
6085
|
return builder.finish();
|
5421
6086
|
};
|
5422
|
-
var PreviewInlineWidget = class extends
|
6087
|
+
var PreviewInlineWidget = class extends import_view31.WidgetType {
|
5423
6088
|
constructor(_options, _link) {
|
5424
|
-
super();
|
5425
|
-
this._options = _options;
|
5426
|
-
this._link = _link;
|
6089
|
+
super(), this._options = _options, this._link = _link;
|
5427
6090
|
}
|
5428
6091
|
// override ignoreEvent() {
|
5429
6092
|
// return false;
|
@@ -5434,15 +6097,13 @@ var PreviewInlineWidget = class extends import_view28.WidgetType {
|
|
5434
6097
|
toDOM(view) {
|
5435
6098
|
const root = document.createElement("dx-ref-tag");
|
5436
6099
|
root.textContent = this._link.label;
|
5437
|
-
root.setAttribute("
|
6100
|
+
root.setAttribute("refId", this._link.ref);
|
5438
6101
|
return root;
|
5439
6102
|
}
|
5440
6103
|
};
|
5441
|
-
var PreviewBlockWidget = class extends
|
6104
|
+
var PreviewBlockWidget = class extends import_view31.WidgetType {
|
5442
6105
|
constructor(_options, _link) {
|
5443
|
-
super();
|
5444
|
-
this._options = _options;
|
5445
|
-
this._link = _link;
|
6106
|
+
super(), this._options = _options, this._link = _link;
|
5446
6107
|
}
|
5447
6108
|
// override ignoreEvent() {
|
5448
6109
|
// return true;
|
@@ -5455,7 +6116,7 @@ var PreviewBlockWidget = class extends import_view28.WidgetType {
|
|
5455
6116
|
root.classList.add("cm-preview-block");
|
5456
6117
|
const handleAction = (action) => {
|
5457
6118
|
const pos = view.posAtDOM(root);
|
5458
|
-
const node = (0,
|
6119
|
+
const node = (0, import_language15.syntaxTree)(view.state).resolve(pos + 1).node.parent;
|
5459
6120
|
if (!node) {
|
5460
6121
|
return;
|
5461
6122
|
}
|
@@ -5506,7 +6167,7 @@ var typewriter = ({ delay = 75, items = defaultItems } = {}) => {
|
|
5506
6167
|
let t;
|
5507
6168
|
let idx = 0;
|
5508
6169
|
return [
|
5509
|
-
|
6170
|
+
import_view32.keymap.of([
|
5510
6171
|
{
|
5511
6172
|
// Reset.
|
5512
6173
|
key: "alt-meta-'",
|
@@ -5607,28 +6268,6 @@ var createBlocks = (state, getView) => {
|
|
5607
6268
|
]
|
5608
6269
|
};
|
5609
6270
|
};
|
5610
|
-
var commentLabel = (comment, selection) => comment ? "selection overlaps existing comment label" : selection === false ? "select text to comment label" : "comment label";
|
5611
|
-
var createCommentAction = (label, getView) => createEditorAction("comment", () => createComment(getView()), {
|
5612
|
-
testId: "editor.toolbar.comment",
|
5613
|
-
icon: "ph--chat-text--regular",
|
5614
|
-
label
|
5615
|
-
});
|
5616
|
-
var createComment2 = (state, getView) => ({
|
5617
|
-
nodes: [
|
5618
|
-
createCommentAction([
|
5619
|
-
commentLabel(state.comment, state.selection),
|
5620
|
-
{
|
5621
|
-
ns: translationKey
|
5622
|
-
}
|
5623
|
-
], getView)
|
5624
|
-
],
|
5625
|
-
edges: [
|
5626
|
-
{
|
5627
|
-
source: "root",
|
5628
|
-
target: "comment"
|
5629
|
-
}
|
5630
|
-
]
|
5631
|
-
});
|
5632
6271
|
var formats = {
|
5633
6272
|
strong: "ph--text-b--regular",
|
5634
6273
|
emphasis: "ph--text-italic--regular",
|
@@ -5855,113 +6494,261 @@ var createViewMode = (state, onViewModeChange) => {
|
|
5855
6494
|
]
|
5856
6495
|
};
|
5857
6496
|
};
|
5858
|
-
var margin = "!mt-[1rem]";
|
5859
6497
|
var editorWidth = "!mli-auto is-full max-is-[min(50rem,100%-4rem)]";
|
5860
|
-
var
|
5861
|
-
|
5862
|
-
|
5863
|
-
|
5864
|
-
|
6498
|
+
var editorSlots = {
|
6499
|
+
scroll: {
|
6500
|
+
className: "pbs-2"
|
6501
|
+
},
|
6502
|
+
content: {
|
6503
|
+
className: editorWidth
|
6504
|
+
}
|
6505
|
+
};
|
6506
|
+
var editorGutter = import_view33.EditorView.theme({
|
5865
6507
|
".cm-gutters": {
|
5866
|
-
marginTop: "1rem",
|
5867
6508
|
paddingRight: "1rem"
|
5868
6509
|
}
|
5869
6510
|
});
|
5870
|
-
var editorMonospace =
|
6511
|
+
var editorMonospace = import_view33.EditorView.theme({
|
5871
6512
|
".cm-content": {
|
5872
6513
|
fontFamily: fontMono
|
5873
6514
|
}
|
5874
6515
|
});
|
5875
6516
|
var editorWithToolbarLayout = "grid grid-cols-1 grid-rows-[min-content_1fr] data-[toolbar=disabled]:grid-rows-[1fr] justify-center content-start overflow-hidden";
|
5876
6517
|
var stackItemContentEditorClassNames = (role) => (0, import_react_ui_theme8.mx)("attention-surface dx-focus-ring-inset data-[toolbar=disabled]:pbs-2", role === "section" ? "[&_.cm-scroller]:overflow-hidden [&_.cm-scroller]:min-bs-24" : "min-bs-0");
|
5877
|
-
var stackItemContentToolbarClassNames = (role) => (0, import_react_ui_theme8.mx)("relative z-[1] flex is-full bg-toolbarSurface border-be border-
|
6518
|
+
var stackItemContentToolbarClassNames = (role) => (0, import_react_ui_theme8.mx)("relative z-[1] flex is-full bg-toolbarSurface border-be border-subduedSeparator", role === "section" && "sticky block-start-0 -mbe-px min-is-0");
|
5878
6519
|
var createToolbar = ({ getView, state, customActions, ...features }) => {
|
5879
|
-
|
5880
|
-
|
5881
|
-
|
5882
|
-
|
5883
|
-
|
5884
|
-
|
5885
|
-
|
5886
|
-
|
5887
|
-
|
5888
|
-
|
5889
|
-
|
5890
|
-
|
5891
|
-
|
5892
|
-
|
5893
|
-
|
5894
|
-
|
5895
|
-
|
5896
|
-
|
5897
|
-
|
5898
|
-
|
5899
|
-
|
5900
|
-
|
5901
|
-
|
5902
|
-
|
5903
|
-
|
5904
|
-
|
5905
|
-
|
5906
|
-
|
5907
|
-
const
|
5908
|
-
nodes.push(...
|
5909
|
-
edges.push(...
|
5910
|
-
|
5911
|
-
|
5912
|
-
|
5913
|
-
|
5914
|
-
|
5915
|
-
|
5916
|
-
|
5917
|
-
|
5918
|
-
|
5919
|
-
|
5920
|
-
|
5921
|
-
|
5922
|
-
|
5923
|
-
|
5924
|
-
|
5925
|
-
|
5926
|
-
|
5927
|
-
|
5928
|
-
|
5929
|
-
|
5930
|
-
nodes,
|
5931
|
-
edges
|
5932
|
-
};
|
6520
|
+
return import_rx_react.Rx.make((get2) => {
|
6521
|
+
const nodes = [];
|
6522
|
+
const edges = [];
|
6523
|
+
if (features.headings ?? true) {
|
6524
|
+
const headings2 = get2((0, import_app_graph.rxFromSignal)(() => createHeadings(state, getView)));
|
6525
|
+
nodes.push(...headings2.nodes);
|
6526
|
+
edges.push(...headings2.edges);
|
6527
|
+
}
|
6528
|
+
if (features.formatting ?? true) {
|
6529
|
+
const formatting = get2((0, import_app_graph.rxFromSignal)(() => createFormatting(state, getView)));
|
6530
|
+
nodes.push(...formatting.nodes);
|
6531
|
+
edges.push(...formatting.edges);
|
6532
|
+
}
|
6533
|
+
if (features.lists ?? true) {
|
6534
|
+
const lists = get2((0, import_app_graph.rxFromSignal)(() => createLists(state, getView)));
|
6535
|
+
nodes.push(...lists.nodes);
|
6536
|
+
edges.push(...lists.edges);
|
6537
|
+
}
|
6538
|
+
if (features.blocks ?? true) {
|
6539
|
+
const blocks = get2((0, import_app_graph.rxFromSignal)(() => createBlocks(state, getView)));
|
6540
|
+
nodes.push(...blocks.nodes);
|
6541
|
+
edges.push(...blocks.edges);
|
6542
|
+
}
|
6543
|
+
if (features.image) {
|
6544
|
+
const image2 = get2((0, import_app_graph.rxFromSignal)(() => createImageUpload(features.image)));
|
6545
|
+
nodes.push(...image2.nodes);
|
6546
|
+
edges.push(...image2.edges);
|
6547
|
+
}
|
6548
|
+
const editorToolbarGap = (0, import_react_ui_menu.createGapSeparator)();
|
6549
|
+
nodes.push(...editorToolbarGap.nodes);
|
6550
|
+
edges.push(...editorToolbarGap.edges);
|
6551
|
+
if (customActions) {
|
6552
|
+
const custom = get2(customActions);
|
6553
|
+
nodes.push(...custom.nodes);
|
6554
|
+
edges.push(...custom.edges);
|
6555
|
+
}
|
6556
|
+
if (features.search ?? true) {
|
6557
|
+
const search = get2((0, import_app_graph.rxFromSignal)(() => createSearch(getView)));
|
6558
|
+
nodes.push(...search.nodes);
|
6559
|
+
edges.push(...search.edges);
|
6560
|
+
}
|
6561
|
+
if (features.viewMode) {
|
6562
|
+
const viewMode = get2((0, import_app_graph.rxFromSignal)(() => createViewMode(state, features.viewMode)));
|
6563
|
+
nodes.push(...viewMode.nodes);
|
6564
|
+
edges.push(...viewMode.edges);
|
6565
|
+
}
|
6566
|
+
return {
|
6567
|
+
nodes,
|
6568
|
+
edges
|
6569
|
+
};
|
6570
|
+
});
|
5933
6571
|
};
|
5934
6572
|
var useEditorToolbarActionGraph = (props) => {
|
5935
|
-
const menuCreator = (0, import_react.
|
5936
|
-
props
|
6573
|
+
const menuCreator = (0, import_react.useMemo)(() => createToolbar({
|
6574
|
+
getView: props.getView,
|
6575
|
+
state: props.state,
|
6576
|
+
customActions: props.customActions,
|
6577
|
+
headings: props.headings,
|
6578
|
+
formatting: props.formatting,
|
6579
|
+
lists: props.lists,
|
6580
|
+
blocks: props.blocks,
|
6581
|
+
image: props.image,
|
6582
|
+
search: props.search,
|
6583
|
+
viewMode: props.viewMode
|
6584
|
+
}), [
|
6585
|
+
props.getView,
|
6586
|
+
props.state,
|
6587
|
+
props.customActions,
|
6588
|
+
props.headings,
|
6589
|
+
props.formatting,
|
6590
|
+
props.lists,
|
6591
|
+
props.blocks,
|
6592
|
+
props.image,
|
6593
|
+
props.search,
|
6594
|
+
props.viewMode
|
5937
6595
|
]);
|
5938
6596
|
return (0, import_react_ui_menu.useMenuActions)(menuCreator);
|
5939
6597
|
};
|
5940
6598
|
var EditorToolbar = /* @__PURE__ */ (0, import_react.memo)(({ classNames, attendableId, role, ...props }) => {
|
5941
|
-
|
5942
|
-
|
5943
|
-
|
5944
|
-
|
5945
|
-
|
5946
|
-
|
5947
|
-
|
5948
|
-
|
5949
|
-
|
5950
|
-
|
5951
|
-
|
5952
|
-
|
5953
|
-
classNames
|
5954
|
-
|
5955
|
-
|
6599
|
+
var _effect = (0, import_tracking.useSignals)();
|
6600
|
+
try {
|
6601
|
+
const menuProps = useEditorToolbarActionGraph(props);
|
6602
|
+
return /* @__PURE__ */ import_react.default.createElement("div", {
|
6603
|
+
role: "none",
|
6604
|
+
className: stackItemContentToolbarClassNames(role)
|
6605
|
+
}, /* @__PURE__ */ import_react.default.createElement(import_react_ui.ElevationProvider, {
|
6606
|
+
elevation: role === "section" ? "positioned" : "base"
|
6607
|
+
}, /* @__PURE__ */ import_react.default.createElement(import_react_ui_menu.MenuProvider, {
|
6608
|
+
...menuProps,
|
6609
|
+
attendableId
|
6610
|
+
}, /* @__PURE__ */ import_react.default.createElement(import_react_ui_menu.ToolbarMenu, {
|
6611
|
+
classNames: [
|
6612
|
+
import_react_ui_theme.textBlockWidth,
|
6613
|
+
classNames
|
6614
|
+
]
|
6615
|
+
}))));
|
6616
|
+
} finally {
|
6617
|
+
_effect.f();
|
6618
|
+
}
|
5956
6619
|
});
|
5957
|
-
var
|
6620
|
+
var customEventOptions = {
|
6621
|
+
capture: true,
|
6622
|
+
passive: false
|
6623
|
+
};
|
6624
|
+
var REF_POPOVER = "RefPopover";
|
6625
|
+
var [RefPopoverContextProvider, useRefPopover] = (0, import_react_context.createContext)(REF_POPOVER, {});
|
6626
|
+
var RefPopoverProvider = ({ children, onLookup }) => {
|
6627
|
+
var _effect = (0, import_tracking2.useSignals)();
|
6628
|
+
try {
|
6629
|
+
const trigger = (0, import_react7.useRef)(null);
|
6630
|
+
const [value, setValue] = (0, import_react7.useState)({});
|
6631
|
+
const [rootRef, setRootRef] = (0, import_react7.useState)(null);
|
6632
|
+
const [open, setOpen] = (0, import_react7.useState)(false);
|
6633
|
+
const handleDxRefTagActivate = (0, import_react7.useCallback)((event) => {
|
6634
|
+
const { refId, label, trigger: dxTrigger } = event;
|
6635
|
+
setValue((value2) => ({
|
6636
|
+
...value2,
|
6637
|
+
link: {
|
6638
|
+
label,
|
6639
|
+
ref: refId
|
6640
|
+
},
|
6641
|
+
pending: true
|
6642
|
+
}));
|
6643
|
+
trigger.current = dxTrigger;
|
6644
|
+
queueMicrotask(() => setOpen(true));
|
6645
|
+
void onLookup?.({
|
6646
|
+
label,
|
6647
|
+
ref: refId
|
6648
|
+
}).then((target) => setValue((value2) => ({
|
6649
|
+
...value2,
|
6650
|
+
target: target ?? void 0,
|
6651
|
+
pending: false
|
6652
|
+
})));
|
6653
|
+
}, [
|
6654
|
+
onLookup
|
6655
|
+
]);
|
6656
|
+
(0, import_react7.useEffect)(() => {
|
6657
|
+
return rootRef ? (0, import_async5.addEventListener)(rootRef, "dx-ref-tag-activate", handleDxRefTagActivate, customEventOptions) : void 0;
|
6658
|
+
}, [
|
6659
|
+
rootRef
|
6660
|
+
]);
|
6661
|
+
return /* @__PURE__ */ import_react7.default.createElement(RefPopoverContextProvider, {
|
6662
|
+
pending: value.pending,
|
6663
|
+
link: value.link,
|
6664
|
+
target: value.target
|
6665
|
+
}, /* @__PURE__ */ import_react7.default.createElement(import_react_ui4.Popover.Root, {
|
6666
|
+
open,
|
6667
|
+
onOpenChange: setOpen
|
6668
|
+
}, /* @__PURE__ */ import_react7.default.createElement(import_react_ui4.Popover.VirtualTrigger, {
|
6669
|
+
virtualRef: trigger
|
6670
|
+
}), /* @__PURE__ */ import_react7.default.createElement("div", {
|
6671
|
+
role: "none",
|
6672
|
+
className: "contents",
|
6673
|
+
ref: setRootRef
|
6674
|
+
}, children)));
|
6675
|
+
} finally {
|
6676
|
+
_effect.f();
|
6677
|
+
}
|
6678
|
+
};
|
6679
|
+
var RefPopover = {
|
6680
|
+
Provider: RefPopoverProvider
|
6681
|
+
};
|
6682
|
+
var customEventOptions2 = {
|
6683
|
+
capture: true,
|
6684
|
+
passive: false
|
6685
|
+
};
|
6686
|
+
var REF_DROPDOWN_MENU = "RefDropdownMenu";
|
6687
|
+
var [RefDropdownMenuContextProvider, useRefDropdownMenu] = (0, import_react_context2.createContext)(REF_DROPDOWN_MENU, {});
|
6688
|
+
var RefDropdownMenuProvider = ({ children, onLookup }) => {
|
6689
|
+
var _effect = (0, import_tracking3.useSignals)();
|
6690
|
+
try {
|
6691
|
+
const trigger = (0, import_react8.useRef)(null);
|
6692
|
+
const [value, setValue] = (0, import_react8.useState)({});
|
6693
|
+
const [rootRef, setRootRef] = (0, import_react8.useState)(null);
|
6694
|
+
const [open, setOpen] = (0, import_react8.useState)(false);
|
6695
|
+
const handleDxRefTagActivate = (0, import_react8.useCallback)((event) => {
|
6696
|
+
const { refId, label, trigger: dxTrigger } = event;
|
6697
|
+
setValue((value2) => ({
|
6698
|
+
...value2,
|
6699
|
+
link: {
|
6700
|
+
label,
|
6701
|
+
ref: refId
|
6702
|
+
},
|
6703
|
+
pending: true
|
6704
|
+
}));
|
6705
|
+
trigger.current = dxTrigger;
|
6706
|
+
queueMicrotask(() => setOpen(true));
|
6707
|
+
void onLookup?.({
|
6708
|
+
label,
|
6709
|
+
ref: refId
|
6710
|
+
}).then((target) => setValue((value2) => ({
|
6711
|
+
...value2,
|
6712
|
+
target: target ?? void 0,
|
6713
|
+
pending: false
|
6714
|
+
})));
|
6715
|
+
}, [
|
6716
|
+
onLookup
|
6717
|
+
]);
|
6718
|
+
(0, import_react8.useEffect)(() => {
|
6719
|
+
return rootRef ? (0, import_async6.addEventListener)(rootRef, "dx-ref-tag-activate", handleDxRefTagActivate, customEventOptions2) : void 0;
|
6720
|
+
}, [
|
6721
|
+
rootRef
|
6722
|
+
]);
|
6723
|
+
return /* @__PURE__ */ import_react8.default.createElement(RefDropdownMenuContextProvider, {
|
6724
|
+
pending: value.pending,
|
6725
|
+
link: value.link,
|
6726
|
+
target: value.target
|
6727
|
+
}, /* @__PURE__ */ import_react8.default.createElement(import_react_ui5.DropdownMenu.Root, {
|
6728
|
+
open,
|
6729
|
+
onOpenChange: setOpen
|
6730
|
+
}, /* @__PURE__ */ import_react8.default.createElement(import_react_ui5.DropdownMenu.VirtualTrigger, {
|
6731
|
+
virtualRef: trigger
|
6732
|
+
}), /* @__PURE__ */ import_react8.default.createElement("div", {
|
6733
|
+
role: "none",
|
6734
|
+
className: "contents",
|
6735
|
+
ref: setRootRef
|
6736
|
+
}, children)));
|
6737
|
+
} finally {
|
6738
|
+
_effect.f();
|
6739
|
+
}
|
6740
|
+
};
|
6741
|
+
var RefDropdownMenu = {
|
6742
|
+
Provider: RefDropdownMenuProvider
|
6743
|
+
};
|
6744
|
+
var __dxlog_file13 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-editor/src/hooks/useTextEditor.ts";
|
5958
6745
|
var instanceCount = 0;
|
5959
6746
|
var useTextEditor = (props = {}, deps = []) => {
|
5960
|
-
const { id, doc, initialValue, extensions, autoFocus, scrollTo, selection, moveToEndOfLine, debug } = (0,
|
5961
|
-
const [instanceId] = (0,
|
5962
|
-
const [view, setView] = (0,
|
5963
|
-
const parentRef = (0,
|
5964
|
-
(0,
|
6747
|
+
const { id, doc, initialValue, extensions, autoFocus, scrollTo, selection, moveToEndOfLine, debug } = (0, import_react9.useMemo)(() => (0, import_util6.getProviderValue)(props), deps ?? []);
|
6748
|
+
const [instanceId] = (0, import_react9.useState)(() => `text-editor-${++instanceCount}`);
|
6749
|
+
const [view, setView] = (0, import_react9.useState)();
|
6750
|
+
const parentRef = (0, import_react9.useRef)(null);
|
6751
|
+
(0, import_react9.useEffect)(() => {
|
5965
6752
|
let view2;
|
5966
6753
|
if (parentRef.current) {
|
5967
6754
|
(0, import_log8.log)("create", {
|
@@ -5969,7 +6756,7 @@ var useTextEditor = (props = {}, deps = []) => {
|
|
5969
6756
|
instanceId,
|
5970
6757
|
doc: initialValue?.length ?? 0
|
5971
6758
|
}, {
|
5972
|
-
F:
|
6759
|
+
F: __dxlog_file13,
|
5973
6760
|
L: 76,
|
5974
6761
|
S: void 0,
|
5975
6762
|
C: (f, a) => f(...a)
|
@@ -5986,27 +6773,27 @@ var useTextEditor = (props = {}, deps = []) => {
|
|
5986
6773
|
anchor
|
5987
6774
|
};
|
5988
6775
|
}
|
5989
|
-
const state =
|
6776
|
+
const state = import_state30.EditorState.create({
|
5990
6777
|
doc: doc ?? initialValue,
|
5991
6778
|
// selection: initialSelection,
|
5992
6779
|
extensions: [
|
5993
6780
|
id && documentId.of(id),
|
5994
6781
|
extensions,
|
5995
6782
|
// NOTE: This doesn't catch errors in keymap functions.
|
5996
|
-
|
6783
|
+
import_view34.EditorView.exceptionSink.of((err) => {
|
5997
6784
|
import_log8.log.catch(err, void 0, {
|
5998
|
-
F:
|
6785
|
+
F: __dxlog_file13,
|
5999
6786
|
L: 98,
|
6000
6787
|
S: void 0,
|
6001
6788
|
C: (f, a) => f(...a)
|
6002
6789
|
});
|
6003
6790
|
})
|
6004
|
-
].filter(
|
6791
|
+
].filter(import_util6.isNotFalsy)
|
6005
6792
|
});
|
6006
|
-
view2 = new
|
6793
|
+
view2 = new import_view34.EditorView({
|
6007
6794
|
parent: parentRef.current,
|
6008
6795
|
state,
|
6009
|
-
scrollTo: scrollTo ?
|
6796
|
+
scrollTo: scrollTo ? import_view34.EditorView.scrollIntoView(scrollTo, {
|
6010
6797
|
yMargin: 96
|
6011
6798
|
}) : void 0,
|
6012
6799
|
dispatchTransactions: debug ? debugDispatcher : void 0
|
@@ -6027,7 +6814,7 @@ var useTextEditor = (props = {}, deps = []) => {
|
|
6027
6814
|
(0, import_log8.log)("destroy", {
|
6028
6815
|
id
|
6029
6816
|
}, {
|
6030
|
-
F:
|
6817
|
+
F: __dxlog_file13,
|
6031
6818
|
L: 135,
|
6032
6819
|
S: void 0,
|
6033
6820
|
C: (f, a) => f(...a)
|
@@ -6035,7 +6822,7 @@ var useTextEditor = (props = {}, deps = []) => {
|
|
6035
6822
|
view2?.destroy();
|
6036
6823
|
};
|
6037
6824
|
}, deps);
|
6038
|
-
(0,
|
6825
|
+
(0, import_react9.useEffect)(() => {
|
6039
6826
|
if (view) {
|
6040
6827
|
if (scrollTo || selection) {
|
6041
6828
|
if (selection && selection.anchor > view.state.doc.length) {
|
@@ -6044,7 +6831,7 @@ var useTextEditor = (props = {}, deps = []) => {
|
|
6044
6831
|
scrollTo,
|
6045
6832
|
selection
|
6046
6833
|
}, {
|
6047
|
-
F:
|
6834
|
+
F: __dxlog_file13,
|
6048
6835
|
L: 144,
|
6049
6836
|
S: void 0,
|
6050
6837
|
C: (f, a) => f(...a)
|
@@ -6062,7 +6849,7 @@ var useTextEditor = (props = {}, deps = []) => {
|
|
6062
6849
|
scrollTo,
|
6063
6850
|
selection
|
6064
6851
|
]);
|
6065
|
-
(0,
|
6852
|
+
(0, import_react9.useEffect)(() => {
|
6066
6853
|
if (view && autoFocus) {
|
6067
6854
|
view.focus();
|
6068
6855
|
}
|
@@ -6076,7 +6863,7 @@ var useTextEditor = (props = {}, deps = []) => {
|
|
6076
6863
|
Escape: view?.state.facet(editorInputMode).noTabster
|
6077
6864
|
}
|
6078
6865
|
});
|
6079
|
-
const handleKeyUp = (0,
|
6866
|
+
const handleKeyUp = (0, import_react9.useCallback)((event) => {
|
6080
6867
|
const { key, target, currentTarget } = event;
|
6081
6868
|
if (target === currentTarget) {
|
6082
6869
|
switch (key) {
|
@@ -6112,9 +6899,12 @@ var useTextEditor = (props = {}, deps = []) => {
|
|
6112
6899
|
Inline,
|
6113
6900
|
InputModeExtensions,
|
6114
6901
|
List,
|
6902
|
+
RefDropdownMenu,
|
6903
|
+
RefPopover,
|
6115
6904
|
RemoteSelectionsDecorator,
|
6116
6905
|
SpaceAwarenessProvider,
|
6117
6906
|
TextKind,
|
6907
|
+
Tree,
|
6118
6908
|
addBlockquote,
|
6119
6909
|
addCodeblock,
|
6120
6910
|
addLink,
|
@@ -6132,6 +6922,7 @@ var useTextEditor = (props = {}, deps = []) => {
|
|
6132
6922
|
closeEffect,
|
6133
6923
|
command,
|
6134
6924
|
commandKeyBindings,
|
6925
|
+
commentClickedEffect,
|
6135
6926
|
comments,
|
6136
6927
|
commentsState,
|
6137
6928
|
convertTreeToJson,
|
@@ -6144,6 +6935,7 @@ var useTextEditor = (props = {}, deps = []) => {
|
|
6144
6935
|
createEditorStateTransaction,
|
6145
6936
|
createElement,
|
6146
6937
|
createExternalCommentSync,
|
6938
|
+
createJsonExtensions,
|
6147
6939
|
createMarkdownExtensions,
|
6148
6940
|
createRenderer,
|
6149
6941
|
createThemeExtensions,
|
@@ -6154,33 +6946,39 @@ var useTextEditor = (props = {}, deps = []) => {
|
|
6154
6946
|
defaultOptions,
|
6155
6947
|
documentId,
|
6156
6948
|
dropFile,
|
6157
|
-
editorContent,
|
6158
|
-
editorFullWidth,
|
6159
6949
|
editorGutter,
|
6160
6950
|
editorInputMode,
|
6161
6951
|
editorMonospace,
|
6952
|
+
editorSlots,
|
6162
6953
|
editorWidth,
|
6163
6954
|
editorWithToolbarLayout,
|
6164
6955
|
flattenRect,
|
6956
|
+
floatingMenu,
|
6165
6957
|
focus,
|
6166
6958
|
focusField,
|
6167
6959
|
folding,
|
6168
6960
|
formattingEquals,
|
6169
6961
|
formattingKeymap,
|
6170
6962
|
getFormatting,
|
6963
|
+
getListItemContent,
|
6964
|
+
getRange,
|
6171
6965
|
image,
|
6172
6966
|
insertTable,
|
6967
|
+
itemToJSON,
|
6173
6968
|
keymap,
|
6174
6969
|
linkTooltip,
|
6970
|
+
listItemToString,
|
6175
6971
|
listener,
|
6176
6972
|
logChanges,
|
6177
6973
|
markdownHighlightStyle,
|
6178
6974
|
markdownTags,
|
6179
6975
|
markdownTagsExtensions,
|
6976
|
+
matchCompletion,
|
6180
6977
|
mention,
|
6181
6978
|
openCommand,
|
6182
6979
|
openEffect,
|
6183
6980
|
outliner,
|
6981
|
+
outlinerTree,
|
6184
6982
|
overlap,
|
6185
6983
|
preventNewline,
|
6186
6984
|
preview,
|
@@ -6192,7 +6990,6 @@ var useTextEditor = (props = {}, deps = []) => {
|
|
6192
6990
|
removeStyle,
|
6193
6991
|
renderRoot,
|
6194
6992
|
scrollThreadIntoView,
|
6195
|
-
selectionOverlapsComment,
|
6196
6993
|
selectionState,
|
6197
6994
|
setBlockquote,
|
6198
6995
|
setComments,
|
@@ -6202,6 +6999,7 @@ var useTextEditor = (props = {}, deps = []) => {
|
|
6202
6999
|
singleValueFacet,
|
6203
7000
|
stackItemContentEditorClassNames,
|
6204
7001
|
stackItemContentToolbarClassNames,
|
7002
|
+
staticCompletion,
|
6205
7003
|
table,
|
6206
7004
|
tags,
|
6207
7005
|
textRange,
|
@@ -6214,12 +7012,15 @@ var useTextEditor = (props = {}, deps = []) => {
|
|
6214
7012
|
toggleStrong,
|
6215
7013
|
toggleStyle,
|
6216
7014
|
translations,
|
7015
|
+
traverse,
|
7016
|
+
treeFacet,
|
7017
|
+
typeahead,
|
6217
7018
|
typewriter,
|
6218
|
-
useCommentClickListener,
|
6219
|
-
useCommentState,
|
6220
7019
|
useComments,
|
6221
7020
|
useEditorToolbarState,
|
6222
7021
|
useFormattingState,
|
7022
|
+
useRefDropdownMenu,
|
7023
|
+
useRefPopover,
|
6223
7024
|
useTextEditor,
|
6224
7025
|
wrapWithCatch
|
6225
7026
|
});
|