@filipc77/cowrite 0.6.11 → 0.6.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bin/cowrite.js
CHANGED
|
@@ -1104,7 +1104,7 @@ function createPreviewServer(store, projectDir, port, initialFile) {
|
|
|
1104
1104
|
// bin/cowrite.ts
|
|
1105
1105
|
import updateNotifier from "update-notifier";
|
|
1106
1106
|
import "module";
|
|
1107
|
-
var version = true ? "0.6.
|
|
1107
|
+
var version = true ? "0.6.13" : createRequire(import.meta.url)("../package.json").version;
|
|
1108
1108
|
var USAGE = `
|
|
1109
1109
|
cowrite \u2014 Live commenting plugin for coding agent sessions
|
|
1110
1110
|
|
package/package.json
CHANGED
|
@@ -234,14 +234,33 @@ function wrapRange(textNodes, start, end, comment) {
|
|
|
234
234
|
|
|
235
235
|
/**
|
|
236
236
|
* Initialize comment highlight click behavior.
|
|
237
|
+
* Clicking a highlight scrolls to & highlights the matching sidebar card.
|
|
237
238
|
*/
|
|
238
239
|
export function initCommentHighlights() {
|
|
239
240
|
const commentListEl = $('#commentList');
|
|
241
|
+
|
|
240
242
|
document.addEventListener('mousedown', (e) => {
|
|
241
|
-
|
|
243
|
+
const highlight = e.target.closest('.comment-highlight');
|
|
244
|
+
|
|
245
|
+
// Clear active state when clicking outside highlights
|
|
246
|
+
if (!highlight) {
|
|
242
247
|
for (const card of commentListEl.querySelectorAll('.comment-card.active')) {
|
|
243
248
|
card.classList.remove('active');
|
|
244
249
|
}
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
// Scroll sidebar to the matching comment card
|
|
254
|
+
const commentId = highlight.dataset?.commentId;
|
|
255
|
+
if (!commentId) return;
|
|
256
|
+
const card = commentListEl.querySelector(`.comment-card[data-id="${commentId}"]`);
|
|
257
|
+
if (!card) return;
|
|
258
|
+
|
|
259
|
+
// Clear previous active states
|
|
260
|
+
for (const c of commentListEl.querySelectorAll('.comment-card.active')) {
|
|
261
|
+
c.classList.remove('active');
|
|
245
262
|
}
|
|
263
|
+
card.classList.add('active');
|
|
264
|
+
card.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
|
246
265
|
});
|
|
247
266
|
}
|
|
@@ -124,10 +124,18 @@ export function renderComments() {
|
|
|
124
124
|
`;
|
|
125
125
|
}).join("");
|
|
126
126
|
|
|
127
|
-
// Click to scroll to highlight
|
|
127
|
+
// Click to scroll to highlight and mark card active
|
|
128
128
|
for (const card of commentListEl.querySelectorAll(".comment-card")) {
|
|
129
129
|
card.addEventListener("click", (e) => {
|
|
130
|
-
if (e.target.
|
|
130
|
+
if (e.target.closest("button, textarea, .proposal-actions, .reply-form, .comment-actions")) return;
|
|
131
|
+
|
|
132
|
+
// Mark this card active
|
|
133
|
+
for (const c of commentListEl.querySelectorAll(".comment-card.active")) {
|
|
134
|
+
c.classList.remove("active");
|
|
135
|
+
}
|
|
136
|
+
card.classList.add("active");
|
|
137
|
+
|
|
138
|
+
// Scroll to and flash the in-content highlight
|
|
131
139
|
const id = card.dataset.id;
|
|
132
140
|
const highlight = fileContentEl.querySelector(`[data-comment-id="${id}"]`);
|
|
133
141
|
if (highlight) {
|