Skip to content

Commit cf9c948

Browse files
committed
feat: Make toolbar sticky
1 parent a980a56 commit cf9c948

File tree

2 files changed

+8
-13
lines changed

2 files changed

+8
-13
lines changed

private/css/cms.toolbar.css

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/* Position sticky toolbar below the django CMS toolbar when it's visible */
2+
html.cms-toolbar-expanded {
3+
--cms-toolbar-height: 46px;
4+
}
5+
16
.cms-editor-inline-wrapper {
27
--tiptap-ease: 100ms;
38
.ProseMirror-focused [role="menubar"] {
@@ -22,18 +27,17 @@
2227

2328
[role="menubar"] {
2429
font-family: var(--font-family-primary, Helvetica, Arial, sans-serif);
25-
bottom: calc(100% - 1px);
2630
min-width: 375px;
27-
z-index: 1;
31+
z-index: 88889; /* Above #cms-top (z-index: 88888) */
2832
padding: 2px 0.4rem;
29-
/* border-radius: 3px; */
3033
margin: 0 !important;
3134
font-size: 1rem;
3235
font-weight: normal;
3336
visibility: hidden;
3437
opacity: 0;
3538
transition: opacity var(--tiptap-ease, 100ms) ease-out, visibility 0s linear var(--tiptap-ease, 100ms);
36-
position: absolute;
39+
position: sticky;
40+
top: var(--cms-toolbar-height, 0px);
3741
pointer-events: all;
3842
display: flex;
3943
flex-flow: row wrap;

private/js/tiptap_plugins/cms.toolbar.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,6 @@ let _node_icons = null;
4646
*
4747
* @param {Object} editor - The editor instance.
4848
* @returns {Plugin} - A ProseMirror Plugin instance.
49-
*
50-
* @property {Object} props - Plugin properties.
51-
* @property {Function} props.decorations - Function to get the current state of decorations.
52-
* @property {Object} props.handleDOMEvents - Object containing DOM event handlers.
53-
* @property {Function} props.handleDOMEvents.click - Click event handler for the block toolbar.
54-
*
55-
* @property {Object} state - Plugin state.
56-
* @property {Function} state.init - Initializes the plugin state with decorations.
57-
* @property {Function} state.apply - Applies state changes and updates the block toolbar.
5849
*/
5950
function _createBlockToolbarPlugin(editor) {
6051
'use strict';

0 commit comments

Comments
 (0)