Skip to content

Commit

Permalink
enh(links): close link bubble when opening preview toggle
Browse files Browse the repository at this point in the history
Signed-off-by: Max <[email protected]>
  • Loading branch information
max-nextcloud committed Mar 19, 2024
1 parent 12098aa commit c06997c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/components/Editor/PreviewOptions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
-
-->
<template>
<NcActions data-text-preview-options="select">
<NcActions data-text-preview-options="select"
@open="$emit('open')">
<template #icon>
<DotsVerticalIcon :size="20" />
</template>
Expand Down
10 changes: 9 additions & 1 deletion src/extensions/LinkBubble.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
import { Extension } from '@tiptap/core'
import { linkBubble } from '../plugins/links.js'
import { linkBubble, hideLinkBubble } from '../plugins/links.js'

const LinkBubble = Extension.create({
name: 'linkViewBubble',

addCommands() {
return {
hideLinkBubble: () => ({ state, dispatch }) => {
return hideLinkBubble(state, dispatch)
},
}
},

addProseMirrorPlugins() {
return [
linkBubble({
Expand Down
1 change: 1 addition & 0 deletions src/nodes/ParagraphView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
<NodeViewWrapper class="vue-component" as="p">
<PreviewOptions v-if="editor.isEditable && href"
:value.sync="value"
@open="editor.commands.hideLinkBubble()"
@update:value="convertToPreview" />
<NodeViewContent class="paragraph-content" />
</NodeViewWrapper>
Expand Down

0 comments on commit c06997c

Please sign in to comment.