@ckeditor/ckeditor5-operations-compressor 36.0.1 → 37.0.0
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/package.json +14 -4
- package/src/actioncompressor/actioncompressor.d.ts +56 -0
- package/src/actioncompressor/actioncompressor.js +1 -1
- package/src/actioncompressor/deletingactioncompressor.d.ts +24 -0
- package/src/actioncompressor/deletingactioncompressor.js +1 -1
- package/src/actioncompressor/forwarddeletingactioncompressor.d.ts +24 -0
- package/src/actioncompressor/forwarddeletingactioncompressor.js +1 -1
- package/src/actioncompressor/typingactioncompressor.d.ts +24 -0
- package/src/actioncompressor/typingactioncompressor.js +1 -1
- package/src/actioncompressor/userselectionactioncompressor.d.ts +12 -0
- package/src/actioncompressor/userselectionactioncompressor.js +1 -1
- package/src/compressor.d.ts +41 -0
- package/src/compressor.js +1 -1
- package/src/lib/compiledmessages.d.ts +1435 -0
- package/src/lib/compiledmessages.js +23 -0
- package/src/operationcompressor/annotationmarkeroperationcompressor.d.ts +18 -0
- package/src/operationcompressor/annotationmarkeroperationcompressor.js +1 -1
- package/src/operationcompressor/attributeoperationcompressor.d.ts +13 -0
- package/src/operationcompressor/attributeoperationcompressor.js +1 -1
- package/src/operationcompressor/insertoperationcompressor.d.ts +13 -0
- package/src/operationcompressor/insertoperationcompressor.js +1 -1
- package/src/operationcompressor/markeroperationcompressor.d.ts +9 -0
- package/src/operationcompressor/markeroperationcompressor.js +1 -1
- package/src/operationcompressor/nooperationcompressor.d.ts +16 -0
- package/src/operationcompressor/nooperationcompressor.js +1 -1
- package/src/operationcompressor/operationcompressor.d.ts +24 -0
- package/src/operationcompressor/operationcompressor.js +1 -1
- package/src/protobufdescriptions.d.ts +12 -0
- package/src/protobufdescriptions.js +23 -0
- package/src/protobuffactory.d.ts +1 -0
- package/src/protobuffactory.js +1 -1
- package/src/utils.d.ts +26 -0
- package/src/utils.js +1 -1
- package/src/commondescriptions.js +0 -23
- package/src/errors.jsdoc +0 -18
- package/src/operationcompressor/mergeoperationcompressor.js +0 -23
- package/src/operationcompressor/moveoperationcompressor.js +0 -23
- package/src/operationcompressor/renameoperationcompressor.js +0 -23
- package/src/operationcompressor/rootattributeoperationcompressor.js +0 -23
- package/src/operationcompressor/splitoperationcompressor.js +0 -23
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ckeditor/ckeditor5-operations-compressor",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "37.0.0",
|
|
4
4
|
"description": "CKEditor 5 operations compressor for real-time collaboration.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"homepage": "https://ckeditor.com/collaboration/real-time/",
|
|
@@ -27,8 +27,18 @@
|
|
|
27
27
|
],
|
|
28
28
|
"author": "CKSource (http://cksource.com/)",
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"ckeditor5": "^
|
|
30
|
+
"ckeditor5": "^37.0.0",
|
|
31
31
|
"lodash-es": "^4.17.11",
|
|
32
|
-
"protobufjs": "^
|
|
33
|
-
}
|
|
32
|
+
"protobufjs": "^7.0.0"
|
|
33
|
+
},
|
|
34
|
+
"files": [
|
|
35
|
+
"src/**/*.js",
|
|
36
|
+
"src/**/*.d.ts",
|
|
37
|
+
"CHANGELOG.md"
|
|
38
|
+
],
|
|
39
|
+
"scripts": {
|
|
40
|
+
"build": "tsc -p ./tsconfig.json",
|
|
41
|
+
"postversion": "npm run build"
|
|
42
|
+
},
|
|
43
|
+
"obfuscated": true
|
|
34
44
|
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { CompressedOperationsData, default as Compressor } from '../compressor';
|
|
2
|
+
/**
|
|
3
|
+
* * Compresses and decompresses multiple operations into the one buffer.
|
|
4
|
+
*/
|
|
5
|
+
export default abstract class ActionCompressor {
|
|
6
|
+
constructor(id: number, context: Compressor);
|
|
7
|
+
/**
|
|
8
|
+
* Combines and compress operations from the list.
|
|
9
|
+
* Operations are consumed as long as match this compressor.
|
|
10
|
+
*
|
|
11
|
+
* @param result Object to which compression result should be added.
|
|
12
|
+
* @param operations List of operations in JSON format to compress.
|
|
13
|
+
* @returns `true` when operation is consumed `false` otherwise.
|
|
14
|
+
*/
|
|
15
|
+
compress(result: CompressedOperationsData, operations: Array<any>): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Decompress and split compressed operations. Decompressed operations are consumed (removed from the input data).
|
|
18
|
+
*
|
|
19
|
+
* @param result Decompressed operations in JSON format.
|
|
20
|
+
* @param data Compressed operations data.
|
|
21
|
+
*/
|
|
22
|
+
decompress(result: Array<any>, data: CompressedOperationsData): void;
|
|
23
|
+
/**
|
|
24
|
+
* Compresses single operation using a proper compressor.
|
|
25
|
+
*
|
|
26
|
+
* @param operation Operation in JSON format.
|
|
27
|
+
* @returns Operation JSON compressed to the binary format.
|
|
28
|
+
*/
|
|
29
|
+
protected abstract _compressSingleOperation(operation: any): Uint8Array;
|
|
30
|
+
/**
|
|
31
|
+
* Decompresses combined operation using a proper compressor.
|
|
32
|
+
*
|
|
33
|
+
* @param data Data to compress.
|
|
34
|
+
* @returns Decompressed operation in JSON format.
|
|
35
|
+
*/
|
|
36
|
+
protected abstract _decompressSingleOperation(data: CompressedOperationsData): any;
|
|
37
|
+
/**
|
|
38
|
+
* Combine next operation into the combined one.
|
|
39
|
+
*
|
|
40
|
+
* @param nextOperation Operation to combine in JSON format.
|
|
41
|
+
* @param combined Combined operation in JSON format.
|
|
42
|
+
* @returns Combined operation in JSON format.
|
|
43
|
+
*/
|
|
44
|
+
protected abstract _combineNext(nextOperation: any, combined: any): any;
|
|
45
|
+
/**
|
|
46
|
+
* Split operation from combined one.
|
|
47
|
+
*
|
|
48
|
+
* @param combined Combined operation in JSON format.
|
|
49
|
+
* @returns Split operation in JSON format.
|
|
50
|
+
*/
|
|
51
|
+
protected abstract _splitCurrent(combined: any): any;
|
|
52
|
+
/**
|
|
53
|
+
* Checks if two operations can be combined.
|
|
54
|
+
*/
|
|
55
|
+
protected abstract _compareOperations(opA: any, opB: any): boolean;
|
|
56
|
+
}
|
|
@@ -20,4 +20,4 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
const
|
|
23
|
+
const _0x3bbd=['_splitCurrent','_combineNext','_context','types','shift','_compareOperations','_id','compress','buffers','push','_compressSingleOperation'];(function(_0x5e0630,_0x3bbd34){const _0x391287=function(_0x4c1aa1){while(--_0x4c1aa1){_0x5e0630['push'](_0x5e0630['shift']());}};_0x391287(++_0x3bbd34);}(_0x3bbd,0x7c));const _0x3912=function(_0x5e0630,_0x3bbd34){_0x5e0630=_0x5e0630-0x0;let _0x391287=_0x3bbd[_0x5e0630];return _0x391287;};import{cloneDeep as _0x8e954f}from'lodash-es';export default class b{constructor(_0x38ceb0,_0x19bf4){this[_0x3912('0x3')]=_0x38ceb0,this[_0x3912('0xa')]=_0x19bf4;}[_0x3912('0x4')](_0x2570ee,_0x205517){let _0x2dd0c0;for(;_0x205517['length']>0x1&&this[_0x3912('0x2')](_0x205517[0x0],_0x205517[0x1]);)_0x2dd0c0?(_0x2dd0c0=this[_0x3912('0x9')](_0x205517['shift'](),_0x2dd0c0),_0x2570ee[_0x3912('0x0')][_0x3912('0x6')](0x0)):(_0x2dd0c0=_0x8e954f(_0x205517[_0x3912('0x1')]()),_0x2570ee[_0x3912('0x0')][_0x3912('0x6')](this[_0x3912('0x3')]));return!!_0x2dd0c0&&(_0x2dd0c0=this[_0x3912('0x9')](_0x205517['shift'](),_0x2dd0c0),_0x2570ee[_0x3912('0x0')][_0x3912('0x6')](0x0),_0x2570ee[_0x3912('0x5')]['push'](this[_0x3912('0x7')](_0x2dd0c0)),!0x0);}['decompress'](_0x367093,_0x397c5e){const _0x500210=this['_decompressSingleOperation'](_0x397c5e);for(;0x0==_0x397c5e[_0x3912('0x0')][0x0];)_0x397c5e[_0x3912('0x0')][_0x3912('0x1')](),_0x367093[_0x3912('0x6')](this[_0x3912('0x8')](_0x500210));_0x367093['push'](_0x500210);}}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import ActionCompressor from './actioncompressor';
|
|
2
|
+
import type { CompressedOperationsData } from '../compressor';
|
|
3
|
+
export default class DeletingActionCompressor extends ActionCompressor {
|
|
4
|
+
/**
|
|
5
|
+
* @inheritDoc
|
|
6
|
+
*/
|
|
7
|
+
protected _combineNext(nextOperation: any, combined: any): any;
|
|
8
|
+
/**
|
|
9
|
+
* @inheritDoc
|
|
10
|
+
*/
|
|
11
|
+
protected _splitCurrent(combined: any): any;
|
|
12
|
+
/**
|
|
13
|
+
* @inheritDoc
|
|
14
|
+
*/
|
|
15
|
+
protected _compareOperations(opA: any, opB: any): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* @inheritDoc
|
|
18
|
+
*/
|
|
19
|
+
protected _compressSingleOperation(operation: any): Uint8Array;
|
|
20
|
+
/**
|
|
21
|
+
* @inheritDoc
|
|
22
|
+
*/
|
|
23
|
+
protected _decompressSingleOperation(data: CompressedOperationsData): any;
|
|
24
|
+
}
|
|
@@ -20,4 +20,4 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
const
|
|
23
|
+
const _0x2e35=['compress','root','_decompressSingleOperation','sourcePosition','_combineNext','MoveOperation','howMany','wasUndone','__className','buffers','_context','decompress','_checkOperation','targetPosition'];(function(_0x47dd90,_0x2e35ef){const _0x70eaa3=function(_0x911591){while(--_0x911591){_0x47dd90['push'](_0x47dd90['shift']());}};_0x70eaa3(++_0x2e35ef);}(_0x2e35,0x192));const _0x70ea=function(_0x47dd90,_0x2e35ef){_0x47dd90=_0x47dd90-0x0;let _0x70eaa3=_0x2e35[_0x47dd90];return _0x70eaa3;};import _0x1a7134 from'./actioncompressor';import{arePositionsEqual as _0xf942f1,getPositionShiftedBy as _0x1eabe2}from'../utils';import{cloneDeep as _0x26786f}from'lodash-es';export default class c extends _0x1a7134{[_0x70ea('0x8')](_0xeb8d72,_0x365807){return _0x365807[_0x70ea('0xa')]++,_0x365807[_0x70ea('0x7')]=_0x26786f(_0xeb8d72[_0x70ea('0x7')]),_0x365807;}['_splitCurrent'](_0x71ab04){const _0x5426e4=_0x26786f(_0x71ab04);return _0x71ab04['howMany']--,_0x5426e4['howMany']=0x1,_0x5426e4[_0x70ea('0x7')]=_0x1eabe2(_0x5426e4[_0x70ea('0x7')],_0x71ab04[_0x70ea('0xa')]),_0x5426e4;}['_compareOperations'](_0x5e896b,_0x24c2bc){return!(!this['_checkOperation'](_0x5e896b)||!this['_checkOperation'](_0x24c2bc))&&(_0xf942f1(_0x1eabe2(_0x5e896b[_0x70ea('0x7')],-0x1),_0x24c2bc['sourcePosition'])&&_0xf942f1(_0x5e896b['targetPosition'],_0x24c2bc['targetPosition']));}['_compressSingleOperation'](_0x82973e){const _0x39f935={'types':[],'buffers':[],'baseVersion':0x0};return this[_0x70ea('0x0')]['_getCompressorByName']('MoveOperation')[_0x70ea('0x4')](_0x39f935,[_0x82973e]),_0x39f935[_0x70ea('0xd')][0x0];}[_0x70ea('0x6')](_0x40cf6c){const _0x546a7a=[];return this[_0x70ea('0x0')]['_getCompressorByName'](_0x70ea('0x9'))[_0x70ea('0x1')](_0x546a7a,_0x40cf6c),_0x546a7a[0x0];}[_0x70ea('0x2')](_0x10d106){return _0x70ea('0x9')==_0x10d106[_0x70ea('0xc')]&&'$graveyard'==_0x10d106[_0x70ea('0x3')][_0x70ea('0x5')]&&0x1==_0x10d106['howMany']&&!_0x10d106[_0x70ea('0xb')];}}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import ActionCompressor from './actioncompressor';
|
|
2
|
+
import type { CompressedOperationsData } from '../compressor';
|
|
3
|
+
export default class ForwardDeletingActionCompressor extends ActionCompressor {
|
|
4
|
+
/**
|
|
5
|
+
* @inheritDoc
|
|
6
|
+
*/
|
|
7
|
+
protected _combineNext(nextOperation: any, combined: any): any;
|
|
8
|
+
/**
|
|
9
|
+
* @inheritDoc
|
|
10
|
+
*/
|
|
11
|
+
protected _splitCurrent(combined: any): any;
|
|
12
|
+
/**
|
|
13
|
+
* @inheritDoc
|
|
14
|
+
*/
|
|
15
|
+
protected _compareOperations(opA: any, opB: any): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* @inheritDoc
|
|
18
|
+
*/
|
|
19
|
+
protected _compressSingleOperation(operation: any): Uint8Array;
|
|
20
|
+
/**
|
|
21
|
+
* @inheritDoc
|
|
22
|
+
*/
|
|
23
|
+
protected _decompressSingleOperation(data: CompressedOperationsData): any;
|
|
24
|
+
}
|
|
@@ -20,4 +20,4 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
const
|
|
23
|
+
const _0x1a44=['decompress','targetPosition','howMany','_compressSingleOperation','_context','_combineNext','__className','_checkOperation','_getCompressorByName','_compareOperations','buffers','_splitCurrent','$graveyard','sourcePosition','MoveOperation','compress','root'];(function(_0x40e553,_0x1a443a){const _0x48d818=function(_0x356c2f){while(--_0x356c2f){_0x40e553['push'](_0x40e553['shift']());}};_0x48d818(++_0x1a443a);}(_0x1a44,0x174));const _0x48d8=function(_0x40e553,_0x1a443a){_0x40e553=_0x40e553-0x0;let _0x48d818=_0x1a44[_0x40e553];return _0x48d818;};import _0x2b6c7b from'./actioncompressor';import{arePositionsEqual as _0x23c41f}from'../utils';import{cloneDeep as _0x5cb38d}from'lodash-es';export default class h extends _0x2b6c7b{[_0x48d8('0x7')](_0x2a6ce3,_0x13f05e){return _0x13f05e[_0x48d8('0x4')]++,_0x13f05e;}[_0x48d8('0xd')](_0x4e7092){const _0x193e7e=_0x5cb38d(_0x4e7092);return _0x193e7e['howMany']=0x1,_0x4e7092[_0x48d8('0x4')]--,_0x193e7e;}[_0x48d8('0xb')](_0x3cad5d,_0x43f16a){return!(!this['_checkOperation'](_0x3cad5d)||!this[_0x48d8('0x9')](_0x43f16a))&&(_0x23c41f(_0x3cad5d[_0x48d8('0xf')],_0x43f16a[_0x48d8('0xf')])&&_0x23c41f(_0x3cad5d['targetPosition'],_0x43f16a[_0x48d8('0x3')]));}[_0x48d8('0x5')](_0x2ff3b9){const _0x333efc={'types':[],'buffers':[],'baseVersion':0x0};return this[_0x48d8('0x6')][_0x48d8('0xa')](_0x48d8('0x10'))[_0x48d8('0x0')](_0x333efc,[_0x2ff3b9]),_0x333efc[_0x48d8('0xc')][0x0];}['_decompressSingleOperation'](_0x513209){const _0x2a63af=[];return this['_context']['_getCompressorByName']('MoveOperation')[_0x48d8('0x2')](_0x2a63af,_0x513209),_0x2a63af[0x0];}[_0x48d8('0x9')](_0x504b26){return _0x48d8('0x10')==_0x504b26[_0x48d8('0x8')]&&_0x48d8('0xe')==_0x504b26[_0x48d8('0x3')][_0x48d8('0x1')]&&0x1==_0x504b26['howMany']&&!_0x504b26['wasUndone'];}}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import ActionCompressor from './actioncompressor';
|
|
2
|
+
import type { CompressedOperationsData } from '../compressor';
|
|
3
|
+
export default class TypingActionCompressor extends ActionCompressor {
|
|
4
|
+
/**
|
|
5
|
+
* @inheritDocs
|
|
6
|
+
*/
|
|
7
|
+
protected _combineNext(nextOperation: any, combined: any): any;
|
|
8
|
+
/**
|
|
9
|
+
* @inheritDoc
|
|
10
|
+
*/
|
|
11
|
+
protected _splitCurrent(combined: any): any;
|
|
12
|
+
/**
|
|
13
|
+
* @inheritDoc
|
|
14
|
+
*/
|
|
15
|
+
protected _compareOperations(opA: any, opB: any): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* @inheritDoc
|
|
18
|
+
*/
|
|
19
|
+
protected _compressSingleOperation(operation: any): Uint8Array;
|
|
20
|
+
/**
|
|
21
|
+
* @inheritDoc
|
|
22
|
+
*/
|
|
23
|
+
protected _decompressSingleOperation(data: CompressedOperationsData): any;
|
|
24
|
+
}
|
|
@@ -20,4 +20,4 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
const
|
|
23
|
+
const _0x1e31=['compress','iterator','value','_context','_compareAttributes','length','keys','wasUndone','data','_splitCurrent','_getCompressorByName','nodes','_compressSingleOperation','__className','_checkOperation','_combineNext','substr','decompress','attributes','InsertOperation','position'];(function(_0xb23211,_0x1e311d){const _0x4c7bbe=function(_0x48485a){while(--_0x48485a){_0xb23211['push'](_0xb23211['shift']());}};_0x4c7bbe(++_0x1e311d);}(_0x1e31,0x92));const _0x4c7b=function(_0xb23211,_0x1e311d){_0xb23211=_0xb23211-0x0;let _0x4c7bbe=_0x1e31[_0xb23211];return _0x4c7bbe;};import _0x556ae1 from'./actioncompressor';import{arePositionsEqual as _0x134ff3,getPositionShiftedBy as _0x1c837e}from'../utils';import{cloneDeep as _0x2ef7f5}from'lodash-es';export default class m extends _0x556ae1{[_0x4c7b('0x10')](_0x6b5c1d,_0x294046){return _0x294046[_0x4c7b('0xc')][0x0][_0x4c7b('0x9')]+=_0x6b5c1d[_0x4c7b('0xc')][0x0]['data'],_0x294046;}[_0x4c7b('0xa')](_0x48a140){const _0x24b11b=_0x2ef7f5(_0x48a140),_0xbc2d6d=_0x24b11b[_0x4c7b('0xc')][0x0],_0x283e9d=_0x48a140[_0x4c7b('0xc')][0x0],_0xe833a9=_0x283e9d[_0x4c7b('0x9')][Symbol[_0x4c7b('0x2')]]()['next']()[_0x4c7b('0x3')],_0x4524c8=_0xe833a9[_0x4c7b('0x6')];return _0xbc2d6d['data']=_0xe833a9,_0x283e9d['data']=_0x283e9d[_0x4c7b('0x9')][_0x4c7b('0x11')](_0x4524c8),_0x48a140['position']=_0x1c837e(_0x48a140['position'],_0x4524c8),_0x24b11b;}['_compareOperations'](_0x520ae2,_0x118406){if(this[_0x4c7b('0xf')](_0x520ae2)&&this['_checkOperation'](_0x118406)){const _0x49335c=_0x520ae2[_0x4c7b('0xc')][0x0][_0x4c7b('0x9')][_0x4c7b('0x6')],_0x4b22f9=_0x134ff3(_0x1c837e(_0x520ae2[_0x4c7b('0x0')],_0x49335c),_0x118406[_0x4c7b('0x0')]),_0xfd8564=_0x520ae2[_0x4c7b('0xc')][0x0],_0xcc9fbd=_0x118406['nodes'][0x0];return _0x4b22f9&&this[_0x4c7b('0x5')](_0xfd8564,_0xcc9fbd);}return!0x1;}[_0x4c7b('0xd')](_0x4fb5ea){const _0x9a1b86={'types':[],'buffers':[],'baseVersion':0x0};return this[_0x4c7b('0x4')][_0x4c7b('0xb')](_0x4c7b('0x14'))[_0x4c7b('0x1')](_0x9a1b86,[_0x4fb5ea]),_0x9a1b86['buffers'][0x0];}['_decompressSingleOperation'](_0x37b174){const _0x589731=[];return this[_0x4c7b('0x4')]['_getCompressorByName'](_0x4c7b('0x14'))[_0x4c7b('0x12')](_0x589731,_0x37b174),_0x589731[0x0];}[_0x4c7b('0xf')](_0x51426e){return _0x4c7b('0x14')==_0x51426e[_0x4c7b('0xe')]&&0x1==_0x51426e['nodes'][_0x4c7b('0x6')]&&_0x51426e[_0x4c7b('0xc')][0x0][_0x4c7b('0x9')]&&!_0x51426e[_0x4c7b('0x8')]&&0x1==Array['from'](_0x51426e['nodes'][0x0]['data'])['length'];}[_0x4c7b('0x5')](_0x183261,_0x19ffcb){const _0x2920e5=Object['keys'](_0x183261[_0x4c7b('0x13')]||{}),_0x435eff=Object[_0x4c7b('0x7')](_0x19ffcb['attributes']||{});return _0x2920e5['length']===_0x435eff[_0x4c7b('0x6')]&&_0x2920e5['every'](_0x2fd995=>_0x19ffcb[_0x4c7b('0x13')][_0x2fd995]&&_0x19ffcb['attributes'][_0x2fd995]===_0x183261['attributes'][_0x2fd995]);}}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import ActionCompressor from './actioncompressor';
|
|
2
|
+
import type { CompressedOperationsData } from '../compressor';
|
|
3
|
+
export default class UserSelectionActionCompressor extends ActionCompressor {
|
|
4
|
+
/**
|
|
5
|
+
* @inheritDoc
|
|
6
|
+
*/
|
|
7
|
+
compress(result: CompressedOperationsData, operations: Array<any>): boolean;
|
|
8
|
+
/**
|
|
9
|
+
* @inheritDoc
|
|
10
|
+
*/
|
|
11
|
+
decompress(result: Array<any>, data: CompressedOperationsData): void;
|
|
12
|
+
}
|
|
@@ -20,4 +20,4 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
const
|
|
23
|
+
const _0x40d9=['oldRange','user:position:','compress','start','types','shift','_context','buffers','startsWith','_getCompressorByName','decompress','newRange','MarkerOperation','_compressSingleOperation','toNone','name','user:','end','push','_compareOperations','_decompressSingleOperation','split'];(function(_0x5c0e8d,_0x40d940){const _0x5f4933=function(_0x177734){while(--_0x177734){_0x5c0e8d['push'](_0x5c0e8d['shift']());}};_0x5f4933(++_0x40d940);}(_0x40d9,0x7c));const _0x5f49=function(_0x5c0e8d,_0x40d940){_0x5c0e8d=_0x5c0e8d-0x0;let _0x5f4933=_0x40d9[_0x5c0e8d];return _0x5f4933;};import _0x474db7 from'./actioncompressor';import{arePositionsEqual as _0x2abf27}from'../utils';import{cloneDeep as _0x18dc87}from'lodash-es';export default class f extends _0x474db7{[_0x5f49('0xa')](_0x25cb6d,_0x185425){if(!this['_compareOperations'](_0x185425[0x0],_0x185425[0x1]))return!0x1;const _0x24ad56=_0x185425[_0x5f49('0xd')]();return _0x24ad56[_0x5f49('0x8')]=null,_0x24ad56[_0x5f49('0x13')]&&_0x2abf27(_0x24ad56[_0x5f49('0x13')]['start'],_0x24ad56[_0x5f49('0x13')][_0x5f49('0x3')])&&(_0x24ad56[_0x5f49('0x13')]['end']=null),_0x185425[_0x5f49('0xd')](),_0x25cb6d[_0x5f49('0xc')][_0x5f49('0x4')](this['_id']),_0x25cb6d[_0x5f49('0xc')][_0x5f49('0x4')](0x0),_0x25cb6d[_0x5f49('0xf')][_0x5f49('0x4')](this['_compressSingleOperation'](_0x24ad56)),!0x0;}['decompress'](_0x4f6cab,_0x3ce0a0){const _0x15aca6=this[_0x5f49('0x6')](_0x3ce0a0);_0x15aca6[_0x5f49('0x13')]&&!_0x15aca6[_0x5f49('0x13')]['end']&&(_0x15aca6['newRange'][_0x5f49('0x3')]=_0x18dc87(_0x15aca6[_0x5f49('0x13')][_0x5f49('0xb')]));const _0x22f366=_0x18dc87(_0x15aca6);_0x22f366[_0x5f49('0x13')]&&(_0x22f366[_0x5f49('0x13')]['start']['stickiness']=_0x5f49('0x0'),_0x22f366[_0x5f49('0x13')][_0x5f49('0x3')]=_0x18dc87(_0x22f366[_0x5f49('0x13')][_0x5f49('0xb')])),_0x22f366[_0x5f49('0x1')]=_0x5f49('0x9')+_0x22f366[_0x5f49('0x1')][_0x5f49('0x7')](':')[0x2],_0x3ce0a0[_0x5f49('0xc')][_0x5f49('0xd')](),_0x4f6cab['push'](_0x15aca6),_0x4f6cab[_0x5f49('0x4')](_0x22f366);}[_0x5f49('0x15')](_0x56cf33){const _0x21be79={'types':[],'buffers':[],'baseVersion':0x0};return this[_0x5f49('0xe')][_0x5f49('0x11')](_0x5f49('0x14'))[_0x5f49('0xa')](_0x21be79,[_0x56cf33]),_0x21be79['buffers'][0x0];}[_0x5f49('0x6')](_0x149ed0){const _0x1d41cd=[];return this[_0x5f49('0xe')][_0x5f49('0x11')](_0x5f49('0x14'))[_0x5f49('0x12')](_0x1d41cd,_0x149ed0),_0x1d41cd[0x0];}[_0x5f49('0x5')](_0x464c1d,_0x43ae5c){return!(!_0x464c1d||!_0x43ae5c)&&(_0x5f49('0x14')==_0x464c1d['__className']&&_0x5f49('0x14')==_0x43ae5c['__className']&&!(!_0x464c1d['name'][_0x5f49('0x10')](_0x5f49('0x2'))||!_0x43ae5c['name'][_0x5f49('0x10')](_0x5f49('0x2'))||_0x464c1d[_0x5f49('0x1')]==_0x43ae5c[_0x5f49('0x1')]));}}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compresses and decompresses given set of operations in JSON format to/from the binary format using `Protocol Buffers`.
|
|
3
|
+
*/
|
|
4
|
+
export default class Compressor {
|
|
5
|
+
constructor();
|
|
6
|
+
/**
|
|
7
|
+
* Compress given list of operations in JSON format.
|
|
8
|
+
*
|
|
9
|
+
* **Note** It tries to combine typing-like or deleting-like operations into the one buffer.
|
|
10
|
+
* **Note** Input data will be consumed and modified during compression process. If you need untouched data
|
|
11
|
+
* you need to copy it before the compression.
|
|
12
|
+
*/
|
|
13
|
+
compress(operations: Array<any>): CompressedOperationsData;
|
|
14
|
+
/**
|
|
15
|
+
* Decompress given data to the list of operations in JSON format.
|
|
16
|
+
*
|
|
17
|
+
* **Note** Input data will be consumed during decompression process. If you need untouched data
|
|
18
|
+
* you need to copy it before the decompression.
|
|
19
|
+
*
|
|
20
|
+
* @param data Compressed operations.
|
|
21
|
+
* @returns List of operations in JSON format.
|
|
22
|
+
*/
|
|
23
|
+
decompress(data: CompressedOperationsData): Array<any>;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Compressed operations data.
|
|
27
|
+
*/
|
|
28
|
+
export type CompressedOperationsData = {
|
|
29
|
+
/**
|
|
30
|
+
* List of operations compressed to the binary format.
|
|
31
|
+
*/
|
|
32
|
+
buffers: Array<Uint8Array>;
|
|
33
|
+
/**
|
|
34
|
+
* List of compressor identifiers. According to this types a proper compressor will be used for the decompression.
|
|
35
|
+
*/
|
|
36
|
+
types: Array<number>;
|
|
37
|
+
/**
|
|
38
|
+
* Base version of the first compressed operation.
|
|
39
|
+
*/
|
|
40
|
+
baseVersion: number;
|
|
41
|
+
};
|
package/src/compressor.js
CHANGED
|
@@ -20,4 +20,4 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
const
|
|
23
|
+
const _0x4b6f=['no-operations-provided','RenameOperation','__className','InsertOperation','MoveOperation','types','MergeOperation','set','forEach','baseVersion','ForwardDeletingAction','_registerOperationCompressor','getDescriptor','SuggestionMarkerOperation','get','decompress','CommentMarkerOperation','_registerCompressor','_compressorById','compress','_registerActionCompressor','length','_compressorByName','RootOperation','UserSelectionAction','RootAttributeOperation','MarkerOperation','SplitOperation','DeletingAction','_getCompressorByName','NoOperation','_protobufFactory'];(function(_0x45777b,_0x4b6fc7){const _0x207ba9=function(_0xaab6a0){while(--_0xaab6a0){_0x45777b['push'](_0x45777b['shift']());}};_0x207ba9(++_0x4b6fc7);}(_0x4b6f,0x188));const _0x207b=function(_0x45777b,_0x4b6fc7){_0x45777b=_0x45777b-0x0;let _0x207ba9=_0x4b6f[_0x45777b];return _0x207ba9;};import{CKEditorError as _0x2ded25}from'ckeditor5/src/utils';import _0x14ecb1 from'./protobuffactory';import _0x404e7f from'./operationcompressor/operationcompressor';import _0x5c36b1 from'./operationcompressor/attributeoperationcompressor';import _0x4df0db from'./operationcompressor/insertoperationcompressor';import _0x3d2f26 from'./operationcompressor/markeroperationcompressor';import _0x2b0bf6 from'./operationcompressor/nooperationcompressor';import _0x168c23 from'./operationcompressor/annotationmarkeroperationcompressor';import _0x336756 from'./actioncompressor/typingactioncompressor';import _0x5662b1 from'./actioncompressor/deletingactioncompressor';import _0x2cedd0 from'./actioncompressor/forwarddeletingactioncompressor';import _0x39bdab from'./actioncompressor/userselectionactioncompressor';export default class g{constructor(){this[_0x207b('0xa')]=new Map(),this['_compressorByName']=new Map(),this['_protobufFactory']=new _0x14ecb1();const _0x4d6be9=this[_0x207b('0x17')][_0x207b('0x4')]('MarkerOperation');this['_registerCompressor'](0x1,'NoOperation',new _0x2b0bf6(0x1,_0x207b('0x16'),void 0x0)),this[_0x207b('0x3')](0xa,'AttributeOperation',_0x5c36b1),this[_0x207b('0x3')](0xb,_0x207b('0x1b'),_0x4df0db),this[_0x207b('0x3')](0xc,'MarkerOperation',_0x3d2f26),this[_0x207b('0x3')](0xd,_0x207b('0x1e'),_0x404e7f),this[_0x207b('0x3')](0xe,_0x207b('0x1c'),_0x404e7f),this[_0x207b('0x3')](0xf,_0x207b('0x19'),_0x404e7f),this[_0x207b('0x3')](0x10,_0x207b('0x11'),_0x5c36b1),this[_0x207b('0x3')](0x11,_0x207b('0x13'),_0x404e7f),this[_0x207b('0x9')](0x12,_0x207b('0x8'),new _0x168c23(0x12,_0x207b('0x12'),_0x4d6be9,'comment')),this[_0x207b('0x9')](0x13,_0x207b('0x5'),new _0x168c23(0x13,'MarkerOperation',_0x4d6be9,'suggestion')),this[_0x207b('0x3')](0x14,_0x207b('0xf'),_0x404e7f),this[_0x207b('0xc')](0x64,'TypingAction',_0x336756),this['_registerActionCompressor'](0x65,_0x207b('0x14'),_0x5662b1),this[_0x207b('0xc')](0x66,'ForwardDeletingAction',_0x2cedd0),this[_0x207b('0xc')](0x67,_0x207b('0x10'),_0x39bdab);}[_0x207b('0xb')](_0x3d71aa){if(!_0x3d71aa||!_0x3d71aa[0x0])throw new _0x2ded25(_0x207b('0x18'),this);const _0x496d97={'types':[],'buffers':[],'baseVersion':_0x3d71aa[0x0][_0x207b('0x1')]};for(;_0x3d71aa[_0x207b('0xd')];)this[_0x207b('0x15')](_0x207b('0x10'))[_0x207b('0xb')](_0x496d97,_0x3d71aa)||this[_0x207b('0x15')]('TypingAction')[_0x207b('0xb')](_0x496d97,_0x3d71aa)||this[_0x207b('0x15')](_0x207b('0x14'))[_0x207b('0xb')](_0x496d97,_0x3d71aa)||this[_0x207b('0x15')](_0x207b('0x2'))[_0x207b('0xb')](_0x496d97,_0x3d71aa)||this[_0x207b('0x15')](_0x207b('0x8'))[_0x207b('0xb')](_0x496d97,_0x3d71aa)||this[_0x207b('0x15')](_0x207b('0x5'))[_0x207b('0xb')](_0x496d97,_0x3d71aa)||this['_getCompressorByName'](_0x3d71aa[0x0][_0x207b('0x1a')])[_0x207b('0xb')](_0x496d97,_0x3d71aa);return _0x496d97;}['decompress'](_0x4c743c){const _0xc1f1c7=[];for(;_0x4c743c[_0x207b('0x1d')][_0x207b('0xd')];){this[_0x207b('0xa')][_0x207b('0x6')](_0x4c743c[_0x207b('0x1d')][0x0])[_0x207b('0x7')](_0xc1f1c7,_0x4c743c);}return _0xc1f1c7[_0x207b('0x0')]((_0x4454fe,_0x19b0f6)=>_0x4454fe['baseVersion']=_0x4c743c[_0x207b('0x1')]+_0x19b0f6),_0xc1f1c7;}['_getCompressorByName'](_0x30e92e){return this['_compressorByName']['get'](_0x30e92e);}[_0x207b('0x3')](_0x5089f3,_0x5b46c2,_0xa9694){const _0x55b111=new _0xa9694(_0x5089f3,_0x5b46c2,this[_0x207b('0x17')][_0x207b('0x4')](_0x5b46c2));this['_registerCompressor'](_0x5089f3,_0x5b46c2,_0x55b111);}['_registerActionCompressor'](_0xed483a,_0x5a7d0c,_0x5d60f7){const _0x328d0a=new _0x5d60f7(_0xed483a,this);this[_0x207b('0x9')](_0xed483a,_0x5a7d0c,_0x328d0a);}[_0x207b('0x9')](_0x3d2cb9,_0x42564f,_0x12b2ca){this['_compressorById']['set'](_0x3d2cb9,_0x12b2ca),this[_0x207b('0xe')][_0x207b('0x1f')](_0x42564f,_0x12b2ca);}}
|