Skip to content
Merged
Prev Previous commit
Next Next commit
fix(LinkBubble): Don't open bubble on changes by other session members
Signed-off-by: Jonas <[email protected]>
  • Loading branch information
mejo- authored and backportbot[bot] committed Jun 25, 2024
commit c7daca8e2260cdda6c58404032de22715834e17e
12 changes: 9 additions & 3 deletions src/plugins/links.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,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 noHistory = !transactions.some(tr => tr.meta.addToHistory)
if (sameSelection && (noHistory || sameDoc)) {
return
}
const active = activeLinkFromSelection(state)
Expand Down