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

test

parent 7b4bfabd
Loading
Loading
Loading
Loading
+17 −0
Changes for src/edit.cpp: 17 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -2058,6 +2058,23 @@ void blogi::webedit::WebEditor::JsonApi(const int tid, json_object *request, jso
            json_object_object_add(single_response, "status", json_object_new_string("success"));
            json_object_object_add(single_response, "xml", json_object_new_string(xmlStr.c_str()));
            handled = true;
        } else if (strcmp(command, "ExportHtml") == 0) {
            // Export the current document tree as rendered HTML
            std::string renderedHtml;
            if (DocRoot) {
                libhtmlpp::HtmlElement wrapper("div");
                const EditPlugin *el = DocRoot;
                while (el) {
                    el->Render(wrapper);
                    el = el->nextElement();
                }
                libhtmlpp::HtmlString htmlOut;
                libhtmlpp::print(wrapper, htmlOut,true);
                renderedHtml = htmlOut.str();
            }
            json_object_object_add(single_response, "status", json_object_new_string("success"));
            json_object_object_add(single_response, "html", json_object_new_string(renderedHtml.c_str()));
            handled = true;
        } else if (strcmp(command, "ImportXml") == 0) {
            // Import raw XML string into the document tree
            json_object *xml_obj = nullptr;