File tree Expand file tree Collapse file tree 2 files changed +39
-1
lines changed
apps/rich-text-versioning/src/locations Expand file tree Collapse file tree 2 files changed +39
-1
lines changed Original file line number Diff line number Diff line change 1+ import { css } from 'emotion' ;
2+
3+ /**
4+ * Rich Text Editor - Sticky Toolbar
5+ * Makes the formatting toolbar remain visible when scrolling through content
6+ */
7+
8+ // CSS custom properties for configuration
9+ const rteEditorMaxHeight = '500px' ;
10+ const rteToolbarZIndex = 100 ;
11+
12+ export const styles = {
13+ richTextEditorContainer : css ( {
14+ position : 'relative' ,
15+ overflow : 'visible' ,
16+
17+ // Sticky toolbar positioning
18+ '& > div > div:first-child > div' : {
19+ position : 'sticky' ,
20+ top : 0 ,
21+ zIndex : rteToolbarZIndex ,
22+ } ,
23+
24+ // Scrollable editor content area
25+ '& [data-slate-editor="true"]' : {
26+ maxHeight : rteEditorMaxHeight ,
27+ overflowY : 'auto' ,
28+ overflowX : 'hidden' ,
29+ // Smooth scrolling for better UX
30+ scrollBehavior : 'smooth' ,
31+ // Prevent scroll chaining to parent
32+ overscrollBehavior : 'contain' ,
33+ } ,
34+ } ) ,
35+ } ;
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ import { Document } from '@contentful/rich-text-types';
88import { EntrySys } from '@contentful/app-sdk/dist/types/utils' ;
99import { convertToSerializableJson , ErrorInfo } from '../utils' ;
1010import { ReleaseEntrySys } from '@contentful/app-sdk/dist/types/entry.types' ;
11+ import { styles } from './Field.styles' ;
1112
1213const Field = ( ) => {
1314 const sdk = useSDK < FieldAppSDK > ( ) ;
@@ -93,7 +94,9 @@ const Field = () => {
9394
9495 return (
9596 < >
96- < RichTextEditor sdk = { sdk } isInitiallyDisabled = { false } />
97+ < div className = { styles . richTextEditorContainer } >
98+ < RichTextEditor sdk = { sdk } isInitiallyDisabled = { false } />
99+ </ div >
97100 < Tooltip
98101 placement = "top"
99102 content = {
You can’t perform that action at this time.
0 commit comments