Add discardShortcutEnabled setting to opt into this feature
Only editing the task description and comments have this feature enabled
This commit is contained in:
parent
6ad8ce8f44
commit
308a98c876
@ -203,6 +203,7 @@ const {
|
||||
showSave = false,
|
||||
placeholder = '',
|
||||
editShortcut = '',
|
||||
discardShortcutEnabled = false,
|
||||
} = defineProps<{
|
||||
modelValue: string,
|
||||
uploadCallback?: UploadCallback,
|
||||
@ -211,6 +212,7 @@ const {
|
||||
showSave?: boolean,
|
||||
placeholder?: string,
|
||||
editShortcut?: string,
|
||||
discardShortcutEnabled?: boolean,
|
||||
}>()
|
||||
|
||||
const emit = defineEmits(['update:modelValue', 'save'])
|
||||
@ -351,19 +353,6 @@ const editor = useEditor({
|
||||
}
|
||||
},
|
||||
}),
|
||||
// Add a custom extension for the Escape key
|
||||
Extension.create({
|
||||
name: 'escapeKey',
|
||||
|
||||
addKeyboardShortcuts() {
|
||||
return {
|
||||
'Escape': () => {
|
||||
exitEditMode()
|
||||
return true
|
||||
},
|
||||
}
|
||||
},
|
||||
}),
|
||||
Heading,
|
||||
History,
|
||||
HorizontalRule,
|
||||
@ -438,6 +427,24 @@ const editor = useEditor({
|
||||
suggestion: suggestionSetup(t),
|
||||
}),
|
||||
BubbleMenu,
|
||||
|
||||
// Add a custom extension for the Escape key
|
||||
...(
|
||||
discardShortcutEnabled
|
||||
?[discardShortcutEnabled && Extension.create({
|
||||
name: 'escapeKey',
|
||||
|
||||
addKeyboardShortcuts() {
|
||||
return {
|
||||
'Escape': () => {
|
||||
exitEditMode()
|
||||
return true
|
||||
},
|
||||
}
|
||||
},
|
||||
})]
|
||||
: []
|
||||
),
|
||||
],
|
||||
onUpdate: () => {
|
||||
bubbleNow()
|
||||
|
@ -85,6 +85,7 @@
|
||||
:upload-enabled="true"
|
||||
:bottom-actions="actions[c.id]"
|
||||
:show-save="true"
|
||||
:discard-shortcut-enabled="true"
|
||||
initial-mode="preview"
|
||||
@update:modelValue="
|
||||
() => {
|
||||
|
@ -30,6 +30,7 @@
|
||||
:placeholder="$t('task.description.placeholder')"
|
||||
:show-save="true"
|
||||
edit-shortcut="e"
|
||||
:discard-shortcut-enabled="true"
|
||||
@update:modelValue="saveWithDelay"
|
||||
@save="save"
|
||||
/>
|
||||
|
Loading…
x
Reference in New Issue
Block a user