Move toasts to sonner (#6053)
This commit is contained in:
@@ -56,6 +56,7 @@ import visualbasic from "refractor/lang/visual-basic";
|
||||
import yaml from "refractor/lang/yaml";
|
||||
import zig from "refractor/lang/zig";
|
||||
|
||||
import { toast } from "sonner";
|
||||
import { Primitive } from "utility-types";
|
||||
import { Dictionary } from "~/hooks/useDictionary";
|
||||
import { UserPreferences } from "../../types";
|
||||
@@ -130,7 +131,6 @@ export default class CodeFence extends Node {
|
||||
constructor(options: {
|
||||
dictionary: Dictionary;
|
||||
userPreferences?: UserPreferences | null;
|
||||
onShowToast: (message: string) => void;
|
||||
}) {
|
||||
super(options);
|
||||
}
|
||||
@@ -197,7 +197,7 @@ export default class CodeFence extends Node {
|
||||
}
|
||||
|
||||
copy(codeBlock.node.textContent);
|
||||
this.options.onShowToast(this.options.dictionary.codeCopied);
|
||||
toast.message(this.options.dictionary.codeCopied);
|
||||
return true;
|
||||
},
|
||||
};
|
||||
|
||||
@@ -8,6 +8,7 @@ import {
|
||||
} from "prosemirror-model";
|
||||
import { Command, Plugin, Selection } from "prosemirror-state";
|
||||
import { Decoration, DecorationSet } from "prosemirror-view";
|
||||
import { toast } from "sonner";
|
||||
import { Primitive } from "utility-types";
|
||||
import Storage from "../../utils/Storage";
|
||||
import backspaceToParagraph from "../commands/backspaceToParagraph";
|
||||
@@ -188,7 +189,7 @@ export default class Heading extends Node {
|
||||
.replace("/edit", "");
|
||||
copy(normalizedUrl + hash);
|
||||
|
||||
this.options.onShowToast(this.options.dictionary.linkCopied);
|
||||
toast.message(this.options.dictionary.linkCopied);
|
||||
};
|
||||
|
||||
keys({ type, schema }: { type: NodeType; schema: Schema }) {
|
||||
|
||||
@@ -125,7 +125,7 @@ export default class SimpleImage extends Node {
|
||||
}
|
||||
const { view } = this.editor;
|
||||
const { node } = state.selection;
|
||||
const { uploadFile, onFileUploadStart, onFileUploadStop, onShowToast } =
|
||||
const { uploadFile, onFileUploadStart, onFileUploadStop } =
|
||||
this.editor.props;
|
||||
|
||||
if (!uploadFile) {
|
||||
@@ -146,7 +146,6 @@ export default class SimpleImage extends Node {
|
||||
uploadFile,
|
||||
onFileUploadStart,
|
||||
onFileUploadStop,
|
||||
onShowToast,
|
||||
dictionary: this.options.dictionary,
|
||||
replaceExisting: true,
|
||||
attrs: {
|
||||
|
||||
Reference in New Issue
Block a user