Loading editor/html/css/editor.css +9 −0 Original line number Diff line number Diff line Loading @@ -656,6 +656,8 @@ dialog label { cursor: pointer; border-radius: 4px; font-size: 0.85rem; display: flex; align-items: center; } .conn-item:hover { Loading @@ -666,3 +668,10 @@ dialog label { background: var(--accent); color: var(--bg-primary); } .conn-item.connected::after { content: '\2713'; color: #40a02b; margin-left: auto; font-weight: bold; } editor/html/index.html +35 −10 Original line number Diff line number Diff line Loading @@ -143,7 +143,7 @@ <div class="set-sidebar"> <h3 data-i18n="I18N_CONNECTIONS">Verbindungen</h3> <div id="conn-list" class="conn-list"></div> <button id="btn-conn-add" class="set-save-btn" style="margin-top:0.5em;width:100%">+ <span data-i18n="I18N_ADD">Hinzufügen</span></button> <button id="btn-conn-add" class="set-save-btn" style="margin-top:0.5em;width:100%">+ <span data-i18n="I18N_ADD">Hinzufügen</span></button> </div> <div class="set-content"> <div id="conn-form" style="display:none"> Loading @@ -161,10 +161,6 @@ <label data-i18n="I18N_BLOG_URL">URL</label> <input type="text" id="conn-url" placeholder="https://..."> </div> <div class="set-field"> <label data-i18n="I18N_BLOG_API_KEY">API Key</label> <input type="password" id="conn-apikey" placeholder=""> </div> <div class="set-field"> <label style="display:flex;align-items:center;gap:0.3em"> <input type="checkbox" id="conn-ignore-ssl"> Loading @@ -173,19 +169,48 @@ </div> <div class="set-field" style="display:flex;gap:0.5em;flex-wrap:wrap"> <button id="btn-conn-save" class="set-save-btn" data-i18n="save">Speichern</button> <button id="btn-conn-test" class="set-save-btn" data-i18n="I18N_TEST_CONNECTION">Testen</button> <button id="btn-conn-publish" class="set-save-btn" data-i18n="I18N_PUBLISH">Veröffentlichen</button> <button id="btn-conn-delete" class="set-save-btn" style="background:#c00" data-i18n="I18N_DELETE">Löschen</button> <button id="btn-conn-delete" class="set-save-btn" style="background:#c00" data-i18n="I18N_DELETE">Löschen</button> </div> <hr style="border-color:var(--border);margin:1em 0"> <!-- Login & Connect section --> <h4 data-i18n="I18N_CONNECT">Verbinden</h4> <div class="set-field"> <label data-i18n="I18N_USERNAME">Benutzername</label> <input type="text" id="conn-username" placeholder="" autocomplete="username"> </div> <div class="set-field"> <label data-i18n="I18N_PASSWORD">Passwort</label> <input type="password" id="conn-password" placeholder="" autocomplete="current-password"> </div> <div class="set-field"> <button id="btn-conn-connect" class="set-save-btn" data-i18n="I18N_CONNECT">Verbinden</button> </div> <!-- Publish section (shown after connect) --> <div id="conn-publish-section" style="display:none"> <hr style="border-color:var(--border);margin:1em 0"> <h4 data-i18n="I18N_PUBLISH">Veröffentlichen</h4> <div class="set-field"> <label data-i18n="I18N_PUBLISH_TARGET">Ziel</label> <select id="conn-publish-target"></select> </div> <div id="conn-publish-fields"></div> <div class="set-field"> <button id="btn-conn-publish" class="set-save-btn" data-i18n="I18N_PUBLISH">Veröffentlichen</button> </div> </div> <span id="conn-status" class="set-status"></span> </div> <div id="conn-placeholder"> <p class="hint" data-i18n="I18N_SELECT_CONNECTION">Verbindung auswählen oder neue hinzufügen.</p> <p class="hint" data-i18n="I18N_SELECT_CONNECTION">Verbindung auswählen oder neue hinzufügen.</p> </div> </div> </div> <div class="dialog-actions"> <button id="btn-conn-manager-close" data-i18n="Close">Schließen</button> <button id="btn-conn-manager-close" data-i18n="Close">Schließen</button> </div> </dialog> Loading editor/html/js/api.js +10 −4 Original line number Diff line number Diff line Loading @@ -222,12 +222,18 @@ var EditorApi = (function() { return request('DELETE', '/api/connection/delete/' + id); }, testConnectionById: function(id) { return request('POST', '/api/connection/test/' + id); connectToConnection: function(id, username, password) { return request('POST', '/api/connection/connect/' + id, { username: username, password: password }); }, publishToConnection: function(id) { return request('POST', '/api/connection/publish/' + id); publishToConnection: function(id, target, params) { return request('POST', '/api/connection/publish/' + id, { target: target, params: params || {} }); }, // HTML import/export Loading editor/html/js/editor.js +147 −19 Original line number Diff line number Diff line Loading @@ -641,6 +641,9 @@ // --- Connection Manager --- // Track which connections are currently "connected" (have authid on server) var connectedConnections = {}; function openConnectionManager() { document.getElementById('conn-form').style.display = 'none'; document.getElementById('conn-placeholder').style.display = 'block'; Loading @@ -665,14 +668,15 @@ document.getElementById('conn-group').value = ''; document.getElementById('conn-name').value = ''; document.getElementById('conn-url').value = ''; document.getElementById('conn-apikey').value = ''; document.getElementById('conn-ignore-ssl').checked = false; document.getElementById('conn-username').value = ''; document.getElementById('conn-password').value = ''; document.getElementById('conn-publish-section').style.display = 'none'; document.getElementById('conn-form').style.display = 'block'; document.getElementById('conn-placeholder').style.display = 'none'; document.getElementById('conn-status').textContent = ''; document.getElementById('btn-conn-delete').style.display = 'none'; document.getElementById('btn-conn-publish').style.display = 'none'; document.getElementById('btn-conn-test').style.display = 'none'; document.getElementById('btn-conn-connect').style.display = 'none'; }); document.getElementById('btn-conn-save').addEventListener('click', function() { Loading @@ -682,7 +686,6 @@ name: document.getElementById('conn-name').value, group: document.getElementById('conn-group').value, url: document.getElementById('conn-url').value, api_key: document.getElementById('conn-apikey').value, ignore_ssl: document.getElementById('conn-ignore-ssl').checked }; if (!conn.name || !conn.url) { Loading @@ -696,8 +699,7 @@ status.className = 'set-status success'; document.getElementById('conn-edit-id').value = resp.id || ''; document.getElementById('btn-conn-delete').style.display = ''; document.getElementById('btn-conn-publish').style.display = ''; document.getElementById('btn-conn-test').style.display = ''; document.getElementById('btn-conn-connect').style.display = ''; loadConnectionList(); setTimeout(function() { status.textContent = ''; status.className = 'set-status'; }, 2000); }).catch(function(err) { Loading @@ -709,44 +711,161 @@ document.getElementById('btn-conn-delete').addEventListener('click', function() { var id = document.getElementById('conn-edit-id').value; if (!id) return; if (!confirm(I18n.t('I18N_REMOVE_CONFIRM', 'Wirklich löschen') + '?')) return; if (!confirm(I18n.t('I18N_REMOVE_CONFIRM', 'Wirklich l\u00f6schen') + '?')) return; EditorApi.deleteConnection(id).then(function() { delete connectedConnections[id]; document.getElementById('conn-form').style.display = 'none'; document.getElementById('conn-placeholder').style.display = 'block'; loadConnectionList(); }); }); document.getElementById('btn-conn-test').addEventListener('click', function() { // Connect button: login to blog server document.getElementById('btn-conn-connect').addEventListener('click', function() { var id = document.getElementById('conn-edit-id').value; if (!id) return; var username = document.getElementById('conn-username').value; var password = document.getElementById('conn-password').value; if (!username || !password) { var status = document.getElementById('conn-status'); status.textContent = I18n.t('I18N_LOGIN_REQUIRED', 'Benutzername und Passwort eingeben'); status.className = 'set-status error'; return; } var status = document.getElementById('conn-status'); status.textContent = I18n.t('I18N_TESTING', 'Teste...'); status.textContent = I18n.t('I18N_CONNECTING', 'Verbinde...'); status.className = 'set-status'; EditorApi.testConnectionById(id).then(function() { status.textContent = I18n.t('I18N_CONNECTION_OK', 'Verbindung erfolgreich'); EditorApi.connectToConnection(id, username, password).then(function(resp) { connectedConnections[id] = true; status.textContent = I18n.t('I18N_CONNECTION_OK', 'Verbunden'); status.className = 'set-status success'; // Clear password from UI document.getElementById('conn-password').value = ''; // Show publish section with targets var targets = resp.targets || []; showPublishTargets(targets); // Update list to show connected state loadConnectionList(); }).catch(function(err) { status.textContent = I18n.t('I18N_CONNECTION_FAILED', 'Verbindung fehlgeschlagen') + ': ' + (err.error || ''); status.className = 'set-status error'; document.getElementById('conn-publish-section').style.display = 'none'; }); }); // Publish button document.getElementById('btn-conn-publish').addEventListener('click', function() { var id = document.getElementById('conn-edit-id').value; if (!id) return; if (!confirm(I18n.t('I18N_PUBLISH_CONFIRM', 'Dokument veröffentlichen?'))) return; var targetSelect = document.getElementById('conn-publish-target'); var target = targetSelect.value; if (!target) return; // Collect dynamic fields var params = {}; var fieldsContainer = document.getElementById('conn-publish-fields'); var inputs = fieldsContainer.querySelectorAll('[data-publish-key]'); for (var i = 0; i < inputs.length; i++) { var key = inputs[i].getAttribute('data-publish-key'); if (inputs[i].type === 'checkbox') { params[key] = inputs[i].checked; } else { params[key] = inputs[i].value; } } if (!confirm(I18n.t('I18N_PUBLISH_CONFIRM', 'Dokument ver\u00f6ffentlichen?'))) return; var status = document.getElementById('conn-status'); status.textContent = I18n.t('I18N_PUBLISHING', 'Veröffentliche...'); status.textContent = I18n.t('I18N_PUBLISHING', 'Ver\u00f6ffentliche...'); status.className = 'set-status'; EditorApi.publishToConnection(id).then(function() { status.textContent = I18n.t('I18N_PUBLISH_SUCCESS', 'Erfolgreich veröffentlicht'); EditorApi.publishToConnection(id, target, params).then(function() { status.textContent = I18n.t('I18N_PUBLISH_SUCCESS', 'Erfolgreich ver\u00f6ffentlicht'); status.className = 'set-status success'; }).catch(function(err) { status.textContent = I18n.t('I18N_PUBLISH_FAILED', 'Veröffentlichung fehlgeschlagen') + ': ' + (err.error || ''); status.textContent = I18n.t('I18N_PUBLISH_FAILED', 'Ver\u00f6ffentlichung fehlgeschlagen') + ': ' + (err.error || ''); status.className = 'set-status error'; if (err.error && err.error.indexOf('Not connected') !== -1) { delete connectedConnections[id]; document.getElementById('conn-publish-section').style.display = 'none'; } }); }); // Target select change: render dynamic fields document.getElementById('conn-publish-target').addEventListener('change', function() { renderPublishFields(this.value); }); } // Current targets cache for dynamic field rendering var currentPublishTargets = []; function showPublishTargets(targets) { currentPublishTargets = targets; var section = document.getElementById('conn-publish-section'); var select = document.getElementById('conn-publish-target'); select.innerHTML = ''; if (!targets || targets.length === 0) { section.style.display = 'none'; return; } for (var i = 0; i < targets.length; i++) { var opt = document.createElement('option'); opt.value = targets[i].name; opt.textContent = targets[i].name; select.appendChild(opt); } section.style.display = 'block'; renderPublishFields(targets[0].name); } function renderPublishFields(targetName) { var container = document.getElementById('conn-publish-fields'); container.innerHTML = ''; var target = null; for (var i = 0; i < currentPublishTargets.length; i++) { if (currentPublishTargets[i].name === targetName) { target = currentPublishTargets[i]; break; } } if (!target || !target.fields) return; var fields = target.fields; for (var f = 0; f < fields.length; f++) { var field = fields[f]; var div = document.createElement('div'); div.className = 'set-field'; var label = document.createElement('label'); label.textContent = field.label || field.key; div.appendChild(label); if (field.type === 'select' && field.options) { var sel = document.createElement('select'); sel.setAttribute('data-publish-key', field.key); for (var o = 0; o < field.options.length; o++) { var optEl = document.createElement('option'); optEl.value = field.options[o].value; optEl.textContent = field.options[o].label; sel.appendChild(optEl); } div.appendChild(sel); } else { var inp = document.createElement('input'); inp.type = field.type || 'text'; inp.setAttribute('data-publish-key', field.key); if (field.placeholder) inp.placeholder = field.placeholder; if (field.required) inp.required = true; div.appendChild(inp); } container.appendChild(div); } } function loadConnectionList() { Loading Loading @@ -781,6 +900,9 @@ var conn = conns[ci]; var item = document.createElement('div'); item.className = 'conn-item'; if (connectedConnections[conn.id]) { item.classList.add('connected'); } item.textContent = conn.name; item.setAttribute('data-conn', JSON.stringify(conn)); item.addEventListener('click', function() { Loading @@ -789,14 +911,20 @@ document.getElementById('conn-group').value = c.group || ''; document.getElementById('conn-name').value = c.name; document.getElementById('conn-url').value = c.url; document.getElementById('conn-apikey').value = c.api_key || ''; document.getElementById('conn-ignore-ssl').checked = c.ignore_ssl || false; document.getElementById('conn-username').value = ''; document.getElementById('conn-password').value = ''; document.getElementById('conn-form').style.display = 'block'; document.getElementById('conn-placeholder').style.display = 'none'; document.getElementById('conn-status').textContent = ''; document.getElementById('btn-conn-delete').style.display = ''; document.getElementById('btn-conn-publish').style.display = ''; document.getElementById('btn-conn-test').style.display = ''; document.getElementById('btn-conn-connect').style.display = ''; // Show/hide publish section based on connected state if (connectedConnections[c.id]) { document.getElementById('conn-publish-section').style.display = 'block'; } else { document.getElementById('conn-publish-section').style.display = 'none'; } // Highlight selected var items = document.querySelectorAll('.conn-item'); for (var j = 0; j < items.length; j++) items[j].classList.remove('selected'); Loading editor/src/webedit_api.cpp +230 −58 File changed.Preview size limit exceeded, changes collapsed. Show changes Loading
editor/html/css/editor.css +9 −0 Original line number Diff line number Diff line Loading @@ -656,6 +656,8 @@ dialog label { cursor: pointer; border-radius: 4px; font-size: 0.85rem; display: flex; align-items: center; } .conn-item:hover { Loading @@ -666,3 +668,10 @@ dialog label { background: var(--accent); color: var(--bg-primary); } .conn-item.connected::after { content: '\2713'; color: #40a02b; margin-left: auto; font-weight: bold; }
editor/html/index.html +35 −10 Original line number Diff line number Diff line Loading @@ -143,7 +143,7 @@ <div class="set-sidebar"> <h3 data-i18n="I18N_CONNECTIONS">Verbindungen</h3> <div id="conn-list" class="conn-list"></div> <button id="btn-conn-add" class="set-save-btn" style="margin-top:0.5em;width:100%">+ <span data-i18n="I18N_ADD">Hinzufügen</span></button> <button id="btn-conn-add" class="set-save-btn" style="margin-top:0.5em;width:100%">+ <span data-i18n="I18N_ADD">Hinzufügen</span></button> </div> <div class="set-content"> <div id="conn-form" style="display:none"> Loading @@ -161,10 +161,6 @@ <label data-i18n="I18N_BLOG_URL">URL</label> <input type="text" id="conn-url" placeholder="https://..."> </div> <div class="set-field"> <label data-i18n="I18N_BLOG_API_KEY">API Key</label> <input type="password" id="conn-apikey" placeholder=""> </div> <div class="set-field"> <label style="display:flex;align-items:center;gap:0.3em"> <input type="checkbox" id="conn-ignore-ssl"> Loading @@ -173,19 +169,48 @@ </div> <div class="set-field" style="display:flex;gap:0.5em;flex-wrap:wrap"> <button id="btn-conn-save" class="set-save-btn" data-i18n="save">Speichern</button> <button id="btn-conn-test" class="set-save-btn" data-i18n="I18N_TEST_CONNECTION">Testen</button> <button id="btn-conn-publish" class="set-save-btn" data-i18n="I18N_PUBLISH">Veröffentlichen</button> <button id="btn-conn-delete" class="set-save-btn" style="background:#c00" data-i18n="I18N_DELETE">Löschen</button> <button id="btn-conn-delete" class="set-save-btn" style="background:#c00" data-i18n="I18N_DELETE">Löschen</button> </div> <hr style="border-color:var(--border);margin:1em 0"> <!-- Login & Connect section --> <h4 data-i18n="I18N_CONNECT">Verbinden</h4> <div class="set-field"> <label data-i18n="I18N_USERNAME">Benutzername</label> <input type="text" id="conn-username" placeholder="" autocomplete="username"> </div> <div class="set-field"> <label data-i18n="I18N_PASSWORD">Passwort</label> <input type="password" id="conn-password" placeholder="" autocomplete="current-password"> </div> <div class="set-field"> <button id="btn-conn-connect" class="set-save-btn" data-i18n="I18N_CONNECT">Verbinden</button> </div> <!-- Publish section (shown after connect) --> <div id="conn-publish-section" style="display:none"> <hr style="border-color:var(--border);margin:1em 0"> <h4 data-i18n="I18N_PUBLISH">Veröffentlichen</h4> <div class="set-field"> <label data-i18n="I18N_PUBLISH_TARGET">Ziel</label> <select id="conn-publish-target"></select> </div> <div id="conn-publish-fields"></div> <div class="set-field"> <button id="btn-conn-publish" class="set-save-btn" data-i18n="I18N_PUBLISH">Veröffentlichen</button> </div> </div> <span id="conn-status" class="set-status"></span> </div> <div id="conn-placeholder"> <p class="hint" data-i18n="I18N_SELECT_CONNECTION">Verbindung auswählen oder neue hinzufügen.</p> <p class="hint" data-i18n="I18N_SELECT_CONNECTION">Verbindung auswählen oder neue hinzufügen.</p> </div> </div> </div> <div class="dialog-actions"> <button id="btn-conn-manager-close" data-i18n="Close">Schließen</button> <button id="btn-conn-manager-close" data-i18n="Close">Schließen</button> </div> </dialog> Loading
editor/html/js/api.js +10 −4 Original line number Diff line number Diff line Loading @@ -222,12 +222,18 @@ var EditorApi = (function() { return request('DELETE', '/api/connection/delete/' + id); }, testConnectionById: function(id) { return request('POST', '/api/connection/test/' + id); connectToConnection: function(id, username, password) { return request('POST', '/api/connection/connect/' + id, { username: username, password: password }); }, publishToConnection: function(id) { return request('POST', '/api/connection/publish/' + id); publishToConnection: function(id, target, params) { return request('POST', '/api/connection/publish/' + id, { target: target, params: params || {} }); }, // HTML import/export Loading
editor/html/js/editor.js +147 −19 Original line number Diff line number Diff line Loading @@ -641,6 +641,9 @@ // --- Connection Manager --- // Track which connections are currently "connected" (have authid on server) var connectedConnections = {}; function openConnectionManager() { document.getElementById('conn-form').style.display = 'none'; document.getElementById('conn-placeholder').style.display = 'block'; Loading @@ -665,14 +668,15 @@ document.getElementById('conn-group').value = ''; document.getElementById('conn-name').value = ''; document.getElementById('conn-url').value = ''; document.getElementById('conn-apikey').value = ''; document.getElementById('conn-ignore-ssl').checked = false; document.getElementById('conn-username').value = ''; document.getElementById('conn-password').value = ''; document.getElementById('conn-publish-section').style.display = 'none'; document.getElementById('conn-form').style.display = 'block'; document.getElementById('conn-placeholder').style.display = 'none'; document.getElementById('conn-status').textContent = ''; document.getElementById('btn-conn-delete').style.display = 'none'; document.getElementById('btn-conn-publish').style.display = 'none'; document.getElementById('btn-conn-test').style.display = 'none'; document.getElementById('btn-conn-connect').style.display = 'none'; }); document.getElementById('btn-conn-save').addEventListener('click', function() { Loading @@ -682,7 +686,6 @@ name: document.getElementById('conn-name').value, group: document.getElementById('conn-group').value, url: document.getElementById('conn-url').value, api_key: document.getElementById('conn-apikey').value, ignore_ssl: document.getElementById('conn-ignore-ssl').checked }; if (!conn.name || !conn.url) { Loading @@ -696,8 +699,7 @@ status.className = 'set-status success'; document.getElementById('conn-edit-id').value = resp.id || ''; document.getElementById('btn-conn-delete').style.display = ''; document.getElementById('btn-conn-publish').style.display = ''; document.getElementById('btn-conn-test').style.display = ''; document.getElementById('btn-conn-connect').style.display = ''; loadConnectionList(); setTimeout(function() { status.textContent = ''; status.className = 'set-status'; }, 2000); }).catch(function(err) { Loading @@ -709,44 +711,161 @@ document.getElementById('btn-conn-delete').addEventListener('click', function() { var id = document.getElementById('conn-edit-id').value; if (!id) return; if (!confirm(I18n.t('I18N_REMOVE_CONFIRM', 'Wirklich löschen') + '?')) return; if (!confirm(I18n.t('I18N_REMOVE_CONFIRM', 'Wirklich l\u00f6schen') + '?')) return; EditorApi.deleteConnection(id).then(function() { delete connectedConnections[id]; document.getElementById('conn-form').style.display = 'none'; document.getElementById('conn-placeholder').style.display = 'block'; loadConnectionList(); }); }); document.getElementById('btn-conn-test').addEventListener('click', function() { // Connect button: login to blog server document.getElementById('btn-conn-connect').addEventListener('click', function() { var id = document.getElementById('conn-edit-id').value; if (!id) return; var username = document.getElementById('conn-username').value; var password = document.getElementById('conn-password').value; if (!username || !password) { var status = document.getElementById('conn-status'); status.textContent = I18n.t('I18N_LOGIN_REQUIRED', 'Benutzername und Passwort eingeben'); status.className = 'set-status error'; return; } var status = document.getElementById('conn-status'); status.textContent = I18n.t('I18N_TESTING', 'Teste...'); status.textContent = I18n.t('I18N_CONNECTING', 'Verbinde...'); status.className = 'set-status'; EditorApi.testConnectionById(id).then(function() { status.textContent = I18n.t('I18N_CONNECTION_OK', 'Verbindung erfolgreich'); EditorApi.connectToConnection(id, username, password).then(function(resp) { connectedConnections[id] = true; status.textContent = I18n.t('I18N_CONNECTION_OK', 'Verbunden'); status.className = 'set-status success'; // Clear password from UI document.getElementById('conn-password').value = ''; // Show publish section with targets var targets = resp.targets || []; showPublishTargets(targets); // Update list to show connected state loadConnectionList(); }).catch(function(err) { status.textContent = I18n.t('I18N_CONNECTION_FAILED', 'Verbindung fehlgeschlagen') + ': ' + (err.error || ''); status.className = 'set-status error'; document.getElementById('conn-publish-section').style.display = 'none'; }); }); // Publish button document.getElementById('btn-conn-publish').addEventListener('click', function() { var id = document.getElementById('conn-edit-id').value; if (!id) return; if (!confirm(I18n.t('I18N_PUBLISH_CONFIRM', 'Dokument veröffentlichen?'))) return; var targetSelect = document.getElementById('conn-publish-target'); var target = targetSelect.value; if (!target) return; // Collect dynamic fields var params = {}; var fieldsContainer = document.getElementById('conn-publish-fields'); var inputs = fieldsContainer.querySelectorAll('[data-publish-key]'); for (var i = 0; i < inputs.length; i++) { var key = inputs[i].getAttribute('data-publish-key'); if (inputs[i].type === 'checkbox') { params[key] = inputs[i].checked; } else { params[key] = inputs[i].value; } } if (!confirm(I18n.t('I18N_PUBLISH_CONFIRM', 'Dokument ver\u00f6ffentlichen?'))) return; var status = document.getElementById('conn-status'); status.textContent = I18n.t('I18N_PUBLISHING', 'Veröffentliche...'); status.textContent = I18n.t('I18N_PUBLISHING', 'Ver\u00f6ffentliche...'); status.className = 'set-status'; EditorApi.publishToConnection(id).then(function() { status.textContent = I18n.t('I18N_PUBLISH_SUCCESS', 'Erfolgreich veröffentlicht'); EditorApi.publishToConnection(id, target, params).then(function() { status.textContent = I18n.t('I18N_PUBLISH_SUCCESS', 'Erfolgreich ver\u00f6ffentlicht'); status.className = 'set-status success'; }).catch(function(err) { status.textContent = I18n.t('I18N_PUBLISH_FAILED', 'Veröffentlichung fehlgeschlagen') + ': ' + (err.error || ''); status.textContent = I18n.t('I18N_PUBLISH_FAILED', 'Ver\u00f6ffentlichung fehlgeschlagen') + ': ' + (err.error || ''); status.className = 'set-status error'; if (err.error && err.error.indexOf('Not connected') !== -1) { delete connectedConnections[id]; document.getElementById('conn-publish-section').style.display = 'none'; } }); }); // Target select change: render dynamic fields document.getElementById('conn-publish-target').addEventListener('change', function() { renderPublishFields(this.value); }); } // Current targets cache for dynamic field rendering var currentPublishTargets = []; function showPublishTargets(targets) { currentPublishTargets = targets; var section = document.getElementById('conn-publish-section'); var select = document.getElementById('conn-publish-target'); select.innerHTML = ''; if (!targets || targets.length === 0) { section.style.display = 'none'; return; } for (var i = 0; i < targets.length; i++) { var opt = document.createElement('option'); opt.value = targets[i].name; opt.textContent = targets[i].name; select.appendChild(opt); } section.style.display = 'block'; renderPublishFields(targets[0].name); } function renderPublishFields(targetName) { var container = document.getElementById('conn-publish-fields'); container.innerHTML = ''; var target = null; for (var i = 0; i < currentPublishTargets.length; i++) { if (currentPublishTargets[i].name === targetName) { target = currentPublishTargets[i]; break; } } if (!target || !target.fields) return; var fields = target.fields; for (var f = 0; f < fields.length; f++) { var field = fields[f]; var div = document.createElement('div'); div.className = 'set-field'; var label = document.createElement('label'); label.textContent = field.label || field.key; div.appendChild(label); if (field.type === 'select' && field.options) { var sel = document.createElement('select'); sel.setAttribute('data-publish-key', field.key); for (var o = 0; o < field.options.length; o++) { var optEl = document.createElement('option'); optEl.value = field.options[o].value; optEl.textContent = field.options[o].label; sel.appendChild(optEl); } div.appendChild(sel); } else { var inp = document.createElement('input'); inp.type = field.type || 'text'; inp.setAttribute('data-publish-key', field.key); if (field.placeholder) inp.placeholder = field.placeholder; if (field.required) inp.required = true; div.appendChild(inp); } container.appendChild(div); } } function loadConnectionList() { Loading Loading @@ -781,6 +900,9 @@ var conn = conns[ci]; var item = document.createElement('div'); item.className = 'conn-item'; if (connectedConnections[conn.id]) { item.classList.add('connected'); } item.textContent = conn.name; item.setAttribute('data-conn', JSON.stringify(conn)); item.addEventListener('click', function() { Loading @@ -789,14 +911,20 @@ document.getElementById('conn-group').value = c.group || ''; document.getElementById('conn-name').value = c.name; document.getElementById('conn-url').value = c.url; document.getElementById('conn-apikey').value = c.api_key || ''; document.getElementById('conn-ignore-ssl').checked = c.ignore_ssl || false; document.getElementById('conn-username').value = ''; document.getElementById('conn-password').value = ''; document.getElementById('conn-form').style.display = 'block'; document.getElementById('conn-placeholder').style.display = 'none'; document.getElementById('conn-status').textContent = ''; document.getElementById('btn-conn-delete').style.display = ''; document.getElementById('btn-conn-publish').style.display = ''; document.getElementById('btn-conn-test').style.display = ''; document.getElementById('btn-conn-connect').style.display = ''; // Show/hide publish section based on connected state if (connectedConnections[c.id]) { document.getElementById('conn-publish-section').style.display = 'block'; } else { document.getElementById('conn-publish-section').style.display = 'none'; } // Highlight selected var items = document.querySelectorAll('.conn-item'); for (var j = 0; j < items.length; j++) items[j].classList.remove('selected'); Loading
editor/src/webedit_api.cpp +230 −58 File changed.Preview size limit exceeded, changes collapsed. Show changes