fix(editor): pasted link capturing trailing text (#912)
This commit is contained in:
parent
b41665b6e4
commit
f487f81f52
|
|
@ -182,6 +182,7 @@ import XButton from '@/components/input/Button.vue'
|
|||
import {isEditorContentEmpty} from '@/helpers/editorContentEmpty'
|
||||
import inputPrompt from '@/helpers/inputPrompt'
|
||||
import {setLinkInEditor} from '@/components/input/editor/setLinkInEditor'
|
||||
import StopLinkOnSpace from './stopLinkOnSpace'
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
modelValue: string,
|
||||
|
|
@ -464,11 +465,12 @@ const extensions : Extensions = [
|
|||
},
|
||||
}),
|
||||
|
||||
Commands.configure({
|
||||
suggestion: suggestionSetup(t),
|
||||
}),
|
||||
|
||||
PasteHandler,
|
||||
Commands.configure({
|
||||
suggestion: suggestionSetup(t),
|
||||
}),
|
||||
|
||||
PasteHandler,
|
||||
StopLinkOnSpace,
|
||||
]
|
||||
|
||||
// Add a custom extension for the Escape key
|
||||
|
|
|
|||
|
|
@ -0,0 +1,16 @@
|
|||
import {Extension} from '@tiptap/core'
|
||||
|
||||
export default Extension.create({
|
||||
name: 'stopLinkOnSpace',
|
||||
|
||||
addKeyboardShortcuts() {
|
||||
return {
|
||||
Space: ({editor}) => {
|
||||
if (editor.isActive('link')) {
|
||||
editor.commands.unsetLink()
|
||||
}
|
||||
return false
|
||||
},
|
||||
}
|
||||
},
|
||||
})
|
||||
Loading…
Reference in New Issue