mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-29 08:09:52 +08:00
47 lines
1.2 KiB
TypeScript
47 lines
1.2 KiB
TypeScript
import { NoteBlockModel } from '@blocksuite/affine-model';
|
|
import {
|
|
type BlockStdScope,
|
|
PropTypes,
|
|
requiredProperties,
|
|
ShadowlessElement,
|
|
stdContext,
|
|
} from '@blocksuite/block-std';
|
|
import { SignalWatcher, WithDisposable } from '@blocksuite/global/utils';
|
|
import { consume } from '@lit/context';
|
|
import { html } from 'lit';
|
|
import { property } from 'lit/decorators.js';
|
|
|
|
import { NoteConfigExtension } from '../config';
|
|
import * as styles from './edgeless-page-block-title.css';
|
|
|
|
@requiredProperties({
|
|
note: PropTypes.instanceOf(NoteBlockModel),
|
|
})
|
|
export class EdgelessPageBlockTitle extends SignalWatcher(
|
|
WithDisposable(ShadowlessElement)
|
|
) {
|
|
override render() {
|
|
if (!this.note.isPageBlock()) return;
|
|
|
|
const title = this.std
|
|
.getOptional(NoteConfigExtension.identifier)
|
|
?.pageBlockTitle({
|
|
note: this.note,
|
|
std: this.std,
|
|
});
|
|
|
|
return html`<div class=${styles.pageBlockTitle}>${title}</div>`;
|
|
}
|
|
|
|
@consume({ context: stdContext })
|
|
accessor std!: BlockStdScope;
|
|
|
|
@property({ attribute: false })
|
|
accessor note!: NoteBlockModel;
|
|
}
|
|
declare global {
|
|
interface HTMLElementTagNameMap {
|
|
'edgeless-page-block-title': EdgelessPageBlockTitle;
|
|
}
|
|
}
|