Skip to content

Commit 260a452

Browse files
committed
Fix: allow cursors to scroll with rich text document
1 parent c89e336 commit 260a452

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

ui/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"description": "Notebooks UI",
44
"license": "MIT",
55
"author": "dev@holochain.org",
6-
"version": "0.6.6",
6+
"version": "0.6.7",
77
"dnaVersion": "0.6.0",
88
"scripts": {
99
"start": "vite --port $UI_PORT --clearScreen false",

ui/src/elements/syn-pm-editor.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,15 @@ export class SynPmEditor extends LitElement {
146146

147147
// Subscribe to Syn changes
148148
this.subscribeToSynChanges();
149+
150+
// Listen for scroll events on the ProseMirror DOM to update cursor positions
151+
this.view.dom.addEventListener('scroll', () => {
152+
this.requestUpdate();
153+
});
154+
// Also listen on the editor container in case scroll happens there
155+
this.editorEl.addEventListener('scroll', () => {
156+
this.requestUpdate();
157+
});
149158

150159
setTimeout(() => this.view?.focus(), 100);
151160
}
@@ -1276,7 +1285,7 @@ export class SynPmEditor extends LitElement {
12761285
if (this._state.value === undefined) return html``;
12771286

12781287
return html`
1279-
<div style="position: relative; overflow: auto; flex: 1; background-color: white; display: flex; flex-direction: column;">
1288+
<div class="editor-container" style="position: relative; overflow: auto; flex: 1; background-color: white; display: flex; flex-direction: column;">
12801289
<div id="editor"></div>
12811290
${Object.entries(this._delayedCursors)
12821291
.filter(([pubKeyB64, _]) => pubKeyB64 !== encodeHashToBase64(this.slice.myPubKey))

0 commit comments

Comments
 (0)