diff --git a/Cargo.lock b/Cargo.lock
index a21d6ba..ad2bdb3 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2433,7 +2433,7 @@ dependencies = [
[[package]]
name = "rustpad"
-version = "0.0.24"
+version = "0.0.25"
dependencies = [
"argon2",
"aws-config",
diff --git a/Cargo.toml b/Cargo.toml
index 569d289..0a620e4 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "rustpad"
-version = "0.0.24"
+version = "0.0.25"
edition = "2024"
rust-version = "1.94"
description = "Collaborative Markdown notepad built with Axum, WebSockets and SQLite, PostgreSQL and MySQL"
diff --git a/static/js/note.js b/static/js/note.js
index b4f12b9..0b452a7 100644
--- a/static/js/note.js
+++ b/static/js/note.js
@@ -15,7 +15,7 @@ import { askConfirm } from "@rustpad/modal";
import { currentShareUrl, readEditorState, writeEditorState } from "@rustpad/url-state";
const parts = location.pathname.split("/").filter(Boolean), workspaceSlug = parts[1], noteSlug = parts[3];
-const editor = document.querySelector("#editor"), preview = document.querySelector("#preview"), editorWorkspace = document.querySelector("#editor-workspace"), gutter = document.querySelector("#line-gutter"), ownerLabels = document.querySelector("#owner-labels"), authorshipLayer = document.querySelector("#authorship-layer"), documentOwnerBadge = document.querySelector("#document-owner-badge");
+const editor = document.querySelector("#editor"), preview = document.querySelector("#preview"), editorWorkspace = document.querySelector("#editor-workspace"), gutter = document.querySelector("#line-gutter"), ownerLabels = document.querySelector("#owner-labels"), authorshipLayer = document.querySelector("#authorship-layer");
const modeToggle = document.querySelector("#mode-toggle"), passwordDialog = document.querySelector("#password-dialog"), identityDialog = document.querySelector("#identity-dialog");
const roomDetails = document.querySelector("#room-details"), roomUsers = document.querySelector("#room-users"), roomCount = document.querySelector("#room-count"), socketLatency = document.querySelector("#socket-latency"), chatMessages = document.querySelector("#chat-messages"), chatForm = document.querySelector("#chat-form"), chatInput = document.querySelector("#chat-input"), chatUnread = document.querySelector("#chat-unread");
let unreadChat = 0;
@@ -56,29 +56,25 @@ function renderGutter() {
const showSingleOwner = owners.length === 1;
const showAuthorship = owners.length > 1;
const authorsByLine = showAuthorship ? lineAuthors(editor.value, authorship) : [];
- if (documentOwnerBadge) {
- documentOwnerBadge.hidden = !showSingleOwner;
- if (showSingleOwner) {
- documentOwnerBadge.textContent = ownerName(owners[0]);
- documentOwnerBadge.style.setProperty("--owner", colorFor(owners[0]));
- } else {
- documentOwnerBadge.textContent = "";
- documentOwnerBadge.style.removeProperty("--owner");
- }
- }
authorshipLayer.hidden = !showAuthorship;
- ownerLabels.hidden = !showAuthorship;
+ ownerLabels.hidden = !(showSingleOwner || showAuthorship);
const style = getComputedStyle(editor), lineHeight = parseFloat(style.lineHeight) || 29, paddingTop = parseFloat(style.paddingTop) || 24, paddingBottom = parseFloat(style.paddingBottom) || 24;
gutter.style.paddingTop = `${paddingTop}px`; gutter.style.paddingBottom = `${paddingBottom}px`; gutter.style.lineHeight = `${lineHeight}px`;
gutter.innerHTML = lines.map((_, i) => `
${i + 1}
`).join("");
ownerLabels.style.setProperty("--editor-line-height", `${lineHeight}px`);
- ownerLabels.innerHTML = lines.map((_, i) => {
- const authors = authorsByLine[i] || [];
- if (!authors.length) return "";
- const top = paddingTop + i * lineHeight - editor.scrollTop;
- const badges = authors.map(owner => `${escapeHtml(ownerName(owner))}`).join("");
- return `${badges}`;
- }).join("");
+ if (showSingleOwner) {
+ const owner = owners[0];
+ const top = paddingTop - editor.scrollTop;
+ ownerLabels.innerHTML = `${escapeHtml(ownerName(owner))}`;
+ } else {
+ ownerLabels.innerHTML = lines.map((_, i) => {
+ const authors = authorsByLine[i] || [];
+ if (!authors.length) return "";
+ const top = paddingTop + i * lineHeight - editor.scrollTop;
+ const badges = authors.map(owner => `${escapeHtml(ownerName(owner))}`).join("");
+ return `${badges}`;
+ }).join("");
+ }
if (showAuthorship) renderAuthorshipLayer(authorshipLayer, editor, authorship, colorFor);
else authorshipLayer.replaceChildren();
document.body.classList.toggle("hide-editor-line-numbers", !lineToggle.checked);
diff --git a/static/js/pad.js b/static/js/pad.js
index 4a7425e..e6d7f82 100644
--- a/static/js/pad.js
+++ b/static/js/pad.js
@@ -14,7 +14,7 @@ import { PadSocket } from "@rustpad/socket";
import { currentShareUrl, readEditorState, writeEditorState } from "@rustpad/url-state";
const slug = location.pathname.split("/").filter(Boolean)[1];
-const editor = document.querySelector("#editor"), preview = document.querySelector("#preview"), editorWorkspace = document.querySelector("#editor-workspace"), gutter = document.querySelector("#line-gutter"), ownerLabels = document.querySelector("#owner-labels"), authorshipLayer = document.querySelector("#authorship-layer"), documentOwnerBadge = document.querySelector("#document-owner-badge");
+const editor = document.querySelector("#editor"), preview = document.querySelector("#preview"), editorWorkspace = document.querySelector("#editor-workspace"), gutter = document.querySelector("#line-gutter"), ownerLabels = document.querySelector("#owner-labels"), authorshipLayer = document.querySelector("#authorship-layer");
const modeToggle = document.querySelector("#mode-toggle"), passwordDialog = document.querySelector("#password-dialog"), identityDialog = document.querySelector("#identity-dialog");
const roomDetails = document.querySelector("#room-details"), roomUsers = document.querySelector("#room-users"), roomCount = document.querySelector("#room-count"), socketLatency = document.querySelector("#socket-latency"), chatMessages = document.querySelector("#chat-messages"), chatForm = document.querySelector("#chat-form"), chatInput = document.querySelector("#chat-input"), chatUnread = document.querySelector("#chat-unread");
let unreadChat = 0;
@@ -54,29 +54,25 @@ function renderGutter() {
const showSingleOwner = owners.length === 1;
const showAuthorship = owners.length > 1;
const authorsByLine = showAuthorship ? lineAuthors(editor.value, authorship) : [];
- if (documentOwnerBadge) {
- documentOwnerBadge.hidden = !showSingleOwner;
- if (showSingleOwner) {
- documentOwnerBadge.textContent = ownerName(owners[0]);
- documentOwnerBadge.style.setProperty("--owner", colorFor(owners[0]));
- } else {
- documentOwnerBadge.textContent = "";
- documentOwnerBadge.style.removeProperty("--owner");
- }
- }
authorshipLayer.hidden = !showAuthorship;
- ownerLabels.hidden = !showAuthorship;
+ ownerLabels.hidden = !(showSingleOwner || showAuthorship);
const style = getComputedStyle(editor), lineHeight = parseFloat(style.lineHeight) || 29, paddingTop = parseFloat(style.paddingTop) || 24, paddingBottom = parseFloat(style.paddingBottom) || 24;
gutter.style.paddingTop = `${paddingTop}px`; gutter.style.paddingBottom = `${paddingBottom}px`; gutter.style.lineHeight = `${lineHeight}px`;
gutter.innerHTML = lines.map((_, i) => `${i + 1}
`).join("");
ownerLabels.style.setProperty("--editor-line-height", `${lineHeight}px`);
- ownerLabels.innerHTML = lines.map((_, i) => {
- const authors = authorsByLine[i] || [];
- if (!authors.length) return "";
- const top = paddingTop + i * lineHeight - editor.scrollTop;
- const badges = authors.map(owner => `${escapeHtml(ownerName(owner))}`).join("");
- return `${badges}`;
- }).join("");
+ if (showSingleOwner) {
+ const owner = owners[0];
+ const top = paddingTop - editor.scrollTop;
+ ownerLabels.innerHTML = `${escapeHtml(ownerName(owner))}`;
+ } else {
+ ownerLabels.innerHTML = lines.map((_, i) => {
+ const authors = authorsByLine[i] || [];
+ if (!authors.length) return "";
+ const top = paddingTop + i * lineHeight - editor.scrollTop;
+ const badges = authors.map(owner => `${escapeHtml(ownerName(owner))}`).join("");
+ return `${badges}`;
+ }).join("");
+ }
if (showAuthorship) renderAuthorshipLayer(authorshipLayer, editor, authorship, colorFor);
else authorshipLayer.replaceChildren();
document.body.classList.toggle("hide-editor-line-numbers", !lineToggle.checked);
diff --git a/static/note.html b/static/note.html
index 2b62d95..1f5aa24 100644
--- a/static/note.html
+++ b/static/note.html
@@ -97,7 +97,7 @@