[feat]: Tiptap table integration (#2008)
* added basic table support * fixed table position at bottom * fixed image node deletion logic's regression issue * added compatible styles * enabled slash commands * disabled slash command and bubble menu's node selector for table cells * added dropcursor support to type below the table/image * blocked image uploads for handledrop and paste actions
This commit is contained in:
parent
320608ea73
commit
38b7f4382f
15 changed files with 306 additions and 8 deletions
|
|
@ -16,6 +16,7 @@ const TrackImageDeletionPlugin = () =>
|
|||
oldState.doc.descendants((oldNode, oldPos) => {
|
||||
if (oldNode.type.name !== 'image') return;
|
||||
|
||||
if (oldPos < 0 || oldPos > newState.doc.content.size) return;
|
||||
if (!newState.doc.resolve(oldPos).parent) return;
|
||||
const newNode = newState.doc.nodeAt(oldPos);
|
||||
|
||||
|
|
@ -28,7 +29,6 @@ const TrackImageDeletionPlugin = () =>
|
|||
nodeExists = true;
|
||||
}
|
||||
});
|
||||
|
||||
if (!nodeExists) {
|
||||
removedImages.push(oldNode as ProseMirrorNode);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,8 +60,6 @@ function findPlaceholder(state: EditorState, id: {}) {
|
|||
export async function startImageUpload(file: File, view: EditorView, pos: number, workspaceSlug: string, setIsSubmitting?: (isSubmitting: "submitting" | "submitted" | "saved") => void) {
|
||||
if (!file.type.includes("image/")) {
|
||||
return;
|
||||
} else if (file.size / 1024 / 1024 > 20) {
|
||||
return;
|
||||
}
|
||||
|
||||
const id = {};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue