Loading editor/html/js/preview.js +9 −0 Changes for editor/html/js/preview.js: 9 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -122,11 +122,20 @@ var Preview = (function() { '<p>Vorschau wird hier angezeigt.</p></body></html>'; } function highlight(uuid) { var f = getIframe(); if (!f.contentWindow) return; try { f.contentWindow.postMessage({ type: 'blogi-highlight', uuid: uuid || null }, '*'); } catch (e) { /* iframe not ready yet */ } } return { refresh: refresh, clear: clear, toggleMode: toggleMode, bindToggle: bindToggle, highlight: highlight, isMobile: function() { return _mobileMode; } }; })(); editor/html/js/properties.js +2 −0 Changes for editor/html/js/properties.js: 2 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ var PropertiesPanel = (function() { } currentUuid = uuid; if (typeof Preview !== 'undefined') Preview.highlight(uuid); var container = document.getElementById('properties-content'); if (!uuid) { Loading Loading @@ -868,6 +869,7 @@ var PropertiesPanel = (function() { } currentUuid = null; currentSchema = null; if (typeof Preview !== 'undefined') Preview.highlight(null); var container = document.getElementById('properties-content'); container.innerHTML = '<p class="hint">Element auswählen um Eigenschaften zu bearbeiten.</p>'; } Loading editor/src/webedit_api.cpp +24 −0 Changes for editor/src/webedit_api.cpp: 24 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -1441,6 +1441,30 @@ void webedit::Api::handlePreviewPage(libhttppp::HttpRequest &curreq, "})();</script>"; } // Highlight the element selected in the editor's document tree. Every // widget's root node carries a "we-<instance_id>" class (see each // widget's Render()), so the editor just needs to tell us which // instance id is selected via postMessage. widgetHtml += "<script>(function(){" "var hl=null;" "function clearHl(){if(hl){hl.style.outline='';hl.style.outlineOffset='';hl=null;}}" "window.addEventListener('message',function(ev){" "var d=ev.data;" "if(!d||d.type!=='blogi-highlight')return;" "clearHl();" "if(d.uuid){" "var els=document.getElementsByClassName('we-'+d.uuid);" "if(els.length){" "hl=els[0];" "hl.style.outline='2px solid #ff5722';" "hl.style.outlineOffset='-2px';" "hl.scrollIntoView({block:'nearest',behavior:'smooth'});" "}" "}" "});" "})();</script>"; json_object *resp = json_object_new_object(); json_object_object_add(resp, "blogUrl", json_object_new_string(blogUrl.c_str())); json_object_object_add(resp, "authid", json_object_new_string(authid.c_str())); Loading Loading
editor/html/js/preview.js +9 −0 Changes for editor/html/js/preview.js: 9 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -122,11 +122,20 @@ var Preview = (function() { '<p>Vorschau wird hier angezeigt.</p></body></html>'; } function highlight(uuid) { var f = getIframe(); if (!f.contentWindow) return; try { f.contentWindow.postMessage({ type: 'blogi-highlight', uuid: uuid || null }, '*'); } catch (e) { /* iframe not ready yet */ } } return { refresh: refresh, clear: clear, toggleMode: toggleMode, bindToggle: bindToggle, highlight: highlight, isMobile: function() { return _mobileMode; } }; })();
editor/html/js/properties.js +2 −0 Changes for editor/html/js/properties.js: 2 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ var PropertiesPanel = (function() { } currentUuid = uuid; if (typeof Preview !== 'undefined') Preview.highlight(uuid); var container = document.getElementById('properties-content'); if (!uuid) { Loading Loading @@ -868,6 +869,7 @@ var PropertiesPanel = (function() { } currentUuid = null; currentSchema = null; if (typeof Preview !== 'undefined') Preview.highlight(null); var container = document.getElementById('properties-content'); container.innerHTML = '<p class="hint">Element auswählen um Eigenschaften zu bearbeiten.</p>'; } Loading
editor/src/webedit_api.cpp +24 −0 Changes for editor/src/webedit_api.cpp: 24 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -1441,6 +1441,30 @@ void webedit::Api::handlePreviewPage(libhttppp::HttpRequest &curreq, "})();</script>"; } // Highlight the element selected in the editor's document tree. Every // widget's root node carries a "we-<instance_id>" class (see each // widget's Render()), so the editor just needs to tell us which // instance id is selected via postMessage. widgetHtml += "<script>(function(){" "var hl=null;" "function clearHl(){if(hl){hl.style.outline='';hl.style.outlineOffset='';hl=null;}}" "window.addEventListener('message',function(ev){" "var d=ev.data;" "if(!d||d.type!=='blogi-highlight')return;" "clearHl();" "if(d.uuid){" "var els=document.getElementsByClassName('we-'+d.uuid);" "if(els.length){" "hl=els[0];" "hl.style.outline='2px solid #ff5722';" "hl.style.outlineOffset='-2px';" "hl.scrollIntoView({block:'nearest',behavior:'smooth'});" "}" "}" "});" "})();</script>"; json_object *resp = json_object_new_object(); json_object_object_add(resp, "blogUrl", json_object_new_string(blogUrl.c_str())); json_object_object_add(resp, "authid", json_object_new_string(authid.c_str())); Loading