mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-02-24 04:00:59 +01:00
editor: fix type errors
This commit is contained in:
@@ -1,3 +1,33 @@
|
||||
diff --git a/node_modules/@tiptap/core/dist/index.cjs b/node_modules/@tiptap/core/dist/index.cjs
|
||||
index d61da68..31ceb87 100644
|
||||
--- a/node_modules/@tiptap/core/dist/index.cjs
|
||||
+++ b/node_modules/@tiptap/core/dist/index.cjs
|
||||
@@ -1880,8 +1880,23 @@ const lift = (typeOrName, attributes = {}) => ({ state, dispatch }) => {
|
||||
return commands$1.lift(state, dispatch);
|
||||
};
|
||||
|
||||
-const liftEmptyBlock = () => ({ state, dispatch }) => {
|
||||
- return commands$1.liftEmptyBlock(state, dispatch);
|
||||
+const liftEmptyBlock = () => ({ state, dispatch, editor }) => {
|
||||
+ return commands$1.liftEmptyBlock$1(state, (tr) => {
|
||||
+ if (!dispatch) return true;
|
||||
+
|
||||
+ const { selection, storedMarks } = state;
|
||||
+ const marks = storedMarks || (selection.$to.parentOffset && selection.$from.marks());
|
||||
+
|
||||
+ if (!marks) return dispatch(tr);
|
||||
+
|
||||
+ const { splittableMarks } = editor.extensionManager;
|
||||
+ const filteredMarks = marks.filter((mark) =>
|
||||
+ splittableMarks.includes(mark.type.name)
|
||||
+ );
|
||||
+ tr.ensureMarks(filteredMarks)
|
||||
+
|
||||
+ return dispatch(tr);
|
||||
+ });
|
||||
};
|
||||
|
||||
const liftListItem = typeOrName => ({ state, dispatch }) => {
|
||||
diff --git a/node_modules/@tiptap/core/dist/index.js b/node_modules/@tiptap/core/dist/index.js
|
||||
index 38c9884..4a9e10c 100644
|
||||
--- a/node_modules/@tiptap/core/dist/index.js
|
||||
|
||||
@@ -97,12 +97,21 @@ export function ImageComponent(
|
||||
if (!inView) return;
|
||||
if (src || !hash || bloburl) return;
|
||||
(async function () {
|
||||
const data = await editor.storage
|
||||
.getAttachmentData?.(node.attrs)
|
||||
.catch(() => null);
|
||||
if (typeof data !== "string" || !data) return; // TODO: show error
|
||||
const { hash, filename, mime, size } = node.attrs;
|
||||
if (!!hash && !!filename && !!mime && !!size) {
|
||||
const data = await editor.storage
|
||||
.getAttachmentData?.({
|
||||
type: "image",
|
||||
hash,
|
||||
filename,
|
||||
mime,
|
||||
size
|
||||
})
|
||||
.catch(() => null);
|
||||
if (typeof data !== "string" || !data) return; // TODO: show error
|
||||
|
||||
setBloburl(toBlobURL(data, "image", node.attrs.mime, hash));
|
||||
setBloburl(toBlobURL(data, "image", node.attrs.mime, hash));
|
||||
}
|
||||
})();
|
||||
}, [inView]);
|
||||
|
||||
|
||||
@@ -101,7 +101,9 @@ interface TiptapStorage {
|
||||
createInternalLink?: (
|
||||
attributes?: LinkAttributes
|
||||
) => Promise<LinkAttributes | undefined>;
|
||||
getAttachmentData: (attachment: Attachment) => Promise<string | undefined>;
|
||||
getAttachmentData:
|
||||
| ((attachment: Attachment) => Promise<string | undefined>)
|
||||
| undefined;
|
||||
}
|
||||
|
||||
declare module "@tiptap/core" {
|
||||
|
||||
Reference in New Issue
Block a user