@@ -64,13 +64,10 @@ export const fitInlineTableWidth = (root) => {
6464 s . style . maxWidth = '0px' // reflow to natural layout
6565 s . style . paddingRight = '' // measure true overflow without our spacer
6666 } )
67- // In fullscreen the renderer itself defines the available width; the
67+ // When maximised the renderer itself defines the available width; the
6868 // Logseq block clip ancestor is irrelevant. Let the scroll wrapper fill
69- // the fullscreen viewport so the table can render edge-to-edge.
70- const doc = root . ownerDocument
71- const fsEl = doc . fullscreenElement || doc . webkitFullscreenElement
72- const maximised = root . classList . contains ( 'lsp-mdt-max' )
73- if ( ( fsEl && fsEl . contains ( root ) ) || maximised ) {
69+ // the window so the table can render edge-to-edge.
70+ if ( root . classList . contains ( 'lsp-mdt-max' ) ) {
7471 scrolls . forEach ( s => {
7572 s . style . maxWidth = '100%'
7673 if ( s . scrollWidth > s . clientWidth + 1 ) {
@@ -111,8 +108,6 @@ const bindResizeRefit = (root) => {
111108 } , 100 )
112109 }
113110 win . addEventListener ( 'resize' , refitAll )
114- doc . addEventListener ( 'fullscreenchange' , refitAll )
115- doc . addEventListener ( 'webkitfullscreenchange' , refitAll )
116111}
117112
118113// Called from the renderer's ref on every (re-)mount, regardless of whether
@@ -435,20 +430,15 @@ const ICONS = {
435430 sortColAsc : SVG ( '<path d="M11 5h3M11 10h6M11 15h9"/><polyline points="4 8 7 5 10 8"/><line x1="7" y1="5" x2="7" y2="19"/>' ) ,
436431 sortColDesc : SVG ( '<path d="M11 5h9M11 10h6M11 15h3"/><polyline points="4 16 7 19 10 16"/><line x1="7" y1="5" x2="7" y2="19"/>' ) ,
437432 pin : SVG ( '<line x1="12" y1="17" x2="12" y2="22"/><path d="M9 3h6l-1 6 3 3v2H7v-2l3-3-1-6z"/>' ) ,
438- fullscreen : SVG ( '<polyline points="4 9 4 4 9 4"/><polyline points="20 9 20 4 15 4"/><polyline points="4 15 4 20 9 20"/><polyline points="20 15 20 20 15 20"/>' ) ,
439- exitFullscreen : SVG ( '<polyline points="9 4 9 9 4 9"/><polyline points="15 4 15 9 20 9"/><polyline points="4 15 9 15 9 20"/><polyline points="20 15 15 15 15 20"/>' ) ,
440433 // Maximise = expand to Logseq's window bounds (covers sidebars/blocks).
441- // Distinct glyph from fullscreen so the two are distinguishable in the bar:
442- // a framed box with inward arrows.
434+ // A framed box with inward arrows; the exit variant has the arrows outward.
443435 maximise : SVG ( '<rect x="3" y="3" width="18" height="18" rx="1"/><polyline points="8 13 8 16 11 16"/><polyline points="16 11 16 8 13 8"/>' ) ,
444436 exitMaximise : SVG ( '<rect x="3" y="3" width="18" height="18" rx="1"/><polyline points="13 8 16 8 16 11"/><polyline points="11 16 8 16 8 13"/>' )
445437}
446438
447- // Overlay host for popovers/toolbars: when the renderer is in native
448- // fullscreen, doc.body sits beneath the fullscreen element's top layer and
449- // our popups would be invisible. Mount them inside the fullscreen element
450- // in that case so they share the top layer.
451- const overlayHost = ( doc ) => doc . fullscreenElement || doc . webkitFullscreenElement || doc . body
439+ // Overlay host for popovers/toolbars. The renderer is reparented to <body>
440+ // while maximised, so mounting popups on <body> keeps them above it.
441+ const overlayHost = ( doc ) => doc . body
452442
453443const closeMenu = ( doc ) => {
454444 const el = doc . querySelector ( '.lsp-mdt-menu' )
@@ -502,29 +492,6 @@ const buildItems = (root, opts, cell) => {
502492
503493const isPinned = ( opts ) => ! ! ( opts . isPinned && opts . isPinned ( ) )
504494
505- // Full-screen toggle item; lives next to Pin/Unpin in both the right-click
506- // menu and the pinned toolbar. Uses the native Fullscreen API on the
507- // renderer root so the DOM doesn't move and all editing hooks stay bound.
508- // `after(nowFs)` lets the surface refresh its item state.
509- const fullScreenItem = ( root , opts , after ) => {
510- const doc = root . ownerDocument
511- const fsEl = doc . fullscreenElement || doc . webkitFullscreenElement
512- const isFs = fsEl === root
513- const L = opts . menuLabels || { }
514- return {
515- icon : isFs ? ICONS . exitFullscreen : ICONS . fullscreen ,
516- label : isFs ? ( L . exitFullScreen || 'Exit full screen' ) : ( L . fullScreen || 'Full screen' ) ,
517- enabled : true ,
518- action : ( ) => {
519- try {
520- if ( isFs ) ( doc . exitFullscreen || doc . webkitExitFullscreen ) . call ( doc )
521- else ( root . requestFullscreen || root . webkitRequestFullscreen ) . call ( root )
522- } catch ( e ) { console . warn ( '[mdtable] fullscreen toggle failed' , e ) }
523- if ( after ) after ( ! isFs )
524- }
525- }
526- }
527-
528495// Maximise = expand the renderer to fill Logseq's window (covering sidebars
529496// and other blocks), without entering OS-level fullscreen. Implementation:
530497// reparent the renderer to <body> so ancestor transforms / overflow / stacking
@@ -580,7 +547,7 @@ const bindMaximiseEsc = (doc) => {
580547 } , true )
581548}
582549
583- // Maximise toggle item; mirrors fullScreenItem's shape .
550+ // Maximise toggle item; lives next to Pin/Unpin in both surfaces .
584551const maximiseItem = ( root , opts , after ) => {
585552 const max = isMaximised ( root )
586553 const L = opts . menuLabels || { }
@@ -691,7 +658,6 @@ const buildToolbar = (root, opts, cell) => {
691658 const aRow = Array . from ( cell . closest ( 'table.lsp-mdt' ) . querySelectorAll ( 'tr' ) ) . indexOf ( aTr )
692659 const aCol = Array . from ( aTr . querySelectorAll ( 'th,td' ) ) . indexOf ( cell )
693660 const all = items . concat ( [ { sep : true } ,
694- fullScreenItem ( root , opts , ( ) => buildToolbar ( root , opts , cell ) ) ,
695661 maximiseItem ( root , opts , ( ) => buildToolbar ( root , opts , cell ) ) ,
696662 pinItem ( opts , ( ) => removeToolbar ( doc ) ) ] ) // pinned bar's toggle = unpin
697663
@@ -728,7 +694,6 @@ const openContextMenu = (root, opts, cell, ev) => {
728694
729695 const { items, ord } = buildItems ( root , opts , cell )
730696 const all = items . concat ( [ { sep : true } ,
731- fullScreenItem ( root , opts ) ,
732697 maximiseItem ( root , opts ) ,
733698 pinItem ( opts , ( now ) => { if ( now ) buildToolbar ( root , opts , cell ) ; else removeToolbar ( doc ) } ) ] )
734699
0 commit comments