Skip to content

Commit

Permalink
vue 3
Browse files Browse the repository at this point in the history
  • Loading branch information
braddialpad committed Dec 11, 2024
1 parent 02b77b5 commit 3a48c70
Showing 1 changed file with 29 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -359,31 +359,6 @@ export default {
// These are the default extensions needed just for plain text.
const extensions = [Document, Paragraph, Text, History, HardBreak];

const self = this;
const ShiftEnter = Extension.create({
addKeyboardShortcuts () {
return {
'Shift-Enter': ({ editor }) => {
editor.commands.first(({ commands }) => [
() => commands.newlineInCode(),
() => commands.splitListItem('listItem'),
() => commands.createParagraphNear(),
() => commands.liftEmptyBlock(),
() => commands.splitBlock(),
]);
},
Enter: () => {
if (self.allowLineBreaks) {
return false;
}
self.$emit('enter');
return true;
},
};
},
});
extensions.push(ShiftEnter);

if (this.link) {
extensions.push(TipTapLink.extend({ inclusive: false }).configure({
HTMLAttributes: {
Expand Down Expand Up @@ -467,6 +442,35 @@ export default {
extensions.push(...this.additionalExtensions);
}

const self = this;
const ShiftEnter = Extension.create({
addKeyboardShortcuts () {
return {
'Shift-Enter': ({ editor }) => {
if (self.allowLineBreaks) {
return false;
}
editor.commands.first(({ commands }) => [
() => commands.newlineInCode(),
() => commands.splitListItem('listItem'),
() => commands.createParagraphNear(),
() => commands.liftEmptyBlock(),
() => commands.splitBlock(),
]);
return true;
},
Enter: () => {
if (self.allowLineBreaks) {
return false;
}
self.$emit('enter');
return true;
},
};
},
});
extensions.push(ShiftEnter);

return extensions;
},

Expand Down

0 comments on commit 3a48c70

Please sign in to comment.