@nerd-bible/wordgard 0.5.3-beta1 → 0.5.3-beta2

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.
Files changed (2) hide show
  1. package/dist/editor.js +6 -4
  2. package/package.json +1 -1
package/dist/editor.js CHANGED
@@ -1858,7 +1858,9 @@ class CompositeTile extends Tile {
1858
1858
  return CoordPos.create(start + this.length - 2 * this.boundary, -1);
1859
1859
  }
1860
1860
  }
1861
- function rowScan(x, y, scan) {
1861
+ function rowScan(x, y, scan, depth = 0) {
1862
+ if (depth > 1)
1863
+ return null;
1862
1864
  let closest = null, closestDx = 1e8, closestRect = null;
1863
1865
  let above = null, below = null;
1864
1866
  scan((rect, value) => {
@@ -1884,16 +1886,16 @@ function rowScan(x, y, scan) {
1884
1886
  if (closestRect) {
1885
1887
  if (closestDx) {
1886
1888
  if (above && above.bottom > closestRect.top)
1887
- return rowScan(x, above.bottom - 1, scan);
1889
+ return rowScan(x, above.bottom - 1, scan, depth + 1);
1888
1890
  if (below && below.top < closestRect.bottom)
1889
- return rowScan(x, below.top + 1, scan);
1891
+ return rowScan(x, below.top + 1, scan, depth + 1);
1890
1892
  }
1891
1893
  return { closest: closest, rect: closestRect };
1892
1894
  }
1893
1895
  let side = above && (!below || (y - above.bottom < below.top - y)) ? above : below;
1894
1896
  if (!side)
1895
1897
  return null;
1896
- return rowScan(x, (side.top + side.bottom) / 2, scan);
1898
+ return rowScan(x, (side.top + side.bottom) / 2, scan, depth + 1);
1897
1899
  }
1898
1900
  function ltrAt(state, pos, assoc, textblock) {
1899
1901
  if (textblock === undefined) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nerd-bible/wordgard",
3
- "version": "0.5.3-beta1",
3
+ "version": "0.5.3-beta2",
4
4
  "description": "Semantic rich text editor system",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",