@blocknote/core 0.30.0 → 0.30.1
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/blocknote.cjs +2 -2
- package/dist/blocknote.cjs.map +1 -1
- package/dist/blocknote.js +22 -20
- package/dist/blocknote.js.map +1 -1
- package/dist/comments.cjs.map +1 -1
- package/dist/comments.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/webpack-stats.json +1 -1
- package/package.json +5 -3
- package/src/api/README.md +1 -1
- package/src/api/blockManipulation/commands/insertBlocks/insertBlocks.test.ts +19 -14
- package/src/api/blockManipulation/commands/insertBlocks/insertBlocks.ts +5 -5
- package/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.test.ts +3 -3
- package/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.ts +12 -12
- package/src/api/blockManipulation/commands/moveBlocks/moveBlocks.test.ts +14 -14
- package/src/api/blockManipulation/commands/moveBlocks/moveBlocks.ts +16 -16
- package/src/api/blockManipulation/commands/nestBlock/nestBlock.ts +8 -8
- package/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.test.ts +12 -12
- package/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.ts +7 -7
- package/src/api/blockManipulation/commands/splitBlock/splitBlock.test.ts +10 -10
- package/src/api/blockManipulation/commands/splitBlock/splitBlock.ts +2 -2
- package/src/api/blockManipulation/commands/updateBlock/updateBlock.test.ts +42 -42
- package/src/api/blockManipulation/commands/updateBlock/updateBlock.ts +18 -18
- package/src/api/blockManipulation/getBlock/getBlock.ts +9 -9
- package/src/api/blockManipulation/insertContentAt.ts +1 -1
- package/src/api/blockManipulation/selections/selection.ts +11 -11
- package/src/api/blockManipulation/selections/textCursorPosition/textCursorPosition.test.ts +7 -7
- package/src/api/blockManipulation/selections/textCursorPosition/textCursorPosition.ts +6 -6
- package/src/api/blockManipulation/tables/tables.test.ts +106 -106
- package/src/api/blockManipulation/tables/tables.ts +35 -35
- package/src/api/clipboard/fromClipboard/fileDropExtension.ts +2 -2
- package/src/api/clipboard/fromClipboard/handleFileInsertion.ts +9 -9
- package/src/api/clipboard/fromClipboard/handleVSCodePaste.ts +3 -3
- package/src/api/clipboard/fromClipboard/pasteExtension.ts +3 -3
- package/src/api/clipboard/toClipboard/copyExtension.ts +22 -22
- package/src/api/exporters/html/externalHTMLExporter.ts +6 -6
- package/src/api/exporters/html/internalHTMLSerializer.ts +3 -3
- package/src/api/exporters/html/util/serializeBlocksExternalHTML.ts +16 -16
- package/src/api/exporters/html/util/serializeBlocksInternalHTML.ts +14 -14
- package/src/api/exporters/markdown/markdownExporter.ts +3 -3
- package/src/api/exporters/markdown/util/addSpacesToCheckboxesRehypePlugin.ts +3 -3
- package/src/api/getBlockInfoFromPos.ts +6 -6
- package/src/api/nodeConversions/blockToNode.ts +26 -26
- package/src/api/nodeConversions/fragmentToBlocks.ts +1 -1
- package/src/api/nodeConversions/nodeToBlock.ts +37 -33
- package/src/api/nodeUtil.test.ts +16 -16
- package/src/api/nodeUtil.ts +10 -10
- package/src/api/parsers/html/parseHTML.ts +1 -1
- package/src/api/parsers/html/util/nestedLists.ts +2 -2
- package/src/api/parsers/markdown/parseMarkdown.ts +1 -1
- package/src/api/pmUtil.ts +4 -4
- package/src/api/positionMapping.test.ts +3 -3
- package/src/api/positionMapping.ts +5 -5
- package/src/blocks/AudioBlockContent/AudioBlockContent.ts +4 -4
- package/src/blocks/CodeBlockContent/CodeBlockContent.ts +12 -12
- package/src/blocks/FileBlockContent/FileBlockContent.ts +2 -2
- package/src/blocks/FileBlockContent/helpers/parse/parseFigureElement.ts +2 -2
- package/src/blocks/FileBlockContent/helpers/render/createAddFileButton.ts +5 -5
- package/src/blocks/FileBlockContent/helpers/render/createFileBlockWrapper.ts +2 -2
- package/src/blocks/FileBlockContent/helpers/render/createFileNameWithIcon.ts +1 -1
- package/src/blocks/FileBlockContent/helpers/render/createResizableFileBlockWrapper.ts +7 -7
- package/src/blocks/FileBlockContent/helpers/toExternalHTML/createFigureWithCaption.ts +1 -1
- package/src/blocks/FileBlockContent/helpers/toExternalHTML/createLinkWithCaption.ts +1 -1
- package/src/blocks/FileBlockContent/uploadToTmpFilesDotOrg_DEV_ONLY.ts +2 -2
- package/src/blocks/HeadingBlockContent/HeadingBlockContent.ts +6 -6
- package/src/blocks/ImageBlockContent/ImageBlockContent.ts +4 -4
- package/src/blocks/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.ts +4 -4
- package/src/blocks/ListItemBlockContent/CheckListItemBlockContent/CheckListItemBlockContent.ts +10 -10
- package/src/blocks/ListItemBlockContent/ListItemKeyboardShortcuts.ts +1 -1
- package/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListIndexingPlugin.ts +1 -1
- package/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.ts +4 -4
- package/src/blocks/ListItemBlockContent/getListItemContent.ts +5 -5
- package/src/blocks/PageBreakBlockContent/PageBreakBlockContent.ts +1 -1
- package/src/blocks/PageBreakBlockContent/getPageBreakSlashMenuItems.ts +3 -3
- package/src/blocks/PageBreakBlockContent/schema.ts +2 -2
- package/src/blocks/ParagraphBlockContent/ParagraphBlockContent.ts +3 -3
- package/src/blocks/QuoteBlockContent/QuoteBlockContent.ts +4 -4
- package/src/blocks/README.md +1 -1
- package/src/blocks/TableBlockContent/TableBlockContent.ts +5 -5
- package/src/blocks/TableBlockContent/TableExtension.ts +3 -3
- package/src/blocks/VideoBlockContent/VideoBlockContent.ts +4 -4
- package/src/blocks/defaultBlockHelpers.ts +8 -8
- package/src/blocks/defaultBlockTypeGuards.ts +16 -16
- package/src/blocks/defaultBlocks.ts +3 -3
- package/src/comments/threadstore/DefaultThreadStoreAuth.ts +3 -3
- package/src/comments/threadstore/ThreadStore.ts +1 -1
- package/src/comments/threadstore/TipTapThreadStore.ts +10 -10
- package/src/comments/threadstore/yjs/RESTYjsThreadStore.ts +4 -4
- package/src/comments/threadstore/yjs/YjsThreadStore.test.ts +2 -2
- package/src/comments/threadstore/yjs/YjsThreadStore.ts +14 -14
- package/src/comments/threadstore/yjs/YjsThreadStoreBase.ts +1 -1
- package/src/comments/threadstore/yjs/yjsHelpers.ts +6 -6
- package/src/editor/Block.css +8 -0
- package/src/editor/BlockNoteEditor.test.ts +3 -3
- package/src/editor/BlockNoteEditor.ts +7 -1
- package/src/editor/BlockNoteExtensions.ts +10 -10
- package/src/editor/BlockNoteSchema.ts +4 -4
- package/src/editor/BlockNoteTipTapEditor.ts +10 -10
- package/src/editor/README.md +1 -1
- package/src/editor/cursorPositionTypes.ts +1 -1
- package/src/editor/editor.css +15 -3
- package/src/editor/selectionTypes.ts +1 -1
- package/src/editor/transformPasted.ts +2 -2
- package/src/exporter/Exporter.ts +5 -5
- package/src/exporter/mapping.ts +7 -7
- package/src/extensions/BackgroundColor/BackgroundColorMark.ts +1 -1
- package/src/extensions/Collaboration/CursorPlugin.ts +2 -2
- package/src/extensions/Comments/CommentsPlugin.ts +9 -9
- package/src/extensions/Comments/userstore/UserStore.ts +2 -2
- package/src/extensions/FilePanel/FilePanelPlugin.ts +7 -7
- package/src/extensions/FormattingToolbar/FormattingToolbarPlugin.ts +4 -4
- package/src/extensions/KeyboardShortcuts/KeyboardShortcutsExtension.ts +26 -26
- package/src/extensions/LinkToolbar/LinkToolbarPlugin.ts +11 -11
- package/src/extensions/NodeSelectionKeyboard/NodeSelectionKeyboardPlugin.ts +4 -4
- package/src/extensions/Placeholder/PlaceholderPlugin.ts +10 -10
- package/src/extensions/PreviousBlockType/PreviousBlockTypePlugin.ts +2 -2
- package/src/extensions/README.md +1 -1
- package/src/extensions/SideMenu/MultipleNodeSelection.ts +1 -1
- package/src/extensions/SideMenu/SideMenuPlugin.ts +31 -31
- package/src/extensions/SideMenu/dragging.ts +8 -8
- package/src/extensions/SuggestionMenu/SuggestionPlugin.ts +17 -17
- package/src/extensions/SuggestionMenu/getDefaultEmojiPickerItems.ts +2 -2
- package/src/extensions/SuggestionMenu/getDefaultSlashMenuItems.ts +12 -12
- package/src/extensions/TableHandles/TableHandlesPlugin.ts +54 -53
- package/src/extensions/TrailingNode/TrailingNodeExtension.ts +1 -1
- package/src/extensions/UniqueID/UniqueID.ts +6 -6
- package/src/extensions/getDraggableBlockFromElement.ts +1 -1
- package/src/fonts/inter.css +18 -9
- package/src/locales.ts +1 -1
- package/src/pm-nodes/BlockGroup.ts +1 -1
- package/src/pm-nodes/Doc.ts +4 -4
- package/src/schema/README.md +1 -1
- package/src/schema/blocks/createSpec.ts +14 -14
- package/src/schema/blocks/internal.ts +17 -17
- package/src/schema/blocks/types.ts +25 -25
- package/src/schema/inlineContent/createSpec.ts +16 -20
- package/src/schema/inlineContent/internal.ts +9 -9
- package/src/schema/inlineContent/types.ts +26 -26
- package/src/schema/propTypes.ts +8 -8
- package/src/schema/styles/createSpec.ts +2 -2
- package/src/schema/styles/internal.ts +7 -7
- package/src/schema/styles/types.ts +2 -2
- package/src/util/EventEmitter.ts +4 -4
- package/src/util/README.md +1 -1
- package/src/util/combineByGroup.ts +1 -1
- package/src/util/table.ts +33 -30
- package/types/src/editor/BlockNoteEditor.d.ts +3 -1
|
@@ -22,7 +22,7 @@ export type SuggestionMenuState = UiElementPosition & {
|
|
|
22
22
|
class SuggestionMenuView<
|
|
23
23
|
BSchema extends BlockSchema,
|
|
24
24
|
I extends InlineContentSchema,
|
|
25
|
-
S extends StyleSchema
|
|
25
|
+
S extends StyleSchema,
|
|
26
26
|
> {
|
|
27
27
|
public state?: SuggestionMenuState;
|
|
28
28
|
public emitUpdate: (triggerCharacter: string) => void;
|
|
@@ -31,7 +31,7 @@ class SuggestionMenuView<
|
|
|
31
31
|
|
|
32
32
|
constructor(
|
|
33
33
|
private readonly editor: BlockNoteEditor<BSchema, I, S>,
|
|
34
|
-
emitUpdate: (menuName: string, state: SuggestionMenuState) => void
|
|
34
|
+
emitUpdate: (menuName: string, state: SuggestionMenuState) => void,
|
|
35
35
|
) {
|
|
36
36
|
this.pluginState = undefined;
|
|
37
37
|
|
|
@@ -57,7 +57,7 @@ class SuggestionMenuView<
|
|
|
57
57
|
handleScroll = () => {
|
|
58
58
|
if (this.state?.show) {
|
|
59
59
|
const decorationNode = this.rootEl?.querySelector(
|
|
60
|
-
`[data-decoration-id="${this.pluginState!.decorationId}"]
|
|
60
|
+
`[data-decoration-id="${this.pluginState!.decorationId}"]`,
|
|
61
61
|
);
|
|
62
62
|
if (!decorationNode) {
|
|
63
63
|
return;
|
|
@@ -71,7 +71,7 @@ class SuggestionMenuView<
|
|
|
71
71
|
const prev: SuggestionPluginState =
|
|
72
72
|
suggestionMenuPluginKey.getState(prevState);
|
|
73
73
|
const next: SuggestionPluginState = suggestionMenuPluginKey.getState(
|
|
74
|
-
view.state
|
|
74
|
+
view.state,
|
|
75
75
|
);
|
|
76
76
|
|
|
77
77
|
// See how the state changed
|
|
@@ -96,7 +96,7 @@ class SuggestionMenuView<
|
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
const decorationNode = this.rootEl?.querySelector(
|
|
99
|
-
`[data-decoration-id="${this.pluginState!.decorationId}"]
|
|
99
|
+
`[data-decoration-id="${this.pluginState!.decorationId}"]`,
|
|
100
100
|
);
|
|
101
101
|
|
|
102
102
|
if (this.editor.isEditable && decorationNode) {
|
|
@@ -165,7 +165,7 @@ const suggestionMenuPluginKey = new PluginKey("SuggestionMenuPlugin");
|
|
|
165
165
|
export class SuggestionMenuProseMirrorPlugin<
|
|
166
166
|
BSchema extends BlockSchema,
|
|
167
167
|
I extends InlineContentSchema,
|
|
168
|
-
S extends StyleSchema
|
|
168
|
+
S extends StyleSchema,
|
|
169
169
|
> extends EventEmitter<any> {
|
|
170
170
|
private view: SuggestionMenuView<BSchema, I, S> | undefined;
|
|
171
171
|
public readonly plugin: Plugin;
|
|
@@ -183,7 +183,7 @@ export class SuggestionMenuProseMirrorPlugin<
|
|
|
183
183
|
editor,
|
|
184
184
|
(triggerCharacter, state) => {
|
|
185
185
|
this.emit(`update ${triggerCharacter}`, state);
|
|
186
|
-
}
|
|
186
|
+
},
|
|
187
187
|
);
|
|
188
188
|
return this.view;
|
|
189
189
|
},
|
|
@@ -199,7 +199,7 @@ export class SuggestionMenuProseMirrorPlugin<
|
|
|
199
199
|
transaction,
|
|
200
200
|
prev,
|
|
201
201
|
_oldState,
|
|
202
|
-
newState
|
|
202
|
+
newState,
|
|
203
203
|
): SuggestionPluginState => {
|
|
204
204
|
// TODO: More clearly define which transactions should be ignored.
|
|
205
205
|
if (transaction.getMeta("orderedListIndexing") !== undefined) {
|
|
@@ -231,7 +231,7 @@ export class SuggestionMenuProseMirrorPlugin<
|
|
|
231
231
|
editor,
|
|
232
232
|
newState.selection.from -
|
|
233
233
|
// Need to account for the trigger char that was inserted, so we offset the position by the length of the trigger character.
|
|
234
|
-
suggestionPluginTransactionMeta.triggerCharacter.length
|
|
234
|
+
suggestionPluginTransactionMeta.triggerCharacter.length,
|
|
235
235
|
);
|
|
236
236
|
return {
|
|
237
237
|
triggerCharacter:
|
|
@@ -271,7 +271,7 @@ export class SuggestionMenuProseMirrorPlugin<
|
|
|
271
271
|
newState.selection.from < prev.queryStartPos()) ||
|
|
272
272
|
// Moving the caret to a new block should hide the menu.
|
|
273
273
|
!newState.selection.$from.sameParent(
|
|
274
|
-
newState.doc.resolve(prev.queryStartPos())
|
|
274
|
+
newState.doc.resolve(prev.queryStartPos()),
|
|
275
275
|
)
|
|
276
276
|
) {
|
|
277
277
|
return undefined;
|
|
@@ -282,7 +282,7 @@ export class SuggestionMenuProseMirrorPlugin<
|
|
|
282
282
|
// Updates the current query.
|
|
283
283
|
next.query = newState.doc.textBetween(
|
|
284
284
|
prev.queryStartPos(),
|
|
285
|
-
newState.selection.from
|
|
285
|
+
newState.selection.from,
|
|
286
286
|
);
|
|
287
287
|
|
|
288
288
|
return next;
|
|
@@ -298,7 +298,7 @@ export class SuggestionMenuProseMirrorPlugin<
|
|
|
298
298
|
.setMeta(suggestionMenuPluginKey, {
|
|
299
299
|
triggerCharacter: text,
|
|
300
300
|
})
|
|
301
|
-
.scrollIntoView()
|
|
301
|
+
.scrollIntoView(),
|
|
302
302
|
);
|
|
303
303
|
|
|
304
304
|
return true;
|
|
@@ -329,7 +329,7 @@ export class SuggestionMenuProseMirrorPlugin<
|
|
|
329
329
|
nodeName: "span",
|
|
330
330
|
class: "bn-suggestion-decorator",
|
|
331
331
|
"data-decoration-id": suggestionPluginState.decorationId,
|
|
332
|
-
}
|
|
332
|
+
},
|
|
333
333
|
),
|
|
334
334
|
]);
|
|
335
335
|
}
|
|
@@ -344,7 +344,7 @@ export class SuggestionMenuProseMirrorPlugin<
|
|
|
344
344
|
nodeName: "span",
|
|
345
345
|
class: "bn-suggestion-decorator",
|
|
346
346
|
"data-decoration-id": suggestionPluginState.decorationId,
|
|
347
|
-
}
|
|
347
|
+
},
|
|
348
348
|
),
|
|
349
349
|
]);
|
|
350
350
|
},
|
|
@@ -354,7 +354,7 @@ export class SuggestionMenuProseMirrorPlugin<
|
|
|
354
354
|
|
|
355
355
|
public onUpdate(
|
|
356
356
|
triggerCharacter: string,
|
|
357
|
-
callback: (state: SuggestionMenuState) => void
|
|
357
|
+
callback: (state: SuggestionMenuState) => void,
|
|
358
358
|
) {
|
|
359
359
|
if (!this.triggerCharacters.includes(triggerCharacter)) {
|
|
360
360
|
this.addTriggerCharacter(triggerCharacter);
|
|
@@ -370,7 +370,7 @@ export class SuggestionMenuProseMirrorPlugin<
|
|
|
370
370
|
// TODO: Should this be called automatically when listeners are removed?
|
|
371
371
|
removeTriggerCharacter = (triggerCharacter: string) => {
|
|
372
372
|
this.triggerCharacters = this.triggerCharacters.filter(
|
|
373
|
-
(c) => c !== triggerCharacter
|
|
373
|
+
(c) => c !== triggerCharacter,
|
|
374
374
|
);
|
|
375
375
|
};
|
|
376
376
|
|
|
@@ -386,7 +386,7 @@ export class SuggestionMenuProseMirrorPlugin<
|
|
|
386
386
|
export function createSuggestionMenu<
|
|
387
387
|
BSchema extends BlockSchema,
|
|
388
388
|
I extends InlineContentSchema,
|
|
389
|
-
S extends StyleSchema
|
|
389
|
+
S extends StyleSchema,
|
|
390
390
|
>(editor: BlockNoteEditor<BSchema, I, S>, triggerCharacter: string) {
|
|
391
391
|
editor.suggestionMenus.addTriggerCharacter(triggerCharacter);
|
|
392
392
|
}
|
|
@@ -49,10 +49,10 @@ async function loadEmojiMart() {
|
|
|
49
49
|
export async function getDefaultEmojiPickerItems<
|
|
50
50
|
BSchema extends BlockSchema,
|
|
51
51
|
I extends InlineContentSchema,
|
|
52
|
-
S extends StyleSchema
|
|
52
|
+
S extends StyleSchema,
|
|
53
53
|
>(
|
|
54
54
|
editor: BlockNoteEditor<BSchema, I, S>,
|
|
55
|
-
query: string
|
|
55
|
+
query: string,
|
|
56
56
|
): Promise<DefaultGridSuggestionItem[]> {
|
|
57
57
|
if (!checkDefaultInlineContentTypeInSchema("text", editor)) {
|
|
58
58
|
return [];
|
|
@@ -18,7 +18,7 @@ import { DefaultSuggestionItem } from "./DefaultSuggestionItem.js";
|
|
|
18
18
|
function setSelectionToNextContentEditableBlock<
|
|
19
19
|
BSchema extends BlockSchema,
|
|
20
20
|
I extends InlineContentSchema,
|
|
21
|
-
S extends StyleSchema
|
|
21
|
+
S extends StyleSchema,
|
|
22
22
|
>(editor: BlockNoteEditor<BSchema, I, S>) {
|
|
23
23
|
let block: Block<BSchema, I, S> | undefined =
|
|
24
24
|
editor.getTextCursorPosition().block;
|
|
@@ -44,10 +44,10 @@ function setSelectionToNextContentEditableBlock<
|
|
|
44
44
|
export function insertOrUpdateBlock<
|
|
45
45
|
BSchema extends BlockSchema,
|
|
46
46
|
I extends InlineContentSchema,
|
|
47
|
-
S extends StyleSchema
|
|
47
|
+
S extends StyleSchema,
|
|
48
48
|
>(
|
|
49
49
|
editor: BlockNoteEditor<BSchema, I, S>,
|
|
50
|
-
block: PartialBlock<BSchema, I, S
|
|
50
|
+
block: PartialBlock<BSchema, I, S>,
|
|
51
51
|
): Block<BSchema, I, S> {
|
|
52
52
|
const currentBlock = editor.getTextCursorPosition().block;
|
|
53
53
|
|
|
@@ -83,7 +83,7 @@ export function insertOrUpdateBlock<
|
|
|
83
83
|
export function getDefaultSlashMenuItems<
|
|
84
84
|
BSchema extends BlockSchema,
|
|
85
85
|
I extends InlineContentSchema,
|
|
86
|
-
S extends StyleSchema
|
|
86
|
+
S extends StyleSchema,
|
|
87
87
|
>(editor: BlockNoteEditor<BSchema, I, S>) {
|
|
88
88
|
const items: DefaultSuggestionItem[] = [];
|
|
89
89
|
|
|
@@ -121,7 +121,7 @@ export function getDefaultSlashMenuItems<
|
|
|
121
121
|
badge: formatKeyboardShortcut("Mod-Alt-3"),
|
|
122
122
|
key: "heading_3",
|
|
123
123
|
...editor.dictionary.slash_menu.heading_3,
|
|
124
|
-
}
|
|
124
|
+
},
|
|
125
125
|
);
|
|
126
126
|
}
|
|
127
127
|
|
|
@@ -237,7 +237,7 @@ export function getDefaultSlashMenuItems<
|
|
|
237
237
|
editor.transact((tr) =>
|
|
238
238
|
tr.setMeta(editor.filePanel!.plugin, {
|
|
239
239
|
block: insertedBlock,
|
|
240
|
-
})
|
|
240
|
+
}),
|
|
241
241
|
);
|
|
242
242
|
},
|
|
243
243
|
key: "image",
|
|
@@ -256,7 +256,7 @@ export function getDefaultSlashMenuItems<
|
|
|
256
256
|
editor.transact((tr) =>
|
|
257
257
|
tr.setMeta(editor.filePanel!.plugin, {
|
|
258
258
|
block: insertedBlock,
|
|
259
|
-
})
|
|
259
|
+
}),
|
|
260
260
|
);
|
|
261
261
|
},
|
|
262
262
|
key: "video",
|
|
@@ -275,7 +275,7 @@ export function getDefaultSlashMenuItems<
|
|
|
275
275
|
editor.transact((tr) =>
|
|
276
276
|
tr.setMeta(editor.filePanel!.plugin, {
|
|
277
277
|
block: insertedBlock,
|
|
278
|
-
})
|
|
278
|
+
}),
|
|
279
279
|
);
|
|
280
280
|
},
|
|
281
281
|
key: "audio",
|
|
@@ -294,7 +294,7 @@ export function getDefaultSlashMenuItems<
|
|
|
294
294
|
editor.transact((tr) =>
|
|
295
295
|
tr.setMeta(editor.filePanel!.plugin, {
|
|
296
296
|
block: insertedBlock,
|
|
297
|
-
})
|
|
297
|
+
}),
|
|
298
298
|
);
|
|
299
299
|
},
|
|
300
300
|
key: "file",
|
|
@@ -317,14 +317,14 @@ export function getDefaultSlashMenuItems<
|
|
|
317
317
|
}
|
|
318
318
|
|
|
319
319
|
export function filterSuggestionItems<
|
|
320
|
-
T extends { title: string; aliases?: readonly string[] }
|
|
320
|
+
T extends { title: string; aliases?: readonly string[] },
|
|
321
321
|
>(items: T[], query: string) {
|
|
322
322
|
return items.filter(
|
|
323
323
|
({ title, aliases }) =>
|
|
324
324
|
title.toLowerCase().includes(query.toLowerCase()) ||
|
|
325
325
|
(aliases &&
|
|
326
326
|
aliases.filter((alias) =>
|
|
327
|
-
alias.toLowerCase().includes(query.toLowerCase())
|
|
328
|
-
).length !== 0)
|
|
327
|
+
alias.toLowerCase().includes(query.toLowerCase()),
|
|
328
|
+
).length !== 0),
|
|
329
329
|
);
|
|
330
330
|
}
|
|
@@ -46,7 +46,7 @@ let dragImageElement: HTMLElement | undefined;
|
|
|
46
46
|
// TODO consider switching this to jotai, it is a bit messy and noisy
|
|
47
47
|
export type TableHandlesState<
|
|
48
48
|
I extends InlineContentSchema,
|
|
49
|
-
S extends StyleSchema
|
|
49
|
+
S extends StyleSchema,
|
|
50
50
|
> = {
|
|
51
51
|
show: boolean;
|
|
52
52
|
showAddOrRemoveRowsButton: boolean;
|
|
@@ -146,7 +146,7 @@ function hideElements(selector: string, rootEl: Document | ShadowRoot) {
|
|
|
146
146
|
|
|
147
147
|
export class TableHandlesView<
|
|
148
148
|
I extends InlineContentSchema,
|
|
149
|
-
S extends StyleSchema
|
|
149
|
+
S extends StyleSchema,
|
|
150
150
|
> implements PluginView
|
|
151
151
|
{
|
|
152
152
|
public state?: TableHandlesState<I, S>;
|
|
@@ -169,7 +169,7 @@ export class TableHandlesView<
|
|
|
169
169
|
S
|
|
170
170
|
>,
|
|
171
171
|
private readonly pmView: EditorView,
|
|
172
|
-
emitUpdate: (state: TableHandlesState<I, S>) => void
|
|
172
|
+
emitUpdate: (state: TableHandlesState<I, S>) => void,
|
|
173
173
|
) {
|
|
174
174
|
this.emitUpdate = () => {
|
|
175
175
|
if (!this.state) {
|
|
@@ -185,11 +185,11 @@ export class TableHandlesView<
|
|
|
185
185
|
|
|
186
186
|
pmView.root.addEventListener(
|
|
187
187
|
"dragover",
|
|
188
|
-
this.dragOverHandler as EventListener
|
|
188
|
+
this.dragOverHandler as EventListener,
|
|
189
189
|
);
|
|
190
190
|
pmView.root.addEventListener(
|
|
191
191
|
"drop",
|
|
192
|
-
this.dropHandler as unknown as EventListener
|
|
192
|
+
this.dropHandler as unknown as EventListener,
|
|
193
193
|
);
|
|
194
194
|
}
|
|
195
195
|
|
|
@@ -264,7 +264,7 @@ export class TableHandlesView<
|
|
|
264
264
|
| undefined;
|
|
265
265
|
|
|
266
266
|
const pmNodeInfo = this.editor.transact((tr) =>
|
|
267
|
-
getNodeById(blockEl.id, tr.doc)
|
|
267
|
+
getNodeById(blockEl.id, tr.doc),
|
|
268
268
|
);
|
|
269
269
|
if (!pmNodeInfo) {
|
|
270
270
|
throw new Error(`Block with ID ${blockEl.id} not found`);
|
|
@@ -275,7 +275,7 @@ export class TableHandlesView<
|
|
|
275
275
|
this.editor.pmSchema,
|
|
276
276
|
this.editor.schema.blockSchema,
|
|
277
277
|
this.editor.schema.inlineContentSchema,
|
|
278
|
-
this.editor.schema.styleSchema
|
|
278
|
+
this.editor.schema.styleSchema,
|
|
279
279
|
);
|
|
280
280
|
|
|
281
281
|
if (checkBlockIsDefaultType("table", block, this.editor)) {
|
|
@@ -368,7 +368,7 @@ export class TableHandlesView<
|
|
|
368
368
|
|
|
369
369
|
hideElements(
|
|
370
370
|
".prosemirror-dropcursor-block, .prosemirror-dropcursor-inline",
|
|
371
|
-
this.pmView.root
|
|
371
|
+
this.pmView.root,
|
|
372
372
|
);
|
|
373
373
|
|
|
374
374
|
// The mouse cursor coordinates, bounded to the table's bounding box. The
|
|
@@ -377,11 +377,11 @@ export class TableHandlesView<
|
|
|
377
377
|
const boundedMouseCoords = {
|
|
378
378
|
left: Math.min(
|
|
379
379
|
Math.max(event.clientX, this.state.referencePosTable.left + 1),
|
|
380
|
-
this.state.referencePosTable.right - 1
|
|
380
|
+
this.state.referencePosTable.right - 1,
|
|
381
381
|
),
|
|
382
382
|
top: Math.min(
|
|
383
383
|
Math.max(event.clientY, this.state.referencePosTable.top + 1),
|
|
384
|
-
this.state.referencePosTable.bottom - 1
|
|
384
|
+
this.state.referencePosTable.bottom - 1,
|
|
385
385
|
),
|
|
386
386
|
};
|
|
387
387
|
|
|
@@ -390,7 +390,7 @@ export class TableHandlesView<
|
|
|
390
390
|
const tableCellElements = this.pmView.root
|
|
391
391
|
.elementsFromPoint(boundedMouseCoords.left, boundedMouseCoords.top)
|
|
392
392
|
.filter(
|
|
393
|
-
(element) => element.tagName === "TD" || element.tagName === "TH"
|
|
393
|
+
(element) => element.tagName === "TD" || element.tagName === "TH",
|
|
394
394
|
);
|
|
395
395
|
if (tableCellElements.length === 0) {
|
|
396
396
|
return;
|
|
@@ -461,7 +461,7 @@ export class TableHandlesView<
|
|
|
461
461
|
this.state.colIndex === undefined
|
|
462
462
|
) {
|
|
463
463
|
throw new Error(
|
|
464
|
-
"Attempted to drop table row or column, but no table block was hovered prior."
|
|
464
|
+
"Attempted to drop table row or column, but no table block was hovered prior.",
|
|
465
465
|
);
|
|
466
466
|
}
|
|
467
467
|
|
|
@@ -476,7 +476,7 @@ export class TableHandlesView<
|
|
|
476
476
|
!canRowBeDraggedInto(
|
|
477
477
|
this.state.block,
|
|
478
478
|
draggingState.originalIndex,
|
|
479
|
-
rowIndex
|
|
479
|
+
rowIndex,
|
|
480
480
|
)
|
|
481
481
|
) {
|
|
482
482
|
// If the target row is invalid, don't move the row
|
|
@@ -485,7 +485,7 @@ export class TableHandlesView<
|
|
|
485
485
|
const newTable = moveRow(
|
|
486
486
|
this.state.block,
|
|
487
487
|
draggingState.originalIndex,
|
|
488
|
-
rowIndex
|
|
488
|
+
rowIndex,
|
|
489
489
|
);
|
|
490
490
|
this.editor.updateBlock(this.state.block, {
|
|
491
491
|
type: "table",
|
|
@@ -499,7 +499,7 @@ export class TableHandlesView<
|
|
|
499
499
|
!canColumnBeDraggedInto(
|
|
500
500
|
this.state.block,
|
|
501
501
|
draggingState.originalIndex,
|
|
502
|
-
colIndex
|
|
502
|
+
colIndex,
|
|
503
503
|
)
|
|
504
504
|
) {
|
|
505
505
|
// If the target column is invalid, don't move the column
|
|
@@ -508,7 +508,7 @@ export class TableHandlesView<
|
|
|
508
508
|
const newTable = moveColumn(
|
|
509
509
|
this.state.block,
|
|
510
510
|
draggingState.originalIndex,
|
|
511
|
-
colIndex
|
|
511
|
+
colIndex,
|
|
512
512
|
);
|
|
513
513
|
const [columnWidth] = columnWidths.splice(draggingState.originalIndex, 1);
|
|
514
514
|
columnWidths.splice(colIndex, 0, columnWidth);
|
|
@@ -538,6 +538,7 @@ export class TableHandlesView<
|
|
|
538
538
|
this.state.block = this.editor.getBlock(this.state.block.id)!;
|
|
539
539
|
if (
|
|
540
540
|
!this.state.block ||
|
|
541
|
+
this.state.block.type !== "table" ||
|
|
541
542
|
// when collaborating, the table element might be replaced and out of date
|
|
542
543
|
// because yjs replaces the element when for example you change the color via the side menu
|
|
543
544
|
!this.tableElement?.isConnected
|
|
@@ -551,7 +552,7 @@ export class TableHandlesView<
|
|
|
551
552
|
}
|
|
552
553
|
|
|
553
554
|
const { height: rowCount, width: colCount } = getDimensionsOfTable(
|
|
554
|
-
this.state.block
|
|
555
|
+
this.state.block,
|
|
555
556
|
);
|
|
556
557
|
|
|
557
558
|
if (
|
|
@@ -574,7 +575,7 @@ export class TableHandlesView<
|
|
|
574
575
|
|
|
575
576
|
if (!tableBody) {
|
|
576
577
|
throw new Error(
|
|
577
|
-
"Table block does not contain a 'tbody' HTML element. This should never happen."
|
|
578
|
+
"Table block does not contain a 'tbody' HTML element. This should never happen.",
|
|
578
579
|
);
|
|
579
580
|
}
|
|
580
581
|
|
|
@@ -602,11 +603,11 @@ export class TableHandlesView<
|
|
|
602
603
|
this.pmView.dom.removeEventListener("mousedown", this.viewMousedownHandler);
|
|
603
604
|
this.pmView.root.removeEventListener(
|
|
604
605
|
"dragover",
|
|
605
|
-
this.dragOverHandler as EventListener
|
|
606
|
+
this.dragOverHandler as EventListener,
|
|
606
607
|
);
|
|
607
608
|
this.pmView.root.removeEventListener(
|
|
608
609
|
"drop",
|
|
609
|
-
this.dropHandler as unknown as EventListener
|
|
610
|
+
this.dropHandler as unknown as EventListener,
|
|
610
611
|
);
|
|
611
612
|
}
|
|
612
613
|
}
|
|
@@ -615,7 +616,7 @@ export const tableHandlesPluginKey = new PluginKey("TableHandlesPlugin");
|
|
|
615
616
|
|
|
616
617
|
export class TableHandlesProsemirrorPlugin<
|
|
617
618
|
I extends InlineContentSchema,
|
|
618
|
-
S extends StyleSchema
|
|
619
|
+
S extends StyleSchema,
|
|
619
620
|
> extends EventEmitter<any> {
|
|
620
621
|
private view: TableHandlesView<I, S> | undefined;
|
|
621
622
|
public readonly plugin: Plugin;
|
|
@@ -625,7 +626,7 @@ export class TableHandlesProsemirrorPlugin<
|
|
|
625
626
|
BlockSchemaWithBlock<"table", DefaultBlockSchema["table"]>,
|
|
626
627
|
I,
|
|
627
628
|
S
|
|
628
|
-
|
|
629
|
+
>,
|
|
629
630
|
) {
|
|
630
631
|
super();
|
|
631
632
|
this.plugin = new Plugin({
|
|
@@ -684,18 +685,18 @@ export class TableHandlesProsemirrorPlugin<
|
|
|
684
685
|
if (this.view.state.draggingState.draggedCellOrientation === "row") {
|
|
685
686
|
const cellsInRow = getCellsAtRowHandle(
|
|
686
687
|
this.view.state.block,
|
|
687
|
-
newIndex
|
|
688
|
+
newIndex,
|
|
688
689
|
);
|
|
689
690
|
|
|
690
691
|
cellsInRow.forEach(({ row, col }) => {
|
|
691
692
|
// Gets each row in the table.
|
|
692
693
|
const rowResolvedPos = state.doc.resolve(
|
|
693
|
-
tableResolvedPos.posAtIndex(row) + 1
|
|
694
|
+
tableResolvedPos.posAtIndex(row) + 1,
|
|
694
695
|
);
|
|
695
696
|
|
|
696
697
|
// Gets the cell within the row.
|
|
697
698
|
const cellResolvedPos = state.doc.resolve(
|
|
698
|
-
rowResolvedPos.posAtIndex(col) + 1
|
|
699
|
+
rowResolvedPos.posAtIndex(col) + 1,
|
|
699
700
|
);
|
|
700
701
|
const cellNode = cellResolvedPos.node();
|
|
701
702
|
// Creates a decoration at the start or end of each cell,
|
|
@@ -724,24 +725,24 @@ export class TableHandlesProsemirrorPlugin<
|
|
|
724
725
|
widget.style.height = "4px";
|
|
725
726
|
|
|
726
727
|
return widget;
|
|
727
|
-
})
|
|
728
|
+
}),
|
|
728
729
|
);
|
|
729
730
|
});
|
|
730
731
|
} else {
|
|
731
732
|
const cellsInColumn = getCellsAtColumnHandle(
|
|
732
733
|
this.view.state.block,
|
|
733
|
-
newIndex
|
|
734
|
+
newIndex,
|
|
734
735
|
);
|
|
735
736
|
|
|
736
737
|
cellsInColumn.forEach(({ row, col }) => {
|
|
737
738
|
// Gets each row in the table.
|
|
738
739
|
const rowResolvedPos = state.doc.resolve(
|
|
739
|
-
tableResolvedPos.posAtIndex(row) + 1
|
|
740
|
+
tableResolvedPos.posAtIndex(row) + 1,
|
|
740
741
|
);
|
|
741
742
|
|
|
742
743
|
// Gets the cell within the row.
|
|
743
744
|
const cellResolvedPos = state.doc.resolve(
|
|
744
|
-
rowResolvedPos.posAtIndex(col) + 1
|
|
745
|
+
rowResolvedPos.posAtIndex(col) + 1,
|
|
745
746
|
);
|
|
746
747
|
const cellNode = cellResolvedPos.node();
|
|
747
748
|
|
|
@@ -772,7 +773,7 @@ export class TableHandlesProsemirrorPlugin<
|
|
|
772
773
|
widget.style.width = "4px";
|
|
773
774
|
|
|
774
775
|
return widget;
|
|
775
|
-
})
|
|
776
|
+
}),
|
|
776
777
|
);
|
|
777
778
|
});
|
|
778
779
|
}
|
|
@@ -800,7 +801,7 @@ export class TableHandlesProsemirrorPlugin<
|
|
|
800
801
|
this.view!.state.colIndex === undefined
|
|
801
802
|
) {
|
|
802
803
|
throw new Error(
|
|
803
|
-
"Attempted to drag table column, but no table block was hovered prior."
|
|
804
|
+
"Attempted to drag table column, but no table block was hovered prior.",
|
|
804
805
|
);
|
|
805
806
|
}
|
|
806
807
|
|
|
@@ -818,7 +819,7 @@ export class TableHandlesProsemirrorPlugin<
|
|
|
818
819
|
originalIndex: this.view!.state!.colIndex,
|
|
819
820
|
newIndex: this.view!.state!.colIndex,
|
|
820
821
|
tablePos: this.view!.tablePos,
|
|
821
|
-
})
|
|
822
|
+
}),
|
|
822
823
|
);
|
|
823
824
|
|
|
824
825
|
if (!this.editor.prosemirrorView) {
|
|
@@ -843,7 +844,7 @@ export class TableHandlesProsemirrorPlugin<
|
|
|
843
844
|
this.view!.state.rowIndex === undefined
|
|
844
845
|
) {
|
|
845
846
|
throw new Error(
|
|
846
|
-
"Attempted to drag table row, but no table block was hovered prior."
|
|
847
|
+
"Attempted to drag table row, but no table block was hovered prior.",
|
|
847
848
|
);
|
|
848
849
|
}
|
|
849
850
|
|
|
@@ -861,7 +862,7 @@ export class TableHandlesProsemirrorPlugin<
|
|
|
861
862
|
originalIndex: this.view!.state!.rowIndex,
|
|
862
863
|
newIndex: this.view!.state!.rowIndex,
|
|
863
864
|
tablePos: this.view!.tablePos,
|
|
864
|
-
})
|
|
865
|
+
}),
|
|
865
866
|
);
|
|
866
867
|
|
|
867
868
|
if (!this.editor.prosemirrorView) {
|
|
@@ -880,7 +881,7 @@ export class TableHandlesProsemirrorPlugin<
|
|
|
880
881
|
dragEnd = () => {
|
|
881
882
|
if (this.view!.state === undefined) {
|
|
882
883
|
throw new Error(
|
|
883
|
-
"Attempted to drag table row, but no table block was hovered prior."
|
|
884
|
+
"Attempted to drag table row, but no table block was hovered prior.",
|
|
884
885
|
);
|
|
885
886
|
}
|
|
886
887
|
|
|
@@ -914,7 +915,7 @@ export class TableHandlesProsemirrorPlugin<
|
|
|
914
915
|
|
|
915
916
|
getCellsAtRowHandle = (
|
|
916
917
|
block: BlockFromConfigNoChildren<DefaultBlockSchema["table"], any, any>,
|
|
917
|
-
relativeRowIndex: RelativeCellIndices["row"]
|
|
918
|
+
relativeRowIndex: RelativeCellIndices["row"],
|
|
918
919
|
) => {
|
|
919
920
|
return getCellsAtRowHandle(block, relativeRowIndex);
|
|
920
921
|
};
|
|
@@ -924,7 +925,7 @@ export class TableHandlesProsemirrorPlugin<
|
|
|
924
925
|
*/
|
|
925
926
|
getCellsAtColumnHandle = (
|
|
926
927
|
block: BlockFromConfigNoChildren<DefaultBlockSchema["table"], any, any>,
|
|
927
|
-
relativeColumnIndex: RelativeCellIndices["col"]
|
|
928
|
+
relativeColumnIndex: RelativeCellIndices["col"],
|
|
928
929
|
) => {
|
|
929
930
|
return getCellsAtColumnHandle(block, relativeColumnIndex);
|
|
930
931
|
};
|
|
@@ -936,7 +937,7 @@ export class TableHandlesProsemirrorPlugin<
|
|
|
936
937
|
private setCellSelection = (
|
|
937
938
|
state: EditorState,
|
|
938
939
|
relativeStartCell: RelativeCellIndices,
|
|
939
|
-
relativeEndCell: RelativeCellIndices = relativeStartCell
|
|
940
|
+
relativeEndCell: RelativeCellIndices = relativeStartCell,
|
|
940
941
|
) => {
|
|
941
942
|
const view = this.view;
|
|
942
943
|
|
|
@@ -946,18 +947,18 @@ export class TableHandlesProsemirrorPlugin<
|
|
|
946
947
|
|
|
947
948
|
const tableResolvedPos = state.doc.resolve(view.tablePos! + 1);
|
|
948
949
|
const startRowResolvedPos = state.doc.resolve(
|
|
949
|
-
tableResolvedPos.posAtIndex(relativeStartCell.row) + 1
|
|
950
|
+
tableResolvedPos.posAtIndex(relativeStartCell.row) + 1,
|
|
950
951
|
);
|
|
951
952
|
const startCellResolvedPos = state.doc.resolve(
|
|
952
953
|
// No need for +1, since CellSelection expects the position before the cell
|
|
953
|
-
startRowResolvedPos.posAtIndex(relativeStartCell.col)
|
|
954
|
+
startRowResolvedPos.posAtIndex(relativeStartCell.col),
|
|
954
955
|
);
|
|
955
956
|
const endRowResolvedPos = state.doc.resolve(
|
|
956
|
-
tableResolvedPos.posAtIndex(relativeEndCell.row) + 1
|
|
957
|
+
tableResolvedPos.posAtIndex(relativeEndCell.row) + 1,
|
|
957
958
|
);
|
|
958
959
|
const endCellResolvedPos = state.doc.resolve(
|
|
959
960
|
// No need for +1, since CellSelection expects the position before the cell
|
|
960
|
-
endRowResolvedPos.posAtIndex(relativeEndCell.col)
|
|
961
|
+
endRowResolvedPos.posAtIndex(relativeEndCell.col),
|
|
961
962
|
);
|
|
962
963
|
|
|
963
964
|
// Begin a new transaction to set the selection
|
|
@@ -965,7 +966,7 @@ export class TableHandlesProsemirrorPlugin<
|
|
|
965
966
|
|
|
966
967
|
// Set the selection to the given cell or a range of cells
|
|
967
968
|
tr.setSelection(
|
|
968
|
-
new CellSelection(startCellResolvedPos, endCellResolvedPos)
|
|
969
|
+
new CellSelection(startCellResolvedPos, endCellResolvedPos),
|
|
969
970
|
);
|
|
970
971
|
|
|
971
972
|
// Quickly apply the transaction to get the new state to update the selection before splitting the cell
|
|
@@ -979,14 +980,14 @@ export class TableHandlesProsemirrorPlugin<
|
|
|
979
980
|
index: RelativeCellIndices["row"] | RelativeCellIndices["col"],
|
|
980
981
|
direction:
|
|
981
982
|
| { orientation: "row"; side: "above" | "below" }
|
|
982
|
-
| { orientation: "column"; side: "left" | "right" }
|
|
983
|
+
| { orientation: "column"; side: "left" | "right" },
|
|
983
984
|
) => {
|
|
984
985
|
this.editor.exec((beforeState, dispatch) => {
|
|
985
986
|
const state = this.setCellSelection(
|
|
986
987
|
beforeState,
|
|
987
988
|
direction.orientation === "row"
|
|
988
989
|
? { row: index, col: 0 }
|
|
989
|
-
: { row: 0, col: index }
|
|
990
|
+
: { row: 0, col: index },
|
|
990
991
|
);
|
|
991
992
|
|
|
992
993
|
if (direction.orientation === "row") {
|
|
@@ -1010,7 +1011,7 @@ export class TableHandlesProsemirrorPlugin<
|
|
|
1010
1011
|
*/
|
|
1011
1012
|
removeRowOrColumn = (
|
|
1012
1013
|
index: RelativeCellIndices["row"] | RelativeCellIndices["col"],
|
|
1013
|
-
direction: "row" | "column"
|
|
1014
|
+
direction: "row" | "column",
|
|
1014
1015
|
) => {
|
|
1015
1016
|
if (direction === "row") {
|
|
1016
1017
|
return this.editor.exec((beforeState, dispatch) => {
|
|
@@ -1043,7 +1044,7 @@ export class TableHandlesProsemirrorPlugin<
|
|
|
1043
1044
|
? this.setCellSelection(
|
|
1044
1045
|
beforeState,
|
|
1045
1046
|
cellsToMerge.relativeStartCell,
|
|
1046
|
-
cellsToMerge.relativeEndCell
|
|
1047
|
+
cellsToMerge.relativeEndCell,
|
|
1047
1048
|
)
|
|
1048
1049
|
: beforeState;
|
|
1049
1050
|
|
|
@@ -1099,10 +1100,10 @@ export class TableHandlesProsemirrorPlugin<
|
|
|
1099
1100
|
// Assumes we are within a tableParagraph
|
|
1100
1101
|
// And find the from and to cells by resolving the positions
|
|
1101
1102
|
$fromCell = tr.doc.resolve(
|
|
1102
|
-
selection.$from.pos - selection.$from.parentOffset - 1
|
|
1103
|
+
selection.$from.pos - selection.$from.parentOffset - 1,
|
|
1103
1104
|
);
|
|
1104
1105
|
$toCell = tr.doc.resolve(
|
|
1105
|
-
selection.$to.pos - selection.$to.parentOffset - 1
|
|
1106
|
+
selection.$to.pos - selection.$to.parentOffset - 1,
|
|
1106
1107
|
);
|
|
1107
1108
|
|
|
1108
1109
|
// Opt-out when the selection is not pointing into cells
|
|
@@ -1113,7 +1114,7 @@ export class TableHandlesProsemirrorPlugin<
|
|
|
1113
1114
|
|
|
1114
1115
|
// Find the row and table that the from and to cells are in
|
|
1115
1116
|
const $fromRow = tr.doc.resolve(
|
|
1116
|
-
$fromCell.pos - $fromCell.parentOffset - 1
|
|
1117
|
+
$fromCell.pos - $fromCell.parentOffset - 1,
|
|
1117
1118
|
);
|
|
1118
1119
|
const $toRow = tr.doc.resolve($toCell.pos - $toCell.parentOffset - 1);
|
|
1119
1120
|
|
|
@@ -1155,7 +1156,7 @@ export class TableHandlesProsemirrorPlugin<
|
|
|
1155
1156
|
getMergeDirection = (
|
|
1156
1157
|
block:
|
|
1157
1158
|
| BlockFromConfigNoChildren<DefaultBlockSchema["table"], any, any>
|
|
1158
|
-
| undefined
|
|
1159
|
+
| undefined,
|
|
1159
1160
|
) => {
|
|
1160
1161
|
return this.editor.transact((tr) => {
|
|
1161
1162
|
const isSelectingTableCells = isTableCellSelection(tr.selection)
|
|
@@ -1187,7 +1188,7 @@ export class TableHandlesProsemirrorPlugin<
|
|
|
1187
1188
|
|
|
1188
1189
|
cropEmptyRowsOrColumns = (
|
|
1189
1190
|
block: BlockFromConfigNoChildren<DefaultBlockSchema["table"], any, any>,
|
|
1190
|
-
removeEmpty: "columns" | "rows"
|
|
1191
|
+
removeEmpty: "columns" | "rows",
|
|
1191
1192
|
) => {
|
|
1192
1193
|
return cropEmptyRowsOrColumns(block, removeEmpty);
|
|
1193
1194
|
};
|
|
@@ -1195,7 +1196,7 @@ export class TableHandlesProsemirrorPlugin<
|
|
|
1195
1196
|
addRowsOrColumns = (
|
|
1196
1197
|
block: BlockFromConfigNoChildren<DefaultBlockSchema["table"], any, any>,
|
|
1197
1198
|
addType: "columns" | "rows",
|
|
1198
|
-
numToAdd: number
|
|
1199
|
+
numToAdd: number,
|
|
1199
1200
|
) => {
|
|
1200
1201
|
return addRowsOrColumns(block, addType, numToAdd);
|
|
1201
1202
|
};
|