Commit 526b66f9 authored by jan.koester's avatar jan.koester
Browse files

test

parent 417498ce
Loading
Loading
Loading
Loading
+18 −0
Changes for src/edit.cpp: 18 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -1845,6 +1845,24 @@ void blogi::webedit::WebEditor::JsonApi(const int tid, json_object *request, jso
                json_object_object_add(single_response, "message", json_object_new_string("Missing 'xml' parameter."));
            }
            handled = true;
        } else if (strcmp(command, "ImportHtml") == 0) {
            // Import raw HTML and convert to widget tree
            json_object *html_obj = nullptr;
            if (json_object_object_get_ex(single_request, "html", &html_obj)) {
                const char *htmlData = json_object_get_string(html_obj);
                if (htmlData && htmlData[0] != '\0') {
                    importHtmlToWidgets(htmlData);
                    json_object_object_add(single_response, "status", json_object_new_string("success"));
                    json_object_object_add(single_response, "message", json_object_new_string("HTML imported successfully."));
                } else {
                    json_object_object_add(single_response, "status", json_object_new_string("error"));
                    json_object_object_add(single_response, "message", json_object_new_string("Empty HTML data."));
                }
            } else {
                json_object_object_add(single_response, "status", json_object_new_string("error"));
                json_object_object_add(single_response, "message", json_object_new_string("Missing 'html' parameter."));
            }
            handled = true;
        } else if (strcmp(command, "LoadXml") == 0) {
            // Load an XML template by name
            json_object *name_obj = nullptr;