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

timeline widget added

parent 6ef729c8
Loading
Loading
Loading
Loading
+135 −0
Changes for editor/html/js/properties.js: 135 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -893,6 +893,141 @@ var PropertiesPanel = (function() {
                    group.appendChild(faqWrap);
                    panel.appendChild(group);
                    continue;
                } else if (field.type === 'timeline_items') {
                    var tlWrap = document.createElement('div');
                    tlWrap.className = 'faq-items-editor';

                    var tlHidden = document.createElement('input');
                    tlHidden.type = 'hidden';
                    tlHidden.name = field.key;
                    tlHidden.setAttribute('data-json-array', 'true');

                    var tlList = Array.isArray(value) ? value.slice() : [];
                    var tlListEl = document.createElement('div');
                    tlListEl.className = 'faq-items-list';

                    function tlSyncHidden() {
                        tlHidden.value = JSON.stringify(tlList);
                        tlHidden.dispatchEvent(new Event('change', { bubbles: true }));
                    }

                    function tlRenderList() {
                        tlListEl.innerHTML = '';
                        tlList.forEach(function(item, idx) {
                            var card = document.createElement('div');
                            card.className = 'faq-item-card';

                            var cardHeader = document.createElement('div');
                            cardHeader.className = 'faq-item-header';
                            cardHeader.textContent = 'Schritt ' + (idx + 1);

                            var removeBtn = document.createElement('button');
                            removeBtn.type = 'button';
                            removeBtn.className = 'faq-item-remove';
                            removeBtn.textContent = '✕';
                            removeBtn.title = 'Entfernen';
                            removeBtn.addEventListener('click', function() {
                                tlList.splice(idx, 1);
                                tlSyncHidden();
                                tlRenderList();
                            });
                            cardHeader.appendChild(removeBtn);

                            var imgWrap = document.createElement('div');
                            imgWrap.className = 'media-browse-field';
                            var imgInput = document.createElement('input');
                            imgInput.type = 'text';
                            imgInput.placeholder = 'Bild-URL';
                            imgInput.value = item.image || '';
                            imgInput.addEventListener('input', function() {
                                tlList[idx].image = imgInput.value;
                                tlSyncHidden();
                            });
                            var imgBrowseBtn = document.createElement('button');
                            imgBrowseBtn.type = 'button';
                            imgBrowseBtn.textContent = '🖼️';
                            imgBrowseBtn.title = 'Bild durchsuchen';
                            imgBrowseBtn.addEventListener('click', function() {
                                if (typeof MediaBrowser !== 'undefined') {
                                    MediaBrowser.open(function(mediaItem) {
                                        imgInput.value = mediaItem.url || '';
                                        tlList[idx].image = imgInput.value;
                                        tlSyncHidden();
                                    });
                                }
                            });
                            imgWrap.appendChild(imgInput);
                            imgWrap.appendChild(imgBrowseBtn);

                            var headingInput = document.createElement('input');
                            headingInput.type = 'text';
                            headingInput.placeholder = 'Überschrift';
                            headingInput.className = 'faq-item-question';
                            headingInput.value = item.heading || '';
                            headingInput.addEventListener('input', function() {
                                tlList[idx].heading = headingInput.value;
                                tlSyncHidden();
                            });

                            var textInput = document.createElement('textarea');
                            textInput.placeholder = 'Text';
                            textInput.className = 'faq-item-answer';
                            textInput.rows = 3;
                            textInput.value = item.text || '';
                            textInput.addEventListener('input', function() {
                                tlList[idx].text = textInput.value;
                                tlSyncHidden();
                            });

                            var hlLabelInput = document.createElement('input');
                            hlLabelInput.type = 'text';
                            hlLabelInput.placeholder = 'Hervorhebung, z.B. "Typische Folgen:"';
                            hlLabelInput.className = 'faq-item-question';
                            hlLabelInput.value = item.highlight_label || '';
                            hlLabelInput.addEventListener('input', function() {
                                tlList[idx].highlight_label = hlLabelInput.value;
                                tlSyncHidden();
                            });

                            var hlTextInput = document.createElement('textarea');
                            hlTextInput.placeholder = 'Hervorhebungstext';
                            hlTextInput.className = 'faq-item-answer';
                            hlTextInput.rows = 2;
                            hlTextInput.value = item.highlight_text || '';
                            hlTextInput.addEventListener('input', function() {
                                tlList[idx].highlight_text = hlTextInput.value;
                                tlSyncHidden();
                            });

                            card.appendChild(cardHeader);
                            card.appendChild(imgWrap);
                            card.appendChild(headingInput);
                            card.appendChild(textInput);
                            card.appendChild(hlLabelInput);
                            card.appendChild(hlTextInput);
                            tlListEl.appendChild(card);
                        });
                    }

                    tlRenderList();
                    tlSyncHidden();

                    var tlAddBtn = document.createElement('button');
                    tlAddBtn.type = 'button';
                    tlAddBtn.className = 'faq-item-add';
                    tlAddBtn.textContent = '+ Schritt hinzufügen';
                    tlAddBtn.addEventListener('click', function() {
                        tlList.push({ image: '', heading: '', text: '', highlight_label: '', highlight_text: '' });
                        tlSyncHidden();
                        tlRenderList();
                    });

                    tlWrap.appendChild(tlListEl);
                    tlWrap.appendChild(tlAddBtn);
                    tlWrap.appendChild(tlHidden);
                    group.appendChild(tlWrap);
                    panel.appendChild(group);
                    continue;
                } else {
                    input = document.createElement('input');
                    input.type = 'text';
+1 −0
Changes for editor/widgets/CMakeLists.txt: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -43,3 +43,4 @@ add_subdirectory(accordion)
add_subdirectory(googlemaps)
add_subdirectory(googlereviews)
add_subdirectory(faq)
add_subdirectory(timeline)
+14 −0
Changes for editor/widgets/timeline/CMakeLists.txt: 14 added lines, 0 removed lines.
Original line number Diff line number Diff line
add_library(timeline SHARED timeline.cpp)

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

install(TARGETS timeline DESTINATION lib/blogi/plugins/webedit)
+766 −0

File added.

Preview size limit exceeded, changes collapsed.

+73 −0
Changes for editor/widgets/timeline/translations.h: 73 added lines, 0 removed lines.
Original line number Diff line number Diff line
/*******************************************************************************
Copyright (c) 2026, Jan Koester jan.koester@gmx.net
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
    * Redistributions of source code must retain the above copyright
      notice, this list of conditions and the following disclaimer.
    * Redistributions in binary form must reproduce the above copyright
      notice, this list of conditions and the following disclaimer in the
      documentation and/or other materials provided with the distribution.
    * Neither the name of the <organization> nor the
      names of its contributors may be used to endorse or promote products
      derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*******************************************************************************/

#pragma once

#include <string>
#include <unordered_map>

namespace blogi { namespace webedit { namespace timeline_i18n {

    inline const std::unordered_map<std::string, std::string>& de() {
        static const std::unordered_map<std::string, std::string> m = {
            {"Section Title", "Abschnittstitel"},
            {"Title Font Size", "Titel-Schriftgröße"},
            {"Title Color (Dark)", "Titelfarbe (Dunkel)"},
            {"Title Color (Light)", "Titelfarbe (Hell)"},
            {"Max Width", "Maximale Breite"},
            {"Step Spacing", "Abstand zwischen Schritten"},
            {"Step Spacing (Mobile)", "Abstand zwischen Schritten (Mobil)"},
            {"Image Height", "Bildhöhe"},
            {"Image Height (Mobile)", "Bildhöhe (Mobil)"},
            {"Image Border Radius", "Bild-Eckradius"},
            {"Line Color (Dark)", "Linienfarbe (Dunkel)"},
            {"Line Color (Light)", "Linienfarbe (Hell)"},
            {"Dot Color (Dark)", "Punktfarbe (Dunkel)"},
            {"Dot Color (Light)", "Punktfarbe (Hell)"},
            {"Dot Ring Color (Dark)", "Punktring-Farbe (Dunkel)"},
            {"Dot Ring Color (Light)", "Punktring-Farbe (Hell)"},
            {"Dot Size", "Punktgröße"},
            {"Heading Color (Dark)", "Überschriftfarbe (Dunkel)"},
            {"Heading Color (Light)", "Überschriftfarbe (Hell)"},
            {"Heading Font Size", "Überschrift-Schriftgröße"},
            {"Text Color (Dark)", "Textfarbe (Dunkel)"},
            {"Text Color (Light)", "Textfarbe (Hell)"},
            {"Text Font Size", "Text-Schriftgröße"},
            {"Hidden", "Ausgeblendet"},
            {"Mobile Hidden", "Ausgeblendet (Mobil)"},
            {"Steps", "Schritte"},
            {"Custom CSS", "Eigenes CSS"},
        };
        return m;
    }

    inline const std::unordered_map<std::string, std::string>& en() {
        static const std::unordered_map<std::string, std::string> m = {};
        return m;
    }

}}}