Commit 57ea97ef authored by jan.koester's avatar jan.koester
Browse files

test

parent aa7045f4
Loading
Loading
Loading
Loading
+16 −10
Changes for client/CMakeLists.txt: 16 added lines, 10 removed lines.
Original line number Diff line number Diff line
cmake_minimum_required(VERSION 3.18)

find_package(Qt6 REQUIRED COMPONENTS Core Widgets WebEngineWidgets Network)
find_package(Qt6 REQUIRED COMPONENTS Core Widgets Quick QuickControls2 WebEngineQuick Network)
qt_standard_project_setup()

set(CMAKE_AUTOMOC ON)

qt_add_executable(blogi-editor
    main.cpp
    mainwindow.cpp
    mainwindow.h
    documentmanager.cpp
    documentmanager.h
    publishclient.cpp
@@ -17,18 +15,26 @@ qt_add_executable(blogi-editor
    localapi.h
)

qt_add_resources(blogi-editor "editor_resources"
    PREFIX "/editor"
    FILES
        html/editor.html
        html/editor.css
        html/editor.js
qt_add_qml_module(blogi-editor
    URI BlogiEditor
    VERSION 1.0
    QML_FILES
        qml/Main.qml
        qml/Theme.qml
        qml/SidebarSection.qml
        qml/WidgetToolbar.qml
        qml/DocumentTree.qml
        qml/PropertyPanel.qml
        qml/PreviewPane.qml
    RESOURCE_PREFIX /editor
)

target_link_libraries(blogi-editor PRIVATE
    Qt6::Core
    Qt6::Widgets
    Qt6::WebEngineWidgets
    Qt6::Quick
    Qt6::QuickControls2
    Qt6::WebEngineQuick
    Qt6::Network
    blogidev
    tinyxml2::tinyxml2

client/html/editor.css

deleted100644 → 0
+0 −286
Changes for client/html/editor.css: 0 added lines, 286 removed lines.
Original line number Diff line number Diff line
/* Blogi Desktop Editor – Dark Theme */
:root {
    --bg-primary: #1e1e2e;
    --bg-secondary: #2b2b3d;
    --bg-tertiary: #363650;
    --bg-hover: #3f3f5c;
    --text-primary: #cdd6f4;
    --text-secondary: #9399b2;
    --text-muted: #6c7086;
    --accent: #89b4fa;
    --accent-hover: #74c7ec;
    --border: #45475a;
    --success: #a6e3a1;
    --warning: #f9e2af;
    --danger: #f38ba8;
    --radius: 6px;
    --shadow: 0 2px 8px rgba(0,0,0,0.3);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
}

/* Layout */
#app {
    display: grid;
    grid-template-columns: 320px 6px 1fr;
    grid-template-rows: 48px 1fr;
    height: 100vh;
}

/* Header */
#header {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
}
#header h1 { font-size: 16px; font-weight: 600; }
#header .view-toggle {
    margin-left: auto;
    display: flex; gap: 4px;
}
#header .view-toggle button {
    padding: 4px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 12px;
}
#header .view-toggle button.active {
    background: var(--accent);
    color: var(--bg-primary);
    border-color: var(--accent);
}

/* Sidebar */
#sidebar {
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Resizer */
#resizer {
    background: var(--border);
    cursor: col-resize;
    transition: background 0.2s;
}
#resizer:hover { background: var(--accent); }

/* Preview */
#preview-container {
    overflow: auto;
    background: #fff;
    position: relative;
}
#preview-frame {
    width: 100%;
    height: 100%;
    border: none;
    background: #fff;
}
#preview-frame.mobile {
    width: 375px;
    margin: 0 auto;
    display: block;
}

/* Sections */
.section { margin-bottom: 8px; }
.section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

/* Plugin toolbar */
#plugin-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}
.plugin-btn {
    padding: 8px 4px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 11px;
    text-align: center;
    transition: all 0.15s;
}
.plugin-btn:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
}

/* Document tree */
#doc-tree { font-size: 13px; }
.tree-node {
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    user-select: none;
}
.tree-node:hover { background: var(--bg-hover); }
.tree-node.selected { background: var(--accent); color: var(--bg-primary); }
.tree-node .expand-icon {
    width: 16px; text-align: center;
    font-size: 10px; color: var(--text-muted);
}
.tree-children { padding-left: 16px; }

/* Context menu buttons */
.node-actions {
    margin-left: auto;
    display: flex; gap: 2px;
    opacity: 0;
    transition: opacity 0.15s;
}
.tree-node:hover .node-actions { opacity: 1; }
.node-action-btn {
    width: 22px; height: 22px;
    border: none; border-radius: 3px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 12px;
    display: flex; align-items: center; justify-content: center;
}
.node-action-btn:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.node-action-btn.danger:hover { color: var(--danger); }

/* Properties panel */
#properties-panel {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.prop-group { margin-bottom: 4px; }
.prop-group label {
    display: block;
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}
.prop-group input[type="text"],
.prop-group input[type="color"],
.prop-group input[type="number"],
.prop-group select,
.prop-group textarea {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 13px;
}
.prop-group textarea { min-height: 60px; resize: vertical; }
.prop-group input:focus,
.prop-group select:focus,
.prop-group textarea:focus {
    outline: none;
    border-color: var(--accent);
}
.prop-group input[type="checkbox"] { width: auto; margin-right: 6px; }

/* Rich text toolbar */
.richtext-toolbar {
    display: flex; flex-wrap: wrap; gap: 2px;
    padding: 4px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: var(--radius) var(--radius) 0 0;
}
.richtext-toolbar button {
    padding: 4px 8px;
    border: none; border-radius: 3px;
    background: transparent;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 12px;
}
.richtext-toolbar button:hover { background: var(--bg-hover); }
.richtext-area {
    min-height: 100px;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 0 0 var(--radius) var(--radius);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    outline: none;
}

/* Mobile overrides section */
.mobile-section {
    border-top: 1px solid var(--border);
    padding-top: 8px;
    margin-top: 8px;
}
.mobile-section .section-title { color: var(--warning); }

/* Buttons */
.btn {
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 12px;
    transition: all 0.15s;
}
.btn:hover { background: var(--bg-hover); }
.btn-primary {
    background: var(--accent);
    color: var(--bg-primary);
    border-color: var(--accent);
}
.btn-primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}
.btn-danger {
    border-color: var(--danger);
    color: var(--danger);
}
.btn-danger:hover { background: rgba(243,139,168,0.15); }

/* Status */
#status-bar {
    font-size: 11px;
    color: var(--text-muted);
    padding: 4px 0;
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

client/html/editor.html

deleted100644 → 0
+0 −50
Changes for client/html/editor.html: 0 added lines, 50 removed lines.
Original line number Diff line number Diff line
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Blogi Editor</title>
    <link rel="stylesheet" href="qrc:/editor/html/editor.css">
    <script src="qrc:/qtwebchannel/qwebchannel.js"></script>
</head>
<body>
<div id="app">
    <div id="header">
        <h1>Blogi Editor</h1>
        <div class="view-toggle">
            <button id="btn-desktop" class="active" onclick="setViewMode('desktop')">Desktop</button>
            <button id="btn-mobile" onclick="setViewMode('mobile')">Mobile</button>
        </div>
    </div>

    <div id="sidebar">
        <div class="section">
            <div class="section-title">Widgets</div>
            <div id="plugin-grid"></div>
        </div>

        <div class="section">
            <div class="section-title">Document Tree</div>
            <div id="doc-tree"></div>
        </div>

        <div class="section">
            <div class="section-title">Properties</div>
            <div id="properties-panel">
                <p style="color:var(--text-muted);font-size:12px;">Select an element to edit properties.</p>
            </div>
        </div>

        <div id="status-bar">Ready</div>
    </div>

    <div id="resizer"></div>

    <div id="preview-container">
        <iframe id="preview-frame" sandbox="allow-same-origin"></iframe>
    </div>
</div>

<script src="qrc:/editor/html/editor.js"></script>
</body>
</html>

client/html/editor.js

deleted100644 → 0
+0 −347
Changes for client/html/editor.js: 0 added lines, 347 removed lines.
Original line number Diff line number Diff line
/* Blogi Desktop Editor – JavaScript bridge via QWebChannel */
"use strict";

let api = null;
let selectedUuid = null;
let pluginTypes = [];
let debounceTimer = null;

/* ---- QWebChannel Init ---- */
document.addEventListener("DOMContentLoaded", () => {
    new QWebChannel(qt.webChannelTransport, (channel) => {
        api = channel.objects.localApi;
        api.documentChanged.connect(onDocumentChanged);
        refreshAll();
    });
    setupResizer();
});

function refreshAll() {
    if (!api) return;
    loadPluginTypes();
    loadDocTree();
    updatePreview();
}

/* ---- Status ---- */
function setStatus(msg) {
    const el = document.getElementById("status-bar");
    if (el) el.textContent = msg;
}

/* ---- View Mode ---- */
function setViewMode(mode) {
    document.getElementById("btn-desktop").classList.toggle("active", mode === "desktop");
    document.getElementById("btn-mobile").classList.toggle("active", mode === "mobile");
    const f = document.getElementById("preview-frame");
    f.classList.toggle("mobile", mode === "mobile");
}

/* ---- Resizer ---- */
function setupResizer() {
    const resizer = document.getElementById("resizer");
    const app = document.getElementById("app");
    let startX, startW;

    resizer.addEventListener("mousedown", (e) => {
        startX = e.clientX;
        startW = document.getElementById("sidebar").offsetWidth;
        document.addEventListener("mousemove", onDrag);
        document.addEventListener("mouseup", stopDrag);
        e.preventDefault();
    });

    function onDrag(e) {
        const w = Math.max(200, Math.min(600, startW + e.clientX - startX));
        app.style.gridTemplateColumns = w + "px 6px 1fr";
    }
    function stopDrag() {
        document.removeEventListener("mousemove", onDrag);
        document.removeEventListener("mouseup", stopDrag);
    }
}

/* ---- Plugin Types ---- */
function loadPluginTypes() {
    api.getPluginTypes((json) => {
        pluginTypes = JSON.parse(json);
        const grid = document.getElementById("plugin-grid");
        grid.innerHTML = "";
        pluginTypes.forEach((p) => {
            const btn = document.createElement("button");
            btn.className = "plugin-btn";
            btn.textContent = p.name;
            btn.onclick = () => addNewElement(p.name);
            grid.appendChild(btn);
        });
    });
}

function addNewElement(pluginName) {
    const parentUuid = selectedUuid || "root";
    api.addElement(parentUuid, pluginName, -1, (json) => {
        const resp = JSON.parse(json);
        if (resp.status === "success") {
            setStatus("Added " + pluginName);
        } else {
            setStatus("Error: " + (resp.message || "add failed"));
        }
    });
}

/* ---- Document Tree ---- */
function loadDocTree() {
    api.getDocTree((json) => {
        const resp = JSON.parse(json);
        if (resp.status !== "success") return;

        const container = document.getElementById("doc-tree");
        container.innerHTML = "";
        const tree = resp.doc_tree;
        if (tree.children && tree.children.length > 0) {
            tree.children.forEach((child) => {
                container.appendChild(buildTreeNode(child));
            });
        } else {
            container.innerHTML = '<p style="color:var(--text-muted);font-size:12px;">Empty document. Add a widget to start.</p>';
        }
    });
}

function buildTreeNode(node) {
    const wrapper = document.createElement("div");

    const row = document.createElement("div");
    row.className = "tree-node" + (node.uuid === selectedUuid ? " selected" : "");

    /* Expand icon */
    const expandIcon = document.createElement("span");
    expandIcon.className = "expand-icon";
    const hasChildren = node.children && node.children.length > 0;
    expandIcon.textContent = hasChildren ? "▼" : "•";
    row.appendChild(expandIcon);

    /* Label */
    const label = document.createElement("span");
    label.textContent = node.name;
    row.appendChild(label);

    /* Action buttons */
    const actions = document.createElement("span");
    actions.className = "node-actions";

    const btnUp = mkActionBtn("↑", "Move up", () => api.moveUp(node.uuid, () => {}));
    const btnDown = mkActionBtn("↓", "Move down", () => api.moveDown(node.uuid, () => {}));
    const btnIndent = mkActionBtn("→", "Indent", () => api.indent(node.uuid, () => {}));
    const btnOutdent = mkActionBtn("←", "Outdent", () => api.outdent(node.uuid, () => {}));
    const btnCopy = mkActionBtn("⎘", "Copy", () => api.copyElement(node.uuid, () => { setStatus("Copied"); }));
    const btnPaste = mkActionBtn("📋", "Paste here", () => api.pasteElement(node.uuid, () => {}));
    const btnDel = mkActionBtn("✕", "Remove", () => {
        if (confirm("Remove this element?")) {
            api.removeElement(node.uuid, () => {});
        }
    }, true);

    [btnUp, btnDown, btnIndent, btnOutdent, btnCopy, btnPaste, btnDel].forEach((b) => actions.appendChild(b));
    row.appendChild(actions);

    /* Click to select */
    row.addEventListener("click", (e) => {
        if (e.target.closest(".node-actions")) return;
        selectedUuid = node.uuid;
        loadDocTree();
        loadProperties(node.uuid);
    });

    wrapper.appendChild(row);

    /* Children */
    if (hasChildren) {
        const childContainer = document.createElement("div");
        childContainer.className = "tree-children";
        node.children.forEach((c) => childContainer.appendChild(buildTreeNode(c)));
        wrapper.appendChild(childContainer);

        expandIcon.style.cursor = "pointer";
        expandIcon.addEventListener("click", (e) => {
            e.stopPropagation();
            const hidden = childContainer.style.display === "none";
            childContainer.style.display = hidden ? "" : "none";
            expandIcon.textContent = hidden ? "▼" : "▶";
        });
    }

    return wrapper;
}

function mkActionBtn(icon, title, onclick, danger) {
    const btn = document.createElement("button");
    btn.className = "node-action-btn" + (danger ? " danger" : "");
    btn.textContent = icon;
    btn.title = title;
    btn.onclick = (e) => { e.stopPropagation(); onclick(); };
    return btn;
}

/* ---- Properties ---- */
function loadProperties(uuid) {
    api.getElementProperties(uuid, (json) => {
        const resp = JSON.parse(json);
        const panel = document.getElementById("properties-panel");

        if (resp.status !== "success") {
            panel.innerHTML = '<p style="color:var(--danger);font-size:12px;">' + (resp.message || "Error") + "</p>";
            return;
        }

        panel.innerHTML = "";
        const props = resp.properties || {};
        const schema = resp.schema || [];

        /* Header */
        const header = document.createElement("div");
        header.innerHTML = '<strong style="font-size:13px;">' + escHtml(resp.widget_name) + "</strong>";
        panel.appendChild(header);

        /* Desktop properties */
        const desktopSchema = schema.filter((s) => !s.key.startsWith("m_") && !s.key.startsWith("l_"));
        desktopSchema.forEach((field) => {
            panel.appendChild(buildPropField(field, props, uuid));
        });

        /* Mobile overrides */
        const mobileSchema = schema.filter((s) => s.key.startsWith("m_") || s.key.startsWith("l_"));
        if (mobileSchema.length > 0) {
            const mSection = document.createElement("div");
            mSection.className = "mobile-section";
            const mTitle = document.createElement("div");
            mTitle.className = "section-title";
            mTitle.textContent = "Mobile / Light Mode Overrides";
            mSection.appendChild(mTitle);
            mobileSchema.forEach((field) => {
                mSection.appendChild(buildPropField(field, props, uuid));
            });
            panel.appendChild(mSection);
        }
    });
}

function buildPropField(field, props, uuid) {
    const group = document.createElement("div");
    group.className = "prop-group";

    const label = document.createElement("label");
    label.textContent = field.label || field.key;
    group.appendChild(label);

    const value = props[field.key] !== undefined ? props[field.key] : (field.default || "");
    let input;

    if (field.type === "richtext") {
        /* Rich text editor */
        const toolbar = document.createElement("div");
        toolbar.className = "richtext-toolbar";
        const cmds = [
            ["B", "bold"], ["I", "italic"], ["U", "underline"], ["S", "strikethrough"],
            ["H1", "formatBlock", "h1"], ["H2", "formatBlock", "h2"],
            ["H3", "formatBlock", "h3"], ["P", "formatBlock", "p"],
            ["UL", "insertUnorderedList"], ["OL", "insertOrderedList"]
        ];
        cmds.forEach(([lbl, cmd, arg]) => {
            const b = document.createElement("button");
            b.textContent = lbl;
            b.type = "button";
            b.onclick = () => {
                const area = group.querySelector(".richtext-area");
                area.focus();
                document.execCommand(cmd, false, arg || null);
            };
            toolbar.appendChild(b);
        });
        group.appendChild(toolbar);

        const area = document.createElement("div");
        area.className = "richtext-area";
        area.contentEditable = "true";
        area.innerHTML = value;
        area.addEventListener("input", () => debounceSave(uuid, field.key, area.innerHTML));
        group.appendChild(area);
    } else if (field.type === "select" && field.options) {
        input = document.createElement("select");
        (field.options || []).forEach((opt) => {
            const o = document.createElement("option");
            o.value = opt.value !== undefined ? opt.value : opt;
            o.textContent = opt.label !== undefined ? opt.label : opt;
            if (String(o.value) === String(value)) o.selected = true;
            input.appendChild(o);
        });
        input.addEventListener("change", () => debounceSave(uuid, field.key, input.value));
        group.appendChild(input);
    } else if (field.type === "checkbox") {
        input = document.createElement("input");
        input.type = "checkbox";
        input.checked = value === true || value === "true" || value === "1";
        input.addEventListener("change", () => debounceSave(uuid, field.key, input.checked ? "true" : "false"));
        group.appendChild(input);
    } else if (field.type === "color") {
        input = document.createElement("input");
        input.type = "color";
        input.value = value || "#ffffff";
        input.addEventListener("input", () => debounceSave(uuid, field.key, input.value));
        group.appendChild(input);
    } else if (field.type === "textarea") {
        input = document.createElement("textarea");
        input.value = value;
        input.addEventListener("input", () => debounceSave(uuid, field.key, input.value));
        group.appendChild(input);
    } else {
        input = document.createElement("input");
        input.type = "text";
        input.value = value;
        input.addEventListener("input", () => debounceSave(uuid, field.key, input.value));
        group.appendChild(input);
    }

    return group;
}

function debounceSave(uuid, key, value) {
    clearTimeout(debounceTimer);
    debounceTimer = setTimeout(() => {
        const props = {};
        props[key] = value;
        api.setElementProperties(uuid, JSON.stringify({ properties: props }), (json) => {
            const resp = JSON.parse(json);
            if (resp.status === "success") {
                setStatus("Saved");
            } else {
                setStatus("Save failed: " + (resp.message || ""));
            }
        });
    }, 400);
}

/* ---- Preview ---- */
function updatePreview() {
    if (!api) return;
    api.renderPreview((html) => {
        const frame = document.getElementById("preview-frame");
        const doc = frame.contentDocument || frame.contentWindow.document;
        doc.open();
        doc.write("<!DOCTYPE html><html><head><meta charset='utf-8'></head><body>" + html + "</body></html>");
        doc.close();
    });
}

/* ---- Document change handler ---- */
function onDocumentChanged() {
    loadDocTree();
    updatePreview();
}

/* ---- Utilities ---- */
function escHtml(s) {
    const d = document.createElement("div");
    d.textContent = s;
    return d.innerHTML;
}
+83 −0
Changes for client/localapi.cpp: 83 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -29,6 +29,10 @@
#include "documentmanager.h"
#include "publishclient.h"

#include <QFileDialog>
#include <QInputDialog>
#include <QGuiApplication>

LocalApi::LocalApi(DocumentManager *doc, PublishClient *pub, QObject *parent)
    : QObject(parent), _doc(doc), _pub(pub) {}

@@ -109,3 +113,82 @@ bool LocalApi::importXml(const QString &xml) {
QString LocalApi::renderPreview() {
    return _doc->renderToHtml();
}

void LocalApi::newDocument() {
    _doc->newDocument();
    _currentFile.clear();
    emit currentFileChanged(_currentFile);
    emit documentChanged();
    emit statusMessage("New document created");
}

void LocalApi::openDocument() {
    QString path = QFileDialog::getOpenFileName(
        nullptr, "Open Document", QString(), "XML Files (*.xml);;All Files (*)");
    if (path.isEmpty()) return;

    if (_doc->loadFromFile(path)) {
        _currentFile = path;
        emit currentFileChanged(_currentFile);
        emit documentChanged();
        emit statusMessage("Opened: " + path);
    } else {
        emit statusMessage("Failed to load " + path);
    }
}

void LocalApi::saveDocument() {
    if (_currentFile.isEmpty()) {
        saveAsDocument();
        return;
    }
    if (_doc->saveToFile(_currentFile)) {
        emit statusMessage("Saved: " + _currentFile);
    } else {
        emit statusMessage("Failed to save " + _currentFile);
    }
}

void LocalApi::saveAsDocument() {
    QString path = QFileDialog::getSaveFileName(
        nullptr, "Save Document", QString(), "XML Files (*.xml);;All Files (*)");
    if (path.isEmpty()) return;

    if (_doc->saveToFile(path)) {
        _currentFile = path;
        emit currentFileChanged(_currentFile);
        emit statusMessage("Saved: " + path);
    } else {
        emit statusMessage("Failed to save " + path);
    }
}

void LocalApi::publishToServer() {
    if (!_pub->isConfigured()) {
        bool ok = false;
        QString url = QInputDialog::getText(
            nullptr, "Server URL",
            "Enter blogi server URL (e.g. https://blog.example.com):",
            QLineEdit::Normal, QString(), &ok);
        if (!ok || url.isEmpty()) return;
        _pub->setServerUrl(url);
    }

    QString rendered = _doc->renderToHtml();
    if (rendered.isEmpty()) {
        emit statusMessage("Nothing to publish — document is empty.");
        return;
    }

    emit statusMessage("Publishing...");
    _pub->publish(rendered, [this](bool ok, const QString &msg) {
        if (ok)
            emit statusMessage("Published: " + msg);
        else
            emit statusMessage("Publish failed: " + msg);
    });
}

void LocalApi::refresh() {
    emit documentChanged();
}
Loading