mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-14 13:25:12 +00:00
**Directory Structure Changes** - Renamed multiple block-related directories by removing the "block-" prefix: - `block-attachment` → `attachment` - `block-bookmark` → `bookmark` - `block-callout` → `callout` - `block-code` → `code` - `block-data-view` → `data-view` - `block-database` → `database` - `block-divider` → `divider` - `block-edgeless-text` → `edgeless-text` - `block-embed` → `embed`
51 lines
1.3 KiB
TypeScript
51 lines
1.3 KiB
TypeScript
import { CaptionedBlockComponent } from '@blocksuite/affine-components/caption';
|
|
import type { DividerBlockModel } from '@blocksuite/affine-model';
|
|
import { BLOCK_CHILDREN_CONTAINER_PADDING_LEFT } from '@blocksuite/affine-shared/consts';
|
|
import { BlockSelection } from '@blocksuite/std';
|
|
import { html } from 'lit';
|
|
|
|
import { dividerBlockStyles } from './styles.js';
|
|
|
|
export class DividerBlockComponent extends CaptionedBlockComponent<DividerBlockModel> {
|
|
static override styles = dividerBlockStyles;
|
|
|
|
override connectedCallback() {
|
|
super.connectedCallback();
|
|
|
|
this.contentEditable = 'false';
|
|
|
|
this.handleEvent('click', () => {
|
|
this.host.selection.setGroup('note', [
|
|
this.host.selection.create(BlockSelection, {
|
|
blockId: this.blockId,
|
|
}),
|
|
]);
|
|
});
|
|
}
|
|
|
|
override renderBlock() {
|
|
const children = html`<div
|
|
class="affine-block-children-container"
|
|
style="padding-left: ${BLOCK_CHILDREN_CONTAINER_PADDING_LEFT}px"
|
|
>
|
|
${this.renderChildren(this.model)}
|
|
</div>`;
|
|
|
|
return html`
|
|
<div class="affine-divider-block-container">
|
|
<hr />
|
|
|
|
${children}
|
|
</div>
|
|
`;
|
|
}
|
|
|
|
override accessor useZeroWidth = true;
|
|
}
|
|
|
|
declare global {
|
|
interface HTMLElementTagNameMap {
|
|
'affine-divider': DividerBlockComponent;
|
|
}
|
|
}
|