@tldraw/editor 3.13.0-canary.42a3293334f5 → 3.13.0-canary.4389e5975660
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 +1 -8
- package/dist-cjs/index.js +1 -1
- package/dist-cjs/lib/editor/Editor.js +2 -16
- package/dist-cjs/lib/editor/Editor.js.map +2 -2
- package/dist-cjs/lib/editor/shapes/ShapeUtil.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 +1 -8
- package/dist-esm/index.mjs +1 -1
- package/dist-esm/lib/editor/Editor.mjs +2 -16
- package/dist-esm/lib/editor/Editor.mjs.map +2 -2
- package/dist-esm/lib/editor/shapes/ShapeUtil.mjs.map +2 -2
- package/dist-esm/version.mjs +3 -3
- package/dist-esm/version.mjs.map +1 -1
- package/editor.css +4 -0
- package/package.json +7 -7
- package/src/lib/editor/Editor.ts +2 -16
- package/src/lib/editor/shapes/ShapeUtil.ts +1 -9
- package/src/version.ts +3 -3
package/dist-cjs/index.d.ts
CHANGED
|
@@ -5438,14 +5438,7 @@ export declare abstract class ShapeUtil<Shape extends TLUnknownShape = TLUnknown
|
|
|
5438
5438
|
*/
|
|
5439
5439
|
onClick?(shape: Shape): TLShapePartial<Shape> | void;
|
|
5440
5440
|
/**
|
|
5441
|
-
* A callback called when a shape
|
|
5442
|
-
*
|
|
5443
|
-
* @param shape - The shape.
|
|
5444
|
-
* @public
|
|
5445
|
-
*/
|
|
5446
|
-
onEditStart?(shape: Shape): void;
|
|
5447
|
-
/**
|
|
5448
|
-
* A callback called when a shape finishes being edited.
|
|
5441
|
+
* A callback called when a shape finishes being editing.
|
|
5449
5442
|
*
|
|
5450
5443
|
* @param shape - The shape.
|
|
5451
5444
|
* @public
|
package/dist-cjs/index.js
CHANGED
|
@@ -424,6 +424,7 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
|
|
|
424
424
|
) : getShapeVisibility;
|
|
425
425
|
this.options = { ...import_options.defaultTldrawOptions, ...options };
|
|
426
426
|
this.store = store;
|
|
427
|
+
this.disposables.add(this.store.dispose.bind(this.store));
|
|
427
428
|
this.history = new import_HistoryManager.HistoryManager({
|
|
428
429
|
store,
|
|
429
430
|
annotateError: (error) => {
|
|
@@ -835,7 +836,6 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
|
|
|
835
836
|
dispose() {
|
|
836
837
|
this.disposables.forEach((dispose) => dispose());
|
|
837
838
|
this.disposables.clear();
|
|
838
|
-
this.store.dispose();
|
|
839
839
|
this.isDisposed = true;
|
|
840
840
|
}
|
|
841
841
|
getShapeUtil(arg) {
|
|
@@ -1738,21 +1738,13 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
|
|
|
1738
1738
|
setEditingShape(shape) {
|
|
1739
1739
|
const id = typeof shape === "string" ? shape : shape?.id ?? null;
|
|
1740
1740
|
this.setRichTextEditor(null);
|
|
1741
|
-
|
|
1742
|
-
if (id !== prevEditingShapeId) {
|
|
1741
|
+
if (id !== this.getEditingShapeId()) {
|
|
1743
1742
|
if (id) {
|
|
1744
1743
|
const shape2 = this.getShape(id);
|
|
1745
1744
|
if (shape2 && this.getShapeUtil(shape2).canEdit(shape2)) {
|
|
1746
1745
|
this.run(
|
|
1747
1746
|
() => {
|
|
1748
1747
|
this._updateCurrentPageState({ editingShapeId: id });
|
|
1749
|
-
if (prevEditingShapeId) {
|
|
1750
|
-
const prevEditingShape = this.getShape(prevEditingShapeId);
|
|
1751
|
-
if (prevEditingShape) {
|
|
1752
|
-
this.getShapeUtil(prevEditingShape).onEditEnd?.(prevEditingShape);
|
|
1753
|
-
}
|
|
1754
|
-
}
|
|
1755
|
-
this.getShapeUtil(shape2).onEditStart?.(shape2);
|
|
1756
1748
|
},
|
|
1757
1749
|
{ history: "ignore" }
|
|
1758
1750
|
);
|
|
@@ -1763,12 +1755,6 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
|
|
|
1763
1755
|
() => {
|
|
1764
1756
|
this._updateCurrentPageState({ editingShapeId: null });
|
|
1765
1757
|
this._currentRichTextEditor.set(null);
|
|
1766
|
-
if (prevEditingShapeId) {
|
|
1767
|
-
const prevEditingShape = this.getShape(prevEditingShapeId);
|
|
1768
|
-
if (prevEditingShape) {
|
|
1769
|
-
this.getShapeUtil(prevEditingShape).onEditEnd?.(prevEditingShape);
|
|
1770
|
-
}
|
|
1771
|
-
}
|
|
1772
1758
|
},
|
|
1773
1759
|
{ history: "ignore" }
|
|
1774
1760
|
);
|