Commit f45e952d authored by jan.koester's avatar jan.koester
Browse files

test

parent 5c8cace7
Loading
Loading
Loading
Loading
+1 −13
Changes for editor/html/index.html: 1 added line, 13 removed lines.
Original line number Diff line number Diff line
@@ -33,13 +33,10 @@
            <button id="btn-new" data-i18n-title="I18N_TITLE_NEW_TEMPLATE">&#x1F4C4; <span data-i18n="I18N_NEW">Neu</span></button>
            <button id="btn-save" data-i18n-title="I18N_TITLE_SAVE_TO_DB">&#x1F4BE; <span data-i18n="I18N_SAVE">Speichern</span></button>
            <button id="btn-save-as" data-i18n-title="I18N_TITLE_SAVE_AS_TO_DB">&#x1F4BE; <span data-i18n="I18N_SAVE_AS">Speichern unter</span></button>
            <button id="btn-doc-seo" type="button">&#x1F50D; <span data-i18n="I18N_SEO_SOCIAL">SEO &amp; Social&hellip;</span></button>
            <button id="btn-open" data-i18n-title="I18N_PROJECTS_TEMPLATES_TITLE" title="Projekte &amp; Vorlagen">&#x1F4C2; <span data-i18n="I18N_PROJECTS">Projekte</span></button>
            <button id="btn-template-wizard" title="CSV Vorlagen-Wizard">&#x1F9EA; <span>CSV-Wizard</span></button>
        </div>
        <div class="toolbar-group">
            <button id="btn-copy-el" data-i18n-title="I18N_COPY_ELEMENT">&#x2398; <span data-i18n="I18N_COPY_ELEMENT">Kopieren</span></button>
            <button id="btn-paste-el" data-i18n-title="I18N_PASTE_ELEMENT">&#x1F4CB; <span data-i18n="I18N_PASTE_ELEMENT">Einf&uuml;gen</span></button>
        </div>
        <div class="toolbar-group">
            <button id="btn-import-xml" data-i18n-title="I18N_TITLE_IMPORT_XML">&#x2B07; <span data-i18n="I18N_IMPORT_XML">Import XML</span></button>
            <button id="btn-export-xml" data-i18n-title="I18N_TITLE_EXPORT_XML">&#x2B06; <span data-i18n="I18N_EXPORT_XML">Export XML</span></button>
@@ -47,12 +44,6 @@
            <button id="btn-export-html" data-i18n-title="I18N_EXPORT_HTML">&#x2B06; <span data-i18n="I18N_EXPORT_HTML">Export HTML</span></button>
            <button id="btn-survey-manager" title="Umfragen verwalten">&#x1F4CB; <span>Umfragen</span></button>
        </div>
        <div class="toolbar-group">
            <select id="project-select" title="Projekt ausw&auml;hlen" 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="" data-i18n="I18N_ALL_PROJECTS">Alle Projekte</option>
            </select>
            <span id="project-status" title="Verbindungsstatus" style="font-size:0.8rem"></span>
        </div>
        <div class="toolbar-group">
            <button id="btn-ai" data-i18n-title="I18N_AI_TITLE">&#x1F916; <span data-i18n="I18N_AI">KI</span></button>
        </div>
@@ -185,9 +176,6 @@
        <h3 id="save-dialog-title" data-i18n="I18N_SAVE_TPL_TITLE">Dokument speichern</h3>
        <label><span data-i18n="I18N_PROJECT">Projekt</span>: <select id="save-group"></select></label>
        <label><span data-i18n="I18N_TPL_NAME_LABEL">Name</span>: <input type="text" id="save-name" data-i18n-placeholder="I18N_TPL_NAME_PLACEHOLDER" placeholder="Dokumentname"></label>
        <div class="set-field" style="display:flex;gap:0.5em;flex-wrap:wrap">
            <button id="btn-doc-seo" type="button" class="set-save-btn" style="background:var(--bg-tertiary)">&#x1F50D; <span data-i18n="I18N_SEO_SOCIAL">SEO &amp; Social&hellip;</span></button>
        </div>
        <div class="dialog-actions">
            <button id="btn-save-confirm" data-i18n="I18N_SAVE">Speichern</button>
            <button id="btn-save-cancel" data-i18n="I18N_CANCEL">Abbrechen</button>
+16 −35
Changes for editor/html/js/editor.js: 16 added lines, 35 removed lines.
Original line number Diff line number Diff line
@@ -228,6 +228,11 @@
            openSaveDialog('save-as', name === 'Untitled' ? '' : name, currentDocGroup);
        });

        document.getElementById('btn-doc-seo').addEventListener('click', function() {
            populateDocSeoDialog();
            document.getElementById('doc-seo-dialog').showModal();
        });

        document.getElementById('btn-open').addEventListener('click', function() {
            openProjectManager();
        });
@@ -462,11 +467,6 @@
            });
        });

        document.getElementById('btn-doc-seo').addEventListener('click', function() {
            populateDocSeoDialog();
            document.getElementById('doc-seo-dialog').showModal();
        });

        document.getElementById('btn-doc-seo-close').addEventListener('click', function() {
            collectDocSeoFromDialog();
            document.getElementById('doc-seo-dialog').close();
@@ -1691,41 +1691,29 @@
    // --- Project selector (toolbar) ---
    // A "project" is the same underlying entity as a saved connection (name/group/url/
    // ignore_ssl — see EditorApi.listConnections/connectToConnection and the project
    // manager dialog below). The toolbar select exposes it under project terminology:
    // picking one auto-connects and becomes the default group when saving documents.
    // manager dialog below). There's no toolbar-level picker; the project is chosen from
    // the merged Projects modal's sidebar (see renderConnectionList) and remembered
    // across reloads via localStorage.

    function initProjectSelector() {
        document.getElementById('project-select').addEventListener('change', function() {
            onProjectSelected(this.value);
        });

        loadProjectSelectOptions(function() {
            var saved = '';
            try { saved = localStorage.getItem(CURRENT_PROJECT_STORAGE_KEY) || ''; } catch(e) {}
            if (saved && projectsCache.some(function(p) { return p.id === saved; })) {
                document.getElementById('project-select').value = saved;
                onProjectSelected(saved);
            }
        });
    }

    // Fetches the project list and (re)renders the toolbar select; shared with the
    // project manager dialog (loadConnectionList) so both stay in sync after add/edit/delete.
    // Fetches the project list; shared by initial load and the project manager dialog
    // (loadConnectionList) so projectsCache stays in sync after add/edit/delete.
    function loadProjectSelectOptions(callback) {
        EditorApi.listConnections().then(function(resp) {
            projectsCache = resp.connections || [];
            renderProjectToolbarSelect();
            if (callback) callback();
        });
    }

    function renderProjectToolbarSelect() {
        var select = document.getElementById('project-select');
        select.innerHTML = '<option value="">' + I18n.t('I18N_ALL_PROJECTS', 'Alle Projekte') + '</option>';
        appendGroupedProjectOptions(select, function(p) { return p.id; });
        select.value = currentProjectId || '';
    }

    // Builds <optgroup>-grouped <option>s (grouped like the project manager's sidebar
    // list) into `select` from projectsCache; valueFn picks the option value per project.
    function appendGroupedProjectOptions(select, valueFn) {
@@ -1754,20 +1742,15 @@
        }
    }

    // Single entry point for "the user picked project X" — from the toolbar select,
    // the project-manager sidebar (#conn-list), or restoring the last project on load.
    // Keeps the toolbar select, the merged modal (title/doc-list/settings form) and the
    // auto-connect all in sync regardless of which UI triggered the change.
    // Single entry point for "the user picked project X" — from the project-manager
    // sidebar (#conn-list) or restoring the last project on load. Keeps the merged
    // modal (title/doc-list/settings form) and the auto-connect in sync regardless of
    // which UI triggered the change.
    function onProjectSelected(id) {
        var toolbarSelect = document.getElementById('project-select');
        if (toolbarSelect) toolbarSelect.value = id || '';

        if (!id) {
            currentProjectId = '';
            currentProjectName = '';
            try { localStorage.removeItem(CURRENT_PROJECT_STORAGE_KEY); } catch(e) {}
            var statusEl = document.getElementById('project-status');
            if (statusEl) { statusEl.textContent = ''; statusEl.title = ''; }
            syncProjectManagerModalUI();
            return;
        }
@@ -1784,14 +1767,12 @@

    // Auto-connect (and, via the "Not connected" retry in EditorApi, auto-reconnect on
    // the next connection-scoped call) whenever the current project changes or is
    // restored from localStorage on load. Updates both the toolbar status dot and the
    // merged modal's header status, whichever are present in the DOM right now.
    // restored from localStorage on load. Updates the merged modal's header status if
    // it's currently in the DOM.
    function connectCurrentProject() {
        if (!currentProjectId) return;
        var statusEl = document.getElementById('project-status');
        var modalStatusEl = document.getElementById('open-project-status');
        var setStatus = function(text, title) {
            if (statusEl) { statusEl.textContent = text; statusEl.title = title || ''; }
            if (modalStatusEl) { modalStatusEl.textContent = text; modalStatusEl.title = title || ''; }
        };
        setStatus(I18n.t('I18N_CONNECTING', 'Verbinde...'));