chore(editor): revert padding and layout of code block toolbar (#9562)

Close [BS-1767](https://linear.app/affine-design/issue/BS-1767/code-block调整边距)

This PR reverts padding and layout of code block toolbar.

![CleanShot 2025-01-07 at 12.39.37@2x.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/MyRfgiN4RuBxJfrza3SG/7f278d03-40c4-4592-a844-77a5179149fd.png)
This commit is contained in:
L-Sun
2025-01-07 04:53:04 +00:00
parent ded17abf7e
commit 6e0468c70a
5 changed files with 23 additions and 5 deletions
@@ -17,15 +17,19 @@ export class AffineCodeToolbar extends WithDisposable(LitElement) {
static override styles = css`
:host {
position: absolute;
width: 100%;
top: 0;
right: 0;
left: 0;
}
.code-toolbar-container {
width: auto;
height: 24px;
gap: 4px;
padding: 4px;
margin: 0;
display: flex;
justify-content: flex-end;
}
.code-toolbar-button {
@@ -17,6 +17,10 @@ export class LanguageListButton extends WithDisposable(
SignalWatcher(LitElement)
) {
static override styles = css`
:host {
margin-right: auto;
}
.lang-button {
background-color: var(--affine-background-primary-color);
box-shadow: var(--affine-shadow-1);
@@ -14,7 +14,7 @@ import {
TextSelection,
WidgetComponent,
} from '@blocksuite/block-std';
import { limitShift, shift } from '@floating-ui/dom';
import { limitShift, shift, size } from '@floating-ui/dom';
import { html } from 'lit';
import type { CodeBlockComponent } from '../code-block.js';
@@ -82,8 +82,13 @@ export class AffineCodeToolbarWidget extends WidgetComponent<
},
computePosition: {
referenceElement: codeBlock,
placement: 'right-start',
placement: 'top',
middleware: [
size({
apply({ rects, elements }) {
elements.floating.style.width = `${rects.reference.width}px`;
},
}),
shift({
crossAxis: true,
padding: {