mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 04:48:53 +00:00
chore: fix eslint in blocksuite (#9232)
This commit is contained in:
@@ -140,7 +140,7 @@ export class InlineEditor<
|
||||
return this._rootElement;
|
||||
}
|
||||
|
||||
private _inlineRangeProviderOverride = false;
|
||||
private readonly _inlineRangeProviderOverride: boolean;
|
||||
get inlineRangeProviderOverride() {
|
||||
return this._inlineRangeProviderOverride;
|
||||
}
|
||||
@@ -220,6 +220,7 @@ export class InlineEditor<
|
||||
inlineRangeProvider,
|
||||
vLineRenderer = null,
|
||||
} = ops;
|
||||
this._inlineRangeProviderOverride = false;
|
||||
this.yText = yText;
|
||||
this.isEmbed = isEmbed;
|
||||
this.vLineRenderer = vLineRenderer;
|
||||
|
||||
@@ -15,7 +15,7 @@ export class EventService<TextAttributes extends BaseTextAttributes> {
|
||||
|
||||
private _isComposing = false;
|
||||
|
||||
private _isRangeCompletelyInRoot = (range: Range) => {
|
||||
private readonly _isRangeCompletelyInRoot = (range: Range) => {
|
||||
if (range.commonAncestorContainer.ownerDocument !== document) return false;
|
||||
|
||||
const rootElement = this.editor.rootElement;
|
||||
@@ -38,7 +38,7 @@ export class EventService<TextAttributes extends BaseTextAttributes> {
|
||||
}
|
||||
};
|
||||
|
||||
private _onBeforeInput = (event: InputEvent) => {
|
||||
private readonly _onBeforeInput = (event: InputEvent) => {
|
||||
const range = this.editor.rangeService.getNativeRange();
|
||||
if (
|
||||
this.editor.isReadonly ||
|
||||
@@ -119,7 +119,7 @@ export class EventService<TextAttributes extends BaseTextAttributes> {
|
||||
this.editor.slots.inputting.emit();
|
||||
};
|
||||
|
||||
private _onClick = (event: MouseEvent) => {
|
||||
private readonly _onClick = (event: MouseEvent) => {
|
||||
// select embed element when click on it
|
||||
if (event.target instanceof Node && isInEmbedElement(event.target)) {
|
||||
const selection = document.getSelection();
|
||||
@@ -138,7 +138,7 @@ export class EventService<TextAttributes extends BaseTextAttributes> {
|
||||
}
|
||||
};
|
||||
|
||||
private _onCompositionEnd = async (event: CompositionEvent) => {
|
||||
private readonly _onCompositionEnd = async (event: CompositionEvent) => {
|
||||
this._isComposing = false;
|
||||
if (!this.editor.rootElement.isConnected) return;
|
||||
|
||||
@@ -179,7 +179,7 @@ export class EventService<TextAttributes extends BaseTextAttributes> {
|
||||
this.editor.slots.inputting.emit();
|
||||
};
|
||||
|
||||
private _onCompositionStart = () => {
|
||||
private readonly _onCompositionStart = () => {
|
||||
this._isComposing = true;
|
||||
// embeds is not editable and it will break IME
|
||||
const embeds = this.editor.rootElement.querySelectorAll(
|
||||
@@ -197,7 +197,7 @@ export class EventService<TextAttributes extends BaseTextAttributes> {
|
||||
}
|
||||
};
|
||||
|
||||
private _onCompositionUpdate = () => {
|
||||
private readonly _onCompositionUpdate = () => {
|
||||
if (!this.editor.rootElement.isConnected) return;
|
||||
|
||||
const range = this.editor.rangeService.getNativeRange();
|
||||
@@ -211,7 +211,7 @@ export class EventService<TextAttributes extends BaseTextAttributes> {
|
||||
this.editor.slots.inputting.emit();
|
||||
};
|
||||
|
||||
private _onKeyDown = (event: KeyboardEvent) => {
|
||||
private readonly _onKeyDown = (event: KeyboardEvent) => {
|
||||
const inlineRange = this.editor.getInlineRange();
|
||||
if (!inlineRange) return;
|
||||
|
||||
@@ -270,7 +270,7 @@ export class EventService<TextAttributes extends BaseTextAttributes> {
|
||||
}
|
||||
};
|
||||
|
||||
private _onSelectionChange = () => {
|
||||
private readonly _onSelectionChange = () => {
|
||||
const rootElement = this.editor.rootElement;
|
||||
const previousInlineRange = this.editor.getInlineRange();
|
||||
if (this._isComposing) {
|
||||
|
||||
@@ -11,7 +11,10 @@ import type { BaseTextAttributes } from '../utils/base-attributes.js';
|
||||
import { deltaInsertsToChunks } from '../utils/delta-convert.js';
|
||||
|
||||
export class RenderService<TextAttributes extends BaseTextAttributes> {
|
||||
private _onYTextChange = (_: Y.YTextEvent, transaction: Y.Transaction) => {
|
||||
private readonly _onYTextChange = (
|
||||
_: Y.YTextEvent,
|
||||
transaction: Y.Transaction
|
||||
) => {
|
||||
this.editor.slots.textChange.emit();
|
||||
|
||||
const yText = this.editor.yText;
|
||||
|
||||
Reference in New Issue
Block a user