Browse Source

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

pull/7046/head
Muhammed Mustafa 12 months 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) { if (isActiveNodeMarkActive) {
editor.value!.chain().focus().unsetLink().run() editor.value!.chain().focus().unsetLink().run()
} else { } else {
editor if (editor.value.state.selection.empty) {
.value!.chain() editor
.focus() .value!.chain()
.setLink({ .focus()
href: '', .insertContent(' ')
}) .setTextSelection({ from: editor.value!.state.selection.$from.pos, to: editor.value!.state.selection.$from.pos + 1 })
.selectTextblockEnd() .toggleLink({
.run() 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(() => { setTimeout(() => {
const linkInput = document.querySelector('.docs-link-option-input') const linkInput = document.querySelector('.docs-link-option-input')

Loading…
Cancel
Save