@modusoperandi/licit 1.1.1 → 1.1.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.
@@ -4,7 +4,6 @@ function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o =
4
4
  function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
5
5
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
6
6
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
- /* eslint-disable */
8
7
  var Reporter = /*#__PURE__*/function () {
9
8
  function Reporter() {
10
9
  _classCallCheck(this, Reporter);
@@ -1,5 +1,3 @@
1
- /* eslint-disable */
2
-
3
1
  class Reporter {
4
2
  constructor() {
5
3
  this.setAt = 0;
package/client/http.js CHANGED
@@ -1,5 +1,4 @@
1
- /* eslint-disable */
2
-
1
+ function _readOnlyError(r) { throw new TypeError('"' + r + '" is read-only'); }
3
2
  // A simple wrapper for XHR.
4
3
  export function req(conf) {
5
4
  var req = new XMLHttpRequest(),
@@ -26,7 +25,7 @@ export function req(conf) {
26
25
  result.abort = function () {
27
26
  if (!aborted) {
28
27
  req.abort();
29
- aborted = true;
28
+ true, _readOnlyError("aborted");
30
29
  }
31
30
  };
32
31
  return result;
@@ -1,18 +1,16 @@
1
- /* eslint-disable */
2
-
3
1
  // A simple wrapper for XHR.
4
2
  export function req(conf) {
5
- let req = new XMLHttpRequest(),
3
+ const req = new XMLHttpRequest(),
6
4
  aborted = false;
7
- let result = new Promise((success, failure) => {
5
+ const result = new Promise((success, failure) => {
8
6
  req.open(conf.method, conf.url, true);
9
7
  req.addEventListener('load', () => {
10
8
  if (aborted) return;
11
9
  if (req.status < 400) {
12
10
  success(req.responseText);
13
11
  } else {
14
- let text = req.responseText;
15
- let err = new Error(
12
+ const text = req.responseText;
13
+ const err = new Error(
16
14
  'Request failed: ' + req.statusText + (text ? '\n\n' + text : '')
17
15
  );
18
16
  err.status = req.status;
@@ -24,7 +22,7 @@ export function req(conf) {
24
22
  if (!aborted) failure(new Error('Network error'));
25
23
  });
26
24
  if (conf.headers)
27
- for (let header in conf.headers)
25
+ for (const header in conf.headers)
28
26
  req.setRequestHeader(header, conf.headers[header]);
29
27
  req.send(conf.body || null);
30
28
  });
@@ -28,7 +28,7 @@ export default function convertFromJSON(json, schema, defaultSchema, effectivePl
28
28
  var doc = null;
29
29
  try {
30
30
  doc = editorSchema.nodeFromJSON(json);
31
- } catch (error) {
31
+ } catch (_unused) {
32
32
  return null;
33
33
  }
34
34
  return EditorState.create({
@@ -27,14 +27,10 @@ export default function convertFromJSON(
27
27
  error = true;
28
28
  }
29
29
 
30
- if(error) {
30
+ if (error) {
31
31
  // [FS] IRAD-1455 2021-06-16
32
32
  // Use the effectivePlugins, editor hangs, b'coz of missing default core plugins
33
- return createEmptyEditorState(
34
- schema,
35
- defaultSchema,
36
- effectivePlugins
37
- );
33
+ return createEmptyEditorState(schema, defaultSchema, effectivePlugins);
38
34
  }
39
35
 
40
36
  // [FS] IRAD-1067 2020-09-19
@@ -43,7 +39,7 @@ export default function convertFromJSON(
43
39
 
44
40
  try {
45
41
  doc = editorSchema.nodeFromJSON(json);
46
- } catch (error) {
42
+ } catch {
47
43
  return null;
48
44
  }
49
45
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modusoperandi/licit",
3
- "version": "1.1.1",
3
+ "version": "1.1.3",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "subversion": "1",
@@ -26,7 +26,6 @@
26
26
  "build:licit": "node utils/build_bin.js",
27
27
  "ci:bom": "cyclonedx-npm --ignore-npm-errors --short-PURLs --output-format XML --output-file dist/bom.xml",
28
28
  "ci:build": "npm run build:clean && npm run build:babel && npm run build:flow && npm run build:css && npm run build:fonts && npm run build:bom && copyfiles --up 1 \"src/**/*.d.ts\" dist/ && copyfiles --up 1 \"src/**/*.css\" dist && copyfiles package.json LICENSE dist",
29
- "flow": "flow --show-all-errors",
30
29
  "lint:css": "stylelint \"**/*.css\"",
31
30
  "lint:js": "eslint \"src/**/*.js\"",
32
31
  "lint": "npm run lint:css & npm run lint:js",
@@ -35,6 +34,21 @@
35
34
  "build:style-service-docker": "docker build . -f style-service.Dockerfile -t style-service:latest",
36
35
  "verify": "npm run lint -- --fix && npm run ci:build && npm run test:coverage && echo 'All Tests Passed!'"
37
36
  },
37
+ "peerDependencies": {
38
+ "@modusoperandi/licit-ui-commands": "^1.0.8",
39
+ "prosemirror-collab": "^1.2.2",
40
+ "prosemirror-tables": "^1.2.5"
41
+ },
42
+ "dependencies": {
43
+ "@modusoperandi/color-picker": "^1.0.4",
44
+ "browserkeymap": "^2.0.2",
45
+ "flatted": "^3.1.0",
46
+ "react-tooltip": "^5.28.0",
47
+ "resize-observer-polyfill": "^1.5.1",
48
+ "smooth-scroll-into-view-if-needed": "^2.0.2",
49
+ "url": "^0.11.0",
50
+ "webfontloader": "^1.6.28"
51
+ },
38
52
  "devDependencies": {
39
53
  "@babel/cli": "^7.19.3",
40
54
  "@babel/core": "^7.19.3",
@@ -68,7 +82,7 @@
68
82
  "copyfiles": "^2.4.1",
69
83
  "cors": "^2.8.5",
70
84
  "css-loader": "^7.1.1",
71
- "eslint": "^8.0.0",
85
+ "eslint": "^9.20.1",
72
86
  "eslint-config-prettier": "^10.0.1",
73
87
  "eslint-plugin-jest": "^28.2.0",
74
88
  "eslint-plugin-prettier": "^5.1.3",
@@ -81,12 +95,12 @@
81
95
  "flow-typed": "^4.0.0",
82
96
  "flow-webpack-plugin": "^1.2.0",
83
97
  "formidable": "^3.5.1",
98
+ "globals": "^16.0.0",
84
99
  "html-loader": "^5.0.0",
85
100
  "html-webpack-inline-source-plugin": "1.0.0-beta.2",
86
101
  "html-webpack-plugin": "^5.5.0",
87
102
  "husky": "^9.0.10",
88
103
  "identity-obj-proxy": "^3.0.0",
89
- "invariant": "^2.2.4",
90
104
  "jest": "^29.2.0",
91
105
  "jest-environment-jsdom": "^29.3.1",
92
106
  "jest-junit": "^16.0.0",
@@ -98,7 +112,7 @@
98
112
  "prettier": "^3.2.5",
99
113
  "style-loader": "^4.0.0",
100
114
  "stylelint": "^16.2.1",
101
- "stylelint-config-standard": "^36.0.0",
115
+ "stylelint-config-standard": "^37.0.0",
102
116
  "stylelint-prettier": "^5.0.0",
103
117
  "terser-webpack-plugin": "^5.3.10",
104
118
  "ts-jest": "^29.1.2",
@@ -110,32 +124,8 @@
110
124
  "webpack-dev-server": "^5.0.2",
111
125
  "write-file-webpack-plugin": "^4.5.1"
112
126
  },
113
- "dependencies": {
114
- "@modusoperandi/color-picker": "^1.0.4",
115
- "body-parser": "^1.19.0",
116
- "browserkeymap": "^2.0.2",
117
- "flatted": "^3.1.0",
118
- "flow-typed": "^4.0.0",
119
- "formidable": "^3.5.1",
120
- "invariant": "^2.2.4",
121
- "jquery": "^3.5.1",
122
- "react-tooltip": "^5.28.0",
123
- "resize-observer-polyfill": "^1.5.1",
124
- "smooth-scroll-into-view-if-needed": "^2.0.2",
125
- "style-loader": "^4.0.0",
126
- "url": "^0.11.0",
127
- "webfontloader": "^1.6.28"
128
- },
129
- "peerDependencies": {
130
- "@modusoperandi/licit-ui-commands": "^1.0.8",
131
- "jquery": "^3.5.1",
132
- "prosemirror-collab": "^1.2.2",
133
- "prosemirror-tables": "^1.2.5"
134
- },
135
127
  "overrides": {
136
- "libxmljs2": "^1.0.0",
137
- "react": "^18.3.1",
138
- "react-dom": "^18.3.1"
128
+ "libxmljs2": "^1.0.0"
139
129
  },
140
130
  "importSort": {
141
131
  ".js": {
package/ui/CommandMenu.js CHANGED
@@ -67,7 +67,7 @@ var CommandMenu = /*#__PURE__*/function (_React$PureComponent) {
67
67
  // [FS] IRAD-1053 2020-10-22
68
68
  // Disable the Clear style menu when no styles applied to a paragraph
69
69
  disabled = !editorView || !command.isEnabled(editorState, editorView, label);
70
- } catch (ex) {
70
+ } catch (_unused) {
71
71
  disabled = false;
72
72
  }
73
73
  children.push(/*#__PURE__*/React.createElement(CustomMenuItem, {
@@ -34,7 +34,7 @@ class CommandMenu extends React.PureComponent<any, any> {
34
34
  // Disable the Clear style menu when no styles applied to a paragraph
35
35
  disabled =
36
36
  !editorView || !command.isEnabled(editorState, editorView, label);
37
- } catch (ex) {
37
+ } catch {
38
38
  disabled = false;
39
39
  }
40
40
  children.push(
@@ -98,7 +98,7 @@ var CommandMenuButton = /*#__PURE__*/function (_React$PureComponent) {
98
98
  var disabledVal = true;
99
99
  try {
100
100
  disabledVal = !editorView || !command.isEnabled(editorState, editorView, label);
101
- } catch (ex) {
101
+ } catch (_unused) {
102
102
  disabledVal = false;
103
103
  }
104
104
  return !disabledVal;
@@ -52,7 +52,7 @@ class CommandMenuButton extends React.PureComponent<any, any> {
52
52
  try {
53
53
  disabledVal =
54
54
  !editorView || !command.isEnabled(editorState, editorView, label);
55
- } catch (ex) {
55
+ } catch {
56
56
  disabledVal = false;
57
57
  }
58
58
  return !disabledVal;
package/ui/LinkTooltip.js CHANGED
@@ -102,6 +102,7 @@ var LinkTooltip = /*#__PURE__*/function (_React$PureComponent) {
102
102
  onRemove = _this$props2.onRemove,
103
103
  tocItemPos_ = _this$props2.tocItemPos_,
104
104
  selectionId_ = _this$props2.selectionId_;
105
+ var canEdit = editorView.editable;
105
106
  // [FS] IRAD-1013 2020-07-09
106
107
  var getLabel = function getLabel() {
107
108
  if (tocItemPos_ && selectionId_) {
@@ -131,11 +132,11 @@ var LinkTooltip = /*#__PURE__*/function (_React$PureComponent) {
131
132
  target: "new",
132
133
  title: label,
133
134
  value: label
134
- }), /*#__PURE__*/React.createElement(CustomButton, {
135
+ }), canEdit && /*#__PURE__*/React.createElement(CustomButton, {
135
136
  label: "Change",
136
137
  onClick: onEdit,
137
138
  value: editorView
138
- }), /*#__PURE__*/React.createElement(CustomButton, {
139
+ }), canEdit && /*#__PURE__*/React.createElement(CustomButton, {
139
140
  label: "Remove",
140
141
  onClick: onRemove,
141
142
  value: editorView
@@ -24,6 +24,7 @@ class LinkTooltip extends React.PureComponent<any, any> {
24
24
  render(): React.Element<any> {
25
25
  const { href, editorView, onEdit, onRemove, tocItemPos_, selectionId_ } =
26
26
  this.props;
27
+ const canEdit = editorView.editable;
27
28
  // [FS] IRAD-1013 2020-07-09
28
29
  const getLabel = () => {
29
30
  if (tocItemPos_ && selectionId_) {
@@ -53,8 +54,16 @@ class LinkTooltip extends React.PureComponent<any, any> {
53
54
  title={label}
54
55
  value={label}
55
56
  />
56
- <CustomButton label="Change" onClick={onEdit} value={editorView} />
57
- <CustomButton label="Remove" onClick={onRemove} value={editorView} />
57
+ {canEdit && (
58
+ <CustomButton label="Change" onClick={onEdit} value={editorView} />
59
+ )}
60
+ {canEdit && (
61
+ <CustomButton
62
+ label="Remove"
63
+ onClick={onRemove}
64
+ value={editorView}
65
+ />
66
+ )}
58
67
  </div>
59
68
  </div>
60
69
  </div>
@@ -100,7 +100,7 @@ var ListTypeButton = /*#__PURE__*/function (_React$PureComponent) {
100
100
  var disabledVal = true;
101
101
  try {
102
102
  disabledVal = false;
103
- } catch (ex) {
103
+ } catch (_unused) {
104
104
  disabledVal = false;
105
105
  }
106
106
  return !disabledVal;
@@ -36,14 +36,8 @@ class ListTypeButton extends React.PureComponent<any, any> {
36
36
  render(): React.Element<any> {
37
37
  // editorState,
38
38
  // editorView,
39
- const {
40
- className,
41
- label,
42
- commandGroups,
43
- icon,
44
- disabled,
45
- title,
46
- } = this.props;
39
+ const { className, label, commandGroups, icon, disabled, title } =
40
+ this.props;
47
41
  const enabled =
48
42
  !disabled &&
49
43
  commandGroups.some((group, ii) => {
@@ -51,7 +45,7 @@ class ListTypeButton extends React.PureComponent<any, any> {
51
45
  let disabledVal = true;
52
46
  try {
53
47
  disabledVal = false;
54
- } catch (ex) {
48
+ } catch {
55
49
  disabledVal = false;
56
50
  }
57
51
  return !disabledVal;
package/ui/czi-editor.css CHANGED
@@ -126,6 +126,9 @@
126
126
  line-height: var(--czi-content-line-height);
127
127
  margin: 0;
128
128
  }
129
+ .prosemirror-editor-wrapper.readOnly a {
130
+ pointer-events: none; /* Disable interaction */
131
+ }
129
132
 
130
133
  .ProseMirror a:link,
131
134
  .ProseMirror a:visited,
package/ui/toCSSColor.js CHANGED
@@ -34,7 +34,7 @@ export function toCSSColor(source) {
34
34
  hex = Color(source).hex().toLowerCase();
35
35
  ColorMaping[source] = hex;
36
36
  } catch (ex) {
37
- console.warn('unable to convert to hex', source);
37
+ console.warn('unable to convert to hex', source, ex);
38
38
  ColorMaping[source] = '';
39
39
  }
40
40
  return hex;
@@ -42,7 +42,7 @@ export function toCSSColor(source: any): string {
42
42
  hex = Color(source).hex().toLowerCase();
43
43
  ColorMaping[source] = hex;
44
44
  } catch (ex) {
45
- console.warn('unable to convert to hex', source);
45
+ console.warn('unable to convert to hex', source, ex);
46
46
  ColorMaping[source] = '';
47
47
  }
48
48
  return hex;
package/ui/toHexColor.js CHANGED
@@ -15,7 +15,7 @@ export default function toHexColor(source) {
15
15
  hex = Color(source).hex().toLowerCase();
16
16
  ColorMaping[source] = hex;
17
17
  } catch (ex) {
18
- console.warn('unable to convert to hex', source);
18
+ console.warn('unable to convert to hex', source, ex);
19
19
  ColorMaping[source] = '';
20
20
  }
21
21
  return hex;
@@ -19,7 +19,7 @@ export default function toHexColor(source: any): string {
19
19
  hex = Color(source).hex().toLowerCase();
20
20
  ColorMaping[source] = hex;
21
21
  } catch (ex) {
22
- console.warn('unable to convert to hex', source);
22
+ console.warn('unable to convert to hex', source, ex);
23
23
  ColorMaping[source] = '';
24
24
  }
25
25
  return hex;