Add discardShortcutEnabled setting to opt into this feature
continuous-integration/drone/pr Build is failing
Details
continuous-integration/drone/pr Build is failing
Details
Only editing the task description and comments have this feature enabled
This commit is contained in:
parent
0b7a9c09c5
commit
0e6fea95cb
|
@ -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…
Reference in New Issue