mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-14 13:25:12 +00:00
refactor(editor): remove assertExists (#10615)
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import type { InsertToPosition } from '@blocksuite/affine-shared/utils';
|
||||
import { Point, Rect } from '@blocksuite/global/gfx';
|
||||
import { assertExists } from '@blocksuite/global/utils';
|
||||
import { computed } from '@preact/signals-core';
|
||||
import type { ReactiveController } from 'lit';
|
||||
|
||||
@@ -137,7 +136,6 @@ export class KanbanDragController implements ReactiveController {
|
||||
const scrollContainer = this.host.querySelector(
|
||||
'.affine-data-view-kanban-groups'
|
||||
) as HTMLElement;
|
||||
assertExists(scrollContainer);
|
||||
return scrollContainer;
|
||||
}
|
||||
|
||||
@@ -213,7 +211,10 @@ const createDropPreview = () => {
|
||||
card?: KanbanCard
|
||||
) {
|
||||
const target = card ?? group.querySelector('.add-card');
|
||||
assertExists(target);
|
||||
if (!target) {
|
||||
console.error('`target` is not found');
|
||||
return;
|
||||
}
|
||||
if (target.previousElementSibling === self || target === self) {
|
||||
div.remove();
|
||||
return;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { BlockSuiteError, ErrorCode } from '@blocksuite/global/exceptions';
|
||||
import { assertExists } from '@blocksuite/global/utils';
|
||||
import type { ReactiveController } from 'lit';
|
||||
|
||||
import type {
|
||||
@@ -611,7 +610,7 @@ function getNextGroupFocusElement(
|
||||
selection.selectionType === 'cell'
|
||||
? getFocusCell(viewElement, selection)
|
||||
: getSelectedCards(viewElement, selection)[0];
|
||||
assertExists(element);
|
||||
if (!element) return;
|
||||
const rect = element.getBoundingClientRect();
|
||||
const nextCards = Array.from(
|
||||
nextGroup.querySelectorAll('affine-data-view-kanban-card')
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
import { ShadowlessElement } from '@blocksuite/block-std';
|
||||
import {
|
||||
assertExists,
|
||||
SignalWatcher,
|
||||
WithDisposable,
|
||||
} from '@blocksuite/global/utils';
|
||||
import { SignalWatcher, WithDisposable } from '@blocksuite/global/utils';
|
||||
import { computed } from '@preact/signals-core';
|
||||
import { css } from 'lit';
|
||||
import { property, state } from 'lit/decorators.js';
|
||||
@@ -102,7 +98,6 @@ export class DatabaseCellContainer extends SignalWatcher(
|
||||
|
||||
get table() {
|
||||
const table = this.closest('affine-database-table');
|
||||
assertExists(table);
|
||||
return table;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user