@modusoperandi/licit 0.1.10 → 0.13.1
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/dist/bom.xml +1947 -6573
- package/dist/client/Licit.js +12 -23
- package/dist/client/Licit.js.flow +41 -57
- package/dist/client/Licit.test.js +13 -14
- package/dist/client/Licit.test.js.flow +10 -12
- package/dist/coverage/lcov-report/block-navigation.js +82 -0
- package/dist/coverage/lcov-report/block-navigation.js.flow +87 -0
- package/dist/coverage/lcov-report/prettify.js +994 -0
- package/dist/coverage/lcov-report/prettify.js.flow +2 -0
- package/dist/coverage/lcov-report/sorter.js +211 -0
- package/dist/coverage/lcov-report/sorter.js.flow +196 -0
- package/dist/createEmptyEditorState.js +6 -3
- package/dist/createEmptyEditorState.js.flow +8 -2
- package/dist/ui/Editor.js +1 -0
- package/dist/ui/Editor.js.flow +2 -1
- package/package.json +9 -11
- package/src/client/Licit.js +41 -57
- package/src/client/Licit.test.js +10 -12
- package/src/createEmptyEditorState.js +8 -2
- package/src/ui/Editor.js +2 -1
- package/utils/build_customstyle_server.js +0 -2
- package/utils/build_image_server.js +0 -2
- package/utils/build_licit_collab_server.js +0 -2
- package/webpack.config.js +11 -17
package/src/client/Licit.js
CHANGED
|
@@ -73,7 +73,7 @@ class Licit extends React.Component<any, any> {
|
|
|
73
73
|
this._editorView = null;
|
|
74
74
|
this._skipSCU = true;
|
|
75
75
|
|
|
76
|
-
const noop = function () {
|
|
76
|
+
const noop = function () {};
|
|
77
77
|
|
|
78
78
|
// [FS] IRAD-981 2020-06-10
|
|
79
79
|
// Component's configurations.
|
|
@@ -132,17 +132,17 @@ class Licit extends React.Component<any, any> {
|
|
|
132
132
|
const setState = this.setState.bind(this);
|
|
133
133
|
this._connector = collaborative
|
|
134
134
|
? new CollabConnector(
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
135
|
+
editorState,
|
|
136
|
+
setState,
|
|
137
|
+
{
|
|
138
|
+
docID,
|
|
139
|
+
collabServiceURL,
|
|
140
|
+
},
|
|
141
|
+
this._defaultEditorSchema,
|
|
142
|
+
this._defaultEditorPlugins,
|
|
143
|
+
// [FS] IRAD-1578 2021-09-27
|
|
144
|
+
this.onReady.bind(this)
|
|
145
|
+
)
|
|
146
146
|
: new SimpleConnector(editorState, setState);
|
|
147
147
|
|
|
148
148
|
// FS IRAD-989 2020-18-06
|
|
@@ -265,7 +265,7 @@ class Licit extends React.Component<any, any> {
|
|
|
265
265
|
|
|
266
266
|
setContent = (content: any = {}): void => {
|
|
267
267
|
// [FS] IRAD-1571 2021-09-27
|
|
268
|
-
// dispatch a transaction that MUST start from the view�s current state;
|
|
268
|
+
// dispatch a transaction that MUST start from the view�s current state;
|
|
269
269
|
const editorState = this._editorView.state;
|
|
270
270
|
const { doc, schema } = editorState;
|
|
271
271
|
let { tr } = editorState;
|
|
@@ -278,8 +278,8 @@ class Licit extends React.Component<any, any> {
|
|
|
278
278
|
// set the value for object metadata and objectId
|
|
279
279
|
tr = this.isNodeHasAttribute(document, ATTR_OBJMETADATA)
|
|
280
280
|
? tr.step(
|
|
281
|
-
|
|
282
|
-
|
|
281
|
+
new SetDocAttrStep(ATTR_OBJMETADATA, document.attrs.objectMetaData)
|
|
282
|
+
)
|
|
283
283
|
: tr;
|
|
284
284
|
tr = this.isNodeHasAttribute(document, ATTR_OBJID)
|
|
285
285
|
? tr.step(new SetDocAttrStep(ATTR_OBJID, document.attrs.objectId))
|
|
@@ -296,7 +296,7 @@ class Licit extends React.Component<any, any> {
|
|
|
296
296
|
let dataChanged = false;
|
|
297
297
|
|
|
298
298
|
// [FS] IRAD-1571 2021-09-27
|
|
299
|
-
// dispatch a transaction that MUST start from the view�s current state;
|
|
299
|
+
// dispatch a transaction that MUST start from the view�s current state;
|
|
300
300
|
// [FS] IRAD-1589 2021-10-04
|
|
301
301
|
// Do a proper circular JSON comparison.
|
|
302
302
|
if (stringify(this.state.data) !== stringify(nextState.data)) {
|
|
@@ -323,17 +323,17 @@ class Licit extends React.Component<any, any> {
|
|
|
323
323
|
// create new connector
|
|
324
324
|
this._connector = collabEditing
|
|
325
325
|
? new CollabConnector(
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
326
|
+
editorState,
|
|
327
|
+
setState,
|
|
328
|
+
{
|
|
329
|
+
docID,
|
|
330
|
+
collabServiceURL,
|
|
331
|
+
},
|
|
332
|
+
this._defaultEditorSchema,
|
|
333
|
+
this._defaultEditorPlugins,
|
|
334
|
+
// [FS] IRAD-1578 2021-09-27
|
|
335
|
+
this.onReady.bind(this)
|
|
336
|
+
)
|
|
337
337
|
: new SimpleConnector(editorState, setState);
|
|
338
338
|
}
|
|
339
339
|
}
|
|
@@ -401,7 +401,18 @@ class Licit extends React.Component<any, any> {
|
|
|
401
401
|
|
|
402
402
|
if (transaction.docChanged) {
|
|
403
403
|
const docJson = transaction.doc.toJSON();
|
|
404
|
-
|
|
404
|
+
let isEmpty = false;
|
|
405
|
+
|
|
406
|
+
if (docJson.content && docJson.content.length === 1) {
|
|
407
|
+
if (
|
|
408
|
+
!docJson.content[0].content ||
|
|
409
|
+
(docJson.content[0].content &&
|
|
410
|
+
docJson.content[0].content[0].text &&
|
|
411
|
+
'' === docJson.content[0].content[0].text.trim())
|
|
412
|
+
) {
|
|
413
|
+
isEmpty = true;
|
|
414
|
+
}
|
|
415
|
+
}
|
|
405
416
|
|
|
406
417
|
// setCFlags is/was always the opposite of isEmpty.
|
|
407
418
|
if (isEmpty) {
|
|
@@ -419,27 +430,6 @@ class Licit extends React.Component<any, any> {
|
|
|
419
430
|
}
|
|
420
431
|
}
|
|
421
432
|
};
|
|
422
|
-
|
|
423
|
-
isDocEmpty(docJson: Object) {
|
|
424
|
-
let isEmpty = false;
|
|
425
|
-
|
|
426
|
-
if (docJson.content && docJson.content.length === 1) {
|
|
427
|
-
if (
|
|
428
|
-
!docJson.content[0].content ||
|
|
429
|
-
(docJson.content[0].content &&
|
|
430
|
-
// [FS] IRAD-1710 2022-03-04
|
|
431
|
-
// Empty if no content OR when the one & only text content is empty.
|
|
432
|
-
1 === docJson.content[0].content.length &&
|
|
433
|
-
'text' === docJson.content[0].content[0].type &&
|
|
434
|
-
docJson.content[0].content[0].text &&
|
|
435
|
-
'' === docJson.content[0].content[0].text)
|
|
436
|
-
) {
|
|
437
|
-
isEmpty = true;
|
|
438
|
-
}
|
|
439
|
-
}
|
|
440
|
-
return isEmpty;
|
|
441
|
-
}
|
|
442
|
-
|
|
443
433
|
// [FS] IRAD-1173 2021-02-25
|
|
444
434
|
// Bug fix: Transaction mismatch error when a dialog is opened and keep typing.
|
|
445
435
|
closeOpenedPopupModels() {
|
|
@@ -456,14 +446,8 @@ class Licit extends React.Component<any, any> {
|
|
|
456
446
|
this._editorView = editorView;
|
|
457
447
|
const tr = state.tr;
|
|
458
448
|
const doc = state.doc;
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
if (!this.isDocEmpty(doc.toJSON())) {
|
|
462
|
-
const trx = tr.setSelection(
|
|
463
|
-
TextSelection.create(doc, 0, doc.content.size)
|
|
464
|
-
);
|
|
465
|
-
dispatch(trx.scrollIntoView());
|
|
466
|
-
}
|
|
449
|
+
const trx = tr.setSelection(TextSelection.create(doc, 0, doc.content.size));
|
|
450
|
+
dispatch(trx.scrollIntoView());
|
|
467
451
|
|
|
468
452
|
// [FS] IRAD-1578 2021-09-27
|
|
469
453
|
// In collab mode, fire onRead only after getting the response from collab server.
|
package/src/client/Licit.test.js
CHANGED
|
@@ -16,17 +16,6 @@ describe('<Licit />', () => {
|
|
|
16
16
|
let wrapper;
|
|
17
17
|
let licit;
|
|
18
18
|
|
|
19
|
-
// provide an empty document just to shut up that warning
|
|
20
|
-
const data = {
|
|
21
|
-
type: 'doc',
|
|
22
|
-
content: [
|
|
23
|
-
{
|
|
24
|
-
type: 'paragraph',
|
|
25
|
-
content: [{ type: 'text', text: ' ' }],
|
|
26
|
-
},
|
|
27
|
-
],
|
|
28
|
-
};
|
|
29
|
-
|
|
30
19
|
// Mocking the functions used in _onReady
|
|
31
20
|
const fakeEditorView = {
|
|
32
21
|
focus: noop,
|
|
@@ -35,7 +24,6 @@ describe('<Licit />', () => {
|
|
|
35
24
|
doc: {
|
|
36
25
|
content: { size: 10 },
|
|
37
26
|
resolve: () => ({ min: () => 0, max: () => 10 }),
|
|
38
|
-
toJSON: () => data,
|
|
39
27
|
},
|
|
40
28
|
tr: {
|
|
41
29
|
setSelection: () => fakeEditorView.state.tr,
|
|
@@ -45,6 +33,16 @@ describe('<Licit />', () => {
|
|
|
45
33
|
};
|
|
46
34
|
|
|
47
35
|
beforeEach(() => {
|
|
36
|
+
// provide an empty document just to shut up that warning
|
|
37
|
+
const data = {
|
|
38
|
+
type: 'doc',
|
|
39
|
+
content: [
|
|
40
|
+
{
|
|
41
|
+
type: 'paragraph',
|
|
42
|
+
content: [{ type: 'text', text: ' ' }],
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
};
|
|
48
46
|
wrapper = shallow(<Licit data={data} />);
|
|
49
47
|
licit = wrapper.instance();
|
|
50
48
|
});
|
|
@@ -12,8 +12,14 @@ export const EMPTY_DOC_JSON = {
|
|
|
12
12
|
type: 'doc',
|
|
13
13
|
content: [
|
|
14
14
|
{
|
|
15
|
-
type: 'paragraph'
|
|
16
|
-
|
|
15
|
+
type: 'paragraph',
|
|
16
|
+
content: [
|
|
17
|
+
{
|
|
18
|
+
type: 'text',
|
|
19
|
+
text: ' ',
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
},
|
|
17
23
|
],
|
|
18
24
|
};
|
|
19
25
|
|
package/src/ui/Editor.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @flow
|
|
2
2
|
|
|
3
3
|
import cx from 'classnames';
|
|
4
|
-
import { Schema } from 'prosemirror-model';
|
|
4
|
+
import { DOMSerializer, Schema } from 'prosemirror-model';
|
|
5
5
|
import { EditorState, Transaction } from 'prosemirror-state';
|
|
6
6
|
import { Transform } from 'prosemirror-transform';
|
|
7
7
|
import { EditorView } from 'prosemirror-view';
|
|
@@ -158,6 +158,7 @@ class Editor extends React.PureComponent<any, any> {
|
|
|
158
158
|
|
|
159
159
|
// Reference: http://prosemirror.net/examples/basic/
|
|
160
160
|
const view = (this._editorView = new CustomEditorView(editorNode, {
|
|
161
|
+
clipboardSerializer: DOMSerializer.fromSchema(schema),
|
|
161
162
|
dispatchTransaction,
|
|
162
163
|
editable: this._isEditable,
|
|
163
164
|
nodeViews: boundNodeViews,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
const webpack = require('webpack');
|
|
2
2
|
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
|
|
3
3
|
const FlowWebpackPlugin = require('flow-webpack-plugin');
|
|
4
|
-
const WriteFilePlugin = require('write-file-webpack-plugin');
|
|
5
4
|
const env = require('./env');
|
|
6
5
|
const path = require('path');
|
|
7
6
|
|
|
@@ -53,7 +52,6 @@ const config = {
|
|
|
53
52
|
new webpack.DefinePlugin({
|
|
54
53
|
'process.env.NODE_ENV': JSON.stringify(env.NODE_ENV)
|
|
55
54
|
}),
|
|
56
|
-
new WriteFilePlugin(),
|
|
57
55
|
],
|
|
58
56
|
// to enable debug
|
|
59
57
|
//devtool: 'source-map'
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
const webpack = require('webpack');
|
|
2
2
|
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
|
|
3
3
|
const FlowWebpackPlugin = require('flow-webpack-plugin');
|
|
4
|
-
const WriteFilePlugin = require('write-file-webpack-plugin');
|
|
5
4
|
const env = require('./env');
|
|
6
5
|
const path = require('path');
|
|
7
6
|
|
|
@@ -53,7 +52,6 @@ const config = {
|
|
|
53
52
|
new webpack.DefinePlugin({
|
|
54
53
|
'process.env.NODE_ENV': JSON.stringify(env.NODE_ENV)
|
|
55
54
|
}),
|
|
56
|
-
new WriteFilePlugin(),
|
|
57
55
|
],
|
|
58
56
|
// to enable debug
|
|
59
57
|
//devtool: 'source-map'
|
|
@@ -3,7 +3,6 @@ const webpack = require('webpack');
|
|
|
3
3
|
// Upgrade outdated packages.
|
|
4
4
|
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
|
|
5
5
|
const FlowWebpackPlugin = require('flow-webpack-plugin');
|
|
6
|
-
const WriteFilePlugin = require('write-file-webpack-plugin');
|
|
7
6
|
const env = require('./env');
|
|
8
7
|
const path = require('path');
|
|
9
8
|
|
|
@@ -56,7 +55,6 @@ const config = {
|
|
|
56
55
|
new webpack.DefinePlugin({
|
|
57
56
|
'process.env.NODE_ENV': JSON.stringify(env.NODE_ENV)
|
|
58
57
|
}),
|
|
59
|
-
new WriteFilePlugin(),
|
|
60
58
|
],
|
|
61
59
|
// to enable debug
|
|
62
60
|
//devtool: 'source-map'
|
package/webpack.config.js
CHANGED
|
@@ -3,11 +3,10 @@
|
|
|
3
3
|
var webpack = require('webpack'),
|
|
4
4
|
CopyWebpackPlugin = require('copy-webpack-plugin'),
|
|
5
5
|
FlowWebpackPlugin = require('flow-webpack-plugin'),
|
|
6
|
-
HtmlWebpackInlineSourcePlugin = require('html-webpack-inline-source-plugin'),
|
|
7
6
|
HtmlWebpackPlugin = require('html-webpack-plugin'),
|
|
8
7
|
TerserPlugin = require('terser-webpack-plugin'),
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
|
|
9
|
+
|
|
11
10
|
env = require('./utils/env'),
|
|
12
11
|
fileSystem = require('fs'),
|
|
13
12
|
path = require('path');
|
|
@@ -57,15 +56,8 @@ var options = {
|
|
|
57
56
|
},
|
|
58
57
|
{
|
|
59
58
|
test: /\.(woff(2)?|ttf|otf|eot|svg)(\?v=\d+\.\d+\.\d+)?$/,
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
loader: 'file-loader',
|
|
63
|
-
options: {
|
|
64
|
-
name: '[name].[ext]',
|
|
65
|
-
outputPath: 'fonts/'
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
]
|
|
59
|
+
type: 'asset/resource',
|
|
60
|
+
|
|
69
61
|
},
|
|
70
62
|
{
|
|
71
63
|
test: /\.css$/,
|
|
@@ -75,8 +67,9 @@ var options = {
|
|
|
75
67
|
],
|
|
76
68
|
},
|
|
77
69
|
{
|
|
78
|
-
test: /\.(jpe?g|png|gif|svg)$/i,
|
|
79
|
-
|
|
70
|
+
test: /\.(jpe?g|png|gif|svg)$/i,
|
|
71
|
+
type: 'asset/resource',
|
|
72
|
+
|
|
80
73
|
},
|
|
81
74
|
{
|
|
82
75
|
test: /\.html$/,
|
|
@@ -86,7 +79,10 @@ var options = {
|
|
|
86
79
|
]
|
|
87
80
|
},
|
|
88
81
|
resolve: {
|
|
89
|
-
alias: {}
|
|
82
|
+
alias: {},
|
|
83
|
+
fallback: {
|
|
84
|
+
url: require.resolve("url/")
|
|
85
|
+
}
|
|
90
86
|
},
|
|
91
87
|
plugins: [
|
|
92
88
|
new webpack.ProvidePlugin({
|
|
@@ -107,8 +103,6 @@ var options = {
|
|
|
107
103
|
chunks: ['licit'],
|
|
108
104
|
inlineSource: isDev ? '$^' : '.(js|css)$'
|
|
109
105
|
}),
|
|
110
|
-
new HtmlWebpackInlineSourcePlugin(HtmlWebpackPlugin),
|
|
111
|
-
new WriteFilePlugin()
|
|
112
106
|
]
|
|
113
107
|
};
|
|
114
108
|
|