Skip to content

Commit 1644f2e

Browse files
committed
feat: Allow for fast v5 screen update
1 parent 0a62621 commit 1644f2e

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

djangocms_alias/cms_plugins.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ def render_replace_response(self, request, new_plugins, source_placeholder=None,
313313
plugin.language,
314314
parent_id=plugin.parent_id,
315315
)
316-
plugin_tree = get_plugin_tree(request, plugins)
316+
plugin_tree = get_plugin_tree(request, plugins, target_plugin=root)
317317
move_data = get_plugin_toolbar_info(plugin)
318318
move_data["plugin_order"] = plugin_order
319319
move_data.update(plugin_tree)

djangocms_alias/static/djangocms_alias/js/databridge.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,33 @@
22

33
const processDataBridge = function (data) {
44
let actionsPerformed = 0;
5+
let updateNeeded = false;
56

67
if (data.replacedPlaceholder) {
7-
CMS.API.StructureBoard.invalidateState('CLEAR_PLACEHOLDER', data.replacedPlaceholder);
8+
updateNeeded |= CMS.API.StructureBoard.handleClearPlaceholder(data.replacedPlaceholder);
89
actionsPerformed++;
910
}
1011
if (data.replacedPlugin) {
11-
CMS.API.StructureBoard.invalidateState('DELETE', data.replacedPlugin);
12+
updateNeeded |= CMS.API.StructureBoard.handleDeletePlugin(data.replacedPlugin);
1213
actionsPerformed++;
1314
}
1415
if (data.addedPlugins) {
1516
for (const addedPlugin of data.addedPlugins) {
16-
CMS.API.StructureBoard.invalidateState('ADD', addedPlugin);
17+
updateNeeded |= CMS.API.StructureBoard.handleAddPlugin(addedPlugin);
1718
actionsPerformed++;
1819
}
1920
}
2021
if (data.movedPlugins) {
2122
for (const movedPlugin of data.movedPlugins) {
22-
CMS.API.StructureBoard.invalidateState('MOVE', movedPlugin);
23+
updateNeeded |= CMS.API.StructureBoard.handleMovePlugin(movedPlugin);
2324
actionsPerformed++;
2425
}
2526
}
27+
28+
if (updateNeeded) {
29+
CMS.API.StructureBoard._requestcontent = null;
30+
CMS.API.StructureBoard.updateContent();
31+
}
2632
return actionsPerformed;
2733
}
2834

0 commit comments

Comments
 (0)