@tldraw/editor 4.2.0-canary.5887eb336025 → 4.2.0-canary.7329b1541236
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 +54 -6
- package/dist-cjs/index.js +2 -1
- package/dist-cjs/index.js.map +2 -2
- package/dist-cjs/lib/editor/Editor.js +27 -0
- 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 +1 -1
- package/dist-cjs/lib/license/Watermark.js.map +2 -2
- package/dist-cjs/lib/utils/debug-flags.js +1 -0
- package/dist-cjs/lib/utils/debug-flags.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 +54 -6
- package/dist-esm/index.mjs +3 -1
- package/dist-esm/index.mjs.map +2 -2
- package/dist-esm/lib/editor/Editor.mjs +27 -0
- 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 +1 -1
- package/dist-esm/lib/license/Watermark.mjs.map +2 -2
- package/dist-esm/lib/utils/debug-flags.mjs +1 -0
- package/dist-esm/lib/utils/debug-flags.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/index.ts +1 -0
- package/src/lib/editor/Editor.ts +29 -0
- package/src/lib/license/LicenseManager.ts +1 -0
- package/src/lib/license/Watermark.tsx +1 -1
- package/src/lib/utils/debug-flags.ts +5 -4
- package/src/lib/utils/runtime.ts +3 -3
- package/src/lib/utils/window-open.ts +13 -3
- package/src/version.ts +3 -3
|
@@ -854,6 +854,33 @@ class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed]
|
|
|
854
854
|
typeof shapeOrId === "string" ? shapeOrId : shapeOrId.id
|
|
855
855
|
);
|
|
856
856
|
}
|
|
857
|
+
/**
|
|
858
|
+
* Set a tool. Useful if you need to add a tool to the state chart on demand,
|
|
859
|
+
* after the editor has already been initialized.
|
|
860
|
+
*
|
|
861
|
+
* @param Tool - The tool to set.
|
|
862
|
+
*
|
|
863
|
+
* @public
|
|
864
|
+
*/
|
|
865
|
+
setTool(Tool) {
|
|
866
|
+
if (hasOwnProperty(this.root.children, Tool.id)) {
|
|
867
|
+
throw Error(`Can't override tool with id "${Tool.id}"`);
|
|
868
|
+
}
|
|
869
|
+
this.root.children[Tool.id] = new Tool(this, this.root);
|
|
870
|
+
}
|
|
871
|
+
/**
|
|
872
|
+
* Remove a tool. Useful if you need to remove a tool from the state chart on demand,
|
|
873
|
+
* after the editor has already been initialized.
|
|
874
|
+
*
|
|
875
|
+
* @param Tool - The tool to delete.
|
|
876
|
+
*
|
|
877
|
+
* @public
|
|
878
|
+
*/
|
|
879
|
+
removeTool(Tool) {
|
|
880
|
+
if (hasOwnProperty(this.root.children, Tool.id)) {
|
|
881
|
+
delete this.root.children[Tool.id];
|
|
882
|
+
}
|
|
883
|
+
}
|
|
857
884
|
/**
|
|
858
885
|
* Dispose the editor.
|
|
859
886
|
*
|