@modusoperandi/licit 1.2.0 → 1.2.2
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/TextColorMarkSpec.js +1 -1
- package/TextColorMarkSpec.js.flow +1 -1
- package/TextHighlightMarkSpec.js +1 -1
- package/TextHighlightMarkSpec.js.flow +1 -1
- package/bom.xml +269 -271
- package/client/Licit.js +8 -0
- package/client/Licit.js.flow +8 -2
- package/convertFromJSON.js +2 -3
- package/convertFromJSON.js.flow +2 -3
- package/package.json +3 -3
- package/ui/CommandMenu.js +0 -1
- package/ui/CommandMenu.js.flow +0 -1
package/client/Licit.js
CHANGED
|
@@ -2,6 +2,8 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2
2
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
3
3
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
4
4
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
5
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
6
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
7
|
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
6
8
|
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
7
9
|
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
@@ -132,7 +134,13 @@ var Licit = /*#__PURE__*/function (_React$Component) {
|
|
|
132
134
|
_this._connector.onEdit(transaction, _this._editorView);
|
|
133
135
|
}
|
|
134
136
|
if (transaction.docChanged) {
|
|
137
|
+
var _docJson$attrs;
|
|
135
138
|
var docJson = transaction.doc.toJSON();
|
|
139
|
+
if (!Object.isFrozen(docJson === null || docJson === void 0 || (_docJson$attrs = docJson.attrs) === null || _docJson$attrs === void 0 ? void 0 : _docJson$attrs.objectMetaData)) {
|
|
140
|
+
docJson.attrs.objectMetaData = _objectSpread(_objectSpread({}, docJson.attrs.objectMetaData), {}, {
|
|
141
|
+
lastEditedOn: new Date().toISOString().replace('Z', '+00:00')
|
|
142
|
+
});
|
|
143
|
+
}
|
|
136
144
|
var isEmpty = false;
|
|
137
145
|
if (docJson.content && docJson.content.length === 1) {
|
|
138
146
|
var _docJson$content, _docJson$content2;
|
package/client/Licit.js.flow
CHANGED
|
@@ -77,7 +77,7 @@ class Licit extends React.Component<any, any> {
|
|
|
77
77
|
this._editorView = null;
|
|
78
78
|
this._skipSCU = true;
|
|
79
79
|
|
|
80
|
-
const noop = function () {};
|
|
80
|
+
const noop = function () { };
|
|
81
81
|
|
|
82
82
|
// [FS] IRAD-981 2020-06-10
|
|
83
83
|
// Component's configurations.
|
|
@@ -510,8 +510,14 @@ class Licit extends React.Component<any, any> {
|
|
|
510
510
|
|
|
511
511
|
if (transaction.docChanged) {
|
|
512
512
|
const docJson = transaction.doc.toJSON();
|
|
513
|
-
|
|
513
|
+
if (!Object.isFrozen(docJson?.attrs?.objectMetaData)) {
|
|
514
|
+
docJson.attrs.objectMetaData = {
|
|
515
|
+
...docJson.attrs.objectMetaData,
|
|
516
|
+
lastEditedOn: new Date().toISOString().replace('Z', '+00:00')
|
|
517
|
+
};
|
|
514
518
|
|
|
519
|
+
}
|
|
520
|
+
let isEmpty = false;
|
|
515
521
|
if (docJson.content && docJson.content.length === 1) {
|
|
516
522
|
if (
|
|
517
523
|
!docJson.content[0].content ||
|
package/convertFromJSON.js
CHANGED
|
@@ -18,12 +18,10 @@ export default function convertFromJSON(json, schema, defaultSchema, effectivePl
|
|
|
18
18
|
error = true;
|
|
19
19
|
}
|
|
20
20
|
if (error) {
|
|
21
|
-
// [FS] IRAD-1455 2021-06-16
|
|
22
21
|
// Use the effectivePlugins, editor hangs, b'coz of missing default core plugins
|
|
23
22
|
return createEmptyEditorState(schema, defaultSchema, effectivePlugins);
|
|
24
23
|
}
|
|
25
24
|
|
|
26
|
-
// [FS] IRAD-1067 2020-09-19
|
|
27
25
|
// Handle gracefully when error thrown on invalid json
|
|
28
26
|
var doc = null;
|
|
29
27
|
try {
|
|
@@ -33,7 +31,8 @@ export default function convertFromJSON(json, schema, defaultSchema, effectivePl
|
|
|
33
31
|
}];
|
|
34
32
|
}
|
|
35
33
|
doc = editorSchema.nodeFromJSON(json);
|
|
36
|
-
} catch (
|
|
34
|
+
} catch (error) {
|
|
35
|
+
console.error('Failed to convert JSON to valid ProseMirror: ', error);
|
|
37
36
|
return null;
|
|
38
37
|
}
|
|
39
38
|
return EditorState.create({
|
package/convertFromJSON.js.flow
CHANGED
|
@@ -28,12 +28,10 @@ export default function convertFromJSON(
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
if (error) {
|
|
31
|
-
// [FS] IRAD-1455 2021-06-16
|
|
32
31
|
// Use the effectivePlugins, editor hangs, b'coz of missing default core plugins
|
|
33
32
|
return createEmptyEditorState(schema, defaultSchema, effectivePlugins);
|
|
34
33
|
}
|
|
35
34
|
|
|
36
|
-
// [FS] IRAD-1067 2020-09-19
|
|
37
35
|
// Handle gracefully when error thrown on invalid json
|
|
38
36
|
let doc = null;
|
|
39
37
|
|
|
@@ -42,7 +40,8 @@ export default function convertFromJSON(
|
|
|
42
40
|
json.content = [{ type: 'paragraph' }];
|
|
43
41
|
}
|
|
44
42
|
doc = editorSchema.nodeFromJSON(json);
|
|
45
|
-
} catch {
|
|
43
|
+
} catch (error) {
|
|
44
|
+
console.error('Failed to convert JSON to valid ProseMirror: ', error);
|
|
46
45
|
return null;
|
|
47
46
|
}
|
|
48
47
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@modusoperandi/licit",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"subversion": "1",
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
"exports-loader": "^5.0.0",
|
|
91
91
|
"express": "^5.1.0",
|
|
92
92
|
"file-loader": "^6.2.0",
|
|
93
|
-
"flow-bin": "^0.
|
|
93
|
+
"flow-bin": "^0.268.0",
|
|
94
94
|
"flow-copy-source": "^2.0.9",
|
|
95
95
|
"flow-typed": "^4.0.0",
|
|
96
96
|
"flow-webpack-plugin": "^1.2.0",
|
|
@@ -118,7 +118,7 @@
|
|
|
118
118
|
"ts-jest": "^29.1.2",
|
|
119
119
|
"ts-loader": "^9.5.0",
|
|
120
120
|
"ts-node": "^10.9.2",
|
|
121
|
-
"typescript": "5.
|
|
121
|
+
"typescript": "5.8.3",
|
|
122
122
|
"webpack": "^5.74.0",
|
|
123
123
|
"webpack-cli": "^6.0.1",
|
|
124
124
|
"webpack-dev-server": "^5.0.2",
|
package/ui/CommandMenu.js
CHANGED
|
@@ -64,7 +64,6 @@ var CommandMenu = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
64
64
|
var command = group[label];
|
|
65
65
|
var disabled = true;
|
|
66
66
|
try {
|
|
67
|
-
// [FS] IRAD-1053 2020-10-22
|
|
68
67
|
// Disable the Clear style menu when no styles applied to a paragraph
|
|
69
68
|
disabled = !editorView || !command.isEnabled(editorState, editorView, label);
|
|
70
69
|
} catch (_unused) {
|
package/ui/CommandMenu.js.flow
CHANGED
|
@@ -30,7 +30,6 @@ class CommandMenu extends React.PureComponent<any, any> {
|
|
|
30
30
|
const command = group[label];
|
|
31
31
|
let disabled = true;
|
|
32
32
|
try {
|
|
33
|
-
// [FS] IRAD-1053 2020-10-22
|
|
34
33
|
// Disable the Clear style menu when no styles applied to a paragraph
|
|
35
34
|
disabled =
|
|
36
35
|
!editorView || !command.isEnabled(editorState, editorView, label);
|