@cocreate/text 1.12.25 → 1.12.26
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/CHANGELOG.md +7 -0
- package/package.json +1 -1
- package/src/updateDom.js +10 -5
package/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
## [1.12.26](https://github.com/CoCreate-app/CoCreate-text/compare/v1.12.25...v1.12.26) (2021-11-24)
|
2
|
+
|
3
|
+
|
4
|
+
### Bug Fixes
|
5
|
+
|
6
|
+
* improved on logical conditons on when to processSelection ([53f8ad4](https://github.com/CoCreate-app/CoCreate-text/commit/53f8ad4e075c77b89ade24e56b6512431ac17b35))
|
7
|
+
|
1
8
|
## [1.12.25](https://github.com/CoCreate-app/CoCreate-text/compare/v1.12.24...v1.12.25) (2021-11-23)
|
2
9
|
|
3
10
|
|
package/package.json
CHANGED
package/src/updateDom.js
CHANGED
@@ -12,7 +12,10 @@ export function updateDom({domTextEditor, value, start, end, html}) {
|
|
12
12
|
let domEl, newEl = element, oldEl, curCaret;
|
13
13
|
if(!newEl){
|
14
14
|
newEl = domTextEditor.cloneNode(true);
|
15
|
-
|
15
|
+
if (html != undefined)
|
16
|
+
newEl.innerHTML = html;
|
17
|
+
else
|
18
|
+
newEl.innerHTML = domTextEditor.htmlString;
|
16
19
|
domEl = domTextEditor;
|
17
20
|
type = 'innerHTML';
|
18
21
|
}
|
@@ -65,10 +68,12 @@ export function updateDom({domTextEditor, value, start, end, html}) {
|
|
65
68
|
domEl.replaceChildren(...newEl.childNodes);
|
66
69
|
}
|
67
70
|
}
|
68
|
-
if(curCaret && start && end) {
|
69
|
-
|
70
|
-
|
71
|
-
|
71
|
+
if(curCaret && start >= 0 && end >= 0) {
|
72
|
+
if (curCaret.range && curCaret.start >= curCaret.range.startOffset) {
|
73
|
+
let p = processSelection(domEl, value, curCaret.start, curCaret.end, start, end, curCaret.range);
|
74
|
+
sendPosition(domEl);
|
75
|
+
_dispatchInputEvent(p.element, p.value, p.start, p.end, p.prev_start, p.prev_end);
|
76
|
+
}
|
72
77
|
}
|
73
78
|
|
74
79
|
if (newEl.tagName == 'HTML' || 'HEAD' || 'BODY' || 'SCRIPT'){
|