/
githubmirror
/
tldraw
Обзор
Документация
Войти
/
githubmirror
/
tldraw
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
packages/editor/src/lib/test/TestEditor.ts
31 строка
840 B
David Sheldrick
refactor(editor): use scoped document/window for cross-window embedding support (#8196)
18 мар 2026, 12:11
Не верифицирован
18 мар 2026, 12:11
660e2af
Код
Авторство
О чём код?
import { createTLStore } from '../config/createTLStore' import { Editor, TLEditorOptions } from '../editor/Editor' import { StateNode } from '../editor/tools/StateNode' class CustomTool extends StateNode { static override id = 'custom' } export class TestEditor extends Editor { constructor(options: Partial<Omit<TLEditorOptions, 'store'>> = {}) { // eslint-disable-next-line no-restricted-globals const elm = document.createElement('div') elm.tabIndex = 0 const shapeUtils = [...(options.shapeUtils ?? [])] const bindingUtils = [...(options.bindingUtils ?? [])] super({ ...options, shapeUtils, bindingUtils, tools: [...(options.tools ?? [CustomTool])], store: createTLStore({ shapeUtils, bindingUtils, }), getContainer: () => elm, initialState: options.initialState ?? 'custom', }) } }