Skip to content

Commit

Permalink
fix(linkBubble): only render when needed
Browse files Browse the repository at this point in the history
Prevents 503 requests during tests.
See #5442.

Signed-off-by: Max <max@nextcloud.com>
  • Loading branch information
max-nextcloud committed Apr 23, 2024
1 parent 6ba72ad commit d63c262
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
18 changes: 9 additions & 9 deletions src/plugins/LinkBubblePluginView.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,6 @@ class LinkBubblePluginView {
this.view = view
this.plugin = plugin
this.#editor = this.options.editor

this.#component = new VueRenderer(LinkBubbleView, {
parent: this.options.parent,
propsData: {
editor: this.options.editor,
href: null,
},
})
}

addEventListeners() {
Expand Down Expand Up @@ -71,6 +63,14 @@ class LinkBubblePluginView {
return
}

this.#component ||= new VueRenderer(LinkBubbleView, {
parent: this.options.parent,
propsData: {
editor: this.options.editor,
href: null,
},
})

this.tippy = tippy(editorElement, {
duration: 100,
getReferenceClientRect: null,
Expand Down Expand Up @@ -112,7 +112,7 @@ class LinkBubblePluginView {
}
const clientRect = referenceEl?.getBoundingClientRect()

this.#component.updateProps({
this.#component?.updateProps({
href: domHref(mark),
})

Expand Down
2 changes: 1 addition & 1 deletion src/tests/nodes/TaskItem.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe('TaskItem extension', () => {
expect(taskItem.spec.toMarkdown).toBeDefined()
})

test('markdown syntax is preserved through editor', () => {
it('markdown syntax is preserved through editor', () => {
// Invalid ones but should be syntactical unchanged
expect(markdownThroughEditor('- [F] asd')).toBe('- [F] asd')
expect(markdownThroughEditor('- [ [asd](sdf)')).toBe('- [ [asd](sdf)')
Expand Down

0 comments on commit d63c262

Please sign in to comment.