forked from github/plane
fixed comment editor behavior on Shift-Enter
This commit is contained in:
parent
2ff953896d
commit
d8cd0b0f97
@ -1,9 +0,0 @@
|
|||||||
import ListItem from '@tiptap/extension-list-item'
|
|
||||||
|
|
||||||
export const CustomListItem = ListItem.extend({
|
|
||||||
addKeyboardShortcuts() {
|
|
||||||
return {
|
|
||||||
'Shift-Enter': () => this.editor.chain().focus().splitListItem('listItem').run(),
|
|
||||||
}
|
|
||||||
},
|
|
||||||
})
|
|
@ -1,16 +1,25 @@
|
|||||||
import { Extension } from '@tiptap/core';
|
import { Extension } from "@tiptap/core";
|
||||||
|
|
||||||
export const EnterKeyExtension = (onEnterKeyPress?: () => void) => Extension.create({
|
export const EnterKeyExtension = (onEnterKeyPress?: () => void) =>
|
||||||
name: 'enterKey',
|
Extension.create({
|
||||||
|
name: "enterKey",
|
||||||
|
|
||||||
addKeyboardShortcuts() {
|
addKeyboardShortcuts() {
|
||||||
return {
|
return {
|
||||||
'Enter': () => {
|
Enter: () => {
|
||||||
if (onEnterKeyPress) {
|
if (onEnterKeyPress) {
|
||||||
onEnterKeyPress();
|
onEnterKeyPress();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
}
|
"Shift-Enter": ({ editor }) =>
|
||||||
},
|
editor.commands.first(({ commands }) => [
|
||||||
});
|
() => commands.newlineInCode(),
|
||||||
|
() => commands.splitListItem("listItem"),
|
||||||
|
() => commands.createParagraphNear(),
|
||||||
|
() => commands.liftEmptyBlock(),
|
||||||
|
() => commands.splitBlock(),
|
||||||
|
]),
|
||||||
|
};
|
||||||
|
},
|
||||||
|
});
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
import { CustomListItem } from "./custom-list-extension";
|
|
||||||
import { EnterKeyExtension } from "./enter-key-extension";
|
import { EnterKeyExtension } from "./enter-key-extension";
|
||||||
|
|
||||||
export const LiteTextEditorExtensions = (onEnterKeyPress?: () => void) => [
|
export const LiteTextEditorExtensions = (onEnterKeyPress?: () => void) => [
|
||||||
CustomListItem,
|
|
||||||
EnterKeyExtension(onEnterKeyPress),
|
EnterKeyExtension(onEnterKeyPress),
|
||||||
];
|
];
|
||||||
|
Loading…
Reference in New Issue
Block a user