@textbus/platform-browser 4.2.0 → 4.2.1

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.
@@ -1043,7 +1043,7 @@ class ExperimentalCaret {
1043
1043
  nativeRange.collapse();
1044
1044
  }
1045
1045
  const rect = getLayoutRectByRange(nativeRange);
1046
- const { fontSize, lineHeight, color } = getComputedStyle(node);
1046
+ const { fontSize, lineHeight, color, writingMode } = getComputedStyle(node);
1047
1047
  let height;
1048
1048
  if (isNaN(+lineHeight)) {
1049
1049
  const f = parseFloat(lineHeight);
@@ -1072,7 +1072,8 @@ class ExperimentalCaret {
1072
1072
  rotate = Math.round(Math.atan2(rect.width, rect.height) * 180 / Math.PI);
1073
1073
  if (rotate !== 0) {
1074
1074
  const hackEle = document.createElement('span');
1075
- hackEle.style.cssText = 'display: inline-block; width: 10px; height: 10px; position: relative; contain: layout style size;';
1075
+ // eslint-disable-next-line max-len
1076
+ hackEle.style.cssText = 'display: inline-block; width: 10px; height: 10px; position: relative; contain: layout style size; writing-mode: inherit';
1076
1077
  const pointEle = document.createElement('span');
1077
1078
  pointEle.style.cssText = 'position: absolute; left: 0; top: 0; width:0;height:0';
1078
1079
  hackEle.append(pointEle);
@@ -1087,6 +1088,9 @@ class ExperimentalCaret {
1087
1088
  hackEle.remove();
1088
1089
  }
1089
1090
  }
1091
+ if (rotate === 0 && (writingMode === 'vertical-lr' || writingMode === 'vertical-rl')) {
1092
+ rotate += 90;
1093
+ }
1090
1094
  Object.assign(this.elementRef.style, {
1091
1095
  left: left + 'px',
1092
1096
  top: top + 'px',
package/bundles/index.js CHANGED
@@ -1045,7 +1045,7 @@ class ExperimentalCaret {
1045
1045
  nativeRange.collapse();
1046
1046
  }
1047
1047
  const rect = getLayoutRectByRange(nativeRange);
1048
- const { fontSize, lineHeight, color } = getComputedStyle(node);
1048
+ const { fontSize, lineHeight, color, writingMode } = getComputedStyle(node);
1049
1049
  let height;
1050
1050
  if (isNaN(+lineHeight)) {
1051
1051
  const f = parseFloat(lineHeight);
@@ -1074,7 +1074,8 @@ class ExperimentalCaret {
1074
1074
  rotate = Math.round(Math.atan2(rect.width, rect.height) * 180 / Math.PI);
1075
1075
  if (rotate !== 0) {
1076
1076
  const hackEle = document.createElement('span');
1077
- hackEle.style.cssText = 'display: inline-block; width: 10px; height: 10px; position: relative; contain: layout style size;';
1077
+ // eslint-disable-next-line max-len
1078
+ hackEle.style.cssText = 'display: inline-block; width: 10px; height: 10px; position: relative; contain: layout style size; writing-mode: inherit';
1078
1079
  const pointEle = document.createElement('span');
1079
1080
  pointEle.style.cssText = 'position: absolute; left: 0; top: 0; width:0;height:0';
1080
1081
  hackEle.append(pointEle);
@@ -1089,6 +1090,9 @@ class ExperimentalCaret {
1089
1090
  hackEle.remove();
1090
1091
  }
1091
1092
  }
1093
+ if (rotate === 0 && (writingMode === 'vertical-lr' || writingMode === 'vertical-rl')) {
1094
+ rotate += 90;
1095
+ }
1092
1096
  Object.assign(this.elementRef.style, {
1093
1097
  left: left + 'px',
1094
1098
  top: top + 'px',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@textbus/platform-browser",
3
- "version": "4.2.0",
3
+ "version": "4.2.1",
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",
@@ -26,7 +26,7 @@
26
26
  ],
27
27
  "dependencies": {
28
28
  "@tanbo/stream": "^1.2.5",
29
- "@textbus/core": "^4.2.0",
29
+ "@textbus/core": "^4.2.1",
30
30
  "@viewfly/core": "^1.0.5"
31
31
  },
32
32
  "devDependencies": {