@tldraw/editor 4.2.0-next.3abbdad51d2e → 4.2.0-next.54bc357bbff2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-cjs/index.d.ts +17 -5
- package/dist-cjs/index.js +1 -1
- package/dist-cjs/lib/components/default-components/DefaultCanvas.js +11 -11
- package/dist-cjs/lib/components/default-components/DefaultCanvas.js.map +2 -2
- package/dist-cjs/lib/editor/Editor.js +10 -6
- package/dist-cjs/lib/editor/Editor.js.map +2 -2
- package/dist-cjs/lib/license/LicenseManager.js +1 -0
- package/dist-cjs/lib/license/LicenseManager.js.map +2 -2
- package/dist-cjs/lib/license/Watermark.js +8 -4
- package/dist-cjs/lib/license/Watermark.js.map +2 -2
- package/dist-cjs/lib/utils/runtime.js +2 -2
- package/dist-cjs/lib/utils/runtime.js.map +2 -2
- package/dist-cjs/lib/utils/window-open.js +2 -2
- package/dist-cjs/lib/utils/window-open.js.map +2 -2
- package/dist-cjs/version.js +3 -3
- package/dist-cjs/version.js.map +1 -1
- package/dist-esm/index.d.mts +17 -5
- package/dist-esm/index.mjs +1 -1
- package/dist-esm/lib/components/default-components/DefaultCanvas.mjs +11 -11
- package/dist-esm/lib/components/default-components/DefaultCanvas.mjs.map +2 -2
- package/dist-esm/lib/editor/Editor.mjs +10 -6
- package/dist-esm/lib/editor/Editor.mjs.map +2 -2
- package/dist-esm/lib/license/LicenseManager.mjs +1 -0
- package/dist-esm/lib/license/LicenseManager.mjs.map +2 -2
- package/dist-esm/lib/license/Watermark.mjs +8 -4
- package/dist-esm/lib/license/Watermark.mjs.map +2 -2
- package/dist-esm/lib/utils/runtime.mjs +2 -2
- package/dist-esm/lib/utils/runtime.mjs.map +2 -2
- package/dist-esm/lib/utils/window-open.mjs +2 -2
- package/dist-esm/lib/utils/window-open.mjs.map +2 -2
- package/dist-esm/version.mjs +3 -3
- package/dist-esm/version.mjs.map +1 -1
- package/package.json +7 -7
- package/src/lib/components/default-components/DefaultCanvas.tsx +9 -9
- package/src/lib/editor/Editor.test.ts +268 -0
- package/src/lib/editor/Editor.ts +10 -6
- package/src/lib/license/LicenseManager.ts +1 -0
- package/src/lib/license/Watermark.tsx +8 -5
- package/src/lib/utils/runtime.ts +3 -3
- package/src/lib/utils/window-open.ts +13 -3
- package/src/version.ts +3 -3
|
@@ -859,26 +859,30 @@ class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed]
|
|
|
859
859
|
* after the editor has already been initialized.
|
|
860
860
|
*
|
|
861
861
|
* @param Tool - The tool to set.
|
|
862
|
+
* @param parent - The parent state node to set the tool on.
|
|
862
863
|
*
|
|
863
864
|
* @public
|
|
864
865
|
*/
|
|
865
|
-
setTool(Tool) {
|
|
866
|
-
|
|
866
|
+
setTool(Tool, parent) {
|
|
867
|
+
parent ??= this.root;
|
|
868
|
+
if (hasOwnProperty(parent.children, Tool.id)) {
|
|
867
869
|
throw Error(`Can't override tool with id "${Tool.id}"`);
|
|
868
870
|
}
|
|
869
|
-
|
|
871
|
+
parent.children[Tool.id] = new Tool(this, parent);
|
|
870
872
|
}
|
|
871
873
|
/**
|
|
872
874
|
* Remove a tool. Useful if you need to remove a tool from the state chart on demand,
|
|
873
875
|
* after the editor has already been initialized.
|
|
874
876
|
*
|
|
875
877
|
* @param Tool - The tool to delete.
|
|
878
|
+
* @param parent - The parent state node to remove the tool from.
|
|
876
879
|
*
|
|
877
880
|
* @public
|
|
878
881
|
*/
|
|
879
|
-
removeTool(Tool) {
|
|
880
|
-
|
|
881
|
-
|
|
882
|
+
removeTool(Tool, parent) {
|
|
883
|
+
parent ??= this.root;
|
|
884
|
+
if (hasOwnProperty(parent.children, Tool.id)) {
|
|
885
|
+
delete parent.children[Tool.id];
|
|
882
886
|
}
|
|
883
887
|
}
|
|
884
888
|
/**
|