Skip to content

Commit

Permalink
wagtail: make toolbar sticky by default
Browse files Browse the repository at this point in the history
  • Loading branch information
goapunk authored and philli-m committed Nov 2, 2023
1 parent f1eddcf commit 010f5c5
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 0 deletions.
4 changes: 4 additions & 0 deletions apps/contrib/assets/wagtail.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// force wagtail toolbar to be sticky
try {
localStorage.setItem('wagtail:draftail-toolbar', 'sticky')
} catch {}
10 changes: 10 additions & 0 deletions apps/contrib/wagtail_hooks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from django.templatetags.static import static
from django.utils.html import format_html
from wagtail import hooks


# hook to insert custom js into wagtail. Currently only used to make the
# toolbar sticky
@hooks.register("insert_global_admin_js", order=100)
def global_admin_js():
return format_html('<script src="{}"></script>', static("wagtail.js"))
3 changes: 3 additions & 0 deletions changelog/_1114.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
### Changed

- make wagtail toolbar sticky by default
3 changes: 3 additions & 0 deletions webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ module.exports = {
import: [
'./apps/contrib/assets/matomo.js'
]
},
wagtail: {
import: './apps/contrib/assets/wagtail.js'
}
},
output: {
Expand Down

0 comments on commit 010f5c5

Please sign in to comment.