Просмотр исходного кода

Reapply "Avoid vertical border between editor switch and empty space (#18029)" (#18072)

This reverts commit 9a071e1d02f27bbcaf1d61a9cca577cc6c889abc.

GitOrigin-RevId: 72380a15ccbc4e8d7fddcfdf0a9a48209152b8b9
Alf Eaton 2 лет назад
Родитель
Сommit
9d4340e24a

+ 0 - 2
services/web/frontend/js/features/source-editor/components/codemirror-toolbar.tsx

@@ -168,8 +168,6 @@ const Toolbar = memo(function Toolbar() {
             />
           </ToolbarOverflow>
         )}
-
-        <div className="formatting-buttons-wrapper" />
       </div>
 
       <div

+ 9 - 13
services/web/frontend/js/features/source-editor/extensions/toolbar/toolbar-panel.ts

@@ -87,26 +87,22 @@ const toolbarTheme = EditorView.theme({
     padding: '0 4px',
     margin: '4px 0',
     lineHeight: '1',
-    '&:not(:first-of-type)': {
-      borderLeft: '1px solid rgba(125, 125, 125, 0.3)',
-      '&.ol-cm-toolbar-end': {
-        borderLeft: 'none',
-      },
-      '&.ol-cm-toolbar-stretch': {
-        flex: 1,
-      },
-      '&.overflow-hidden': {
-        borderLeft: 'none',
+    borderLeft: '1px solid rgba(125, 125, 125, 0.3)',
+    '&.ol-cm-toolbar-end': {
+      borderLeft: 'none',
+    },
+    '&.ol-cm-toolbar-stretch': {
+      flex: 1,
+      '.editor-toggle-switch + &': {
+        borderLeft: 'none', // avoid a left border when no toolbar buttons are shown
       },
     },
     '&.overflow-hidden': {
+      borderLeft: 'none',
       width: 0,
       padding: 0,
     },
   },
-  '.formatting-buttons-wrapper': {
-    flex: 1,
-  },
   '.ol-cm-toolbar-button': {
     display: 'inline-flex',
     alignItems: 'center',

+ 2 - 3
services/web/frontend/js/features/source-editor/languages/latex/codemirror-dev-tools.ts

@@ -19,8 +19,7 @@ export const codemirrorDevTools = () => {
 }
 
 const devToolsButton = ViewPlugin.define(view => {
-  const getContainer = () =>
-    document.querySelector('.formatting-buttons-wrapper')
+  const getContainer = () => document.querySelector('.ol-cm-toolbar-end')
 
   const removeButton = () => {
     getContainer()?.querySelector('#cm6-dev-tools-button')?.remove()
@@ -38,7 +37,7 @@ const devToolsButton = ViewPlugin.define(view => {
       view.dispatch(toggleDevTools())
     })
 
-    getContainer()?.prepend(button)
+    getContainer()?.append(button)
   }
 
   window.setTimeout(() => {

+ 0 - 4
services/web/frontend/stylesheets/app/editor/toolbar.less

@@ -334,10 +334,6 @@
   overflow: hidden;
 }
 
-.formatting-buttons-wrapper {
-  display: flex;
-}
-
 .formatting-btn {
   color: @formatting-btn-color;
   background-color: @formatting-btn-bg;