mirror of
https://github.com/outline/outline.git
synced 2026-11-22 22:02:35 +03:00
handle multiple creation error
This commit is contained in:
1 parent
e1a12fd78b
commit
00ef7c46f6
5 files changed
+11
-5
No files matched your search
@@ -61,6 +61,7 @@ export const PasteMenu = observer(({ pastedText, embeds, ...props }: Props) => {
|
||||
name: "mention",
|
||||
title: t("Mention"),
|
||||
attrs: { type: mentionType },
|
||||
appendSpace: true,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ import filterExcessSeparators from "@shared/editor/lib/filterExcessSeparators";
|
||||
import { findParentNode } from "@shared/editor/queries/findParentNode";
|
||||
import { MenuItem } from "@shared/editor/types";
|
||||
import { depths, s } from "@shared/styles";
|
||||
import { MentionType } from "@shared/types";
|
||||
import { getEventFiles } from "@shared/utils/files";
|
||||
import { AttachmentValidation } from "@shared/validations";
|
||||
import Header from "~/components/ContextMenu/Header";
|
||||
@@ -64,7 +65,7 @@ export type Props<T extends MenuItem = MenuItem> = {
|
||||
onFileUploadStop?: () => void;
|
||||
/** Callback when the menu is closed */
|
||||
onClose: (insertNewLine?: boolean) => void;
|
||||
/** Optional callback when a suggestion is selected */
|
||||
/** Optional callback when a suggestion is selected/ */
|
||||
onSelect?: (item: MenuItem) => void;
|
||||
embeds?: EmbedDescriptor[];
|
||||
renderMenuItem: (
|
||||
@@ -233,7 +234,11 @@ function SuggestionsMenu<T extends MenuItem>(props: Props<T>) {
|
||||
const attrs =
|
||||
typeof item.attrs === "function" ? item.attrs(view.state) : item.attrs;
|
||||
|
||||
if (item.name === "noop") {
|
||||
const skipMention =
|
||||
attrs?.type === MentionType.Issue ||
|
||||
attrs?.type === MentionType.PullRequest; // Mention node creation will be handled by PasteHandler.
|
||||
|
||||
if (item.name === "noop" || (item.name === "mention" && skipMention)) {
|
||||
// Do nothing
|
||||
} else if (command) {
|
||||
command(attrs);
|
||||
|
||||
@@ -479,6 +479,8 @@ export default class PasteHandler extends Extension {
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
keys() {
|
||||
|
||||
@@ -60,7 +60,7 @@ class Integration<T = unknown> extends Model {
|
||||
const type = pathParts[3];
|
||||
return type === "pull"
|
||||
? MentionType.PullRequest
|
||||
: type === "issue"
|
||||
: type === "issues"
|
||||
? MentionType.Issue
|
||||
: undefined;
|
||||
}
|
||||
|
||||
@@ -207,8 +207,6 @@ export default class Mention extends Node {
|
||||
commands({ type }: { type: NodeType; schema: Schema }) {
|
||||
return (attrs: Record<string, Primitive>): Command =>
|
||||
(state, dispatch) => {
|
||||
console.log("running mention command", attrs);
|
||||
|
||||
const { selection } = state;
|
||||
const position =
|
||||
selection instanceof TextSelection
|
||||
|
||||
Reference in new issue
Block a user