refactor(editor): remove gfx tool global type (#12116)

Closes: BS-2650
This commit is contained in:
Saul-Mirone
2025-05-04 13:53:26 +00:00
parent f3b5c36cf7
commit 30a2e5b4fb
95 changed files with 664 additions and 521 deletions
@@ -15,12 +15,16 @@ import type { ColorEvent } from '@blocksuite/affine-shared/utils';
import { SignalWatcher, WithDisposable } from '@blocksuite/global/lit';
import { StyleGeneralIcon, StyleScribbleIcon } from '@blocksuite/icons/lit';
import type { BlockComponent } from '@blocksuite/std';
import { GfxControllerIdentifier } from '@blocksuite/std/gfx';
import {
GfxControllerIdentifier,
type ToolOptionWithType,
} from '@blocksuite/std/gfx';
import { computed, effect, type Signal, signal } from '@preact/signals-core';
import { css, html, LitElement } from 'lit';
import { property } from 'lit/decorators.js';
import { when } from 'lit/directives/when.js';
import { ShapeTool } from '../shape-tool';
import { ShapeComponentConfig } from '../toolbar';
export class EdgelessShapeMenu extends SignalWatcher(
@@ -115,8 +119,12 @@ export class EdgelessShapeMenu extends SignalWatcher(
effect(() => {
const value = gfx.tool.currentToolOption$.value;
if (value && value.type === 'shape') {
this._shapeName$.value = value.shapeName;
if (value && value.toolType === ShapeTool) {
const shapeName = (value as ToolOptionWithType<ShapeTool>).options
?.shapeName;
if (shapeName) {
this._shapeName$.value = shapeName;
}
}
})
);