chore(editor): remove redundant edgeless-align-panel component (#10972)
This commit is contained in:
@@ -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;
|
|
||||||
}
|
|
||||||
@@ -9,7 +9,6 @@ import {
|
|||||||
NOTE_SLICER_WIDGET,
|
NOTE_SLICER_WIDGET,
|
||||||
NoteSlicer,
|
NoteSlicer,
|
||||||
} from './edgeless/components/note-slicer/index.js';
|
} 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 { CardStylePanel } from './edgeless/components/panel/card-style-panel.js';
|
||||||
import { EdgelessFontFamilyPanel } from './edgeless/components/panel/font-family-panel.js';
|
import { EdgelessFontFamilyPanel } from './edgeless/components/panel/font-family-panel.js';
|
||||||
import { EdgelessFontWeightAndStylePanel } from './edgeless/components/panel/font-weight-and-style-panel.js';
|
import { EdgelessFontWeightAndStylePanel } from './edgeless/components/panel/font-weight-and-style-panel.js';
|
||||||
@@ -216,7 +215,6 @@ function registerEdgelessToolbarComponents() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function registerEdgelessPanelComponents() {
|
function registerEdgelessPanelComponents() {
|
||||||
customElements.define('edgeless-align-panel', EdgelessAlignPanel);
|
|
||||||
customElements.define('card-style-panel', CardStylePanel);
|
customElements.define('card-style-panel', CardStylePanel);
|
||||||
customElements.define('edgeless-line-width-panel', EdgelessLineWidthPanel);
|
customElements.define('edgeless-line-width-panel', EdgelessLineWidthPanel);
|
||||||
customElements.define(
|
customElements.define(
|
||||||
@@ -314,7 +312,6 @@ declare global {
|
|||||||
'edgeless-toolbar-button': EdgelessToolbarButton;
|
'edgeless-toolbar-button': EdgelessToolbarButton;
|
||||||
'edgeless-connector-handle': EdgelessConnectorHandle;
|
'edgeless-connector-handle': EdgelessConnectorHandle;
|
||||||
'note-slicer': NoteSlicer;
|
'note-slicer': NoteSlicer;
|
||||||
'edgeless-align-panel': EdgelessAlignPanel;
|
|
||||||
'card-style-panel': CardStylePanel;
|
'card-style-panel': CardStylePanel;
|
||||||
'edgeless-font-family-panel': EdgelessFontFamilyPanel;
|
'edgeless-font-family-panel': EdgelessFontFamilyPanel;
|
||||||
'edgeless-font-weight-and-style-panel': EdgelessFontWeightAndStylePanel;
|
'edgeless-font-weight-and-style-panel': EdgelessFontWeightAndStylePanel;
|
||||||
|
|||||||
Reference in New Issue
Block a user