@cocreate/text 1.12.24 → 1.12.28
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 +28 -0
- package/package.json +9 -9
- package/src/updateDom.js +10 -5
package/CHANGELOG.md
CHANGED
@@ -1,3 +1,31 @@
|
|
1
|
+
## [1.12.28](https://github.com/CoCreate-app/CoCreate-text/compare/v1.12.27...v1.12.28) (2021-11-26)
|
2
|
+
|
3
|
+
|
4
|
+
### Bug Fixes
|
5
|
+
|
6
|
+
* update crdt dependency ([e84dcc7](https://github.com/CoCreate-app/CoCreate-text/commit/e84dcc711b8a5f5d2cde572920788dc9b2cb913b))
|
7
|
+
|
8
|
+
## [1.12.27](https://github.com/CoCreate-app/CoCreate-text/compare/v1.12.26...v1.12.27) (2021-11-24)
|
9
|
+
|
10
|
+
|
11
|
+
### Bug Fixes
|
12
|
+
|
13
|
+
* updated selection dependency ([9c85e4d](https://github.com/CoCreate-app/CoCreate-text/commit/9c85e4db523349309070f24a4f34b9994f25df22))
|
14
|
+
|
15
|
+
## [1.12.26](https://github.com/CoCreate-app/CoCreate-text/compare/v1.12.25...v1.12.26) (2021-11-24)
|
16
|
+
|
17
|
+
|
18
|
+
### Bug Fixes
|
19
|
+
|
20
|
+
* improved on logical conditons on when to processSelection ([53f8ad4](https://github.com/CoCreate-app/CoCreate-text/commit/53f8ad4e075c77b89ade24e56b6512431ac17b35))
|
21
|
+
|
22
|
+
## [1.12.25](https://github.com/CoCreate-app/CoCreate-text/compare/v1.12.24...v1.12.25) (2021-11-23)
|
23
|
+
|
24
|
+
|
25
|
+
### Bug Fixes
|
26
|
+
|
27
|
+
* update dependencies ([c0f3d30](https://github.com/CoCreate-app/CoCreate-text/commit/c0f3d3033a4806b82f16555ed3dc02cc059ed4fa))
|
28
|
+
|
1
29
|
## [1.12.24](https://github.com/CoCreate-app/CoCreate-text/compare/v1.12.23...v1.12.24) (2021-11-23)
|
2
30
|
|
3
31
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@cocreate/text",
|
3
|
-
"version": "1.12.
|
3
|
+
"version": "1.12.28",
|
4
4
|
"description": "A simple text component in vanilla javascript. Easily configured using HTML5 attributes and/or JavaScript API.",
|
5
5
|
"keywords": [
|
6
6
|
"text",
|
@@ -61,13 +61,13 @@
|
|
61
61
|
"webpack-log": "^3.0.1"
|
62
62
|
},
|
63
63
|
"dependencies": {
|
64
|
-
"@cocreate/action": "^1.3.
|
65
|
-
"@cocreate/crdt": "^1.8.
|
66
|
-
"@cocreate/crud-client": "^1.4.
|
67
|
-
"@cocreate/cursors": "^1.10.
|
68
|
-
"@cocreate/docs": "^1.2.
|
69
|
-
"@cocreate/hosting": "^1.2.
|
70
|
-
"@cocreate/observer": "^1.3.
|
71
|
-
"@cocreate/selection": "^1.2.
|
64
|
+
"@cocreate/action": "^1.3.18",
|
65
|
+
"@cocreate/crdt": "^1.8.23",
|
66
|
+
"@cocreate/crud-client": "^1.4.34",
|
67
|
+
"@cocreate/cursors": "^1.10.12",
|
68
|
+
"@cocreate/docs": "^1.2.56",
|
69
|
+
"@cocreate/hosting": "^1.2.52",
|
70
|
+
"@cocreate/observer": "^1.3.48",
|
71
|
+
"@cocreate/selection": "^1.2.15"
|
72
72
|
}
|
73
73
|
}
|
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'){
|