@cocreate/text 1.17.1 → 1.17.4
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 +21 -0
- package/package.json +1 -1
- package/src/index.js +9 -2
- package/src/updateDom.js +6 -5
package/CHANGELOG.md
CHANGED
@@ -1,3 +1,24 @@
|
|
1
|
+
## [1.17.4](https://github.com/CoCreate-app/CoCreate-text/compare/v1.17.3...v1.17.4) (2022-08-18)
|
2
|
+
|
3
|
+
|
4
|
+
### Bug Fixes
|
5
|
+
|
6
|
+
* if CurCaret.range ([a0a1678](https://github.com/CoCreate-app/CoCreate-text/commit/a0a1678236f1805ec246def322eedad4267ce498))
|
7
|
+
|
8
|
+
## [1.17.3](https://github.com/CoCreate-app/CoCreate-text/compare/v1.17.2...v1.17.3) (2022-07-25)
|
9
|
+
|
10
|
+
|
11
|
+
### Bug Fixes
|
12
|
+
|
13
|
+
* if name includes_id, organization_id or beginswith $ return ([a7dbfeb](https://github.com/CoCreate-app/CoCreate-text/commit/a7dbfebda7eddaef5b0abe58c2e0615f2250b5d3))
|
14
|
+
|
15
|
+
## [1.17.2](https://github.com/CoCreate-app/CoCreate-text/compare/v1.17.1...v1.17.2) (2022-07-09)
|
16
|
+
|
17
|
+
|
18
|
+
### Bug Fixes
|
19
|
+
|
20
|
+
* updateDom will sendPosition if the currentContainer = domEl ([c1e9f56](https://github.com/CoCreate-app/CoCreate-text/commit/c1e9f56359c88dbff943c3b82d81746d30833fdb))
|
21
|
+
|
1
22
|
## [1.17.1](https://github.com/CoCreate-app/CoCreate-text/compare/v1.17.0...v1.17.1) (2022-06-24)
|
2
23
|
|
3
24
|
|
package/package.json
CHANGED
package/src/index.js
CHANGED
@@ -29,8 +29,15 @@ function initElements (elements) {
|
|
29
29
|
function initElement (element) {
|
30
30
|
const { collection, document_id, name, isRealtime, isCrdt, isCrud, isSave, isRead } = crud.getAttr(element);
|
31
31
|
if (document_id == "pending") return;
|
32
|
-
if (
|
33
|
-
|
32
|
+
if (['_id', 'organization_id'].includes(name))
|
33
|
+
return
|
34
|
+
if (isCrdt == "false" || isRealtime == "false" || element.type == 'number')
|
35
|
+
return;
|
36
|
+
if (!crud.checkAttrValue(collection) || !crud.checkAttrValue(document_id)|| !crud.checkAttrValue(name))
|
37
|
+
return;
|
38
|
+
if(name && name.startsWith('$'))
|
39
|
+
return
|
40
|
+
|
34
41
|
if (element.tagName === "INPUT" && ["text", "tel", "url"].includes(element.type) || element.tagName === "TEXTAREA" || element.hasAttribute('contenteditable')) {
|
35
42
|
if (!collection || !document_id || !name) return;
|
36
43
|
|
package/src/updateDom.js
CHANGED
@@ -147,11 +147,12 @@ export function updateDom({domTextEditor, value, start, end, html}) {
|
|
147
147
|
domTextEditor.htmlString = html;
|
148
148
|
|
149
149
|
if(curCaret && start >= 0 && end >= 0) {
|
150
|
-
if (curCaret.range && curCaret.
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
150
|
+
if (curCaret.range && curCaret.range.startContainer == domEl)
|
151
|
+
if (curCaret.start >= curCaret.range.startOffset) {
|
152
|
+
let p = processSelection(domEl, value, curCaret.start, curCaret.end, start, end, curCaret.range);
|
153
|
+
sendPosition(domEl);
|
154
|
+
_dispatchInputEvent(p.element, p.value, p.start, p.end, p.prev_start, p.prev_end);
|
155
|
+
}
|
155
156
|
}
|
156
157
|
|
157
158
|
if (['HTML', 'HEAD', 'BODY', 'SCRIPT'].includes(newEl.tagName)){
|