mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-01 01:29:31 +08:00
chore: fix eslint in blocksuite (#9232)
This commit is contained in:
@@ -88,28 +88,30 @@ export class AffineEditorContainer
|
||||
}
|
||||
`;
|
||||
|
||||
private _doc = signal<Doc>();
|
||||
private readonly _doc = signal<Doc>();
|
||||
|
||||
private _edgelessSpecs = signal<ExtensionType[]>(EdgelessEditorBlockSpecs);
|
||||
private readonly _edgelessSpecs = signal<ExtensionType[]>(
|
||||
EdgelessEditorBlockSpecs
|
||||
);
|
||||
|
||||
private _mode = signal<DocMode>('page');
|
||||
private readonly _mode = signal<DocMode>('page');
|
||||
|
||||
private _pageSpecs = signal<ExtensionType[]>(PageEditorBlockSpecs);
|
||||
private readonly _pageSpecs = signal<ExtensionType[]>(PageEditorBlockSpecs);
|
||||
|
||||
private _specs = computed(() =>
|
||||
private readonly _specs = computed(() =>
|
||||
this._mode.value === 'page'
|
||||
? this._pageSpecs.value
|
||||
: this._edgelessSpecs.value
|
||||
);
|
||||
|
||||
private _std = computed(() => {
|
||||
private readonly _std = computed(() => {
|
||||
return new BlockStdScope({
|
||||
doc: this.doc,
|
||||
extensions: this._specs.value,
|
||||
});
|
||||
});
|
||||
|
||||
private _editorTemplate = computed(() => {
|
||||
private readonly _editorTemplate = computed(() => {
|
||||
return this._std.value.render();
|
||||
});
|
||||
|
||||
|
||||
@@ -41,11 +41,11 @@ export class CommentInput extends WithDisposable(ShadowlessElement) {
|
||||
}
|
||||
`;
|
||||
|
||||
private _cancel = () => {
|
||||
private readonly _cancel = () => {
|
||||
this.remove();
|
||||
};
|
||||
|
||||
private _submit = (textSelection: TextSelection) => {
|
||||
private readonly _submit = (textSelection: TextSelection) => {
|
||||
const deltas = this._editor.inlineEditor?.yTextDeltas;
|
||||
if (!deltas) {
|
||||
this.remove();
|
||||
|
||||
@@ -79,10 +79,10 @@ export class BacklinkButton extends WithDisposable(LitElement) {
|
||||
${scrollbarStyle('.backlink-popover .group')}
|
||||
`;
|
||||
|
||||
private _backlinks: BacklinkData[];
|
||||
private readonly _backlinks: BacklinkData[];
|
||||
|
||||
// Handle click outside
|
||||
private _onClickAway = (e: Event) => {
|
||||
private readonly _onClickAway = (e: Event) => {
|
||||
if (e.target === this) return;
|
||||
if (!this._showPopover) return;
|
||||
this._showPopover = false;
|
||||
|
||||
@@ -59,7 +59,7 @@ export class DocTitle extends WithDisposable(ShadowlessElement) {
|
||||
}
|
||||
`;
|
||||
|
||||
private _onTitleKeyDown = (event: KeyboardEvent) => {
|
||||
private readonly _onTitleKeyDown = (event: KeyboardEvent) => {
|
||||
if (event.isComposing || this.doc.readonly) return;
|
||||
const hasContent = !this.doc.isEmpty;
|
||||
|
||||
@@ -83,7 +83,7 @@ export class DocTitle extends WithDisposable(ShadowlessElement) {
|
||||
}
|
||||
};
|
||||
|
||||
private _updateTitleInMeta = () => {
|
||||
private readonly _updateTitleInMeta = () => {
|
||||
this.doc.collection.setDocMeta(this.doc.id, {
|
||||
title: this._rootModel.title.toString(),
|
||||
});
|
||||
|
||||
@@ -91,7 +91,7 @@ export class FramePanelBody extends SignalWatcher(
|
||||
) {
|
||||
static override styles = styles;
|
||||
|
||||
private _clearDocDisposables = () => {
|
||||
private readonly _clearDocDisposables = () => {
|
||||
this._docDisposables?.dispose();
|
||||
this._docDisposables = null;
|
||||
};
|
||||
@@ -99,7 +99,7 @@ export class FramePanelBody extends SignalWatcher(
|
||||
/**
|
||||
* click at blank area to clear selection
|
||||
*/
|
||||
private _clickBlank = (e: MouseEvent) => {
|
||||
private readonly _clickBlank = (e: MouseEvent) => {
|
||||
e.stopPropagation();
|
||||
// check if click at frame-card, if not, set this._selected to empty
|
||||
if (
|
||||
@@ -126,7 +126,7 @@ export class FramePanelBody extends SignalWatcher(
|
||||
|
||||
private _lastEdgelessRootId = '';
|
||||
|
||||
private _selectFrame = (e: SelectEvent) => {
|
||||
private readonly _selectFrame = (e: SelectEvent) => {
|
||||
const { selected, id, multiselect } = e.detail;
|
||||
|
||||
if (!selected) {
|
||||
@@ -144,7 +144,7 @@ export class FramePanelBody extends SignalWatcher(
|
||||
});
|
||||
};
|
||||
|
||||
private _updateFrameItems = () => {
|
||||
private readonly _updateFrameItems = () => {
|
||||
this._frameItems = this.frames.map((frame, idx) => ({
|
||||
frame,
|
||||
frameIndex: frame.presentationIndex ?? frame.index,
|
||||
|
||||
@@ -16,7 +16,7 @@ export const AFFINE_FRAME_TITLE_EDITOR = 'affine-frame-card-title-editor';
|
||||
export class FrameCardTitleEditor extends WithDisposable(ShadowlessElement) {
|
||||
static override styles = styles;
|
||||
|
||||
private _isComposing = false;
|
||||
private readonly _isComposing = false;
|
||||
|
||||
get inlineEditor() {
|
||||
return this.richText.inlineEditor;
|
||||
|
||||
@@ -59,12 +59,12 @@ export const AFFINE_FRAME_CARD_TITLE = 'affine-frame-card-title';
|
||||
export class FrameCardTitle extends WithDisposable(ShadowlessElement) {
|
||||
static override styles = styles;
|
||||
|
||||
private _clearTitleDisposables = () => {
|
||||
private readonly _clearTitleDisposables = () => {
|
||||
this._titleDisposables?.dispose();
|
||||
this._titleDisposables = null;
|
||||
};
|
||||
|
||||
private _mountTitleEditor = (e: MouseEvent) => {
|
||||
private readonly _mountTitleEditor = (e: MouseEvent) => {
|
||||
e.stopPropagation();
|
||||
|
||||
const titleEditor = new FrameCardTitleEditor();
|
||||
@@ -78,7 +78,7 @@ export class FrameCardTitle extends WithDisposable(ShadowlessElement) {
|
||||
|
||||
private _titleDisposables: DisposableGroup | null = null;
|
||||
|
||||
private _updateElement = () => {
|
||||
private readonly _updateElement = () => {
|
||||
this.requestUpdate();
|
||||
};
|
||||
|
||||
|
||||
@@ -105,14 +105,14 @@ export const AFFINE_FRAME_PANEL_HEADER = 'affine-frame-panel-header';
|
||||
export class FramePanelHeader extends WithDisposable(LitElement) {
|
||||
static override styles = styles;
|
||||
|
||||
private _clearEdgelessDisposables = () => {
|
||||
private readonly _clearEdgelessDisposables = () => {
|
||||
this._edgelessDisposables?.dispose();
|
||||
this._edgelessDisposables = null;
|
||||
};
|
||||
|
||||
private _edgelessDisposables: DisposableGroup | null = null;
|
||||
|
||||
private _enterPresentationMode = () => {
|
||||
private readonly _enterPresentationMode = () => {
|
||||
if (!this._edgelessRootService) {
|
||||
this.editorHost.std.get(DocModeProvider).setEditorMode('edgeless');
|
||||
}
|
||||
@@ -131,7 +131,7 @@ export class FramePanelHeader extends WithDisposable(LitElement) {
|
||||
|
||||
private _navigatorMode: NavigatorMode = 'fit';
|
||||
|
||||
private _setEdgelessDisposables = () => {
|
||||
private readonly _setEdgelessDisposables = () => {
|
||||
if (!this._edgelessRootService) return;
|
||||
|
||||
this._clearEdgelessDisposables();
|
||||
|
||||
@@ -72,14 +72,14 @@ export const AFFINE_FRAMES_SETTING_MENU = 'affine-frames-setting-menu';
|
||||
export class FramesSettingMenu extends WithDisposable(LitElement) {
|
||||
static override styles = styles;
|
||||
|
||||
private _onBlackBackgroundChange = (checked: boolean) => {
|
||||
private readonly _onBlackBackgroundChange = (checked: boolean) => {
|
||||
this.blackBackground = checked;
|
||||
this._edgelessRootService?.slots.navigatorSettingUpdated.emit({
|
||||
blackBackground: this.blackBackground,
|
||||
});
|
||||
};
|
||||
|
||||
private _onFillScreenChange = (checked: boolean) => {
|
||||
private readonly _onFillScreenChange = (checked: boolean) => {
|
||||
this.fillScreen = checked;
|
||||
this._edgelessRootService?.slots.navigatorSettingUpdated.emit({
|
||||
fillScreen: this.fillScreen,
|
||||
@@ -87,7 +87,7 @@ export class FramesSettingMenu extends WithDisposable(LitElement) {
|
||||
this._editPropsStore.setStorage('presentFillScreen', this.fillScreen);
|
||||
};
|
||||
|
||||
private _onHideToolBarChange = (checked: boolean) => {
|
||||
private readonly _onHideToolBarChange = (checked: boolean) => {
|
||||
this.hideToolbar = checked;
|
||||
this._edgelessRootService?.slots.navigatorSettingUpdated.emit({
|
||||
hideToolbar: this.hideToolbar,
|
||||
|
||||
@@ -120,7 +120,7 @@ export class OutlinePanelBody extends SignalWatcher(
|
||||
) {
|
||||
static override styles = styles;
|
||||
|
||||
private _activeHeadingId$ = signal<string | null>(null);
|
||||
private readonly _activeHeadingId$ = signal<string | null>(null);
|
||||
|
||||
private _changedFlag = false;
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ export const AFFINE_OUTLINE_PANEL = 'affine-outline-panel';
|
||||
export class OutlinePanel extends SignalWatcher(WithDisposable(LitElement)) {
|
||||
static override styles = styles;
|
||||
|
||||
private _setNoticeVisibility = (visibility: boolean) => {
|
||||
private readonly _setNoticeVisibility = (visibility: boolean) => {
|
||||
this._noticeVisible = visibility;
|
||||
};
|
||||
|
||||
@@ -64,12 +64,12 @@ export class OutlinePanel extends SignalWatcher(WithDisposable(LitElement)) {
|
||||
enableSorting: false,
|
||||
};
|
||||
|
||||
private _toggleNotesSorting = () => {
|
||||
private readonly _toggleNotesSorting = () => {
|
||||
this._enableNotesSorting = !this._enableNotesSorting;
|
||||
this._updateAndSaveSettings({ enableSorting: this._enableNotesSorting });
|
||||
};
|
||||
|
||||
private _toggleShowPreviewIcon = (on: boolean) => {
|
||||
private readonly _toggleShowPreviewIcon = (on: boolean) => {
|
||||
this._showPreviewIcon = on;
|
||||
this._updateAndSaveSettings({ showIcons: on });
|
||||
};
|
||||
|
||||
@@ -140,13 +140,13 @@ export class OutlineViewer extends SignalWatcher(WithDisposable(LitElement)) {
|
||||
}
|
||||
`;
|
||||
|
||||
private _activeHeadingId$ = signal<string | null>(null);
|
||||
private readonly _activeHeadingId$ = signal<string | null>(null);
|
||||
|
||||
private _highlightMaskDisposable = () => {};
|
||||
|
||||
private _lockActiveHeadingId = false;
|
||||
|
||||
private _scrollPanel = () => {
|
||||
private readonly _scrollPanel = () => {
|
||||
this._activeItem?.scrollIntoView({
|
||||
behavior: 'instant',
|
||||
block: 'center',
|
||||
|
||||
Reference in New Issue
Block a user