Loading editor/html/index.html +2 −1 Changes for editor/html/index.html: 2 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -85,7 +85,8 @@ <option value="">Nicht verbunden</option> </select> <button id="btn-publish-now" disabled style="padding:0.2em 0.6em;border-radius:4px;border:1px solid var(--border);background:var(--accent);color:var(--bg-primary);font-size:0.8rem;cursor:pointer;font-weight:600;opacity:0.4">🌐 Publish</button> <select id="theme-select" title="Theme" style="margin-left:auto;padding:0.2em 0.4em;border-radius:4px;border:1px solid var(--border);background:var(--bg-secondary);color:var(--text-primary);font-size:0.8rem;cursor:pointer"> <button id="btn-preview-mode" title="Switch Desktop/Mobile Preview" style="margin-left:auto;padding:0.2em 0.6em;border-radius:4px;border:1px solid var(--border);background:var(--bg-secondary);color:var(--text-primary);font-size:0.8rem;cursor:pointer" data-mode="desktop">🖥 <span data-i18n="I18N_AI_DESKTOP">Desktop</span></button> <select id="theme-select" title="Theme" style="padding:0.2em 0.4em;border-radius:4px;border:1px solid var(--border);background:var(--bg-secondary);color:var(--text-primary);font-size:0.8rem;cursor:pointer"> <option value="dark">🌙 Dark</option> <option value="light">☀ Light</option> </select> Loading editor/html/js/editor.js +1 −0 Changes for editor/html/js/editor.js: 1 added line, 0 removed lines. Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ try { bindAiDialog(); } catch(e) { console.error('bindAiDialog:', e); } try { bindClipboardShortcuts(); } catch(e) { console.error('bindClipboardShortcuts:', e); } try { SurveyManager.init(); } catch(e) { console.error('SurveyManager.init:', e); } try { Preview.bindToggle(); } catch(e) { console.error('Preview.bindToggle:', e); } Preview.clear(); DocumentTree.setOnSelect(function(uuid) { Loading editor/html/js/preview.js +31 −1 Changes for editor/html/js/preview.js: 31 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ var Preview = (function() { 'use strict'; var iframe = null; var _mobileMode = false; function getIframe() { if (iframe) return iframe; Loading Loading @@ -55,6 +56,7 @@ var Preview = (function() { }; addField('authid', data.authid); addField('html', data.html); if (_mobileMode) addField('mobile', 'true'); // Send selected color scheme to blog's /render var colorScheme = document.getElementById('theme-select').value || 'dark'; Loading Loading @@ -89,6 +91,31 @@ var Preview = (function() { }); } function toggleMode() { _mobileMode = !_mobileMode; var btn = document.getElementById('btn-preview-mode'); var host = document.getElementById('preview-frame'); if (_mobileMode) { if (btn) { btn.setAttribute('data-mode', 'mobile'); btn.innerHTML = '📱 <span>' + (typeof I18n !== 'undefined' ? I18n.t('I18N_AI_MOBILE', 'Mobile') : 'Mobile') + '</span>'; } if (host) { host.style.maxWidth = '375px'; host.style.margin = '0 auto'; } } else { if (btn) { btn.setAttribute('data-mode', 'desktop'); btn.innerHTML = '🖥 <span>' + (typeof I18n !== 'undefined' ? I18n.t('I18N_AI_DESKTOP', 'Desktop') : 'Desktop') + '</span>'; } if (host) { host.style.maxWidth = ''; host.style.margin = ''; } } refresh(); } function bindToggle() { var btn = document.getElementById('btn-preview-mode'); if (btn) btn.addEventListener('click', toggleMode); } function clear() { var f = getIframe(); f.srcdoc = '<html><body style="display:flex;align-items:center;justify-content:center;height:100vh;margin:0;font-family:sans-serif;color:#999;background:#1e1e2e;">' + Loading @@ -97,6 +124,9 @@ var Preview = (function() { return { refresh: refresh, clear: clear clear: clear, toggleMode: toggleMode, bindToggle: bindToggle, isMobile: function() { return _mobileMode; } }; })(); Loading
editor/html/index.html +2 −1 Changes for editor/html/index.html: 2 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -85,7 +85,8 @@ <option value="">Nicht verbunden</option> </select> <button id="btn-publish-now" disabled style="padding:0.2em 0.6em;border-radius:4px;border:1px solid var(--border);background:var(--accent);color:var(--bg-primary);font-size:0.8rem;cursor:pointer;font-weight:600;opacity:0.4">🌐 Publish</button> <select id="theme-select" title="Theme" style="margin-left:auto;padding:0.2em 0.4em;border-radius:4px;border:1px solid var(--border);background:var(--bg-secondary);color:var(--text-primary);font-size:0.8rem;cursor:pointer"> <button id="btn-preview-mode" title="Switch Desktop/Mobile Preview" style="margin-left:auto;padding:0.2em 0.6em;border-radius:4px;border:1px solid var(--border);background:var(--bg-secondary);color:var(--text-primary);font-size:0.8rem;cursor:pointer" data-mode="desktop">🖥 <span data-i18n="I18N_AI_DESKTOP">Desktop</span></button> <select id="theme-select" title="Theme" style="padding:0.2em 0.4em;border-radius:4px;border:1px solid var(--border);background:var(--bg-secondary);color:var(--text-primary);font-size:0.8rem;cursor:pointer"> <option value="dark">🌙 Dark</option> <option value="light">☀ Light</option> </select> Loading
editor/html/js/editor.js +1 −0 Changes for editor/html/js/editor.js: 1 added line, 0 removed lines. Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ try { bindAiDialog(); } catch(e) { console.error('bindAiDialog:', e); } try { bindClipboardShortcuts(); } catch(e) { console.error('bindClipboardShortcuts:', e); } try { SurveyManager.init(); } catch(e) { console.error('SurveyManager.init:', e); } try { Preview.bindToggle(); } catch(e) { console.error('Preview.bindToggle:', e); } Preview.clear(); DocumentTree.setOnSelect(function(uuid) { Loading
editor/html/js/preview.js +31 −1 Changes for editor/html/js/preview.js: 31 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ var Preview = (function() { 'use strict'; var iframe = null; var _mobileMode = false; function getIframe() { if (iframe) return iframe; Loading Loading @@ -55,6 +56,7 @@ var Preview = (function() { }; addField('authid', data.authid); addField('html', data.html); if (_mobileMode) addField('mobile', 'true'); // Send selected color scheme to blog's /render var colorScheme = document.getElementById('theme-select').value || 'dark'; Loading Loading @@ -89,6 +91,31 @@ var Preview = (function() { }); } function toggleMode() { _mobileMode = !_mobileMode; var btn = document.getElementById('btn-preview-mode'); var host = document.getElementById('preview-frame'); if (_mobileMode) { if (btn) { btn.setAttribute('data-mode', 'mobile'); btn.innerHTML = '📱 <span>' + (typeof I18n !== 'undefined' ? I18n.t('I18N_AI_MOBILE', 'Mobile') : 'Mobile') + '</span>'; } if (host) { host.style.maxWidth = '375px'; host.style.margin = '0 auto'; } } else { if (btn) { btn.setAttribute('data-mode', 'desktop'); btn.innerHTML = '🖥 <span>' + (typeof I18n !== 'undefined' ? I18n.t('I18N_AI_DESKTOP', 'Desktop') : 'Desktop') + '</span>'; } if (host) { host.style.maxWidth = ''; host.style.margin = ''; } } refresh(); } function bindToggle() { var btn = document.getElementById('btn-preview-mode'); if (btn) btn.addEventListener('click', toggleMode); } function clear() { var f = getIframe(); f.srcdoc = '<html><body style="display:flex;align-items:center;justify-content:center;height:100vh;margin:0;font-family:sans-serif;color:#999;background:#1e1e2e;">' + Loading @@ -97,6 +124,9 @@ var Preview = (function() { return { refresh: refresh, clear: clear clear: clear, toggleMode: toggleMode, bindToggle: bindToggle, isMobile: function() { return _mobileMode; } }; })();