@cocreate/text 1.16.2 → 1.16.3
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/index.js +8 -4
package/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
## [1.16.3](https://github.com/CoCreate-app/CoCreate-text/compare/v1.16.2...v1.16.3) (2022-06-16)
|
2
|
+
|
3
|
+
|
4
|
+
### Bug Fixes
|
5
|
+
|
6
|
+
* when iframe need to get iframe elements attributes to send to crdt undo and redo ([ddfc15e](https://github.com/CoCreate-app/CoCreate-text/commit/ddfc15e1184ff7adf4bfabb9a7d147a531b645d6))
|
7
|
+
|
1
8
|
## [1.16.2](https://github.com/CoCreate-app/CoCreate-text/compare/v1.16.1...v1.16.2) (2022-06-13)
|
2
9
|
|
3
10
|
|
package/package.json
CHANGED
package/src/index.js
CHANGED
@@ -193,12 +193,11 @@ function _keydown (event) {
|
|
193
193
|
event.preventDefault();
|
194
194
|
}
|
195
195
|
else if (event.ctrlKey) {
|
196
|
-
const { collection, document_id, name, isCrud, isCrdt, isSave } = crud.getAttr(element);
|
197
196
|
if (event.keyCode == 90) {
|
198
|
-
|
197
|
+
updateText({element, range, undoRedo: 'undo'});
|
199
198
|
}
|
200
199
|
else if (event.keyCode == 89) {
|
201
|
-
|
200
|
+
updateText({element, range, undoRedo: 'redo'});
|
202
201
|
}
|
203
202
|
}
|
204
203
|
}
|
@@ -258,7 +257,7 @@ export function sendPosition (element) {
|
|
258
257
|
cursors.sendPosition({ collection, document_id, name, start, end });
|
259
258
|
}
|
260
259
|
|
261
|
-
function updateText ({element, value, start, end, range}) {
|
260
|
+
function updateText ({element, value, start, end, range, undoRedo}) {
|
262
261
|
if (range) {
|
263
262
|
if (range.element)
|
264
263
|
element = range.element;
|
@@ -269,6 +268,11 @@ function updateText ({element, value, start, end, range}) {
|
|
269
268
|
const { collection, document_id, name, isCrud, isCrdt, isSave } = crud.getAttr(element);
|
270
269
|
if (isCrdt == "false") return;
|
271
270
|
|
271
|
+
if (undoRedo == 'undo')
|
272
|
+
return crdt.undoText({ collection, document_id, name, isCrud, isCrdt, isSave })
|
273
|
+
if (undoRedo == 'redo')
|
274
|
+
return crdt.redoText({ collection, document_id, name, isCrud, isCrdt, isSave })
|
275
|
+
|
272
276
|
let length = end - start;
|
273
277
|
if (element.tagName === "INPUT" || element.tagName === "TEXTAREA") {
|
274
278
|
crdt.updateText({ collection, document_id, name, value, start, length, crud: isCrud, save: isSave });
|