mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-27 02:42:25 +08:00
chore(editor): remove page block feature flag (#10251)
This commit is contained in:
@@ -36,7 +36,6 @@ import { property } from 'lit/decorators.js';
|
||||
import { styleMap } from 'lit/directives/style-map.js';
|
||||
|
||||
import { NoteConfigExtension } from '../config';
|
||||
import { isPageBlock } from '../utils';
|
||||
import * as styles from './edgeless-note-background.css';
|
||||
|
||||
@requiredProperties({
|
||||
@@ -162,7 +161,7 @@ export class EdgelessNoteBackground extends SignalWatcher(
|
||||
@pointerdown=${stopPropagation}
|
||||
@click=${this._handleClickAtBackground}
|
||||
>
|
||||
${isPageBlock(this.std, this.note) ? this._renderHeader() : nothing}
|
||||
${this.note.isPageBlock() ? this._renderHeader() : nothing}
|
||||
</div>`;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@ import { html } from 'lit';
|
||||
import { property } from 'lit/decorators.js';
|
||||
|
||||
import { NoteConfigExtension } from '../config';
|
||||
import { isPageBlock } from '../utils';
|
||||
import * as styles from './edgeless-page-block-title.css';
|
||||
|
||||
@requiredProperties({
|
||||
@@ -22,7 +21,7 @@ export class EdgelessPageBlockTitle extends SignalWatcher(
|
||||
WithDisposable(ShadowlessElement)
|
||||
) {
|
||||
override render() {
|
||||
if (!isPageBlock(this.std, this.note)) return;
|
||||
if (!this.note.isPageBlock()) return;
|
||||
|
||||
const title = this.std
|
||||
.getOptional(NoteConfigExtension.identifier)
|
||||
|
||||
@@ -6,4 +6,3 @@ export * from './note-block';
|
||||
export * from './note-edgeless-block';
|
||||
export * from './note-service';
|
||||
export * from './note-spec';
|
||||
export { isPageBlock } from './utils';
|
||||
|
||||
@@ -12,10 +12,10 @@ import { ifDefined } from 'lit/directives/if-defined.js';
|
||||
import { styleMap } from 'lit/directives/style-map.js';
|
||||
|
||||
import { MoreIndicator } from './components/more-indicator';
|
||||
import { NoteConfigExtension } from './config';
|
||||
import { NoteBlockComponent } from './note-block';
|
||||
import { ACTIVE_NOTE_EXTRA_PADDING } from './note-edgeless-block.css';
|
||||
import * as styles from './note-edgeless-block.css';
|
||||
import { isPageBlock } from './utils';
|
||||
|
||||
export const AFFINE_EDGELESS_NOTE = 'affine-edgeless-note';
|
||||
|
||||
@@ -219,6 +219,9 @@ export class EdgelessNoteBlockComponent extends toGfxBlockComponent(
|
||||
? this._noteFullHeight < height
|
||||
: !!collapsedHeight && collapsedHeight < height;
|
||||
|
||||
const hasHeader = !!this.std.getOptional(NoteConfigExtension.identifier)
|
||||
?.edgelessNoteHeader;
|
||||
|
||||
return html`
|
||||
<div
|
||||
class=${styles.edgelessNoteContainer}
|
||||
@@ -260,7 +263,7 @@ export class EdgelessNoteBlockComponent extends toGfxBlockComponent(
|
||||
.editing=${this._editing}
|
||||
></edgeless-note-mask>
|
||||
|
||||
${isCollapsable && !isPageBlock(this.std, this.model)
|
||||
${isCollapsable && (!this.model.isPageBlock() || !hasHeader)
|
||||
? html`<div
|
||||
class="${classMap({
|
||||
[styles.collapseButton]: true,
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
import { NoteBlockModel, NoteDisplayMode } from '@blocksuite/affine-model';
|
||||
import { FeatureFlagService } from '@blocksuite/affine-shared/services';
|
||||
import { matchModels } from '@blocksuite/affine-shared/utils';
|
||||
import type { BlockStdScope } from '@blocksuite/block-std';
|
||||
|
||||
/**
|
||||
* We define a note block as a page block if it is the first visible note
|
||||
*/
|
||||
export function isPageBlock(std: BlockStdScope, note: NoteBlockModel) {
|
||||
return (
|
||||
std.get(FeatureFlagService).getFlag('enable_page_block') &&
|
||||
note.parent?.children.find(
|
||||
child =>
|
||||
matchModels(child, [NoteBlockModel]) &&
|
||||
child.displayMode !== NoteDisplayMode.EdgelessOnly
|
||||
) === note
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user