Skip to content

Commit 01c9acc

Browse files
committed
fix(mdviewer): rename Done to Reader with book-open icon, tighten collapse thresholds
- Rename Done button to Reader with book-open icon and title - Add Switch to edit mode title on Edit button - Remove unused toolbar.done string - Add toolbar.reader, toolbar.switch_to_reader, toolbar.switch_to_edit strings - Raise collapse thresholds by +100px (640/520/420) to prevent clipping
1 parent 82ab6a9 commit 01c9acc

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

src-mdviewer/src/components/embedded-toolbar.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ import {
2626
FileCode,
2727
ChevronDown,
2828
Type,
29-
MoreHorizontal
29+
MoreHorizontal,
30+
BookOpen
3031
} from "lucide";
3132
import { on, emit } from "../core/events.js";
3233
import { getState, setState } from "../core/state.js";
@@ -37,12 +38,12 @@ let resizeObserver = null;
3738
let collapseLevel = 0; // 0=expanded, 1=blocks, 2=blocks+lists, 3=all
3839

3940
// Width thresholds for progressive collapse
40-
const THRESHOLD_BLOCKS = 480; // collapse block elements first
41-
const THRESHOLD_LISTS = 390; // then lists
42-
const THRESHOLD_TEXT = 300; // finally text formatting
41+
const THRESHOLD_BLOCKS = 640; // collapse block elements first
42+
const THRESHOLD_LISTS = 520; // then lists
43+
const THRESHOLD_TEXT = 420; // finally text formatting
4344

4445
const allIcons = { Bold, Italic, Strikethrough, Underline, Code, Link, List, ListOrdered,
45-
ListChecks, Quote, Minus, Table, FileCode, ChevronDown, Type, MoreHorizontal, Pencil };
46+
ListChecks, Quote, Minus, Table, FileCode, ChevronDown, Type, MoreHorizontal, Pencil, BookOpen };
4647

4748
export function initEmbeddedToolbar() {
4849
toolbar = document.getElementById("toolbar");
@@ -75,7 +76,7 @@ function render() {
7576
function renderReadMode() {
7677
toolbar.innerHTML = `<div class="embedded-toolbar">
7778
<div class="toolbar-spacer"></div>
78-
<button class="edit-toggle-btn" id="emb-edit-btn">
79+
<button class="edit-toggle-btn" id="emb-edit-btn" title="${t("toolbar.switch_to_edit") || "Switch to edit mode"}">
7980
<i data-lucide="pencil"></i>
8081
<span>${t("toolbar.edit") || "Edit"}</span>
8182
</button>
@@ -165,8 +166,9 @@ function renderEditMode(level) {
165166
toolbar.innerHTML = `<div class="embedded-toolbar">
166167
${formatRow}
167168
<div class="toolbar-spacer"></div>
168-
<button class="done-btn" id="emb-done-btn">
169-
<span>${t("toolbar.done") || "Done"}</span>
169+
<button class="done-btn" id="emb-done-btn" title="${t("toolbar.switch_to_reader") || "Switch to reader mode"}">
170+
<i data-lucide="book-open"></i>
171+
<span>${t("toolbar.reader") || "Reader"}</span>
170172
</button>
171173
</div>`;
172174

src-mdviewer/src/locales/en.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
"export_pdf": "Export PDF",
1616
"settings": "Settings",
1717
"more": "More",
18-
"done": "Done"
18+
"reader": "Reader",
19+
"switch_to_reader": "Switch to reader mode",
20+
"switch_to_edit": "Switch to edit mode"
1921
},
2022
"sidebar": {
2123
"toc": "Table of Contents",

0 commit comments

Comments
 (0)