@modusoperandi/licit 1.4.9 → 1.5.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/client/Licit.js CHANGED
@@ -1,6 +1,10 @@
1
1
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
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
+ function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
4
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
5
  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; } }
6
+ function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
7
+ function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
4
8
  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
9
  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
10
  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; }
@@ -359,7 +363,7 @@ var Licit = /*#__PURE__*/function (_React$Component) {
359
363
  }, {
360
364
  key: "getEffectivePlugins",
361
365
  value: function getEffectivePlugins(schema, defaultPlugins, plugins) {
362
- var effectivePlugins = defaultPlugins;
366
+ var effectivePlugins = _toConsumableArray(defaultPlugins);
363
367
  var pasteJSONPlugin = null;
364
368
  if (plugins) {
365
369
  var _iterator = _createForOfIteratorHelper(plugins),
@@ -373,7 +377,12 @@ var Licit = /*#__PURE__*/function (_React$Component) {
373
377
  schema = p.getEffectiveSchema(schema);
374
378
  }
375
379
  if (p.initKeyCommands) {
376
- effectivePlugins.push(p.initKeyCommands());
380
+ var keyCommandPlugins = p.initKeyCommands();
381
+ if (Array.isArray(keyCommandPlugins)) {
382
+ effectivePlugins.push.apply(effectivePlugins, _toConsumableArray(keyCommandPlugins));
383
+ } else if (keyCommandPlugins) {
384
+ effectivePlugins.push(keyCommandPlugins);
385
+ }
377
386
  }
378
387
  if (p.insert) {
379
388
  pasteJSONPlugin = p;
@@ -204,35 +204,42 @@ class Licit extends React.Component<any, any> {
204
204
  return editorState;
205
205
  }
206
206
 
207
- getEffectivePlugins(
208
- schema: Schema,
209
- defaultPlugins: Array<Plugin>,
210
- plugins: Array<Plugin>
211
- ): { plugins: Array<Plugin>, schema: Schema, pasteJSONPlugin: Plugin } {
212
- const effectivePlugins = defaultPlugins;
213
- let pasteJSONPlugin = null;
214
-
215
- if (plugins) {
216
- for (const p of plugins) {
217
- if (!effectivePlugins.includes(p)) {
218
- effectivePlugins.push(p);
219
- if (p.getEffectiveSchema) {
220
- schema = p.getEffectiveSchema(schema);
221
- }
207
+ getEffectivePlugins(
208
+ schema: Schema,
209
+ defaultPlugins: Array<Plugin>,
210
+ plugins: Array<Plugin>
211
+ ): { plugins: Array<Plugin>; schema: Schema; pasteJSONPlugin: Plugin | null } {
212
+ const effectivePlugins = [...defaultPlugins];
213
+ let pasteJSONPlugin: Plugin | null = null;
214
+
215
+ if (plugins) {
216
+ for (const p of plugins) {
217
+ if (!effectivePlugins.includes(p)) {
218
+ effectivePlugins.push(p);
219
+
220
+ if (p.getEffectiveSchema) {
221
+ schema = p.getEffectiveSchema(schema);
222
+ }
222
223
 
223
- if (p.initKeyCommands) {
224
- effectivePlugins.push(p.initKeyCommands());
224
+ if (p.initKeyCommands) {
225
+ const keyCommandPlugins = p.initKeyCommands();
226
+ if (Array.isArray(keyCommandPlugins)) {
227
+ effectivePlugins.push(...keyCommandPlugins);
228
+ } else if (keyCommandPlugins) {
229
+ effectivePlugins.push(keyCommandPlugins);
225
230
  }
231
+ }
226
232
 
227
- if (p.insert) {
228
- pasteJSONPlugin = p;
229
- }
233
+ if (p.insert) {
234
+ pasteJSONPlugin = p;
230
235
  }
231
236
  }
232
237
  }
233
- return { plugins: effectivePlugins, schema, pasteJSONPlugin };
234
238
  }
235
239
 
240
+ return { plugins: effectivePlugins, schema, pasteJSONPlugin };
241
+ }
242
+
236
243
  // [FS] IRAD-1578 2021-09-27
237
244
  onReady(state: EditorState) {
238
245
  const collabEditing = this.state.docID !== '';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modusoperandi/licit",
3
- "version": "1.4.9",
3
+ "version": "1.5.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "subversion": "1",
@@ -76,29 +76,29 @@
76
76
  "babel-loader": "^10.0.0",
77
77
  "babel-plugin-flow-react-proptypes": "^26.0.0",
78
78
  "babel-plugin-transform-react-remove-prop-types": "^0.4.24",
79
- "body-parser": "^2.2.0",
79
+ "body-parser": "^2.2.1",
80
80
  "clean-webpack-plugin": "^4.0.0",
81
81
  "copy-webpack-plugin": "^13.0.1",
82
82
  "copyfiles": "^2.4.1",
83
83
  "cors": "^2.8.5",
84
84
  "css-loader": "^7.1.2",
85
- "eslint": "^9.38.0",
85
+ "eslint": "^9.39.2",
86
86
  "eslint-config-prettier": "^10.1.8",
87
- "eslint-plugin-jest": "^29.0.1",
87
+ "eslint-plugin-jest": "^29.12.0",
88
88
  "eslint-plugin-prettier": "^5.5.4",
89
89
  "eslint-plugin-react": "^7.37.5",
90
90
  "exports-loader": "^5.0.0",
91
- "express": "^5.1.0",
91
+ "express": "^5.2.1",
92
92
  "file-loader": "^6.2.0",
93
- "flow-bin": "^0.287.0",
93
+ "flow-bin": "^0.295.0",
94
94
  "flow-copy-source": "^2.0.9",
95
95
  "flow-typed": "^4.1.1",
96
96
  "flow-webpack-plugin": "^1.2.0",
97
97
  "formidable": "^3.5.4",
98
- "globals": "^16.4.0",
98
+ "globals": "^16.5.0",
99
99
  "html-loader": "^5.1.0",
100
100
  "html-webpack-inline-source-plugin": "1.0.0-beta.2",
101
- "html-webpack-plugin": "^5.6.4",
101
+ "html-webpack-plugin": "^5.6.5",
102
102
  "husky": "^9.1.7",
103
103
  "identity-obj-proxy": "^3.0.0",
104
104
  "jest": "^29.7.0",
@@ -106,20 +106,20 @@
106
106
  "jest-junit": "^16.0.0",
107
107
  "jest-prosemirror": "^3.0.1",
108
108
  "jest-sonar-reporter": "^2.0.0",
109
- "lint-staged": "^16.2.6",
109
+ "lint-staged": "^16.2.7",
110
110
  "mkdirp": "^3.0.1",
111
111
  "mv": "^2.1.1",
112
- "prettier": "^3.6.2",
112
+ "prettier": "^3.7.4",
113
113
  "style-loader": "^4.0.0",
114
- "stylelint": "^16.25.0",
114
+ "stylelint": "^16.26.1",
115
115
  "stylelint-config-standard": "^39.0.1",
116
116
  "stylelint-prettier": "^5.0.3",
117
- "terser-webpack-plugin": "^5.3.14",
118
- "ts-jest": "^29.4.5",
117
+ "terser-webpack-plugin": "^5.3.16",
118
+ "ts-jest": "^29.4.6",
119
119
  "ts-loader": "^9.5.4",
120
120
  "ts-node": "^10.9.2",
121
121
  "typescript": "5.9.3",
122
- "webpack": "^5.102.1",
122
+ "webpack": "^5.104.1",
123
123
  "webpack-cli": "^6.0.1",
124
124
  "webpack-dev-server": "^5.2.2",
125
125
  "write-file-webpack-plugin": "^4.5.1"
@@ -6,7 +6,7 @@
6
6
  import convertToCSSPTValue from './convertToCSSPTValue.js';
7
7
  export function toClosestFontPtSize(styleValue) {
8
8
  // duplicated FONT_PT_SIZES(available in ./ui/FontSizeCommandMenuButton)
9
- var FONT_PT_SIZES = [8, 9, 10, 11, 12, 14, 18, 24, 30, 36, 48, 60, 72, 90];
9
+ var FONT_PT_SIZES = [6, 6.5, 7, 8, 9, 10, 11, 12, 14, 16, 18, 20, 22, 24, 30, 36, 48, 60, 72, 90];
10
10
  var originalPTValue = convertToCSSPTValue(styleValue);
11
11
  if (FONT_PT_SIZES.includes(originalPTValue)) {
12
12
  return originalPTValue;
@@ -7,7 +7,26 @@ import convertToCSSPTValue from './convertToCSSPTValue.js';
7
7
 
8
8
  export function toClosestFontPtSize(styleValue: string): number {
9
9
  // duplicated FONT_PT_SIZES(available in ./ui/FontSizeCommandMenuButton)
10
- const FONT_PT_SIZES = [8, 9, 10, 11, 12, 14, 18, 24, 30, 36, 48, 60, 72, 90];
10
+ const FONT_PT_SIZES = [6,
11
+ 6.5,
12
+ 7,
13
+ 8,
14
+ 9,
15
+ 10,
16
+ 11,
17
+ 12,
18
+ 14,
19
+ 16,
20
+ 18,
21
+ 20,
22
+ 22,
23
+ 24,
24
+ 30,
25
+ 36,
26
+ 48,
27
+ 60,
28
+ 72,
29
+ 90,];
11
30
  const originalPTValue = convertToCSSPTValue(styleValue);
12
31
 
13
32
  if (FONT_PT_SIZES.includes(originalPTValue)) {
@@ -19,7 +19,7 @@ import * as React from 'react';
19
19
  import { FontSizeCommand } from '@modusoperandi/licit-ui-commands';
20
20
  import CommandMenuButton from './CommandMenuButton.js';
21
21
  import findActiveFontSize from './findActiveFontSize.js';
22
- export var FONT_PT_SIZES = [8, 9, 10, 11, 12, 14, 18, 24, 30, 36, 48, 60, 72, 90];
22
+ export var FONT_PT_SIZES = [6, 6.5, 7, 8, 9, 10, 11, 12, 14, 16, 18, 20, 22, 24, 30, 36, 48, 60, 72, 90];
23
23
  var FONT_PT_SIZE_COMMANDS = FONT_PT_SIZES.reduce(function (memo, size) {
24
24
  memo[" ".concat(size, " ")] = new FontSizeCommand(size);
25
25
  return memo;
@@ -5,18 +5,24 @@ import { Transform } from 'prosemirror-transform';
5
5
  import { EditorView } from 'prosemirror-view';
6
6
  import * as React from 'react';
7
7
 
8
- import {FontSizeCommand} from '@modusoperandi/licit-ui-commands';
8
+ import { FontSizeCommand } from '@modusoperandi/licit-ui-commands';
9
9
  import CommandMenuButton from './CommandMenuButton.js';
10
10
  import findActiveFontSize from './findActiveFontSize.js';
11
11
 
12
12
  export const FONT_PT_SIZES = [
13
+ 6,
14
+ 6.5,
15
+ 7,
13
16
  8,
14
17
  9,
15
18
  10,
16
19
  11,
17
20
  12,
18
21
  14,
22
+ 16,
19
23
  18,
24
+ 20,
25
+ 22,
20
26
  24,
21
27
  30,
22
28
  36,
@@ -40,7 +40,7 @@ var TableNodeView = /*#__PURE__*/function (_TableView) {
40
40
  }, {
41
41
  key: "_updateAttrs",
42
42
  value: function _updateAttrs(node) {
43
- var _node$attrs, _node$attrs2, _node$attrs3;
43
+ var _node$attrs, _node$attrs2, _node$attrs3, _node$attrs4;
44
44
  // Handle marginLeft
45
45
  var marginLeft = ((_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.marginLeft) || 0;
46
46
  this.table.style.marginLeft = marginLeft ? "".concat(marginLeft, "px") : '';
@@ -56,6 +56,11 @@ var TableNodeView = /*#__PURE__*/function (_TableView) {
56
56
  } else {
57
57
  this.table.removeAttribute('dirty');
58
58
  }
59
+ if ((_node$attrs4 = node.attrs) !== null && _node$attrs4 !== void 0 && _node$attrs4.coverPage) {
60
+ this.table.setAttribute('data-cover-page', 'true');
61
+ } else {
62
+ this.table.removeAttribute('data-cover-page');
63
+ }
59
64
  }
60
65
  }]);
61
66
  }(TableView);
@@ -32,5 +32,10 @@ export default class TableNodeView extends TableView {
32
32
  } else {
33
33
  this.table.removeAttribute('dirty');
34
34
  }
35
+ if (node.attrs?.coverPage) {
36
+ this.table.setAttribute('data-cover-page', 'true');
37
+ } else {
38
+ this.table.removeAttribute('data-cover-page');
39
+ }
35
40
  }
36
41
  }
@@ -3,10 +3,10 @@
3
3
  border-radius: 0;
4
4
  display: block;
5
5
  margin: 0;
6
- padding-bottom: 8px;
6
+ padding-bottom: 6px;
7
7
  padding-left: 20px;
8
8
  padding-right: 20px;
9
- padding-top: 8px;
9
+ padding-top: 5px;
10
10
  }
11
11
 
12
12
  .czi-custom-menu-item.czi-custom-button:hover {
package/ui/czi-table.css CHANGED
@@ -32,6 +32,15 @@
32
32
  vertical-align: top;
33
33
  }
34
34
 
35
+ .ProseMirror table[data-cover-page="true"] td,
36
+ .ProseMirror table[data-cover-page="true"] th {
37
+ padding: 4px;
38
+ }
39
+
40
+ table[data-cover-page="true"].molm-czi-image-view.align-center {
41
+ margin: 0 0 -18px;
42
+ }
43
+
35
44
  .ProseMirror th {
36
45
  background-color: var(--czi-table-header-background-color);
37
46
  font-weight: bold;