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,
|
showSave = false,
|
||||||
placeholder = '',
|
placeholder = '',
|
||||||
editShortcut = '',
|
editShortcut = '',
|
||||||
|
discardShortcutEnabled = false,
|
||||||
} = defineProps<{
|
} = defineProps<{
|
||||||
modelValue: string,
|
modelValue: string,
|
||||||
uploadCallback?: UploadCallback,
|
uploadCallback?: UploadCallback,
|
||||||
@ -211,6 +212,7 @@ const {
|
|||||||
showSave?: boolean,
|
showSave?: boolean,
|
||||||
placeholder?: string,
|
placeholder?: string,
|
||||||
editShortcut?: string,
|
editShortcut?: string,
|
||||||
|
discardShortcutEnabled?: boolean,
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const emit = defineEmits(['update:modelValue', 'save'])
|
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,
|
Heading,
|
||||||
History,
|
History,
|
||||||
HorizontalRule,
|
HorizontalRule,
|
||||||
@ -438,6 +427,24 @@ const editor = useEditor({
|
|||||||
suggestion: suggestionSetup(t),
|
suggestion: suggestionSetup(t),
|
||||||
}),
|
}),
|
||||||
BubbleMenu,
|
BubbleMenu,
|
||||||
|
|
||||||
|
// Add a custom extension for the Escape key
|
||||||
|
...(
|
||||||
|
discardShortcutEnabled
|
||||||
|
?[discardShortcutEnabled && Extension.create({
|
||||||
|
name: 'escapeKey',
|
||||||
|
|
||||||
|
addKeyboardShortcuts() {
|
||||||
|
return {
|
||||||
|
'Escape': () => {
|
||||||
|
exitEditMode()
|
||||||
|
return true
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
})]
|
||||||
|
: []
|
||||||
|
),
|
||||||
],
|
],
|
||||||
onUpdate: () => {
|
onUpdate: () => {
|
||||||
bubbleNow()
|
bubbleNow()
|
||||||
|
@ -85,6 +85,7 @@
|
|||||||
:upload-enabled="true"
|
:upload-enabled="true"
|
||||||
:bottom-actions="actions[c.id]"
|
:bottom-actions="actions[c.id]"
|
||||||
:show-save="true"
|
:show-save="true"
|
||||||
|
:discard-shortcut-enabled="true"
|
||||||
initial-mode="preview"
|
initial-mode="preview"
|
||||||
@update:modelValue="
|
@update:modelValue="
|
||||||
() => {
|
() => {
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
:placeholder="$t('task.description.placeholder')"
|
:placeholder="$t('task.description.placeholder')"
|
||||||
:show-save="true"
|
:show-save="true"
|
||||||
edit-shortcut="e"
|
edit-shortcut="e"
|
||||||
|
:discard-shortcut-enabled="true"
|
||||||
@update:modelValue="saveWithDelay"
|
@update:modelValue="saveWithDelay"
|
||||||
@save="save"
|
@save="save"
|
||||||
/>
|
/>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user