@tldraw/editor 5.6.0 → 5.7.0-canary.04258659f7da
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 +19 -1
- package/dist-cjs/index.js +1 -1
- package/dist-cjs/lib/editor/Editor.js +11 -4
- package/dist-cjs/lib/editor/Editor.js.map +2 -2
- package/dist-cjs/lib/editor/shapes/ShapeUtil.js +11 -0
- package/dist-cjs/lib/editor/shapes/ShapeUtil.js.map +2 -2
- package/dist-cjs/lib/editor/shapes/group/GroupShapeUtil.js +11 -0
- package/dist-cjs/lib/editor/shapes/group/GroupShapeUtil.js.map +2 -2
- package/dist-cjs/lib/license/LicenseManager.js +6 -1
- package/dist-cjs/lib/license/LicenseManager.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 +19 -1
- package/dist-esm/index.mjs +1 -1
- package/dist-esm/lib/editor/Editor.mjs +11 -4
- package/dist-esm/lib/editor/Editor.mjs.map +2 -2
- package/dist-esm/lib/editor/shapes/ShapeUtil.mjs +11 -0
- package/dist-esm/lib/editor/shapes/ShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/editor/shapes/group/GroupShapeUtil.mjs +11 -0
- package/dist-esm/lib/editor/shapes/group/GroupShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/license/LicenseManager.mjs +6 -1
- package/dist-esm/lib/license/LicenseManager.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/editor/Editor.ts +11 -4
- package/src/lib/editor/shapes/ShapeUtil.ts +12 -0
- package/src/lib/editor/shapes/group/GroupShapeUtil.tsx +14 -0
- package/src/lib/license/LicenseManager.test.ts +31 -0
- package/src/lib/license/LicenseManager.ts +8 -1
- package/src/version.ts +3 -3
package/dist-esm/index.mjs
CHANGED
|
@@ -319,7 +319,7 @@ import { LocalIndexedDb, Table } from "./lib/utils/sync/LocalIndexedDb.mjs";
|
|
|
319
319
|
import { uniq } from "./lib/utils/uniq.mjs";
|
|
320
320
|
registerTldrawLibraryVersion(
|
|
321
321
|
"@tldraw/editor",
|
|
322
|
-
"5.
|
|
322
|
+
"5.7.0-canary.04258659f7da",
|
|
323
323
|
"esm"
|
|
324
324
|
);
|
|
325
325
|
import { getColorValue } from "./lib/editor/managers/ThemeManager/defaultThemes.mjs";
|
|
@@ -1669,7 +1669,7 @@ class Editor extends EventEmitter {
|
|
|
1669
1669
|
const filteredShapes = this.getCurrentPageShapes().filter(
|
|
1670
1670
|
(shape2) => isSelectedWithinContainer ? shape2.parentId === firstParentId : isPageId(shape2.parentId)
|
|
1671
1671
|
);
|
|
1672
|
-
const readingOrderShapes = this.
|
|
1672
|
+
const readingOrderShapes = this.getShapesInReadingOrder(filteredShapes);
|
|
1673
1673
|
const currentShapeId = selectedShapeIds.length === 1 ? selectedShapeIds[0] : readingOrderShapes.find((shape2) => selectedShapeIds.includes(shape2.id))?.id;
|
|
1674
1674
|
let adjacentShapeId;
|
|
1675
1675
|
if (direction === "next" || direction === "prev") {
|
|
@@ -1689,9 +1689,16 @@ class Editor extends EventEmitter {
|
|
|
1689
1689
|
}
|
|
1690
1690
|
getCurrentPageShapesInReadingOrder() {
|
|
1691
1691
|
const shapes = this.getCurrentPageShapes().filter((shape) => isPageId(shape.parentId));
|
|
1692
|
-
return this.
|
|
1692
|
+
return this.getShapesInReadingOrder(shapes);
|
|
1693
1693
|
}
|
|
1694
|
-
|
|
1694
|
+
/**
|
|
1695
|
+
* Sort the given shapes into reading order (left-to-right, top-to-bottom), dropping any that
|
|
1696
|
+
* can't be tabbed to. Use this for the children of a frame or group, which
|
|
1697
|
+
* {@link Editor.getCurrentPageShapesInReadingOrder} leaves out.
|
|
1698
|
+
*
|
|
1699
|
+
* @public
|
|
1700
|
+
*/
|
|
1701
|
+
getShapesInReadingOrder(shapes) {
|
|
1695
1702
|
const SHALLOW_ANGLE = 20;
|
|
1696
1703
|
const ROW_THRESHOLD = 100;
|
|
1697
1704
|
const tabbableShapes = shapes.filter((shape) => this.getShapeUtil(shape).canTabTo(shape));
|
|
@@ -1805,7 +1812,7 @@ class Editor extends EventEmitter {
|
|
|
1805
1812
|
const children = compact(
|
|
1806
1813
|
this.getSortedChildIdsForParent(selectedShape.id).map((id) => this.getShape(id))
|
|
1807
1814
|
);
|
|
1808
|
-
const sortedChildren = this.
|
|
1815
|
+
const sortedChildren = this.getShapesInReadingOrder(children);
|
|
1809
1816
|
if (sortedChildren.length === 0) return;
|
|
1810
1817
|
this._selectShapesAndZoom([sortedChildren[0].id]);
|
|
1811
1818
|
}
|