@textbus/platform-browser 5.0.0-alpha.15 → 5.0.0-alpha.16

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.
@@ -1322,13 +1322,13 @@ class ExperimentalCaret {
1322
1322
  pointEle.style.cssText = 'position: absolute; left: 0; top: 0; width:0;height:0';
1323
1323
  hackEle.append(pointEle);
1324
1324
  node.append(hackEle);
1325
- const t1 = pointEle.getBoundingClientRect().top;
1325
+ const p1 = pointEle.getBoundingClientRect();
1326
1326
  pointEle.style.right = '0';
1327
1327
  pointEle.style.left = '';
1328
- const t2 = pointEle.getBoundingClientRect().top;
1329
- if (t2 < t1) {
1330
- rotate = -rotate;
1331
- }
1328
+ const p2 = pointEle.getBoundingClientRect();
1329
+ const x = p1.x - p2.x;
1330
+ const y = p1.y - p2.y;
1331
+ rotate = Math.atan2(y, x) * 180 / Math.PI;
1332
1332
  hackEle.remove();
1333
1333
  }
1334
1334
  }
@@ -1343,7 +1343,7 @@ class ExperimentalCaret {
1343
1343
  fontSize,
1344
1344
  transform: `rotate(${rotate}deg)`,
1345
1345
  });
1346
- this.caret.style.backgroundColor = color;
1346
+ this.caret.style.backgroundColor = color === 'rgba(0, 0, 0, 0)' ? '#000' : color;
1347
1347
  this.styleChangeEvent.next({
1348
1348
  height: boxHeight + 'px',
1349
1349
  lineHeight: boxHeight + 'px',
package/bundles/index.js CHANGED
@@ -1324,13 +1324,13 @@ class ExperimentalCaret {
1324
1324
  pointEle.style.cssText = 'position: absolute; left: 0; top: 0; width:0;height:0';
1325
1325
  hackEle.append(pointEle);
1326
1326
  node.append(hackEle);
1327
- const t1 = pointEle.getBoundingClientRect().top;
1327
+ const p1 = pointEle.getBoundingClientRect();
1328
1328
  pointEle.style.right = '0';
1329
1329
  pointEle.style.left = '';
1330
- const t2 = pointEle.getBoundingClientRect().top;
1331
- if (t2 < t1) {
1332
- rotate = -rotate;
1333
- }
1330
+ const p2 = pointEle.getBoundingClientRect();
1331
+ const x = p1.x - p2.x;
1332
+ const y = p1.y - p2.y;
1333
+ rotate = Math.atan2(y, x) * 180 / Math.PI;
1334
1334
  hackEle.remove();
1335
1335
  }
1336
1336
  }
@@ -1345,7 +1345,7 @@ class ExperimentalCaret {
1345
1345
  fontSize,
1346
1346
  transform: `rotate(${rotate}deg)`,
1347
1347
  });
1348
- this.caret.style.backgroundColor = color;
1348
+ this.caret.style.backgroundColor = color === 'rgba(0, 0, 0, 0)' ? '#000' : color;
1349
1349
  this.styleChangeEvent.next({
1350
1350
  height: boxHeight + 'px',
1351
1351
  lineHeight: boxHeight + 'px',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@textbus/platform-browser",
3
- "version": "5.0.0-alpha.15",
3
+ "version": "5.0.0-alpha.16",
4
4
  "description": "Textbus is a rich text editor and framework that is highly customizable and extensible to achieve rich wysiwyg effects.",
5
5
  "main": "./bundles/index.js",
6
6
  "module": "./bundles/index.esm.js",
@@ -47,5 +47,5 @@
47
47
  "bugs": {
48
48
  "url": "https://github.com/textbus/textbus.git/issues"
49
49
  },
50
- "gitHead": "0f3c64c5c6105a2e4207ab772e64d3acb801d22a"
50
+ "gitHead": "8c9e90bd1a3effc96dcbbd455f24a8b263087e90"
51
51
  }