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. 14
      packages/nc-gui/components/cell/RichText/SelectedBubbleMenu.vue

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

@ -25,6 +25,19 @@ const onToggleLink = () => {
if (isActiveNodeMarkActive) {
editor.value!.chain().focus().unsetLink().run()
} else {
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()
@ -34,6 +47,7 @@ const onToggleLink = () => {
})
.selectTextblockEnd()
.run()
}
setTimeout(() => {
const linkInput = document.querySelector('.docs-link-option-input')

Loading…
Cancel
Save