Loading src/edit.cpp +13 −0 Changes for src/edit.cpp: 13 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -1796,8 +1796,19 @@ void blogi::webedit::WebEditor::JsonApi(const int tid, json_object *request, jso EditPlugin *parent = findElementByUuid(DocRoot, parent_uuid); if (parent && isAppendChild && parent->canHaveChildren()) { parent->addNextElement(*newWidget); } else if (parent && isAppendChild && !parent->canHaveChildren()) { // Widget does not support children — reject the operation // Remove the widget we just created DocElements.pop_back(); json_object_object_add(single_response, "status", json_object_new_string("error")); json_object_object_add(single_response, "message", json_object_new_string("This element cannot have children.")); handled = true; } else if (parent) { // Insert after parent as sibling, preserving existing chain EditPlugin *oldNext = const_cast<EditPlugin*>(parent->nextElement()); parent->setNextEl(newWidget); newWidget->setNextEl(oldNext); } else { // Parent not found — add as top-level sibling EditPlugin *tail = DocRoot; Loading @@ -1808,6 +1819,7 @@ void blogi::webedit::WebEditor::JsonApi(const int tid, json_object *request, jso } } if (!handled) { json_object_object_add(single_response, "status", json_object_new_string("success")); json_object_object_add(single_response, "message", json_object_new_string("Element added to document.")); Loading @@ -1817,6 +1829,7 @@ void blogi::webedit::WebEditor::JsonApi(const int tid, json_object *request, jso json_object_new_string(newWidget->getName().c_str())); handled = true; } } } else { json_object_object_add(single_response, "status", json_object_new_string("error")); json_object_object_add(single_response, "message", Loading Loading
src/edit.cpp +13 −0 Changes for src/edit.cpp: 13 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -1796,8 +1796,19 @@ void blogi::webedit::WebEditor::JsonApi(const int tid, json_object *request, jso EditPlugin *parent = findElementByUuid(DocRoot, parent_uuid); if (parent && isAppendChild && parent->canHaveChildren()) { parent->addNextElement(*newWidget); } else if (parent && isAppendChild && !parent->canHaveChildren()) { // Widget does not support children — reject the operation // Remove the widget we just created DocElements.pop_back(); json_object_object_add(single_response, "status", json_object_new_string("error")); json_object_object_add(single_response, "message", json_object_new_string("This element cannot have children.")); handled = true; } else if (parent) { // Insert after parent as sibling, preserving existing chain EditPlugin *oldNext = const_cast<EditPlugin*>(parent->nextElement()); parent->setNextEl(newWidget); newWidget->setNextEl(oldNext); } else { // Parent not found — add as top-level sibling EditPlugin *tail = DocRoot; Loading @@ -1808,6 +1819,7 @@ void blogi::webedit::WebEditor::JsonApi(const int tid, json_object *request, jso } } if (!handled) { json_object_object_add(single_response, "status", json_object_new_string("success")); json_object_object_add(single_response, "message", json_object_new_string("Element added to document.")); Loading @@ -1817,6 +1829,7 @@ void blogi::webedit::WebEditor::JsonApi(const int tid, json_object *request, jso json_object_new_string(newWidget->getName().c_str())); handled = true; } } } else { json_object_object_add(single_response, "status", json_object_new_string("error")); json_object_object_add(single_response, "message", Loading