mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-25 10:22:55 +08:00
fix(whiteboard): editor init size when creating new editor
This commit is contained in:
@@ -73,6 +73,7 @@ import { StateManager } from './manager/state-manager';
|
||||
import { getClipboard, setClipboard } from './idb-clipboard';
|
||||
import type { Commands } from './types/commands';
|
||||
import type { BaseTool } from './types/tool';
|
||||
import { MIN_PAGE_WIDTH } from '@toeverything/components/editor-core';
|
||||
|
||||
const uuid = Utils.uniqueId();
|
||||
|
||||
@@ -178,6 +179,7 @@ export interface TldrawAppCtorProps {
|
||||
getSession: (type: SessionType) => {
|
||||
new (app: TldrawApp, ...args: any[]): BaseSessionType;
|
||||
};
|
||||
editorShapeInitSize?: number;
|
||||
commands: Commands;
|
||||
tools: Record<string, { new (app: TldrawApp): BaseTool }>;
|
||||
}
|
||||
@@ -223,6 +225,8 @@ export class TldrawApp extends StateManager<TDSnapshot> {
|
||||
|
||||
fileSystemHandle: FileSystemHandle | null = null;
|
||||
|
||||
editorShapeInitSize = MIN_PAGE_WIDTH;
|
||||
|
||||
viewport = Utils.getBoundsFromPoints([
|
||||
[0, 0],
|
||||
[100, 100],
|
||||
@@ -285,6 +289,10 @@ export class TldrawApp extends StateManager<TDSnapshot> {
|
||||
return acc;
|
||||
}, {} as Record<string, BaseTool>);
|
||||
this.currentTool = this.tools['select'];
|
||||
|
||||
if (props.editorShapeInitSize) {
|
||||
this.editorShapeInitSize = props.editorShapeInitSize;
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------- Internal -------------------- */
|
||||
|
||||
Reference in New Issue
Block a user