@ckeditor/ckeditor5-operations-compressor 36.0.1 → 37.0.0-rc.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-rc.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-rc.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 _0x54da=['length','_compareOperations','push','_decompressSingleOperation','types','_splitCurrent','shift','_compressSingleOperation','_combineNext','compress','_id'];(function(_0x53fbad,_0x54dade){const _0x521280=function(_0x8986d){while(--_0x8986d){_0x53fbad['push'](_0x53fbad['shift']());}};_0x521280(++_0x54dade);}(_0x54da,0x1c5));const _0x5212=function(_0x53fbad,_0x54dade){_0x53fbad=_0x53fbad-0x0;let _0x521280=_0x54da[_0x53fbad];return _0x521280;};import{cloneDeep as _0x1163ed}from'lodash-es';export default class b{constructor(_0x172647,_0x5dcec5){this[_0x5212('0x8')]=_0x172647,this['_context']=_0x5dcec5;}[_0x5212('0x7')](_0x1cd530,_0x266616){let _0x315bcb;for(;_0x266616[_0x5212('0x9')]>0x1&&this[_0x5212('0xa')](_0x266616[0x0],_0x266616[0x1]);)_0x315bcb?(_0x315bcb=this[_0x5212('0x6')](_0x266616['shift'](),_0x315bcb),_0x1cd530[_0x5212('0x2')][_0x5212('0x0')](0x0)):(_0x315bcb=_0x1163ed(_0x266616[_0x5212('0x4')]()),_0x1cd530[_0x5212('0x2')][_0x5212('0x0')](this[_0x5212('0x8')]));return!!_0x315bcb&&(_0x315bcb=this[_0x5212('0x6')](_0x266616['shift'](),_0x315bcb),_0x1cd530[_0x5212('0x2')][_0x5212('0x0')](0x0),_0x1cd530['buffers'][_0x5212('0x0')](this[_0x5212('0x5')](_0x315bcb)),!0x0);}['decompress'](_0x59b549,_0x30f98f){const _0x263dde=this[_0x5212('0x1')](_0x30f98f);for(;0x0==_0x30f98f[_0x5212('0x2')][0x0];)_0x30f98f[_0x5212('0x2')][_0x5212('0x4')](),_0x59b549['push'](this[_0x5212('0x3')](_0x263dde));_0x59b549[_0x5212('0x0')](_0x263dde);}}
|
|
@@ -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 _0x63c8=['__className','compress','$graveyard','sourcePosition','targetPosition','wasUndone','_compressSingleOperation','_splitCurrent','_checkOperation','_combineNext','howMany','_getCompressorByName','buffers','decompress','MoveOperation','_context'];(function(_0x408d05,_0x63c800){const _0x2539b7=function(_0x132284){while(--_0x132284){_0x408d05['push'](_0x408d05['shift']());}};_0x2539b7(++_0x63c800);}(_0x63c8,0x173));const _0x2539=function(_0x408d05,_0x63c800){_0x408d05=_0x408d05-0x0;let _0x2539b7=_0x63c8[_0x408d05];return _0x2539b7;};import _0x3c1dcd from'./actioncompressor';import{arePositionsEqual as _0x4f04c3,getPositionShiftedBy as _0x46fbaf}from'../utils';import{cloneDeep as _0x4f72b2}from'lodash-es';export default class c extends _0x3c1dcd{[_0x2539('0x6')](_0x28447c,_0x1d4914){return _0x1d4914[_0x2539('0x7')]++,_0x1d4914[_0x2539('0x0')]=_0x4f72b2(_0x28447c[_0x2539('0x0')]),_0x1d4914;}[_0x2539('0x4')](_0xe9961){const _0x5354ba=_0x4f72b2(_0xe9961);return _0xe9961[_0x2539('0x7')]--,_0x5354ba[_0x2539('0x7')]=0x1,_0x5354ba[_0x2539('0x0')]=_0x46fbaf(_0x5354ba[_0x2539('0x0')],_0xe9961['howMany']),_0x5354ba;}['_compareOperations'](_0x37b307,_0x5feca4){return!(!this[_0x2539('0x5')](_0x37b307)||!this[_0x2539('0x5')](_0x5feca4))&&(_0x4f04c3(_0x46fbaf(_0x37b307['sourcePosition'],-0x1),_0x5feca4[_0x2539('0x0')])&&_0x4f04c3(_0x37b307[_0x2539('0x1')],_0x5feca4[_0x2539('0x1')]));}[_0x2539('0x3')](_0x37b25d){const _0x4873d6={'types':[],'buffers':[],'baseVersion':0x0};return this[_0x2539('0xc')]['_getCompressorByName'](_0x2539('0xb'))[_0x2539('0xe')](_0x4873d6,[_0x37b25d]),_0x4873d6[_0x2539('0x9')][0x0];}['_decompressSingleOperation'](_0x5c9de){const _0x4e87b2=[];return this[_0x2539('0xc')][_0x2539('0x8')](_0x2539('0xb'))[_0x2539('0xa')](_0x4e87b2,_0x5c9de),_0x4e87b2[0x0];}[_0x2539('0x5')](_0x48e6be){return _0x2539('0xb')==_0x48e6be[_0x2539('0xd')]&&_0x2539('0xf')==_0x48e6be[_0x2539('0x1')]['root']&&0x1==_0x48e6be[_0x2539('0x7')]&&!_0x48e6be[_0x2539('0x2')];}}
|
|
@@ -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 _0x50e6=['_compareOperations','_getCompressorByName','wasUndone','sourcePosition','__className','_combineNext','targetPosition','_checkOperation','_context','$graveyard','_decompressSingleOperation','root','MoveOperation','_compressSingleOperation','howMany','_splitCurrent'];(function(_0x6e8111,_0x50e6c3){const _0x490635=function(_0x54c0ee){while(--_0x54c0ee){_0x6e8111['push'](_0x6e8111['shift']());}};_0x490635(++_0x50e6c3);}(_0x50e6,0x81));const _0x4906=function(_0x6e8111,_0x50e6c3){_0x6e8111=_0x6e8111-0x0;let _0x490635=_0x50e6[_0x6e8111];return _0x490635;};import _0x27bad0 from'./actioncompressor';import{arePositionsEqual as _0x52a4b3}from'../utils';import{cloneDeep as _0x277371}from'lodash-es';export default class h extends _0x27bad0{[_0x4906('0x4')](_0x2495b0,_0x46230e){return _0x46230e[_0x4906('0xd')]++,_0x46230e;}[_0x4906('0xe')](_0x16eda0){const _0x1d3b9d=_0x277371(_0x16eda0);return _0x1d3b9d[_0x4906('0xd')]=0x1,_0x16eda0['howMany']--,_0x1d3b9d;}[_0x4906('0xf')](_0x4a0dba,_0x5d7f82){return!(!this[_0x4906('0x6')](_0x4a0dba)||!this['_checkOperation'](_0x5d7f82))&&(_0x52a4b3(_0x4a0dba[_0x4906('0x2')],_0x5d7f82[_0x4906('0x2')])&&_0x52a4b3(_0x4a0dba[_0x4906('0x5')],_0x5d7f82[_0x4906('0x5')]));}[_0x4906('0xc')](_0x16e6a1){const _0x1a565a={'types':[],'buffers':[],'baseVersion':0x0};return this[_0x4906('0x7')][_0x4906('0x0')](_0x4906('0xb'))['compress'](_0x1a565a,[_0x16e6a1]),_0x1a565a['buffers'][0x0];}[_0x4906('0x9')](_0x38bd78){const _0x585232=[];return this[_0x4906('0x7')][_0x4906('0x0')](_0x4906('0xb'))['decompress'](_0x585232,_0x38bd78),_0x585232[0x0];}['_checkOperation'](_0x22057b){return _0x4906('0xb')==_0x22057b[_0x4906('0x3')]&&_0x4906('0x8')==_0x22057b['targetPosition'][_0x4906('0xa')]&&0x1==_0x22057b[_0x4906('0xd')]&&!_0x22057b[_0x4906('0x1')];}}
|
|
@@ -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 _0x2b07=['iterator','nodes','_compareOperations','position','data','_combineNext','InsertOperation','next','_checkOperation','substr','_compareAttributes','_decompressSingleOperation','length','attributes','__className','decompress','_splitCurrent','value','_getCompressorByName','_context','keys'];(function(_0x510abc,_0x2b072c){const _0x5216db=function(_0x272b05){while(--_0x272b05){_0x510abc['push'](_0x510abc['shift']());}};_0x5216db(++_0x2b072c);}(_0x2b07,0x1b8));const _0x5216=function(_0x510abc,_0x2b072c){_0x510abc=_0x510abc-0x0;let _0x5216db=_0x2b07[_0x510abc];return _0x5216db;};import _0x14308e from'./actioncompressor';import{arePositionsEqual as _0x4fc537,getPositionShiftedBy as _0x5ba88f}from'../utils';import{cloneDeep as _0x49e0ed}from'lodash-es';export default class m extends _0x14308e{[_0x5216('0x6')](_0x12e89a,_0x54aa12){return _0x54aa12[_0x5216('0x2')][0x0]['data']+=_0x12e89a['nodes'][0x0][_0x5216('0x5')],_0x54aa12;}[_0x5216('0x11')](_0x1b94d4){const _0x4acfcc=_0x49e0ed(_0x1b94d4),_0x286923=_0x4acfcc[_0x5216('0x2')][0x0],_0x4f52bb=_0x1b94d4[_0x5216('0x2')][0x0],_0x5aa491=_0x4f52bb[_0x5216('0x5')][Symbol[_0x5216('0x1')]]()[_0x5216('0x8')]()[_0x5216('0x12')],_0x2f924a=_0x5aa491[_0x5216('0xd')];return _0x286923[_0x5216('0x5')]=_0x5aa491,_0x4f52bb[_0x5216('0x5')]=_0x4f52bb[_0x5216('0x5')][_0x5216('0xa')](_0x2f924a),_0x1b94d4['position']=_0x5ba88f(_0x1b94d4['position'],_0x2f924a),_0x4acfcc;}[_0x5216('0x3')](_0x2a0310,_0x1f77b0){if(this[_0x5216('0x9')](_0x2a0310)&&this['_checkOperation'](_0x1f77b0)){const _0x5d7aa8=_0x2a0310[_0x5216('0x2')][0x0]['data'][_0x5216('0xd')],_0x3b7bd0=_0x4fc537(_0x5ba88f(_0x2a0310[_0x5216('0x4')],_0x5d7aa8),_0x1f77b0[_0x5216('0x4')]),_0x10fa8c=_0x2a0310[_0x5216('0x2')][0x0],_0x11d782=_0x1f77b0['nodes'][0x0];return _0x3b7bd0&&this[_0x5216('0xb')](_0x10fa8c,_0x11d782);}return!0x1;}['_compressSingleOperation'](_0x4cbab9){const _0xe671c5={'types':[],'buffers':[],'baseVersion':0x0};return this[_0x5216('0x14')][_0x5216('0x13')](_0x5216('0x7'))['compress'](_0xe671c5,[_0x4cbab9]),_0xe671c5['buffers'][0x0];}[_0x5216('0xc')](_0x448ba1){const _0x4a0077=[];return this[_0x5216('0x14')][_0x5216('0x13')]('InsertOperation')[_0x5216('0x10')](_0x4a0077,_0x448ba1),_0x4a0077[0x0];}[_0x5216('0x9')](_0x1e4003){return'InsertOperation'==_0x1e4003[_0x5216('0xf')]&&0x1==_0x1e4003[_0x5216('0x2')]['length']&&_0x1e4003[_0x5216('0x2')][0x0]['data']&&!_0x1e4003['wasUndone']&&0x1==Array['from'](_0x1e4003[_0x5216('0x2')][0x0]['data'])[_0x5216('0xd')];}['_compareAttributes'](_0x225cc8,_0x24d4b3){const _0x1e5694=Object[_0x5216('0x0')](_0x225cc8[_0x5216('0xe')]||{}),_0x88c92d=Object[_0x5216('0x0')](_0x24d4b3[_0x5216('0xe')]||{});return _0x1e5694[_0x5216('0xd')]===_0x88c92d[_0x5216('0xd')]&&_0x1e5694['every'](_0xc15197=>_0x24d4b3[_0x5216('0xe')][_0xc15197]&&_0x24d4b3['attributes'][_0xc15197]===_0x225cc8[_0x5216('0xe')][_0xc15197]);}}
|
|
@@ -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 _0x14c9=['__className','_compareOperations','user:position:','push','compress','start','types','decompress','startsWith','end','buffers','_context','_getCompressorByName','_compressSingleOperation','newRange','_id','_decompressSingleOperation','user:','MarkerOperation','name','shift'];(function(_0x384d6f,_0x14c962){const _0x4fb77a=function(_0x50b4bf){while(--_0x50b4bf){_0x384d6f['push'](_0x384d6f['shift']());}};_0x4fb77a(++_0x14c962);}(_0x14c9,0x150));const _0x4fb7=function(_0x384d6f,_0x14c962){_0x384d6f=_0x384d6f-0x0;let _0x4fb77a=_0x14c9[_0x384d6f];return _0x4fb77a;};import _0x410a6b from'./actioncompressor';import{arePositionsEqual as _0xc2e7e3}from'../utils';import{cloneDeep as _0x44a154}from'lodash-es';export default class f extends _0x410a6b{['compress'](_0x12e121,_0x139a08){if(!this[_0x4fb7('0x1')](_0x139a08[0x0],_0x139a08[0x1]))return!0x1;const _0x2a9dee=_0x139a08[_0x4fb7('0x14')]();return _0x2a9dee['oldRange']=null,_0x2a9dee[_0x4fb7('0xe')]&&_0xc2e7e3(_0x2a9dee[_0x4fb7('0xe')][_0x4fb7('0x5')],_0x2a9dee[_0x4fb7('0xe')][_0x4fb7('0x9')])&&(_0x2a9dee['newRange'][_0x4fb7('0x9')]=null),_0x139a08[_0x4fb7('0x14')](),_0x12e121['types'][_0x4fb7('0x3')](this[_0x4fb7('0xf')]),_0x12e121[_0x4fb7('0x6')][_0x4fb7('0x3')](0x0),_0x12e121[_0x4fb7('0xa')]['push'](this[_0x4fb7('0xd')](_0x2a9dee)),!0x0;}[_0x4fb7('0x7')](_0x168561,_0x4569c9){const _0x338293=this['_decompressSingleOperation'](_0x4569c9);_0x338293[_0x4fb7('0xe')]&&!_0x338293[_0x4fb7('0xe')][_0x4fb7('0x9')]&&(_0x338293[_0x4fb7('0xe')][_0x4fb7('0x9')]=_0x44a154(_0x338293['newRange']['start']));const _0x4fd7b5=_0x44a154(_0x338293);_0x4fd7b5[_0x4fb7('0xe')]&&(_0x4fd7b5['newRange'][_0x4fb7('0x5')]['stickiness']='toNone',_0x4fd7b5[_0x4fb7('0xe')]['end']=_0x44a154(_0x4fd7b5['newRange'][_0x4fb7('0x5')])),_0x4fd7b5[_0x4fb7('0x13')]=_0x4fb7('0x2')+_0x4fd7b5['name']['split'](':')[0x2],_0x4569c9['types'][_0x4fb7('0x14')](),_0x168561[_0x4fb7('0x3')](_0x338293),_0x168561[_0x4fb7('0x3')](_0x4fd7b5);}['_compressSingleOperation'](_0x1bc415){const _0x12cb01={'types':[],'buffers':[],'baseVersion':0x0};return this[_0x4fb7('0xb')][_0x4fb7('0xc')](_0x4fb7('0x12'))[_0x4fb7('0x4')](_0x12cb01,[_0x1bc415]),_0x12cb01[_0x4fb7('0xa')][0x0];}[_0x4fb7('0x10')](_0x577d82){const _0x51b5a9=[];return this[_0x4fb7('0xb')][_0x4fb7('0xc')]('MarkerOperation')[_0x4fb7('0x7')](_0x51b5a9,_0x577d82),_0x51b5a9[0x0];}[_0x4fb7('0x1')](_0x3563ee,_0x43345f){return!(!_0x3563ee||!_0x43345f)&&(_0x4fb7('0x12')==_0x3563ee[_0x4fb7('0x0')]&&'MarkerOperation'==_0x43345f[_0x4fb7('0x0')]&&!(!_0x3563ee[_0x4fb7('0x13')][_0x4fb7('0x8')](_0x4fb7('0x11'))||!_0x43345f['name'][_0x4fb7('0x8')]('user:')||_0x3563ee['name']==_0x43345f['name']));}}
|
|
@@ -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 _0x44d7=['CommentMarkerOperation','_protobufFactory','SplitOperation','getDescriptor','baseVersion','comment','SuggestionMarkerOperation','_registerActionCompressor','_compressorByName','_getCompressorByName','get','_registerOperationCompressor','AttributeOperation','InsertOperation','types','NoOperation','ForwardDeletingAction','set','UserSelectionAction','forEach','_compressorById','RootOperation','MarkerOperation','decompress','MoveOperation','DeletingAction','__className','TypingAction','no-operations-provided','compress','_registerCompressor'];(function(_0x4ddbb1,_0x44d7f7){const _0x3f080e=function(_0x4915a1){while(--_0x4915a1){_0x4ddbb1['push'](_0x4ddbb1['shift']());}};_0x3f080e(++_0x44d7f7);}(_0x44d7,0x1ab));const _0x3f08=function(_0x4ddbb1,_0x44d7f7){_0x4ddbb1=_0x4ddbb1-0x0;let _0x3f080e=_0x44d7[_0x4ddbb1];return _0x3f080e;};import{CKEditorError as _0x4c2a55}from'ckeditor5/src/utils';import _0x53b782 from'./protobuffactory';import _0x451aa7 from'./operationcompressor/operationcompressor';import _0x1a668b from'./operationcompressor/attributeoperationcompressor';import _0x403be3 from'./operationcompressor/insertoperationcompressor';import _0x5be628 from'./operationcompressor/markeroperationcompressor';import _0x2f87b7 from'./operationcompressor/nooperationcompressor';import _0x31a86c from'./operationcompressor/annotationmarkeroperationcompressor';import _0x823004 from'./actioncompressor/typingactioncompressor';import _0x424024 from'./actioncompressor/deletingactioncompressor';import _0x32fcd3 from'./actioncompressor/forwarddeletingactioncompressor';import _0x5d2d37 from'./actioncompressor/userselectionactioncompressor';export default class g{constructor(){this['_compressorById']=new Map(),this[_0x3f08('0xf')]=new Map(),this['_protobufFactory']=new _0x53b782();const _0x476ad5=this[_0x3f08('0x8')][_0x3f08('0xa')]('MarkerOperation');this[_0x3f08('0x6')](0x1,_0x3f08('0x16'),new _0x2f87b7(0x1,'NoOperation',void 0x0)),this[_0x3f08('0x12')](0xa,_0x3f08('0x13'),_0x1a668b),this['_registerOperationCompressor'](0xb,_0x3f08('0x14'),_0x403be3),this[_0x3f08('0x12')](0xc,_0x3f08('0x1d'),_0x5be628),this[_0x3f08('0x12')](0xd,'MergeOperation',_0x451aa7),this['_registerOperationCompressor'](0xe,_0x3f08('0x0'),_0x451aa7),this[_0x3f08('0x12')](0xf,'RenameOperation',_0x451aa7),this[_0x3f08('0x12')](0x10,'RootAttributeOperation',_0x1a668b),this[_0x3f08('0x12')](0x11,_0x3f08('0x9'),_0x451aa7),this[_0x3f08('0x6')](0x12,_0x3f08('0x7'),new _0x31a86c(0x12,_0x3f08('0x1d'),_0x476ad5,_0x3f08('0xc'))),this[_0x3f08('0x6')](0x13,'SuggestionMarkerOperation',new _0x31a86c(0x13,_0x3f08('0x1d'),_0x476ad5,'suggestion')),this[_0x3f08('0x12')](0x14,_0x3f08('0x1c'),_0x451aa7),this['_registerActionCompressor'](0x64,'TypingAction',_0x823004),this[_0x3f08('0xe')](0x65,_0x3f08('0x1'),_0x424024),this[_0x3f08('0xe')](0x66,_0x3f08('0x17'),_0x32fcd3),this['_registerActionCompressor'](0x67,_0x3f08('0x19'),_0x5d2d37);}[_0x3f08('0x5')](_0x658496){if(!_0x658496||!_0x658496[0x0])throw new _0x4c2a55(_0x3f08('0x4'),this);const _0x5a4fe5={'types':[],'buffers':[],'baseVersion':_0x658496[0x0][_0x3f08('0xb')]};for(;_0x658496['length'];)this[_0x3f08('0x10')]('UserSelectionAction')[_0x3f08('0x5')](_0x5a4fe5,_0x658496)||this[_0x3f08('0x10')](_0x3f08('0x3'))[_0x3f08('0x5')](_0x5a4fe5,_0x658496)||this[_0x3f08('0x10')]('DeletingAction')[_0x3f08('0x5')](_0x5a4fe5,_0x658496)||this['_getCompressorByName'](_0x3f08('0x17'))[_0x3f08('0x5')](_0x5a4fe5,_0x658496)||this[_0x3f08('0x10')](_0x3f08('0x7'))[_0x3f08('0x5')](_0x5a4fe5,_0x658496)||this[_0x3f08('0x10')](_0x3f08('0xd'))[_0x3f08('0x5')](_0x5a4fe5,_0x658496)||this['_getCompressorByName'](_0x658496[0x0][_0x3f08('0x2')])['compress'](_0x5a4fe5,_0x658496);return _0x5a4fe5;}[_0x3f08('0x1e')](_0x198b4b){const _0x4685f6=[];for(;_0x198b4b['types']['length'];){this['_compressorById'][_0x3f08('0x11')](_0x198b4b[_0x3f08('0x15')][0x0])['decompress'](_0x4685f6,_0x198b4b);}return _0x4685f6[_0x3f08('0x1a')]((_0x2e6a4e,_0x2ae6bc)=>_0x2e6a4e[_0x3f08('0xb')]=_0x198b4b['baseVersion']+_0x2ae6bc),_0x4685f6;}['_getCompressorByName'](_0x20cfd5){return this['_compressorByName'][_0x3f08('0x11')](_0x20cfd5);}['_registerOperationCompressor'](_0x57c21f,_0x4cc1d1,_0x5230fb){const _0x32acad=new _0x5230fb(_0x57c21f,_0x4cc1d1,this[_0x3f08('0x8')]['getDescriptor'](_0x4cc1d1));this[_0x3f08('0x6')](_0x57c21f,_0x4cc1d1,_0x32acad);}[_0x3f08('0xe')](_0x566558,_0x3bb3af,_0x1993a6){const _0x4c7e81=new _0x1993a6(_0x566558,this);this[_0x3f08('0x6')](_0x566558,_0x3bb3af,_0x4c7e81);}[_0x3f08('0x6')](_0x314c2e,_0x776eb9,_0x3b5ee6){this[_0x3f08('0x1b')][_0x3f08('0x18')](_0x314c2e,_0x3b5ee6),this[_0x3f08('0xf')][_0x3f08('0x18')](_0x776eb9,_0x3b5ee6);}}
|