Skip to content

Commit

Permalink
[4.x] Bard: Only configure placeholder extension when placeholder is …
Browse files Browse the repository at this point in the history
…provided (#9369)
  • Loading branch information
duncanmcclean authored Jan 22, 2024
1 parent 95b81e6 commit 0742d1a
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions resources/js/components/fieldtypes/bard/BardFieldtype.vue
Original file line number Diff line number Diff line change
Expand Up @@ -706,6 +706,7 @@ export default {
getExtensions() {
let modeExts = this.inputIsInline ? [DocumentInline] : [DocumentBlock, HardBreak];
if (this.config.inline === 'break') {
modeExts.push(HardBreak.extend({
addKeyboardShortcuts() {
Expand All @@ -716,8 +717,12 @@ export default {
},
}));
}
// Allow passthrough of Ctrl/Cmd + Enter to submit the form
if (this.config.placeholder) {
modeExts.push(Placeholder.configure({ placeholder: __(this.config.placeholder) }));
}
// Allow passthrough of Ctrl/Cmd + Enter to submit the form
const DisableCtrlEnter = Extension.create({
addKeyboardShortcuts() {
return {
Expand All @@ -735,7 +740,6 @@ export default {
Gapcursor,
History,
Paragraph,
Placeholder.configure({ placeholder: __(this.config.placeholder) }),
Set.configure({ bard: this }),
Text
];
Expand Down

0 comments on commit 0742d1a

Please sign in to comment.