@modusoperandi/licit 0.13.25 → 0.14.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.
Files changed (200) hide show
  1. package/.eslintrc.js +1 -1
  2. package/README.md +1 -0
  3. package/dist/BlockquoteInsertNewLineCommand.js +3 -23
  4. package/dist/BlockquoteNodeSpec.js +3 -13
  5. package/dist/BlockquoteToggleCommand.js +3 -16
  6. package/dist/BookmarkNodeSpec.js +0 -6
  7. package/dist/BulletListNodeSpec.js +2 -16
  8. package/dist/CZIProseMirror.js +3 -27
  9. package/dist/CodeBlockCommand.js +3 -19
  10. package/dist/CodeBlockNodeSpec.js +3 -4
  11. package/dist/CodeMarkSpec.js +0 -4
  12. package/dist/ContentPlaceholderPlugin.js +6 -58
  13. package/dist/CursorPlaceholderPlugin.js +2 -32
  14. package/dist/DocLayoutCommand.js +5 -28
  15. package/dist/DocNodeSpec.js +0 -9
  16. package/dist/EMMarkSpec.js +0 -4
  17. package/dist/EditorCommands.js +5 -33
  18. package/dist/EditorKeyMap.js +4 -18
  19. package/dist/EditorMarks.js +2 -26
  20. package/dist/EditorNodes.js +4 -22
  21. package/dist/EditorPageLayoutPlugin.js +3 -15
  22. package/dist/EditorPlugins.js +0 -4
  23. package/dist/EditorSchema.js +0 -5
  24. package/dist/EditorState.js +0 -2
  25. package/dist/FontSizeMarkSpec.js +0 -12
  26. package/dist/FontTypeMarkSpec.js +15 -19
  27. package/dist/HTMLMutator.js +5 -24
  28. package/dist/HardBreakNodeSpec.js +0 -2
  29. package/dist/HeadingNodeSpec.js +6 -15
  30. package/dist/HistoryRedoCommand.js +3 -11
  31. package/dist/HistoryUndoCommand.js +3 -11
  32. package/dist/HorizontalRuleCommand.js +3 -22
  33. package/dist/HorizontalRuleNodeSpec.js +0 -10
  34. package/dist/ImageFromURLCommand.js +0 -9
  35. package/dist/ImageNodeSpec.js +2 -14
  36. package/dist/ImageSourceCommand.js +3 -39
  37. package/dist/ImageUploadCommand.js +3 -21
  38. package/dist/ImageUploadPlaceholderPlugin.js +10 -48
  39. package/dist/LinkMarkSpec.js +0 -4
  40. package/dist/LinkSetURLCommand.js +3 -28
  41. package/dist/LinkTooltipPlugin.js +6 -52
  42. package/dist/ListItemInsertNewLineCommand.js +3 -23
  43. package/dist/ListItemMergeCommand.js +15 -66
  44. package/dist/ListItemNodeSpec.js +0 -11
  45. package/dist/ListSplitCommand.js +3 -14
  46. package/dist/ListToggleCommand.js +5 -26
  47. package/dist/MarksClearCommand.js +6 -17
  48. package/dist/MathEditCommand.js +3 -38
  49. package/dist/MathNodeSpec.js +0 -10
  50. package/dist/OrderedListNodeSpec.js +0 -24
  51. package/dist/ParagraphNodeSpec.js +5 -26
  52. package/dist/ParagraphSpacingCommand.js +3 -32
  53. package/dist/PrintCommand.js +3 -13
  54. package/dist/SelectionPlaceholderPlugin.js +2 -31
  55. package/dist/SpacerMarkSpec.js +2 -6
  56. package/dist/StrikeMarkSpec.js +0 -4
  57. package/dist/StrongMarkSpec.js +2 -5
  58. package/dist/StyleView.js +1 -7
  59. package/dist/TableBackgroundColorCommand.js +3 -24
  60. package/dist/TableBorderColorCommand.js +3 -24
  61. package/dist/TableCellColorCommand.js +3 -23
  62. package/dist/TableCellMenuPlugin.js +9 -45
  63. package/dist/TableInsertCommand.js +7 -39
  64. package/dist/TableMergeCellsCommand.js +5 -30
  65. package/dist/TableNodesSpecs.js +4 -23
  66. package/dist/TablePlugins.js +0 -5
  67. package/dist/TableResizePlugin.js +54 -138
  68. package/dist/TextColorMarkSpec.js +0 -9
  69. package/dist/TextHighlightMarkSpec.js +0 -8
  70. package/dist/TextInsertTabSpaceCommand.js +3 -28
  71. package/dist/TextNoWrapMarkSpec.js +0 -4
  72. package/dist/TextSelectionMarkSpec.js +0 -5
  73. package/dist/TextSubMarkSpec.js +0 -4
  74. package/dist/TextSuperMarkSpec.js +0 -4
  75. package/dist/TextUnderlineMarkSpec.js +0 -4
  76. package/dist/Types.js +0 -6
  77. package/dist/WebFontLoader.js +3 -8
  78. package/dist/blockQuoteInputRule.js +0 -13
  79. package/dist/bom.xml +1492 -1645
  80. package/dist/buildEditorPlugins.js +5 -27
  81. package/dist/buildInputRules.js +12 -24
  82. package/dist/client/CollabConnector.js +6 -30
  83. package/dist/client/EditorConnection.js +23 -69
  84. package/dist/client/Licit.js +79 -163
  85. package/dist/client/Licit.js.flow +16 -2
  86. package/dist/client/Licit.test.js +6 -13
  87. package/dist/client/Reporter.js +1 -8
  88. package/dist/client/SimpleConnector.js +6 -26
  89. package/dist/client/http.js +8 -15
  90. package/dist/client/throttle.js +0 -2
  91. package/dist/convertFromDOMElement.js +2 -10
  92. package/dist/convertFromHTML.js +0 -5
  93. package/dist/convertFromJSON.js +3 -13
  94. package/dist/convertToCSSPTValue.js +0 -6
  95. package/dist/convertToJSON.js +0 -2
  96. package/dist/createCommand.js +3 -11
  97. package/dist/createEditorKeyMap.js +0 -13
  98. package/dist/createEmptyEditorState.js +0 -7
  99. package/dist/createTableResizingPlugin.js +5 -16
  100. package/dist/findActionableCell.js +0 -19
  101. package/dist/findActiveMark.js +0 -11
  102. package/dist/hyphenize.js +2 -4
  103. package/dist/index.js +0 -9
  104. package/dist/insertTable.js +0 -16
  105. package/dist/isEditorStateEmpty.js +0 -6
  106. package/dist/isTableNode.js +0 -3
  107. package/dist/joinDown.js +0 -7
  108. package/dist/joinListNode.js +0 -15
  109. package/dist/joinUp.js +0 -9
  110. package/dist/keymaps.js +0 -15
  111. package/dist/lookUpElement.js +0 -3
  112. package/dist/nodeAt.js +0 -3
  113. package/dist/normalizeHTML.js +9 -25
  114. package/dist/patchAnchorElements.js +5 -12
  115. package/dist/patchBreakElements.js +0 -6
  116. package/dist/patchElementInlineStyles.js +5 -15
  117. package/dist/patchListElements.js +20 -54
  118. package/dist/patchMathElements.js +11 -21
  119. package/dist/patchParagraphElements.js +0 -5
  120. package/dist/patchStyleElements.js +12 -41
  121. package/dist/patchTableElements.js +9 -37
  122. package/dist/rebaseDocWithSteps.js +0 -6
  123. package/dist/sanitizeURL.js +0 -3
  124. package/dist/splitListItem.js +12 -43
  125. package/dist/toClosestFontPtSize.js +1 -5
  126. package/dist/toSafeHTMLDocument.js +0 -1
  127. package/dist/toggleBlockquote.js +2 -19
  128. package/dist/toggleCodeBlock.js +2 -22
  129. package/dist/ui/AlertInfo.js +6 -22
  130. package/dist/ui/BookmarkNodeView.js +7 -28
  131. package/dist/ui/CommandButton.js +3 -19
  132. package/dist/ui/CommandMenu.js +3 -25
  133. package/dist/ui/CommandMenuButton.js +3 -36
  134. package/dist/ui/CustomEditorView.js +3 -16
  135. package/dist/ui/CustomMenu.js +0 -8
  136. package/dist/ui/CustomMenuItem.js +4 -18
  137. package/dist/ui/CustomNodeView.js +21 -67
  138. package/dist/ui/CustomRadioButton.js +14 -33
  139. package/dist/ui/DocLayoutEditor.js +5 -27
  140. package/dist/ui/Editor.js +18 -79
  141. package/dist/ui/EditorFrameset.js +3 -18
  142. package/dist/ui/EditorToolbar.js +10 -46
  143. package/dist/ui/EditorToolbarConfig.js +10 -20
  144. package/dist/ui/FontSizeCommandMenuButton.js +5 -19
  145. package/dist/ui/FontTypeCommandMenuButton.js +5 -22
  146. package/dist/ui/Frag.js +0 -7
  147. package/dist/ui/Icon.js +5 -25
  148. package/dist/ui/ImageAlignEditor.js +3 -16
  149. package/dist/ui/ImageInlineEditor.js +3 -16
  150. package/dist/ui/ImageNodeView.js +20 -109
  151. package/dist/ui/ImageResizeBox.js +3 -53
  152. package/dist/ui/ImageURLEditor.js +3 -28
  153. package/dist/ui/ImageUploadEditor.js +3 -35
  154. package/dist/ui/LinkTooltip.js +5 -25
  155. package/dist/ui/LinkURLEditor.js +3 -29
  156. package/dist/ui/ListItemNodeView.js +15 -30
  157. package/dist/ui/ListTypeButton.js +5 -37
  158. package/dist/ui/ListTypeCommandButton.js +3 -19
  159. package/dist/ui/ListTypeMenu.js +4 -25
  160. package/dist/ui/LoadingIndicator.js +0 -7
  161. package/dist/ui/MathEditor.js +3 -24
  162. package/dist/ui/MathInlineEditor.js +3 -26
  163. package/dist/ui/MathNodeView.js +9 -59
  164. package/dist/ui/PasteMenu.js +4 -20
  165. package/dist/ui/ResizeObserver.js +0 -18
  166. package/dist/ui/RichTextEditor.js +5 -27
  167. package/dist/ui/SelectionObserver.js +3 -29
  168. package/dist/ui/TableCellMenu.js +3 -18
  169. package/dist/ui/TableGridSizeEditor.js +5 -51
  170. package/dist/ui/TableNodeView.js +0 -11
  171. package/dist/ui/bindScrollHandler.js +2 -9
  172. package/dist/ui/canUseCSSFont.js +2 -8
  173. package/dist/ui/czi-icon.css +4 -4
  174. package/dist/ui/findActiveFontSize.js +2 -18
  175. package/dist/ui/findActiveFontType.js +0 -12
  176. package/dist/ui/handleEditorDrop.js +0 -9
  177. package/dist/ui/handleEditorKeyDown.js +0 -7
  178. package/dist/ui/handleEditorPaste.js +0 -9
  179. package/dist/ui/htmlElementToRect.js +0 -4
  180. package/dist/ui/injectStyleSheet.js +0 -10
  181. package/dist/ui/isElementFullyVisible.js +2 -8
  182. package/dist/ui/isOffline.js +0 -2
  183. package/dist/ui/isReactClass.js +0 -4
  184. package/dist/ui/mathquill-editor/MathQuillEditor.js +9 -44
  185. package/dist/ui/mathquill-editor/MathQuillEditorSymbols.js +1 -3
  186. package/dist/ui/mathquill-editor/MathQuillEditorSymbolsPanel.js +3 -16
  187. package/dist/ui/mathquill-editor/mathquill-import-kludge.js +5 -7
  188. package/dist/ui/renderLaTeXAsHTML.js +2 -13
  189. package/dist/ui/resolveImage.js +7 -32
  190. package/dist/ui/toCSSColor.js +0 -14
  191. package/dist/ui/toCSSLineSpacing.js +10 -11
  192. package/dist/ui/toHexColor.js +0 -8
  193. package/dist/ui/uuid.js +0 -2
  194. package/dist/uuid.js +0 -2
  195. package/package-lock.json.old +32889 -0
  196. package/package.json +45 -69
  197. package/src/client/Licit.js +16 -2
  198. package/src/ui/czi-icon.css +4 -4
  199. package/utils/build_web_server.js +1 -7
  200. package/webpack.config.js +3 -3
@@ -4,40 +4,32 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = patchTableElements;
7
-
8
7
  var _convertToCSSPTValue = _interopRequireWildcard(require("./convertToCSSPTValue"));
9
-
10
8
  var _toHexColor = _interopRequireDefault(require("./ui/toHexColor"));
11
-
12
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
-
14
10
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
15
-
16
11
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
17
-
18
12
  function patchTableElements(doc) {
19
13
  Array.from(doc.querySelectorAll('td')).forEach(patchTableCell);
20
14
  Array.from(doc.querySelectorAll('tr[style^=height]')).forEach(patchTableRow);
21
- } // The height of each line: ~= 21px
15
+ }
22
16
 
17
+ // The height of each line: ~= 21px
18
+ const LINE_HEIGHT_PT_VALUE = 15.81149997;
23
19
 
24
- const LINE_HEIGHT_PT_VALUE = 15.81149997; // Workaround to patch HTML from Google Doc that Table Cells will apply
20
+ // Workaround to patch HTML from Google Doc that Table Cells will apply
25
21
  // its background colr to all its inner <span />.
26
-
27
22
  function patchTableCell(tdElement) {
28
23
  const {
29
24
  style
30
25
  } = tdElement;
31
-
32
26
  if (!style) {
33
27
  return;
34
28
  }
35
-
36
29
  const {
37
30
  backgroundColor,
38
31
  width
39
32
  } = style;
40
-
41
33
  if (backgroundColor) {
42
34
  const tdBgColor = (0, _toHexColor.default)(backgroundColor);
43
35
  const selector = 'span[style*=background-color]';
@@ -45,82 +37,62 @@ function patchTableCell(tdElement) {
45
37
  spans.some(spanElement => {
46
38
  let retVal = true;
47
39
  const spanStyle = spanElement.style;
48
-
49
40
  if (!spanStyle || !spanStyle.backgroundColor) {
50
41
  retVal = false;
51
42
  } else {
52
43
  const spanBgColor = (0, _toHexColor.default)(spanStyle.backgroundColor);
53
-
54
44
  if (spanBgColor === tdBgColor) {
55
45
  // The span has the same bg color as the cell does, erase its bg color.
56
46
  spanStyle.backgroundColor = '';
57
47
  }
58
48
  }
59
-
60
49
  return retVal;
61
50
  });
62
51
  }
63
-
64
52
  if (width) {
65
53
  const ptValue = (0, _convertToCSSPTValue.default)(width);
66
-
67
54
  if (!ptValue) {
68
55
  return;
69
56
  }
70
-
71
- const pxValue = ptValue * _convertToCSSPTValue.PT_TO_PX_RATIO; // Attribute "data-colwidth" is defined at 'prosemirror-tables';
72
-
57
+ const pxValue = ptValue * _convertToCSSPTValue.PT_TO_PX_RATIO;
58
+ // Attribute "data-colwidth" is defined at 'prosemirror-tables';
73
59
  tdElement.setAttribute('data-colwidth', String(Math.round(pxValue)));
74
60
  }
75
- } // Workaround to support "height" in table row by inject empty <p /> to
76
- // create space for the height.
77
-
61
+ }
78
62
 
63
+ // Workaround to support "height" in table row by inject empty <p /> to
64
+ // create space for the height.
79
65
  function patchTableRow(trElement) {
80
66
  const doc = trElement.ownerDocument;
81
-
82
67
  if (!doc) {
83
68
  return;
84
69
  }
85
-
86
70
  const height = trElement.style.height;
87
-
88
71
  if (!height) {
89
72
  return;
90
73
  }
91
-
92
74
  const firstCell = trElement.querySelector('td, th');
93
-
94
75
  if (!firstCell) {
95
76
  return;
96
77
  }
97
-
98
78
  const ptValue = (0, _convertToCSSPTValue.default)(height);
99
-
100
79
  if (!ptValue) {
101
80
  return;
102
81
  }
103
-
104
82
  const pEls = firstCell.querySelectorAll('p');
105
83
  const heightNeeded = ptValue - LINE_HEIGHT_PT_VALUE * pEls.length;
106
-
107
84
  if (heightNeeded < 0) {
108
85
  return;
109
86
  }
110
-
111
87
  let pElsNeeded = Math.round(heightNeeded / LINE_HEIGHT_PT_VALUE);
112
-
113
88
  if (pElsNeeded <= 0) {
114
89
  return;
115
90
  }
116
-
117
91
  const frag = doc.createDocumentFragment();
118
92
  const line = doc.createElement('p');
119
-
120
93
  while (pElsNeeded > 0) {
121
94
  pElsNeeded--;
122
95
  frag.appendChild(line.cloneNode(false));
123
96
  }
124
-
125
97
  firstCell.appendChild(frag);
126
98
  }
@@ -4,21 +4,15 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = rebaseDocWithSteps;
7
-
8
7
  var _prosemirrorTransform = require("prosemirror-transform");
9
-
10
8
  var _EditorSchema = _interopRequireDefault(require("./EditorSchema"));
11
-
12
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
-
14
10
  function rebaseDocWithSteps(clientID, docJSON, stepsJSON) {
15
11
  return new Promise((resolve, reject) => {
16
12
  // TODO: Move this into a separate server request.
17
13
  let docNode = _EditorSchema.default.nodeFromJSON(docJSON);
18
-
19
14
  const steps = stepsJSON.map(step => {
20
15
  const result = _prosemirrorTransform.Step.fromJSON(_EditorSchema.default, step);
21
-
22
16
  result.clientID = clientID;
23
17
  return result;
24
18
  });
@@ -5,15 +5,12 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = sanitizeURL;
7
7
  const HTTP_PREFIX = /^http(s?):*\/\//i;
8
-
9
8
  function sanitizeURL(url) {
10
9
  if (!url) {
11
10
  return 'http://';
12
11
  }
13
-
14
12
  if (HTTP_PREFIX.test(url)) {
15
13
  return url;
16
14
  }
17
-
18
15
  return 'http://' + url;
19
16
  }
@@ -4,27 +4,18 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = splitListItem;
7
-
8
7
  var _uuid = _interopRequireDefault(require("./ui/uuid"));
9
-
10
8
  var _prosemirrorModel = require("prosemirror-model");
11
-
12
9
  var _prosemirrorState = require("prosemirror-state");
13
-
14
10
  var _prosemirrorTransform = require("prosemirror-transform");
15
-
16
11
  var _NodeNames = require("./NodeNames");
17
-
18
12
  var _prosemirrorUtils = require("prosemirror-utils");
19
-
20
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
-
22
14
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
23
-
24
15
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
25
-
26
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
27
-
16
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
17
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
18
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
28
19
  // Splits a list item by the current cursor's position.
29
20
  // Some examples:
30
21
  //
@@ -74,52 +65,43 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
74
65
  //
75
66
  function splitListItem(tr, schema) {
76
67
  const nodeType = schema.nodes[_NodeNames.LIST_ITEM];
77
-
78
68
  if (!nodeType) {
79
69
  return tr;
80
70
  }
81
-
82
71
  const {
83
72
  selection
84
73
  } = tr;
85
-
86
74
  if (!selection) {
87
75
  return tr;
88
76
  }
89
-
90
77
  const {
91
78
  $from,
92
79
  $to,
93
80
  node
94
81
  } = selection;
95
-
96
82
  if (node && node.isBlock || $from.depth < 2 || !$from.sameParent($to)) {
97
83
  return tr;
98
84
  }
99
-
100
85
  const grandParent = $from.node(-1);
101
-
102
86
  if (grandParent.type !== nodeType) {
103
87
  return tr;
104
88
  }
105
-
106
89
  if ($from.parent.content.size == 0) {
107
90
  // In an empty list item.
108
91
  return splitEmptyListItem(tr, schema);
109
92
  }
110
-
111
93
  const nextType = $to.pos == $from.end() ? grandParent.contentMatchAt($from.indexAfter(-1)).defaultType : null;
112
94
  tr = tr.delete($from.pos, $to.pos);
113
95
  const types = nextType && [null, {
114
96
  type: nextType
115
97
  }];
116
-
117
98
  if (!(0, _prosemirrorTransform.canSplit)(tr.doc, $from.pos, 2, types)) {
118
99
  return tr;
119
100
  }
120
-
121
101
  return tr.split($from.pos, 2, types);
122
- } // Splits an item with empty content:
102
+ }
103
+
104
+ // Splits an item with empty content:
123
105
  // - before:
124
106
  // 1. AA
125
107
  // 2. <cursor>
@@ -129,37 +111,28 @@ function splitListItem(tr, schema) {
129
111
  // <cursor>
130
112
  // 2. BB
131
113
  // 3. CC
132
-
133
-
134
114
  function splitEmptyListItem(tr, schema) {
135
115
  const listItemType = schema.nodes[_NodeNames.LIST_ITEM];
136
116
  const orderedListType = schema.nodes[_NodeNames.ORDERED_LIST];
137
117
  const bulletListType = schema.nodes[_NodeNames.BULLET_LIST];
138
118
  const paragraphType = schema.nodes[_NodeNames.PARAGRAPH];
139
-
140
119
  if (!listItemType || !paragraphType) {
141
120
  // Schema does not support the nodes expected.
142
121
  return tr;
143
122
  }
144
-
145
123
  const listItemFound = (0, _prosemirrorUtils.findParentNodeOfType)(listItemType)(tr.selection);
146
-
147
124
  if (!listItemFound || listItemFound.node.textContent !== '') {
148
125
  // Cursor is not inside an empty list item.
149
126
  return tr;
150
127
  }
151
-
152
128
  const listFound = orderedListType && (0, _prosemirrorUtils.findParentNodeOfType)(orderedListType)(tr.selection) || bulletListType && (0, _prosemirrorUtils.findParentNodeOfType)(bulletListType)(tr.selection);
153
-
154
129
  if (!listFound) {
155
130
  // Cursor isn't inside an list.
156
131
  return tr;
157
132
  }
158
-
159
133
  const $listItemPos = tr.doc.resolve(listItemFound.pos);
160
134
  const listItemIndex = $listItemPos.index($listItemPos.depth);
161
135
  const listFoundNode = listFound.node;
162
-
163
136
  if (listFoundNode.childCount < 3 || listItemIndex < 1 || listItemIndex >= listFoundNode.childCount - 1) {
164
137
  // - The list must have at least three list items
165
138
  // - The cursor must be after the first list item and before the last list
@@ -167,25 +140,24 @@ function splitEmptyListItem(tr, schema) {
167
140
  // If both conditions don't match, bails out, which will remove the empty
168
141
  // item.
169
142
  return tr;
170
- } // Find the name of the current list to split. If the name isn't available,
171
- // assigns a new name.
172
-
143
+ }
173
144
 
145
+ // Find the name of the current list to split. If the name isn't available,
146
+ // assigns a new name.
174
147
  let {
175
148
  name
176
149
  } = listFoundNode.attrs;
177
-
178
150
  if (!name) {
179
151
  name = (0, _uuid.default)();
180
152
  tr = tr.setNodeMarkup(listFound.pos, listFoundNode.type, _objectSpread(_objectSpread({}, listFoundNode.attrs), {}, {
181
153
  name
182
154
  }), listFoundNode.marks);
183
- } // We'll split the list into two lists.
155
+ }
156
+
157
+ // We'll split the list into two lists.
184
158
  // the first list contains the items before the cursor, and the second
185
159
  // list contains the items after the cursor and the second list will "follow"
186
160
  // the first list by sharing the same counter variable.
187
-
188
-
189
161
  const sliceFrom = listItemFound.pos + listItemFound.node.nodeSize;
190
162
  const sliceTo = listFound.pos + listFound.node.nodeSize - 1;
191
163
  const slicedItems = tr.doc.slice(sliceFrom, sliceTo, false);
@@ -193,14 +165,11 @@ function splitEmptyListItem(tr, schema) {
193
165
  const deleteTo = listFound.pos + listFound.node.nodeSize;
194
166
  tr = tr.delete(deleteFrom, deleteTo);
195
167
  const sourceListNode = listFound.node;
196
-
197
168
  const listAttrs = _objectSpread({}, sourceListNode.attrs);
198
-
199
169
  if (orderedListType === sourceListNode.type) {
200
170
  listAttrs.counterReset = 'none';
201
171
  listAttrs.following = name;
202
172
  }
203
-
204
173
  const insertFrom = deleteFrom + 1;
205
174
  const listNode = sourceListNode.type.create(listAttrs, slicedItems.content);
206
175
  tr = tr.insert(insertFrom, listNode);
@@ -4,25 +4,21 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.toClosestFontPtSize = toClosestFontPtSize;
7
-
8
7
  var _convertToCSSPTValue = _interopRequireDefault(require("./convertToCSSPTValue"));
9
-
10
8
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
-
12
9
  // [FS-SEA][24-02-2020]
13
10
  // overrided the method form 'convertToCSSPTValue.js' file to avoid the compiling issue .
14
11
  // [FS][28-02-2020]
15
12
  // IRAD-893 - Copy Paste From External Source Not Working
16
13
  // removed {} from import, because convertToCSSPTValue is a default export function.
14
+
17
15
  function toClosestFontPtSize(styleValue) {
18
16
  // duplicated FONT_PT_SIZES(available in ./ui/FontSizeCommandMenuButton)
19
17
  const FONT_PT_SIZES = [8, 9, 10, 11, 12, 14, 18, 24, 30, 36, 48, 60, 72, 90];
20
18
  const originalPTValue = (0, _convertToCSSPTValue.default)(styleValue);
21
-
22
19
  if (FONT_PT_SIZES.includes(originalPTValue)) {
23
20
  return originalPTValue;
24
21
  }
25
-
26
22
  return FONT_PT_SIZES.reduce((prev, curr) => {
27
23
  return Math.abs(curr - originalPTValue) < Math.abs(prev - originalPTValue) ? curr : prev;
28
24
  }, Number.NEGATIVE_INFINITY);
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = toSafeHTMLDocument;
7
-
8
7
  // Parses HTML in a detached document to help with avoiding XSS
9
8
  // https://developer.mozilla.org/en-US/docs/Archive/Add-ons/Code_snippets/HTML_to_DOM
10
9
  // https://github.com/ProseMirror/prosemirror/issues/473#issuecomment-255727531
@@ -4,15 +4,10 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = toggleBlockquote;
7
-
8
7
  var _prosemirrorModel = require("prosemirror-model");
9
-
10
8
  var _prosemirrorTransform = require("prosemirror-transform");
11
-
12
9
  var _NodeNames = require("./NodeNames");
13
-
14
10
  var _licitUiCommands = require("@modusoperandi/licit-ui-commands");
15
-
16
11
  function toggleBlockquote(tr, schema) {
17
12
  const {
18
13
  nodes
@@ -25,11 +20,9 @@ function toggleBlockquote(tr, schema) {
25
20
  const blockquote = nodes[_NodeNames.BLOCKQUOTE];
26
21
  const paragraph = nodes[_NodeNames.PARAGRAPH];
27
22
  const listItem = nodes[_NodeNames.LIST_ITEM];
28
-
29
23
  if (!selection || !doc || !heading || !paragraph || !listItem) {
30
24
  return tr;
31
25
  }
32
-
33
26
  const {
34
27
  from,
35
28
  to
@@ -39,24 +32,20 @@ function toggleBlockquote(tr, schema) {
39
32
  doc.nodesBetween(from, to, (node, pos, parentNode) => {
40
33
  const nodeType = node.type;
41
34
  const parentNodeType = parentNode.type;
42
-
43
35
  if (startWithBlockQuote === null) {
44
36
  startWithBlockQuote = nodeType === blockquote;
45
37
  }
46
-
47
38
  if (parentNodeType !== listItem) {
48
39
  poses.push(pos);
49
40
  }
50
-
51
41
  return !(0, _licitUiCommands.isListNode)(node);
52
- }); // Update from the bottom to avoid disruptive changes in pos.
53
-
42
+ });
43
+ // Update from the bottom to avoid disruptive changes in pos.
54
44
  poses.sort(_licitUiCommands.compareNumber).reverse().forEach(pos => {
55
45
  tr = setBlockquoteNode(tr, schema, pos);
56
46
  });
57
47
  return tr;
58
48
  }
59
-
60
49
  function setBlockquoteNode(tr, schema, pos) {
61
50
  const {
62
51
  nodes
@@ -64,20 +53,15 @@ function setBlockquoteNode(tr, schema, pos) {
64
53
  const heading = nodes[_NodeNames.HEADING];
65
54
  const paragraph = nodes[_NodeNames.PARAGRAPH];
66
55
  const blockquote = nodes[_NodeNames.BLOCKQUOTE];
67
-
68
56
  if (pos >= tr.doc.content.size) {
69
57
  // Workaround to handle the edge case that pos was shifted caused by `toggleList`.
70
58
  return tr;
71
59
  }
72
-
73
60
  const node = tr.doc.nodeAt(pos);
74
-
75
61
  if (!node || !heading || !paragraph) {
76
62
  return tr;
77
63
  }
78
-
79
64
  const nodeType = node.type;
80
-
81
65
  if ((0, _licitUiCommands.isInsideListItem)(tr.doc, pos)) {
82
66
  return tr;
83
67
  } else if ((0, _licitUiCommands.isListNode)(node)) {
@@ -98,6 +82,5 @@ function setBlockquoteNode(tr, schema, pos) {
98
82
  } else if (nodeType === paragraph || nodeType === heading) {
99
83
  tr = tr.setNodeMarkup(pos, blockquote, node.attrs, node.marks);
100
84
  }
101
-
102
85
  return tr;
103
86
  }
@@ -4,19 +4,12 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = toggleCodeBlock;
7
-
8
7
  var _prosemirrorModel = require("prosemirror-model");
9
-
10
8
  var _prosemirrorState = require("prosemirror-state");
11
-
12
9
  var _prosemirrorTransform = require("prosemirror-transform");
13
-
14
10
  var _MarkNames = require("./MarkNames");
15
-
16
11
  var _NodeNames = require("./NodeNames");
17
-
18
12
  var _licitUiCommands = require("@modusoperandi/licit-ui-commands");
19
-
20
13
  function toggleCodeBlock(tr, schema) {
21
14
  const {
22
15
  nodes
@@ -29,11 +22,9 @@ function toggleCodeBlock(tr, schema) {
29
22
  const paragraph = nodes[_NodeNames.PARAGRAPH];
30
23
  const heading = nodes[_NodeNames.HEADING];
31
24
  const blockquote = nodes[_NodeNames.BLOCKQUOTE];
32
-
33
25
  if (!selection || !doc || !codeBlock || !paragraph) {
34
26
  return tr;
35
27
  }
36
-
37
28
  const poses = [];
38
29
  const {
39
30
  from,
@@ -43,55 +34,45 @@ function toggleCodeBlock(tr, schema) {
43
34
  let startWithCodeBlock = null;
44
35
  doc.nodesBetween(from, to, (node, pos) => {
45
36
  const nodeType = node.type;
46
-
47
37
  if (startWithCodeBlock === null) {
48
38
  startWithCodeBlock = nodeType === codeBlock;
49
39
  }
50
-
51
40
  const {
52
41
  type,
53
42
  isBlock
54
43
  } = node;
55
-
56
44
  if (isBlock) {
57
45
  allowed = allowed && (type === paragraph || type === codeBlock || type === heading || type === blockquote);
58
46
  allowed && poses.push(pos);
59
47
  }
60
-
61
48
  return isBlock;
62
- }); // Update from the bottom to avoid disruptive changes in pos.
49
+ });
63
50
 
51
+ // Update from the bottom to avoid disruptive changes in pos.
64
52
  allowed && poses.sort(_licitUiCommands.compareNumber).reverse().forEach(pos => {
65
53
  tr = setCodeBlockNodeEnabled(tr, schema, pos, startWithCodeBlock ? false : true);
66
54
  });
67
55
  return tr;
68
56
  }
69
-
70
57
  function setCodeBlockNodeEnabled(tr, schema, pos, enabled) {
71
58
  const {
72
59
  doc
73
60
  } = tr;
74
-
75
61
  if (!doc) {
76
62
  return tr;
77
63
  }
78
-
79
64
  const node = doc.nodeAt(pos);
80
-
81
65
  if (!node) {
82
66
  return tr;
83
67
  }
84
-
85
68
  if ((0, _licitUiCommands.isListNode)(node)) {
86
69
  return tr;
87
70
  }
88
-
89
71
  const {
90
72
  nodes
91
73
  } = schema;
92
74
  const codeBlock = nodes[_NodeNames.CODE_BLOCK];
93
75
  const paragraph = nodes[_NodeNames.PARAGRAPH];
94
-
95
76
  if (codeBlock && !enabled && node.type === codeBlock) {
96
77
  tr = tr.setNodeMarkup(pos, paragraph, node.attrs, node.marks);
97
78
  } else if (enabled && node.type !== codeBlock) {
@@ -104,6 +85,5 @@ function setCodeBlockNodeEnabled(tr, schema, pos, enabled) {
104
85
  tr = tr.setSelection(selection);
105
86
  tr = tr.setNodeMarkup(pos, codeBlock, node.attrs, node.marks);
106
87
  }
107
-
108
88
  return tr;
109
89
  }
@@ -4,47 +4,36 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var React = _interopRequireWildcard(require("react"));
9
-
10
8
  var _propTypes = _interopRequireDefault(require("prop-types"));
11
-
12
9
  require("./czi-form.css");
13
-
14
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
-
16
11
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
17
-
18
12
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
19
-
20
13
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
21
-
22
14
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
23
-
24
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
25
-
15
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
16
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
17
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
26
18
  class AlertInfo extends React.PureComponent {
27
19
  constructor(props) {
28
20
  super(props);
29
-
30
21
  _defineProperty(this, "_unmounted", false);
31
-
32
22
  _defineProperty(this, "state", _objectSpread(_objectSpread({}, this.props.initialValue || {}), {}, {
33
23
  validValue: null
34
24
  }));
35
-
36
25
  _defineProperty(this, "_cancel", () => {
37
26
  this.props.close();
38
27
  });
39
- } // [FS] IRAD-1005 2020-07-07
28
+ }
29
+
30
+ // [FS] IRAD-1005 2020-07-07
40
31
  // Upgrade outdated packages.
41
32
  // To take care of the property type declaration.
42
33
 
43
-
44
34
  componentWillUnmount() {
45
35
  this._unmounted = true;
46
36
  }
47
-
48
37
  render() {
49
38
  const title = this.props.title || 'Document Error!';
50
39
  const content = this.props.content || 'Unable to load the document. Have issues in Json format, please verify...';
@@ -55,21 +44,16 @@ class AlertInfo extends React.PureComponent {
55
44
  onClick: this._cancel
56
45
  }, "\xD7"), /*#__PURE__*/React.createElement("strong", null, title), /*#__PURE__*/React.createElement("span", null, content));
57
46
  }
58
-
59
47
  }
60
-
61
48
  _defineProperty(AlertInfo, "propsTypes", {
62
49
  initialValue: _propTypes.default.object,
63
50
  close: function (props, propName) {
64
51
  const fn = props[propName];
65
-
66
52
  if (!fn.prototype || typeof fn.prototype.constructor !== 'function' && fn.prototype.constructor.length !== 1) {
67
53
  return new Error(propName + ' must be a function with 1 arg of type ImageLike');
68
54
  }
69
-
70
55
  return null;
71
56
  }
72
57
  });
73
-
74
58
  var _default = AlertInfo;
75
59
  exports.default = _default;