chore: Editor refactor (#3286)
* cleanup * add context * EventEmitter allows removal of toolbar props from extensions * Move to 'packages' of extensions Remove EmojiTrigger extension * types * iteration * fix render flashing * fix: Missing nodes in collection descriptions
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import { Node } from "prosemirror-model";
|
||||
import { EditorView } from "prosemirror-view";
|
||||
import { ToastType } from "../types";
|
||||
|
||||
function findPlaceholderLink(doc: Node, href: string) {
|
||||
let result: { pos: number; node: Node } | undefined;
|
||||
@@ -38,7 +37,7 @@ const createAndInsertLink = async function (
|
||||
options: {
|
||||
dictionary: any;
|
||||
onCreateLink: (title: string) => Promise<string>;
|
||||
onShowToast: (message: string, code: string) => void;
|
||||
onShowToast: (message: string) => void;
|
||||
}
|
||||
) {
|
||||
const { dispatch, state } = view;
|
||||
@@ -79,10 +78,7 @@ const createAndInsertLink = async function (
|
||||
)
|
||||
);
|
||||
|
||||
// let the user know
|
||||
if (onShowToast) {
|
||||
onShowToast(options.dictionary.createLinkError, ToastType.Error);
|
||||
}
|
||||
onShowToast(options.dictionary.createLinkError);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ import uploadPlaceholderPlugin, {
|
||||
findPlaceholder,
|
||||
} from "../lib/uploadPlaceholder";
|
||||
import findAttachmentById from "../queries/findAttachmentById";
|
||||
import { ToastType } from "../types";
|
||||
|
||||
export type Options = {
|
||||
dictionary: any;
|
||||
@@ -17,7 +16,7 @@ export type Options = {
|
||||
uploadFile?: (file: File) => Promise<string>;
|
||||
onFileUploadStart?: () => void;
|
||||
onFileUploadStop?: () => void;
|
||||
onShowToast: (message: string, code: string) => void;
|
||||
onShowToast: (message: string) => void;
|
||||
};
|
||||
|
||||
const insertFiles = function (
|
||||
@@ -187,10 +186,7 @@ const insertFiles = function (
|
||||
view.dispatch(view.state.tr.deleteRange(from, to || from));
|
||||
}
|
||||
|
||||
onShowToast(
|
||||
error.message || dictionary.fileUploadError,
|
||||
ToastType.Error
|
||||
);
|
||||
onShowToast(error.message || dictionary.fileUploadError);
|
||||
})
|
||||
.finally(() => {
|
||||
complete++;
|
||||
|
||||
Reference in New Issue
Block a user