@textbus/platform-browser 4.2.3 → 4.2.5
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/bundles/index.esm.js +22 -8
- package/bundles/index.js +22 -8
- package/bundles/magic-input.d.ts +1 -0
- package/package.json +4 -4
package/bundles/index.esm.js
CHANGED
@@ -1126,18 +1126,32 @@ class ExperimentalCaret {
|
|
1126
1126
|
if (this.changeFromSelf) {
|
1127
1127
|
this.changeFromSelf = false;
|
1128
1128
|
const selfRect = this.elementRef.getBoundingClientRect();
|
1129
|
+
const scrollContainer = this.getScrollContainer(startContainer);
|
1130
|
+
const scrollRect = scrollContainer === document.documentElement ?
|
1131
|
+
{ top: 0, bottom: document.documentElement.clientHeight } :
|
1132
|
+
scrollContainer.getBoundingClientRect();
|
1129
1133
|
const limit = this.getLimit();
|
1130
|
-
|
1131
|
-
|
1132
|
-
|
1133
|
-
|
1134
|
+
const top = Math.max(limit.top, scrollRect.top);
|
1135
|
+
const bottom = Math.min(limit.bottom, scrollRect.bottom);
|
1136
|
+
if (selfRect.top < top) {
|
1137
|
+
scrollContainer.scrollTop -= top - selfRect.top;
|
1134
1138
|
}
|
1135
|
-
else if (selfRect.bottom >
|
1136
|
-
|
1137
|
-
|
1138
|
-
|
1139
|
+
else if (selfRect.bottom > bottom) {
|
1140
|
+
scrollContainer.scrollTop += selfRect.bottom - bottom;
|
1141
|
+
}
|
1142
|
+
}
|
1143
|
+
}
|
1144
|
+
getScrollContainer(container) {
|
1145
|
+
while (container) {
|
1146
|
+
if (container instanceof Element) {
|
1147
|
+
const styles = getComputedStyle(container);
|
1148
|
+
if (styles.overflow !== 'visible' || styles.overflowX !== 'visible' || styles.overflowY !== 'visible') {
|
1149
|
+
return container;
|
1150
|
+
}
|
1139
1151
|
}
|
1152
|
+
container = container.parentNode;
|
1140
1153
|
}
|
1154
|
+
return document.documentElement;
|
1141
1155
|
}
|
1142
1156
|
}
|
1143
1157
|
/**
|
package/bundles/index.js
CHANGED
@@ -1128,18 +1128,32 @@ class ExperimentalCaret {
|
|
1128
1128
|
if (this.changeFromSelf) {
|
1129
1129
|
this.changeFromSelf = false;
|
1130
1130
|
const selfRect = this.elementRef.getBoundingClientRect();
|
1131
|
+
const scrollContainer = this.getScrollContainer(startContainer);
|
1132
|
+
const scrollRect = scrollContainer === document.documentElement ?
|
1133
|
+
{ top: 0, bottom: document.documentElement.clientHeight } :
|
1134
|
+
scrollContainer.getBoundingClientRect();
|
1131
1135
|
const limit = this.getLimit();
|
1132
|
-
|
1133
|
-
|
1134
|
-
|
1135
|
-
|
1136
|
+
const top = Math.max(limit.top, scrollRect.top);
|
1137
|
+
const bottom = Math.min(limit.bottom, scrollRect.bottom);
|
1138
|
+
if (selfRect.top < top) {
|
1139
|
+
scrollContainer.scrollTop -= top - selfRect.top;
|
1136
1140
|
}
|
1137
|
-
else if (selfRect.bottom >
|
1138
|
-
|
1139
|
-
|
1140
|
-
|
1141
|
+
else if (selfRect.bottom > bottom) {
|
1142
|
+
scrollContainer.scrollTop += selfRect.bottom - bottom;
|
1143
|
+
}
|
1144
|
+
}
|
1145
|
+
}
|
1146
|
+
getScrollContainer(container) {
|
1147
|
+
while (container) {
|
1148
|
+
if (container instanceof Element) {
|
1149
|
+
const styles = getComputedStyle(container);
|
1150
|
+
if (styles.overflow !== 'visible' || styles.overflowX !== 'visible' || styles.overflowY !== 'visible') {
|
1151
|
+
return container;
|
1152
|
+
}
|
1141
1153
|
}
|
1154
|
+
container = container.parentNode;
|
1142
1155
|
}
|
1156
|
+
return document.documentElement;
|
1143
1157
|
}
|
1144
1158
|
}
|
1145
1159
|
/**
|
package/bundles/magic-input.d.ts
CHANGED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@textbus/platform-browser",
|
3
|
-
"version": "4.2.
|
3
|
+
"version": "4.2.5",
|
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,8 +26,8 @@
|
|
26
26
|
],
|
27
27
|
"dependencies": {
|
28
28
|
"@tanbo/stream": "^1.2.6",
|
29
|
-
"@textbus/core": "^4.2.
|
30
|
-
"@viewfly/core": "^1.0
|
29
|
+
"@textbus/core": "^4.2.4",
|
30
|
+
"@viewfly/core": "^1.1.0"
|
31
31
|
},
|
32
32
|
"devDependencies": {
|
33
33
|
"@rollup/plugin-commonjs": "^23.0.2",
|
@@ -47,5 +47,5 @@
|
|
47
47
|
"bugs": {
|
48
48
|
"url": "https://github.com/textbus/textbus.git/issues"
|
49
49
|
},
|
50
|
-
"gitHead": "
|
50
|
+
"gitHead": "e976c07880be8cb3390a1cf956f09c872537064a"
|
51
51
|
}
|