Skip to content

Commit

Permalink
Merge pull request #5723 from nextcloud/test/jest-without-503s
Browse files Browse the repository at this point in the history
fix(linkBubble): load only when needed
  • Loading branch information
juliusknorr authored Apr 23, 2024
2 parents 1d767ac + 02af121 commit b0f9ef1
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 11 additions & 11 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 All @@ -32,7 +24,7 @@ class LinkBubblePluginView {
)
document.addEventListener('scroll',
this.closeOnExternalEvents,
{ capture: true }
{ capture: true },
)
}

Expand All @@ -45,7 +37,7 @@ class LinkBubblePluginView {
)
document.removeEventListener('scroll',
this.closeOnExternalEvents,
{ capture: true }
{ capture: true },
)
}

Expand All @@ -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 b0f9ef1

Please sign in to comment.