From 9c28ad4979fcb959da34acf0d42092b3ec9cd6a1 Mon Sep 17 00:00:00 2001 From: Tristan de Cacqueray Date: Sun, 26 Jan 2025 08:26:32 -0500 Subject: [PATCH] Fix last line chat See #80 --- src/editor.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/editor.js b/src/editor.js index e94e240..e69f430 100644 --- a/src/editor.js +++ b/src/editor.js @@ -97,6 +97,9 @@ export class PastaMirror { to = line.to + 1; } + // Ensure the removal works when the cursor is on the last line + // see: #80 + to = Math.min(to, view.state.doc.length); const message = view.state.sliceDoc(from, to).trim(); doc.session._pubSubClient.publish(`session:pastagang:chat`, { docId: doc.id,