Browse Source

fix: Fixed link button on top right to add link without selected text

pull/7046/head
Muhammed Mustafa 1 year ago
parent
commit
e746c20cf0
  1. 30
      packages/nc-gui/components/cell/RichText/SelectedBubbleMenu.vue

30
packages/nc-gui/components/cell/RichText/SelectedBubbleMenu.vue

@ -26,14 +26,28 @@ const onToggleLink = () => {
if (isActiveNodeMarkActive) {
editor.value!.chain().focus().unsetLink().run()
} else {
editor
.value!.chain()
.focus()
.setLink({
href: '',
})
.selectTextblockEnd()
.run()
if (editor.value.state.selection.empty) {
editor
.value!.chain()
.focus()
.insertContent(' ')
.setTextSelection({ from: editor.value!.state.selection.$from.pos, to: editor.value!.state.selection.$from.pos + 1 })
.toggleLink({
href: '',
})
.setTextSelection({ from: editor.value!.state.selection.$from.pos, to: editor.value!.state.selection.$from.pos + 1 })
.deleteSelection()
.run()
} else {
editor
.value!.chain()
.focus()
.setLink({
href: '',
})
.selectTextblockEnd()
.run()
}
setTimeout(() => {
const linkInput = document.querySelector('.docs-link-option-input')

Loading…
Cancel
Save