@@ -50,6 +50,12 @@ const THRESHOLD_BLOCKS = 640; // collapse block elements + image first
5050const THRESHOLD_LISTS = 590 ; // then lists
5151const THRESHOLD_TEXT = 590 ; // finally text formatting (all dropdowns collapsed)
5252
53+ // window.print() from inside an iframe is a no-op in WKWebView (Safari on macOS),
54+ // which is what Tauri uses for the Mac desktop build. Hide the button there.
55+ const _isMacWebKit = / M a c / . test ( navigator . platform )
56+ && / A p p l e W e b K i t / . test ( navigator . userAgent )
57+ && ! / C h r o m e | C r i O S | E d g | F i r e f o x | F x i O S / . test ( navigator . userAgent ) ;
58+
5359const allIcons = { Bold, Italic, Strikethrough, Underline, Code, Link, List, ListOrdered,
5460 ListChecks, Quote, Minus, Table, FileCode, ChevronDown, Type, MoreHorizontal, Pencil, BookOpen, Link2, Link2Off, Printer, Image : ImageIcon , Upload, Sun, Moon } ;
5561
@@ -89,9 +95,9 @@ function renderReadMode() {
8995 <button class="toolbar-btn theme-toggle-btn" id="emb-theme-toggle" data-tooltip="${ t ( "toolbar.theme" ) || "Toggle theme" } ">
9096 <i data-lucide="${ isDark ? "sun" : "moon" } "></i>
9197 </button>
92- <button class="toolbar-btn print-btn" id="emb-print-btn" data-tooltip="${ t ( "toolbar.print" ) || "Print" } ">
98+ ${ _isMacWebKit ? "" : ` <button class="toolbar-btn print-btn" id="emb-print-btn" data-tooltip="${ t ( "toolbar.print" ) || "Print" } ">
9399 <i data-lucide="printer"></i>
94- </button>
100+ </button>` }
95101 <button class="toolbar-btn cursor-sync-btn${ cursorSyncEnabled ? " active" : "" } " id="emb-cursor-sync" data-tooltip="${ t ( "toolbar.cursor_sync" ) || "Cursor sync" } " aria-pressed="${ cursorSyncEnabled } ">
96102 <i data-lucide="link-2" class="sync-on-icon"${ cursorSyncEnabled ? "" : ' style="display:none"' } ></i>
97103 <i data-lucide="link-2-off" class="sync-off-icon"${ cursorSyncEnabled ? ' style="display:none"' : "" } ></i>
@@ -206,9 +212,9 @@ function renderEditMode(level) {
206212 <button class="toolbar-btn theme-toggle-btn" id="emb-theme-toggle" data-tooltip="${ t ( "toolbar.theme" ) || "Toggle theme" } ">
207213 <i data-lucide="${ isDark ? "sun" : "moon" } "></i>
208214 </button>
209- <button class="toolbar-btn print-btn" id="emb-print-btn" data-tooltip="${ t ( "toolbar.print" ) || "Print" } ">
215+ ${ _isMacWebKit ? "" : ` <button class="toolbar-btn print-btn" id="emb-print-btn" data-tooltip="${ t ( "toolbar.print" ) || "Print" } ">
210216 <i data-lucide="printer"></i>
211- </button>
217+ </button>` }
212218 <button class="toolbar-btn cursor-sync-btn${ cursorSyncEnabled ? " active" : "" } " id="emb-cursor-sync" data-tooltip="${ t ( "toolbar.cursor_sync" ) || "Cursor sync" } " aria-pressed="${ cursorSyncEnabled } ">
213219 <i data-lucide="link-2" class="sync-on-icon"${ cursorSyncEnabled ? "" : ' style="display:none"' } ></i>
214220 <i data-lucide="link-2-off" class="sync-off-icon"${ cursorSyncEnabled ? ' style="display:none"' : "" } ></i>
0 commit comments