@@ -1356,19 +1346,15 @@ body.editing #btn-print {{ display: none; }}
(function(){{
var ICON_EDIT = '
';
var ICON_VIEW = '
';
- var ICON_OPEN = '
';
var ICON_SEARCH = '
';
- var ICON_PRINT = '
';
var ICON_ZOOM = '
';
var ICON_UP = '
';
var ICON_DOWN = '
';
var ICON_CLOSE = '
';
var L_EDIT = '{btn_edit}', L_VIEW = '{btn_preview}';
- var btnOpen = document.getElementById('btn-open');
var btnSearch = document.getElementById('btn-search');
var btnToggle = document.getElementById('btn-toggle');
- var btnPrint = document.getElementById('btn-print');
var btnZoom = document.getElementById('btn-zoom');
var btnZoomOut = document.getElementById('btn-zoom-out');
var btnZoomReset = document.getElementById('btn-zoom-reset');
@@ -1402,10 +1388,8 @@ body.editing #btn-print {{ display: none; }}
var ZOOM_STEP = 10;
var zoomPercent = 100;
- btnOpen.innerHTML = ICON_OPEN;
btnSearch.innerHTML = ICON_SEARCH;
btnToggle.innerHTML = ICON_EDIT;
- btnPrint.innerHTML = ICON_PRINT;
btnZoom.innerHTML = ICON_ZOOM;
findPrev.innerHTML = ICON_UP;
findNext.innerHTML = ICON_DOWN;
@@ -1680,7 +1664,6 @@ body.editing #btn-print {{ display: none; }}
if (activeTabId) requestTabAction('close', activeTabId);
}};
- btnOpen.addEventListener('click', openFile);
tabOpen.addEventListener('click', newFile);
btnSearch.addEventListener('click', showFind);
document.addEventListener('click', function(e) {{
@@ -1740,12 +1723,6 @@ body.editing #btn-print {{ display: none; }}
btnZoomOut.addEventListener('click', function() {{ changeZoom(-ZOOM_STEP); }});
btnZoomReset.addEventListener('click', function() {{ applyZoom(100, true); }});
btnZoomIn.addEventListener('click', function() {{ changeZoom(ZOOM_STEP); }});
- btnPrint.addEventListener('click', function() {{
- if (inEdit()) leaveEdit();
- // Route through Rust: WKWebView ignores window.print(); wry's
- // WebView::print() calls the right native API on each platform.
- setTimeout(function(){{ window.ipc.postMessage('print'); }}, 0);
- }});
ta.addEventListener('input', function() {{ setDirty(true); scheduleAutosave(); autoResize(); updateDocumentStats(ta.value); }});
window.addEventListener('resize', function() {{ if (inEdit()) autoResize(); }});
document.addEventListener('click', function(e) {{
@@ -1965,12 +1942,10 @@ if(window.__enhancePreview)window.__enhancePreview();
base_tag = base_tag,
preview_html = preview_html,
raw_md_escaped = html_escape_ta(raw_md),
- btn_open = s.btn_open,
btn_new = s.btn_new,
btn_search = s.btn_search,
btn_edit = s.btn_edit,
btn_preview = s.btn_preview,
- btn_print = s.btn_print,
btn_zoom = s.btn_zoom,
btn_zoom_out = s.btn_zoom_out,
btn_zoom_reset = s.btn_zoom_reset,
@@ -2285,7 +2260,8 @@ mod tests {
assert!(page.contains("document.addEventListener('contextmenu'"));
assert!(page.contains("window.ipc.postMessage('refresh')"));
- assert!(page.contains("id=\"btn-open\""));
+ assert!(!page.contains("id=\"btn-open\""));
+ assert!(!page.contains("id=\"btn-print\""));
assert!(page.contains("id=\"btn-search\""));
assert!(page.contains("window.ipc.postMessage('open')"));
assert!(page.contains("window.__mdPreviewOpenFile = openFile"));
@@ -2294,7 +2270,7 @@ mod tests {
assert!(page.contains("Cmd/Ctrl+F"));
assert!(page
.contains("if (inEdit()) return;\n\t e.preventDefault();\n\t showFind();"));
- assert!(page.contains("body.editing #btn-open"));
+ assert!(page.contains("body.editing #btn-search"));
assert!(page.contains("ta.focus({ preventScroll: true })"));
assert!(page.contains("window.__setEmptyPreview"));
assert!(page.contains("id=\"tabbar\""));