Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

chore(editor): remove redundant edgeless-align-panel component (#10972)

fundon1c0c698375db
diff --git a/blocksuite/affine/blocks/block-root/src/edgeless/components/panel/align-panel.ts b/blocksuite/affine/blocks/block-root/src/edgeless/components/panel/align-panel.ts
deleted file mode 100644
index 0c88b5cfc7..0000000000
--- a/blocksuite/affine/blocks/block-root/src/edgeless/components/panel/align-panel.ts
+++ /dev/null
@@ -1,70 +0,0 @@
-import { TextAlign } from '@blocksuite/affine-model';
-import {
- TextAlignCenterIcon,
- TextAlignLeftIcon,
- TextAlignRightIcon,
-} from '@blocksuite/icons/lit';
-import { css, html, LitElement } from 'lit';
-import { property } from 'lit/decorators.js';
-import { repeat } from 'lit/directives/repeat.js';
-
-const TEXT_ALIGN_LIST = [
- {
- name: 'Left',
- value: TextAlign.Left,
- icon: TextAlignLeftIcon(),
- },
- {
- name: 'Center',
- value: TextAlign.Center,
- icon: TextAlignCenterIcon(),
- },
- {
- name: 'Right',
- value: TextAlign.Right,
- icon: TextAlignRightIcon(),
- },
-];
-
-export class EdgelessAlignPanel extends LitElement {
- static override styles = css`
- :host {
- display: flex;
- align-items: center;
- justify-content: center;
- gap: 8px;
- }
- `;
-
- private _onSelect(value: TextAlign) {
- this.value = value;
- if (this.onSelect) {
- this.onSelect(value);
- }
- }
-
- override render() {
- return repeat(
- TEXT_ALIGN_LIST,
- item => item.name,
- ({ name, value, icon }) => html`
- <edgeless-tool-icon-button
- .activeMode=${'background'}
- aria-label=${name}
- .tooltip=${name}
- .active=${this.value === value}
- .iconSize=${'20px'}
- @click=${() => this._onSelect(value)}
- >
- ${icon}
- </edgeless-tool-icon-button>
- `
- );
- }
-
- @property({ attribute: false })
- accessor onSelect: undefined | ((value: TextAlign) => void) = undefined;
-
- @property({ attribute: false })
- accessor value: TextAlign = TextAlign.Left;
-}
diff --git a/blocksuite/affine/blocks/block-root/src/effects.ts b/blocksuite/affine/blocks/block-root/src/effects.ts
index fb1df62f07..5d964ff49f 100644
--- a/blocksuite/affine/blocks/block-root/src/effects.ts
+++ b/blocksuite/affine/blocks/block-root/src/effects.ts
@@ -9,7 +9,6 @@ import {
NOTE_SLICER_WIDGET,
NoteSlicer,
} from './edgeless/components/note-slicer/index.js';
-import { EdgelessAlignPanel } from './edgeless/components/panel/align-panel.js';
import { CardStylePanel } from './edgeless/components/panel/card-style-panel.js';
import { EdgelessFontFamilyPanel } from './edgeless/components/panel/font-family-panel.js';
import { EdgelessFontWeightAndStylePanel } from './edgeless/components/panel/font-weight-and-style-panel.js';
@@ -216,7 +215,6 @@ function registerEdgelessToolbarComponents() {
}
function registerEdgelessPanelComponents() {
- customElements.define('edgeless-align-panel', EdgelessAlignPanel);
customElements.define('card-style-panel', CardStylePanel);
customElements.define('edgeless-line-width-panel', EdgelessLineWidthPanel);
customElements.define(
@@ -314,7 +312,6 @@ declare global {
'edgeless-toolbar-button': EdgelessToolbarButton;
'edgeless-connector-handle': EdgelessConnectorHandle;
'note-slicer': NoteSlicer;
- 'edgeless-align-panel': EdgelessAlignPanel;
'card-style-panel': CardStylePanel;
'edgeless-font-family-panel': EdgelessFontFamilyPanel;
'edgeless-font-weight-and-style-panel': EdgelessFontWeightAndStylePanel;