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

test

parent 466d7b7f
Loading
Loading
Loading
Loading
+48 −3
Changes for data/themes/default/editor.html: 48 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -2758,8 +2758,10 @@

                const resp = result[0];
                if (resp.status === 'duplicate') {
                    // Post with same title exists — ask user to overwrite
                    if (confirm(resp.message || 'A post with this title already exists. Overwrite?')) {
                    // Post with same title exists — show a styled modal to ask user to overwrite
                    showOverwriteModal(
                        resp.message || 'A post with this title already exists. Overwrite?',
                        async function() {
                            params.overwrite = true;
                            const owResult = await sendApiRequest([{
                                command: 'publish',
@@ -2778,10 +2780,12 @@
                                statusEl.textContent = owResp.message || I18N.PUBLISH_FAILED;
                                statusEl.className = 'prop-status error';
                            }
                    } else {
                        },
                        function() {
                            statusEl.textContent = '';
                            statusEl.className = 'prop-status';
                        }
                    );
                } else if (resp.status === 'success') {
                    statusEl.textContent = '\u2714 ' + I18N.PUBLISHED;
                    statusEl.className = 'prop-status success';
@@ -2799,6 +2803,47 @@
            }
        }

        /**
         * Show a styled modal dialog for overwrite confirmation (replaces native confirm()).
         * @param {string} message - The message to display.
         * @param {Function} onConfirm - Called when user clicks Overwrite.
         * @param {Function} onCancel - Called when user clicks Cancel.
         */
        function showOverwriteModal(message, onConfirm, onCancel) {
            const existing = document.getElementById('overwrite-modal');
            if (existing) existing.remove();

            const modal = document.createElement('div');
            modal.id = 'overwrite-modal';
            modal.className = 'tpl-modal-overlay';
            modal.onclick = (e) => {
                if (e.target === modal) {
                    modal.remove();
                    if (onCancel) onCancel();
                }
            };
            modal.innerHTML = `
                <div class="tpl-modal" onclick="event.stopPropagation()" style="max-width: 460px;">
                    <h3 style="color:#fbbf24;">&#x26A0; Overwrite?</h3>
                    <p style="font-size:14px; color:#d1d5db; margin-bottom: 16px; line-height:1.5; word-wrap:break-word;">${escapeHtml(message)}</p>
                    <div class="tpl-modal-actions">
                        <button class="tpl-btn tpl-btn-secondary" id="overwrite-cancel-btn">${I18N.CANCEL}</button>
                        <button class="tpl-btn tpl-btn-primary" id="overwrite-confirm-btn" style="background:#d97706;">&#x1F680; Overwrite</button>
                    </div>
                </div>
            `;
            document.body.appendChild(modal);

            document.getElementById('overwrite-cancel-btn').onclick = () => {
                modal.remove();
                if (onCancel) onCancel();
            };
            document.getElementById('overwrite-confirm-btn').onclick = async () => {
                modal.remove();
                if (onConfirm) await onConfirm();
            };
        }

        // --- Share to Social ---

        function toggleSharePanel() {
+48 −3
Changes for data/themes/minimal/editor.html: 48 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -2758,8 +2758,10 @@

                const resp = result[0];
                if (resp.status === 'duplicate') {
                    // Post with same title exists — ask user to overwrite
                    if (confirm(resp.message || 'A post with this title already exists. Overwrite?')) {
                    // Post with same title exists — show a styled modal to ask user to overwrite
                    showOverwriteModal(
                        resp.message || 'A post with this title already exists. Overwrite?',
                        async function() {
                            params.overwrite = true;
                            const owResult = await sendApiRequest([{
                                command: 'publish',
@@ -2778,10 +2780,12 @@
                                statusEl.textContent = owResp.message || I18N.PUBLISH_FAILED;
                                statusEl.className = 'prop-status error';
                            }
                    } else {
                        },
                        function() {
                            statusEl.textContent = '';
                            statusEl.className = 'prop-status';
                        }
                    );
                } else if (resp.status === 'success') {
                    statusEl.textContent = '\u2714 ' + I18N.PUBLISHED;
                    statusEl.className = 'prop-status success';
@@ -2799,6 +2803,47 @@
            }
        }

        /**
         * Show a styled modal dialog for overwrite confirmation (replaces native confirm()).
         * @param {string} message - The message to display.
         * @param {Function} onConfirm - Called when user clicks Overwrite.
         * @param {Function} onCancel - Called when user clicks Cancel.
         */
        function showOverwriteModal(message, onConfirm, onCancel) {
            const existing = document.getElementById('overwrite-modal');
            if (existing) existing.remove();

            const modal = document.createElement('div');
            modal.id = 'overwrite-modal';
            modal.className = 'tpl-modal-overlay';
            modal.onclick = (e) => {
                if (e.target === modal) {
                    modal.remove();
                    if (onCancel) onCancel();
                }
            };
            modal.innerHTML = `
                <div class="tpl-modal" onclick="event.stopPropagation()" style="max-width: 460px;">
                    <h3 style="color:#fbbf24;">&#x26A0; Overwrite?</h3>
                    <p style="font-size:14px; color:#d1d5db; margin-bottom: 16px; line-height:1.5; word-wrap:break-word;">${escapeHtml(message)}</p>
                    <div class="tpl-modal-actions">
                        <button class="tpl-btn tpl-btn-secondary" id="overwrite-cancel-btn">${I18N.CANCEL}</button>
                        <button class="tpl-btn tpl-btn-primary" id="overwrite-confirm-btn" style="background:#d97706;">&#x1F680; Overwrite</button>
                    </div>
                </div>
            `;
            document.body.appendChild(modal);

            document.getElementById('overwrite-cancel-btn').onclick = () => {
                modal.remove();
                if (onCancel) onCancel();
            };
            document.getElementById('overwrite-confirm-btn').onclick = async () => {
                modal.remove();
                if (onConfirm) await onConfirm();
            };
        }

        // --- Share to Social ---

        function toggleSharePanel() {
+1 −0
Changes for src/webedit/CMakeLists.txt: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -13,3 +13,4 @@ add_subdirectory(list)
add_subdirectory(article)
add_subdirectory(slider)
add_subdirectory(popup)
add_subdirectory(accordion)
+11 −0
Changes for src/webedit/accordion/CMakeLists.txt: 11 added lines, 0 removed lines.
Original line number Diff line number Diff line
add_library(accordion SHARED accordion.cpp)

add_dependencies(accordion blogidev)

if(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Windows")
    target_link_libraries(accordion PUBLIC blogidev kernel32.lib uuidp::uuidp htmlpp::htmlpp json-c::json-c tinyxml2::tinyxml2)
else()
    target_link_libraries(accordion PUBLIC blogidev dl uuidp::uuidp htmlpp::htmlpp json-c::json-c tinyxml2::tinyxml2)
endif()

install(TARGETS accordion DESTINATION lib/blogi/plugins/webedit)
+670 −0

File added.

Preview size limit exceeded, changes collapsed.

Loading