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