Skip to content

Commit

Permalink
Hide insert targets when they shouldn't do anything anyway
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiask committed May 31, 2024
1 parent f449e24 commit a5591e2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions content_editor/static/content_editor/content_editor.css
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,10 @@ h3[draggable] {
font-weight: bold;
}

.order-machine-hide-insert-targets .order-machine-insert-target {
display: none;
}

@media screen and (max-width: 767px) {
/* CSS fix for Django's responsive admin interface (shows fields below the
* 767px breakpoint despite them being .hidden */
Expand Down Expand Up @@ -413,6 +417,7 @@ h3[draggable] {
}

.order-machine-readonly .plugin-buttons + p,
.order-machine-readonly .order-machine-insert-target,
.order-machine-readonly + .order-machine-help,
.order-machine-readonly .inline-related > h3[draggable]::before {
display: none;
Expand Down
3 changes: 3 additions & 0 deletions content_editor/static/content_editor/content_editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -294,13 +294,16 @@ django.jQuery(($) => {
})

if (visible) {
orderMachineWrapper.removeClass("order-machine-hide-insert-targets")
noPluginsMessage.hide()

pluginButtons.style.setProperty(
"--_v",
Math.max(7, Math.ceil(visible / 3)),
)
} else {
orderMachineWrapper.addClass("order-machine-hide-insert-targets")

if (ContentEditor.currentRegion) {
noPluginsMessage.show()
machineEmptyMessage.hide()
Expand Down

0 comments on commit a5591e2

Please sign in to comment.