@cocreate/text 1.12.25 → 1.12.29
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 +29 -0
- package/docs/index.html +8 -2
- package/package.json +9 -9
- package/src/updateDom.js +10 -5
package/CHANGELOG.md
CHANGED
@@ -1,3 +1,32 @@
|
|
1
|
+
## [1.12.29](https://github.com/CoCreate-app/CoCreate-text/compare/v1.12.28...v1.12.29) (2021-11-26)
|
2
|
+
|
3
|
+
|
4
|
+
### Bug Fixes
|
5
|
+
|
6
|
+
* add nav and sidenav to docs ([2134b51](https://github.com/CoCreate-app/CoCreate-text/commit/2134b5106addf251ff3c00edaf39f5844eb8b4cd))
|
7
|
+
* updated action dependency to actions ([12ee922](https://github.com/CoCreate-app/CoCreate-text/commit/12ee922408a263df866452fd81dc953ba8268b84))
|
8
|
+
|
9
|
+
## [1.12.28](https://github.com/CoCreate-app/CoCreate-text/compare/v1.12.27...v1.12.28) (2021-11-26)
|
10
|
+
|
11
|
+
|
12
|
+
### Bug Fixes
|
13
|
+
|
14
|
+
* update crdt dependency ([e84dcc7](https://github.com/CoCreate-app/CoCreate-text/commit/e84dcc711b8a5f5d2cde572920788dc9b2cb913b))
|
15
|
+
|
16
|
+
## [1.12.27](https://github.com/CoCreate-app/CoCreate-text/compare/v1.12.26...v1.12.27) (2021-11-24)
|
17
|
+
|
18
|
+
|
19
|
+
### Bug Fixes
|
20
|
+
|
21
|
+
* updated selection dependency ([9c85e4d](https://github.com/CoCreate-app/CoCreate-text/commit/9c85e4db523349309070f24a4f34b9994f25df22))
|
22
|
+
|
23
|
+
## [1.12.26](https://github.com/CoCreate-app/CoCreate-text/compare/v1.12.25...v1.12.26) (2021-11-24)
|
24
|
+
|
25
|
+
|
26
|
+
### Bug Fixes
|
27
|
+
|
28
|
+
* improved on logical conditons on when to processSelection ([53f8ad4](https://github.com/CoCreate-app/CoCreate-text/commit/53f8ad4e075c77b89ade24e56b6512431ac17b35))
|
29
|
+
|
1
30
|
## [1.12.25](https://github.com/CoCreate-app/CoCreate-text/compare/v1.12.24...v1.12.25) (2021-11-23)
|
2
31
|
|
3
32
|
|
package/docs/index.html
CHANGED
@@ -14,7 +14,13 @@
|
|
14
14
|
</head>
|
15
15
|
|
16
16
|
<body>
|
17
|
-
|
17
|
+
<nav class="nav display:flex align-items:center left:0px background:whitesmoke padding-top:10px padding-bottom:10px" content_id="content" scroll="sticky-nav,hide-nav" scroll-up="10" scroll-down="10" collection="files" document_id="60395ef42b3ac232657040fd" name="src">
|
18
|
+
</nav>
|
19
|
+
<sidenav id="menuL" class="position:fixed top:0px left:0px overflow:hidden background:whitesmoke height:100vh width:0px width:300px@xl" resizable resize-target="[content_id='content']" resize-property="margin-left" resize-value="width">
|
20
|
+
<menu collection="files" document_id="603717b07de7fb350ae9fec8" name="src"></menu>
|
21
|
+
<div resize="right"></div>
|
22
|
+
</sidenav>
|
23
|
+
<main class="padding-top:15px padding:15px@lg@xl" content_id="content" id="cocreate-text">
|
18
24
|
<div class="display:flex flex-wrap:wrap justify-content:space-between">
|
19
25
|
<div class="display:flex align-items:center">
|
20
26
|
<h2>CoCreate-text</h2>
|
@@ -112,7 +118,7 @@
|
|
112
118
|
</div>
|
113
119
|
|
114
120
|
</div>
|
115
|
-
</
|
121
|
+
</main>
|
116
122
|
|
117
123
|
<script src="/apikey.js"></script>
|
118
124
|
<script src="https://cdn.cocreate.app/latest/CoCreate.min.js" ></script>
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@cocreate/text",
|
3
|
-
"version": "1.12.
|
3
|
+
"version": "1.12.29",
|
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/
|
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/actions": "^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'){
|