Skip to content

Commit

Permalink
fix(LinkBubble): Don't open bubble on changes by other session members
Browse files Browse the repository at this point in the history
Signed-off-by: Jonas <jonas@freesources.org>
  • Loading branch information
mejo- committed Jun 19, 2024
1 parent ff982a4 commit 8212160
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/plugins/links.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,17 @@ export function linkBubble(options) {
}),

appendTransaction: (transactions, oldState, state) => {
// Don't open bubble at editor initialisation
if (oldState?.doc.content.size === 2) {
return
}

// Don't open bubble if neither selection nor doc changed
const sameSelection = oldState?.selection.eq(state.selection)
const sameDoc = oldState?.doc.eq(state.doc)
// Prevent bubble from opening at editor initialisation
const initLoad = oldState?.doc.content.size === 2
if (initLoad || (sameSelection && sameDoc)) {
// Don't open bubble on changes by other session members
const hasHistory = transactions.some(tr => tr.meta.addToHistory)
if (sameSelection && (!hasHistory || sameDoc)) {
return
}
const active = activeLinkFromSelection(state)
Expand Down

0 comments on commit 8212160

Please sign in to comment.