@@ -38,6 +38,7 @@ import { useLicense } from '../../hooks/useLicense';
3838import { useAIActions } from '../../hooks/useAIActions' ;
3939import { useWebtoolsLinks } from '../../hooks/useWebtoolsLinks' ;
4040import { useVersionHistory } from '../../hooks/useVersionHistory' ;
41+ import { useCustomBlocks } from '../../hooks/useCustomBlocks' ;
4142import AIAssistantPopup from '../AIAssistantPopup' ;
4243import VersionHistoryPanel from '../VersionHistoryPanel' ;
4344import AIInlineToolbar from '../AIInlineToolbar' ;
@@ -213,44 +214,62 @@ const EditorJSGlobalStyles = createGlobalStyle`
213214 z-index: 99999 !important;
214215 }
215216
217+ /* ============================================
218+ NESTED POPOVER FIX - Remove min-width constraint
219+ ============================================ */
220+ .ce-popover--inline .ce-popover--nested .ce-popover__container,
221+ .ce-popover--inline .ce-popover--nested.ce-popover--nested-level-1 .ce-popover__container {
222+ min-width: 0 !important;
223+ }
224+
216225 /* ============================================
217226 TOOLBOX POPOVER (Plus Button) - CRITICAL FIX
218227 Make sure items are visible and properly displayed
219228 ============================================ */
220229
221230 .ce-popover:not(.ce-popover--inline) {
222- display: block !important;
231+ display: flex !important;
232+ flex-direction: column !important;
223233 visibility: visible !important;
224234 opacity: 1 !important;
225235 z-index: 99999 !important;
226236 }
227237
228238 .ce-popover--opened {
229- display: block !important;
239+ display: flex !important;
240+ flex-direction: column !important;
230241 visibility: visible !important;
231242 opacity: 1 !important;
232243 }
233244
234245 .ce-popover__container {
235- display: block !important;
246+ display: flex !important;
247+ flex-direction: column !important;
236248 visibility: visible !important;
237249 opacity: 1 !important;
250+ flex: 1 !important;
251+ overflow: hidden !important;
238252 }
239253
240254 .ce-popover__items {
241255 display: block !important;
242256 visibility: visible !important;
243257 opacity: 1 !important;
244- max-height: 400px !important;
258+ flex: 1 !important;
245259 overflow-y: auto !important;
246260 }
247261
262+ /* Popover items - don't force display, let EditorJS control visibility for search */
248263 .ce-popover-item {
249- display: flex !important;
250264 visibility: visible !important;
251265 opacity: 1 !important;
252266 }
253267
268+ /* Only show flex when not hidden by search */
269+ .ce-popover-item:not([hidden]) {
270+ display: flex !important;
271+ }
272+
254273 .ce-popover-item__icon {
255274 display: flex !important;
256275 visibility: visible !important;
@@ -263,16 +282,48 @@ const EditorJSGlobalStyles = createGlobalStyle`
263282 opacity: 1 !important;
264283 }
265284
266- /* Hide empty/nothing- found message for main toolbox */
285+ /* Nothing found message - EditorJS controls visibility */
267286 .ce-popover:not(.ce-popover--inline) .ce-popover__nothing-found-message {
268- display: none !important;
287+ padding: 16px !important;
288+ text-align: center !important;
289+ color: #64748b !important;
290+ font-size: 14px !important;
269291 }
270292
271- /* Make sure search is visible */
293+ /* Search styling - let EditorJS control visibility */
272294 .ce-popover__search {
273- display: block !important;
274- visibility: visible !important;
275- opacity: 1 !important;
295+ padding: 12px !important;
296+ margin: 0 !important;
297+ border-bottom: 1px solid #e2e8f0 !important;
298+ background: white !important;
299+ }
300+
301+ /* Hide the search icon */
302+ .ce-popover__search-icon {
303+ display: none !important;
304+ }
305+
306+ .ce-popover__search-input {
307+ width: 100% !important;
308+ padding: 10px 14px !important;
309+ border: 1px solid #e2e8f0 !important;
310+ border-radius: 10px !important;
311+ background: #f8fafc !important;
312+ font-size: 14px !important;
313+ color: #334155 !important;
314+ outline: none !important;
315+ transition: all 0.15s ease !important;
316+ box-sizing: border-box !important;
317+ }
318+
319+ .ce-popover__search-input:focus {
320+ border-color: #7C3AED !important;
321+ background: white !important;
322+ box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1) !important;
323+ }
324+
325+ .ce-popover__search-input::placeholder {
326+ color: #94a3b8 !important;
276327 }
277328
278329 /* ============================================
@@ -2082,6 +2133,9 @@ const Editor = forwardRef(({
20822133 // Webtools Link Picker integration (optional)
20832134 const { isAvailable : isWebtoolsAvailable , openLinkPicker : webtoolsOpenLinkPicker } = useWebtoolsLinks ( ) ;
20842135
2136+ // Custom Blocks (user-defined blocks from database)
2137+ const { customBlocks, isLoading : isLoadingCustomBlocks } = useCustomBlocks ( ) ;
2138+
20852139 // Refs - must be defined before useAIActions
20862140 const editorRef = useRef ( null ) ;
20872141 const editorInstanceRef = useRef ( null ) ;
@@ -3358,12 +3412,21 @@ const Editor = forwardRef(({
33583412
33593413 // Initialize Editor.js
33603414 useEffect ( ( ) => {
3415+ // Wait for custom blocks to finish loading before initializing
3416+ if ( isLoadingCustomBlocks ) {
3417+ console . log ( '[Magic Editor X] Waiting for custom blocks to load...' ) ;
3418+ return ;
3419+ }
3420+
33613421 if ( editorRef . current && ! editorInstanceRef . current ) {
33623422 const tools = getTools ( {
33633423 mediaLibToggleFunc,
33643424 pluginId : PLUGIN_ID ,
33653425 openLinkPicker : isWebtoolsAvailable ? webtoolsOpenLinkPicker : null ,
3426+ customBlocks : customBlocks || [ ] ,
33663427 } ) ;
3428+
3429+ console . log ( '[Magic Editor X] Custom blocks loaded:' , customBlocks ?. length || 0 ) ;
33673430
33683431 let initialData = undefined ;
33693432 if ( value ) {
@@ -3610,7 +3673,8 @@ const Editor = forwardRef(({
36103673 }
36113674 document . body . classList . remove ( 'editor-fullscreen' ) ;
36123675 } ;
3613- } , [ ] ) ;
3676+ // eslint-disable-next-line react-hooks/exhaustive-deps
3677+ } , [ isLoadingCustomBlocks , customBlocks ] ) ;
36143678
36153679 // Dynamically toggle readOnly when collaboration role changes (viewer can't edit)
36163680 useEffect ( ( ) => {
0 commit comments