Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/content_editor/components/toolbar_link_button.vue')
-rw-r--r--app/assets/javascripts/content_editor/components/toolbar_link_button.vue13
1 files changed, 6 insertions, 7 deletions
diff --git a/app/assets/javascripts/content_editor/components/toolbar_link_button.vue b/app/assets/javascripts/content_editor/components/toolbar_link_button.vue
index 8f57959a73f..f9d2be7070b 100644
--- a/app/assets/javascripts/content_editor/components/toolbar_link_button.vue
+++ b/app/assets/javascripts/content_editor/components/toolbar_link_button.vue
@@ -9,10 +9,9 @@ import {
GlTooltipDirective as GlTooltip,
} from '@gitlab/ui';
import { Editor as TiptapEditor } from '@tiptap/vue-2';
+import Link from '../extensions/link';
import { hasSelection } from '../services/utils';
-export const linkContentType = 'link';
-
export default {
components: {
GlDropdown,
@@ -38,12 +37,12 @@ export default {
},
computed: {
isActive() {
- return this.tiptapEditor.isActive(linkContentType);
+ return this.tiptapEditor.isActive(Link.name);
},
},
mounted() {
this.tiptapEditor.on('selectionUpdate', ({ editor }) => {
- const { canonicalSrc, href } = editor.getAttributes(linkContentType);
+ const { canonicalSrc, href } = editor.getAttributes(Link.name);
this.linkHref = canonicalSrc || href;
});
@@ -60,20 +59,20 @@ export default {
})
.run();
- this.$emit('execute', { contentType: linkContentType });
+ this.$emit('execute', { contentType: Link.name });
},
selectLink() {
const { tiptapEditor } = this;
// a selection has already been made by the user, so do nothing
if (!hasSelection(tiptapEditor)) {
- tiptapEditor.chain().focus().extendMarkRange(linkContentType).run();
+ tiptapEditor.chain().focus().extendMarkRange(Link.name).run();
}
},
removeLink() {
this.tiptapEditor.chain().focus().unsetLink().run();
- this.$emit('execute', { contentType: linkContentType });
+ this.$emit('execute', { contentType: Link.name });
},
},
};