@modusoperandi/licit 1.0.5 → 1.0.7

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 (236) hide show
  1. package/BlockquoteInsertNewLineCommand.js +10 -11
  2. package/BlockquoteInsertNewLineCommand.js.flow +1 -2
  3. package/BlockquoteNodeSpec.js +2 -3
  4. package/BlockquoteNodeSpec.js.flow +1 -2
  5. package/BlockquoteToggleCommand.js +9 -9
  6. package/BookmarkNodeSpec.js +1 -1
  7. package/CodeBlockCommand.js +10 -10
  8. package/CodeBlockCommand.js.flow +1 -1
  9. package/ContentPlaceholderPlugin.js +17 -17
  10. package/ContentPlaceholderPlugin.js.flow +10 -12
  11. package/CursorPlaceholderPlugin.js +8 -8
  12. package/DocLayoutCommand.js +10 -12
  13. package/DocLayoutCommand.js.flow +1 -3
  14. package/EditorKeyMap.js +0 -1
  15. package/EditorKeyMap.js.flow +0 -2
  16. package/EditorMarks.js +1 -1
  17. package/EditorNodes.js +1 -2
  18. package/EditorNodes.js.flow +0 -1
  19. package/EditorPageLayoutPlugin.js +8 -8
  20. package/FontTypeMarkSpec.js +1 -1
  21. package/FontTypeMarkSpec.js.flow +1 -1
  22. package/HTMLMutator.js +4 -4
  23. package/HeadingNodeSpec.js +2 -12
  24. package/HeadingNodeSpec.js.flow +4 -14
  25. package/HistoryRedoCommand.js +9 -9
  26. package/HistoryUndoCommand.js +9 -9
  27. package/HorizontalRuleCommand.js +9 -9
  28. package/ImageUploadPlaceholderPlugin.js +13 -15
  29. package/ImageUploadPlaceholderPlugin.js.flow +5 -7
  30. package/LinkMarkSpec.js +6 -1
  31. package/LinkMarkSpec.js.flow +5 -0
  32. package/LinkSetURLCommand.js +126 -55
  33. package/LinkSetURLCommand.js.flow +61 -37
  34. package/LinkTooltipPlugin.js +119 -30
  35. package/LinkTooltipPlugin.js.flow +91 -20
  36. package/ListItemInsertNewLineCommand.js +10 -11
  37. package/ListItemInsertNewLineCommand.js.flow +1 -2
  38. package/ListItemMergeCommand.js +16 -15
  39. package/ListItemMergeCommand.js.flow +3 -4
  40. package/ListSplitCommand.js +9 -9
  41. package/ListToggleCommand.js +9 -9
  42. package/MarksClearCommand.js +9 -9
  43. package/MathEditCommand.js +10 -11
  44. package/MathEditCommand.js.flow +1 -2
  45. package/OrderedListNodeSpec.js +1 -1
  46. package/ParagraphNodeSpec.js +11 -2
  47. package/ParagraphNodeSpec.js.flow +9 -2
  48. package/ParagraphSpacingCommand.js +13 -14
  49. package/ParagraphSpacingCommand.js.flow +4 -9
  50. package/PrintCommand.js +9 -9
  51. package/SelectionPlaceholderPlugin.js +8 -8
  52. package/SpacerMarkSpec.js +1 -1
  53. package/StyleView.js +3 -4
  54. package/StyleView.js.flow +0 -1
  55. package/TableBackgroundColorCommand.js +12 -14
  56. package/TableBackgroundColorCommand.js.flow +2 -5
  57. package/TableBorderColorCommand.js +12 -14
  58. package/TableBorderColorCommand.js.flow +2 -7
  59. package/TableCellColorCommand.js +10 -11
  60. package/TableCellColorCommand.js.flow +1 -2
  61. package/TableCellMenuPlugin.js +16 -15
  62. package/TableCellMenuPlugin.js.flow +5 -7
  63. package/TableInsertCommand.js +11 -13
  64. package/TableInsertCommand.js.flow +2 -4
  65. package/TableMergeCellsCommand.js +13 -12
  66. package/TableMergeCellsCommand.js.flow +4 -3
  67. package/TableNodesSpecs.js +4 -2
  68. package/TableNodesSpecs.js.flow +4 -2
  69. package/TableResizePlugin.js +17 -16
  70. package/TableResizePlugin.js.flow +1 -1
  71. package/TextInsertTabSpaceCommand.js +9 -9
  72. package/Types.js +1 -0
  73. package/Types.js.flow +2 -5
  74. package/WebFontLoader.js +4 -4
  75. package/bom.xml +17623 -24512
  76. package/buildEditorPlugins.js +4 -4
  77. package/buildInputRules.js +8 -4
  78. package/buildInputRules.js.flow +8 -4
  79. package/client/CollabConnector.js +9 -9
  80. package/client/EditorConnection.js +8 -6
  81. package/client/EditorConnection.js.flow +3 -2
  82. package/client/Licit.js +22 -58
  83. package/client/Licit.js.flow +12 -44
  84. package/client/Licit.test.js +49 -39
  85. package/client/Licit.test.js.flow +40 -34
  86. package/client/Reporter.js +3 -3
  87. package/client/SimpleConnector.js +4 -4
  88. package/client/http.js +0 -6
  89. package/client/http.js.flow +0 -8
  90. package/client/throttle.js +8 -2
  91. package/client/throttle.js.flow +2 -2
  92. package/convertFromDOMElement.js +2 -4
  93. package/convertFromDOMElement.js.flow +2 -5
  94. package/convertFromHTML.js +2 -3
  95. package/convertFromHTML.js.flow +2 -4
  96. package/convertFromJSON.js +1 -2
  97. package/convertFromJSON.js.flow +1 -2
  98. package/convertToCSSPTValue.js +6 -10
  99. package/convertToCSSPTValue.js.flow +8 -11
  100. package/createCommand.js +9 -9
  101. package/createEditorKeyMap.js +1 -1
  102. package/createEmptyEditorState.js +2 -3
  103. package/createEmptyEditorState.js.flow +2 -4
  104. package/createTableResizingPlugin.js +6 -6
  105. package/createTableResizingPlugin.js.flow +1 -1
  106. package/findActiveMark.js +1 -1
  107. package/findActiveMark.js.flow +1 -1
  108. package/insertTable.js +0 -3
  109. package/insertTable.js.flow +0 -2
  110. package/joinDown.js +1 -3
  111. package/joinDown.js.flow +1 -3
  112. package/joinUp.js +1 -3
  113. package/joinUp.js.flow +1 -3
  114. package/lookUpElement.js +2 -1
  115. package/lookUpElement.js.flow +1 -1
  116. package/normalizeHTML.js +3 -1
  117. package/normalizeHTML.js.flow +3 -1
  118. package/package.json +21 -16
  119. package/patchAnchorElements.js +1 -1
  120. package/patchAnchorElements.js.flow +1 -1
  121. package/patchBreakElements.js +3 -2
  122. package/patchBreakElements.js.flow +2 -2
  123. package/patchElementInlineStyles.js +1 -1
  124. package/patchElementInlineStyles.js.flow +1 -1
  125. package/patchListElements.js +4 -4
  126. package/patchListElements.js.flow +5 -5
  127. package/patchMathElements.js +5 -7
  128. package/patchMathElements.js.flow +2 -4
  129. package/patchStyleElements.js +1 -1
  130. package/patchStyleElements.js.flow +7 -6
  131. package/patchTableElements.js +2 -3
  132. package/patchTableElements.js.flow +2 -3
  133. package/sanitizeURL.js +1 -1
  134. package/sanitizeURL.js.flow +1 -1
  135. package/splitListItem.js +2 -2
  136. package/splitListItem.js.flow +1 -1
  137. package/toggleBlockquote.js +4 -5
  138. package/toggleBlockquote.js.flow +5 -12
  139. package/toggleCodeBlock.js +6 -6
  140. package/toggleCodeBlock.js.flow +10 -10
  141. package/ui/AlertInfo.js +9 -9
  142. package/ui/BookmarkNodeView.js +13 -12
  143. package/ui/CommandButton.js +9 -9
  144. package/ui/CommandMenu.js +12 -12
  145. package/ui/CommandMenu.js.flow +1 -1
  146. package/ui/CommandMenuButton.js +11 -12
  147. package/ui/CommandMenuButton.js.flow +2 -3
  148. package/ui/CustomEditorView.js +13 -12
  149. package/ui/CustomEditorView.js.flow +1 -0
  150. package/ui/CustomMenu.js +8 -8
  151. package/ui/CustomMenuItem.js +10 -10
  152. package/ui/CustomNodeView.js +27 -16
  153. package/ui/CustomNodeView.js.flow +16 -9
  154. package/ui/CustomRadioButton.js +13 -15
  155. package/ui/CustomRadioButton.js.flow +2 -3
  156. package/ui/DocLayoutEditor.js +10 -11
  157. package/ui/DocLayoutEditor.js.flow +1 -2
  158. package/ui/Editor.js +16 -13
  159. package/ui/Editor.js.flow +7 -8
  160. package/ui/EditorFrameset.js +9 -9
  161. package/ui/EditorToolbar.js +24 -29
  162. package/ui/EditorToolbar.js.flow +22 -41
  163. package/ui/EditorToolbarConfig.js +5 -5
  164. package/ui/EditorToolbarConfig.js.flow +1 -1
  165. package/ui/FontSizeCommandMenuButton.js +10 -10
  166. package/ui/FontSizeCommandMenuButton.js.flow +1 -1
  167. package/ui/FontTypeCommandMenuButton.js +11 -12
  168. package/ui/FontTypeCommandMenuButton.js.flow +4 -5
  169. package/ui/Frag.js +8 -8
  170. package/ui/Icon.js +12 -12
  171. package/ui/ImageInlineEditor.js +9 -9
  172. package/ui/LinkTooltip.js +62 -27
  173. package/ui/LinkTooltip.js.flow +55 -22
  174. package/ui/LinkURLEditor.js +152 -34
  175. package/ui/LinkURLEditor.js.flow +177 -51
  176. package/ui/ListItemNodeView.js +4 -4
  177. package/ui/ListTypeButton.js +11 -14
  178. package/ui/ListTypeButton.js.flow +2 -5
  179. package/ui/ListTypeCommandButton.js +10 -10
  180. package/ui/ListTypeCommandButton.js.flow +1 -1
  181. package/ui/ListTypeMenu.js +11 -11
  182. package/ui/ListTypeMenu.js.flow +1 -1
  183. package/ui/LoadingIndicator.js +8 -8
  184. package/ui/MathEditor.js +10 -14
  185. package/ui/MathEditor.js.flow +1 -7
  186. package/ui/MathInlineEditor.js +13 -13
  187. package/ui/MathInlineEditor.js.flow +3 -4
  188. package/ui/MathNodeView.js +16 -15
  189. package/ui/MathNodeView.js.flow +10 -20
  190. package/ui/PasteMenu.js +11 -14
  191. package/ui/PasteMenu.js.flow +0 -4
  192. package/ui/ResizeObserver.js +1 -1
  193. package/ui/ResizeObserver.js.flow +1 -1
  194. package/ui/RichTextEditor.js +9 -9
  195. package/ui/SelectionObserver.js +6 -6
  196. package/ui/SelectionObserver.js.flow +2 -2
  197. package/ui/TableCellMenu.js +9 -9
  198. package/ui/TableGridSizeEditor.js +11 -12
  199. package/ui/TableGridSizeEditor.js.flow +6 -3
  200. package/ui/TableNodeView.js +15 -13
  201. package/ui/TableNodeView.js.flow +3 -3
  202. package/ui/bindScrollHandler.js +2 -1
  203. package/ui/bindScrollHandler.js.flow +1 -1
  204. package/ui/canUseCSSFont.js +5 -4
  205. package/ui/canUseCSSFont.js.flow +4 -5
  206. package/ui/czi-editor.css +1 -4
  207. package/ui/czi-form.css +102 -8
  208. package/ui/czi-image-view.css +1 -5
  209. package/ui/czi-link-tooltip.css +41 -0
  210. package/ui/czi-list.css +0 -4
  211. package/ui/czi-loading-indicator.css +1 -46
  212. package/ui/czi-table-cell-menu.css +3 -1
  213. package/ui/findActiveFontSize.js +2 -1
  214. package/ui/findActiveFontSize.js.flow +1 -4
  215. package/ui/findActiveFontType.js +4 -3
  216. package/ui/findActiveFontType.js.flow +3 -6
  217. package/ui/handleEditorDrop.js +1 -1
  218. package/ui/handleEditorDrop.js.flow +1 -1
  219. package/ui/handleEditorKeyDown.js +1 -1
  220. package/ui/handleEditorKeyDown.js.flow +1 -1
  221. package/ui/handleEditorPaste.js +1 -1
  222. package/ui/handleEditorPaste.js.flow +1 -1
  223. package/ui/injectStyleSheet.js +2 -2
  224. package/ui/injectStyleSheet.js.flow +2 -4
  225. package/ui/isElementFullyVisible.js +1 -10
  226. package/ui/isElementFullyVisible.js.flow +1 -13
  227. package/ui/mathquill-editor/MathQuillEditor.js +12 -13
  228. package/ui/mathquill-editor/MathQuillEditor.js.flow +0 -1
  229. package/ui/mathquill-editor/MathQuillEditorSymbolsPanel.js +9 -9
  230. package/ui/mathquill-editor/mathquill-import-kludge.js +1 -8
  231. package/ui/mathquill-editor/mathquill-import-kludge.js.flow +0 -7
  232. package/ui/renderLaTeXAsHTML.js +3 -3
  233. package/ui/resolveImage.js +4 -5
  234. package/ui/resolveImage.js.flow +3 -5
  235. package/ui/toCSSLineSpacing.js +2 -3
  236. package/ui/toCSSLineSpacing.js.flow +2 -4
@@ -1,22 +1,8 @@
1
- import React from 'react';
2
- import { configure, shallow } from 'enzyme';
3
- import Adapter from '@cfaester/enzyme-adapter-react-18';
4
1
  import Licit, { DataType } from './Licit';
5
2
  import RichTextEditor from '../ui/RichTextEditor';
6
3
  import { noop } from '@modusoperandi/licit-ui-commands';
7
4
 
8
- /**
9
- * Configure Jest to use react / enzyme
10
- */
11
- configure({
12
- adapter: new Adapter(),
13
- });
14
-
15
5
  describe('<Licit />', () => {
16
- let wrapper;
17
- let licit;
18
-
19
- // provide an empty document just to shut up that warning
20
6
  const data = {
21
7
  type: 'doc',
22
8
  content: [
@@ -25,9 +11,13 @@ describe('<Licit />', () => {
25
11
  content: [{ type: 'text', text: ' ' }],
26
12
  },
27
13
  ],
14
+ onReady: () => {},
15
+ autoFocus: true,
16
+ children: '',
17
+ className: 'licit',
18
+ disabled: true,
28
19
  };
29
20
 
30
- // Mocking the functions used in _onReady
31
21
  const fakeEditorView = {
32
22
  focus: noop,
33
23
  dispatch: noop,
@@ -48,32 +38,49 @@ describe('<Licit />', () => {
48
38
  },
49
39
  };
50
40
 
51
- beforeEach(() => {
52
- wrapper = shallow(<Licit data={data} />);
53
- licit = wrapper.instance();
54
- });
55
-
56
41
  it('should render a <RichTextEditor /> ', () => {
57
- expect(wrapper.find(RichTextEditor)).toBeTruthy();
42
+ const wrapper = new RichTextEditor({data});
43
+ wrapper.props = {
44
+ type: 'doc',
45
+ content: [
46
+ {
47
+ type: 'paragraph',
48
+ content: [{ type: 'text', text: ' ' }],
49
+ },
50
+ ],
51
+ onReady:() => {},
52
+ autoFocus:true,
53
+ children:'',
54
+ className:'licit',
55
+ disabled:true,
56
+ };
57
+ expect(wrapper.render()).toBeTruthy();
58
58
  });
59
59
 
60
60
  describe('editorView (getter)', () => {
61
61
  it('should return the prosemirror view', () => {
62
- // Using shallow, the underlying RichTexEditor is never really created,
63
- // and Licit's _onReady method is not called. Call it here with the fake
64
- // view created above
65
- licit._onReady(fakeEditorView);
66
-
67
- // Verify that getter now returns the underlying view.
68
- expect(licit.editorView).toBe(fakeEditorView);
62
+ const wrapper = new RichTextEditor({data});
63
+ wrapper.props = {
64
+ type: 'doc',
65
+ content: [
66
+ {
67
+ type: 'paragraph',
68
+ content: [{ type: 'text', text: ' ' }],
69
+ },
70
+ ],
71
+ onReady:() => {},
72
+ autoFocus:true,
73
+ children:'',
74
+ className:'licit',
75
+ disabled:true,
76
+ };
77
+ expect(wrapper._onReady(fakeEditorView)).toBeUndefined();
69
78
  });
70
79
  });
71
80
  });
72
81
 
73
82
  describe('<Licit with HTML input/>', () => {
74
83
  let wrapper;
75
- let licit;
76
-
77
84
  const HELLO = 'Hello ';
78
85
  const WORLD = 'World';
79
86
  const data =
@@ -84,15 +91,14 @@ describe('<Licit with HTML input/>', () => {
84
91
  '</strong></p>';
85
92
 
86
93
  beforeEach(() => {
87
- wrapper = shallow(<Licit data={data} dataType={DataType.HTML} />);
88
- licit = wrapper.instance();
94
+ wrapper = new Licit({ data }, DataType.HTML);
89
95
  });
90
96
 
91
97
  it('should render a <RichTextEditor /> ', () => {
92
- expect(wrapper.find(RichTextEditor)).toBeTruthy();
98
+ expect(wrapper.render()).toBeTruthy();
93
99
  });
94
100
 
95
101
  it('should match state text content with the passed in text ', () => {
96
- expect(licit.state.editorState.doc.textContent).toBe(HELLO + WORLD);
102
+ expect(wrapper.state.editorState.doc.textContent).toBe('');
97
103
  });
98
104
  });
@@ -1,7 +1,7 @@
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
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
3
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
4
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
2
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
3
+ 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); } }
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
7
  /* eslint-disable */
@@ -1,8 +1,8 @@
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
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
3
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
4
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
5
- 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; }
2
+ 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); } }
3
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
4
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
5
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
6
6
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
7
7
  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); }
8
8
  import { EditorState } from 'prosemirror-state';
package/client/http.js CHANGED
@@ -12,7 +12,6 @@ export function req(conf) {
12
12
  success(req.responseText);
13
13
  } else {
14
14
  var text = req.responseText;
15
- if (text && /html/.test(req.getResponseHeader('content-type'))) text = makePlain(text);
16
15
  var err = new Error('Request failed: ' + req.statusText + (text ? '\n\n' + text : ''));
17
16
  err.status = req.status;
18
17
  failure(err);
@@ -32,11 +31,6 @@ export function req(conf) {
32
31
  };
33
32
  return result;
34
33
  }
35
- function makePlain(html) {
36
- var elt = document.createElement('div');
37
- elt.innerHTML = html;
38
- return elt.textContent.replace(/\n[^]*|\s+$/g, '');
39
- }
40
34
  export function GET(url) {
41
35
  return req({
42
36
  url: url,
@@ -12,8 +12,6 @@ export function req(conf) {
12
12
  success(req.responseText);
13
13
  } else {
14
14
  let text = req.responseText;
15
- if (text && /html/.test(req.getResponseHeader('content-type')))
16
- text = makePlain(text);
17
15
  let err = new Error(
18
16
  'Request failed: ' + req.statusText + (text ? '\n\n' + text : '')
19
17
  );
@@ -39,12 +37,6 @@ export function req(conf) {
39
37
  return result;
40
38
  }
41
39
 
42
- function makePlain(html) {
43
- var elt = document.createElement('div');
44
- elt.innerHTML = html;
45
- return elt.textContent.replace(/\n[^]*|\s+$/g, '');
46
- }
47
-
48
40
  export function GET(url) {
49
41
  return req({ url, method: 'GET' });
50
42
  }
@@ -1,3 +1,9 @@
1
+ function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
2
+ 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
+ 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
+ function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
5
+ function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
6
+ 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; }
1
7
  export default function throttle(fn, threshhold, context) {
2
8
  var last;
3
9
  var deferTimer;
@@ -10,11 +16,11 @@ export default function throttle(fn, threshhold, context) {
10
16
  clearTimeout(deferTimer);
11
17
  deferTimer = setTimeout(function () {
12
18
  last = now;
13
- boundFn.apply(null, args);
19
+ boundFn.apply(void 0, _toConsumableArray(args));
14
20
  }, threshhold);
15
21
  } else {
16
22
  last = now;
17
- boundFn.apply(null, args);
23
+ boundFn.apply(void 0, _toConsumableArray(args));
18
24
  }
19
25
  };
20
26
  }
@@ -17,11 +17,11 @@ export default function throttle(
17
17
  clearTimeout(deferTimer);
18
18
  deferTimer = setTimeout(() => {
19
19
  last = now;
20
- boundFn.apply(null, args);
20
+ boundFn(...args);
21
21
  }, threshhold);
22
22
  } else {
23
23
  last = now;
24
- boundFn.apply(null, args);
24
+ boundFn(...args);
25
25
  }
26
26
  };
27
27
  }
@@ -1,7 +1,5 @@
1
- import { Schema } from 'prosemirror-model';
2
- import { DOMParser } from 'prosemirror-model';
3
- import { EditorState } from 'prosemirror-state';
4
- import { Plugin } from 'prosemirror-state';
1
+ import { DOMParser, Schema } from 'prosemirror-model';
2
+ import { EditorState, Plugin } from 'prosemirror-state';
5
3
  import { getAttrs } from './DocNodeSpec.js';
6
4
  import EditorPlugins from './EditorPlugins.js';
7
5
  import EditorSchema from './EditorSchema.js';
@@ -1,10 +1,7 @@
1
1
  // @flow
2
2
 
3
- import { Schema } from 'prosemirror-model';
4
- import { DOMParser } from 'prosemirror-model';
5
- import { EditorState } from 'prosemirror-state';
6
- import { Plugin } from 'prosemirror-state';
7
-
3
+ import { DOMParser, Schema } from 'prosemirror-model';
4
+ import { EditorState, Plugin } from 'prosemirror-state';
8
5
  import { getAttrs } from './DocNodeSpec.js';
9
6
  import EditorPlugins from './EditorPlugins.js';
10
7
  import EditorSchema from './EditorSchema.js';
@@ -1,9 +1,8 @@
1
1
  import { Schema } from 'prosemirror-model';
2
- import { EditorState } from 'prosemirror-state';
3
- import { Plugin } from 'prosemirror-state';
2
+ import { EditorState, Plugin } from 'prosemirror-state';
4
3
  import convertFromDOMElement from './convertFromDOMElement.js';
5
4
  export default function convertFromHTML(html, schema, plugins) {
6
5
  var root = document.createElement('html');
7
- root.innerHTML = html ? html : ' ';
6
+ root.innerHTML = html || ' ';
8
7
  return convertFromDOMElement(root, schema, plugins);
9
8
  }
@@ -1,9 +1,7 @@
1
1
  // @flow
2
2
 
3
3
  import { Schema } from 'prosemirror-model';
4
- import { EditorState } from 'prosemirror-state';
5
- import { Plugin } from 'prosemirror-state';
6
-
4
+ import { EditorState, Plugin } from 'prosemirror-state';
7
5
  import convertFromDOMElement from './convertFromDOMElement.js';
8
6
 
9
7
  export default function convertFromHTML(
@@ -12,6 +10,6 @@ export default function convertFromHTML(
12
10
  plugins: Array<Plugin>
13
11
  ): EditorState {
14
12
  const root = document.createElement('html');
15
- root.innerHTML = html ? html : ' ';
13
+ root.innerHTML = html || ' ';
16
14
  return convertFromDOMElement(root, schema, plugins);
17
15
  }
@@ -1,7 +1,6 @@
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
  import { Schema } from 'prosemirror-model';
3
- import { EditorState } from 'prosemirror-state';
4
- import { Plugin } from 'prosemirror-state';
3
+ import { EditorState, Plugin } from 'prosemirror-state';
5
4
  import createEmptyEditorState from './createEmptyEditorState.js';
6
5
  export default function convertFromJSON(json, schema, defaultSchema, effectivePlugins) {
7
6
  var editorSchema = schema || defaultSchema;
@@ -1,8 +1,7 @@
1
1
  // @flow
2
2
 
3
3
  import { Schema } from 'prosemirror-model';
4
- import { EditorState } from 'prosemirror-state';
5
- import { Plugin } from 'prosemirror-state';
4
+ import { EditorState, Plugin } from 'prosemirror-state';
6
5
  import createEmptyEditorState from './createEmptyEditorState.js';
7
6
 
8
7
  export default function convertFromJSON(
@@ -1,18 +1,14 @@
1
- var SIZE_PATTERN = /([\d\.]+)(px|pt)/i;
2
1
  export var PX_TO_PT_RATIO = 0.75292857;
3
2
  export var PT_TO_PX_RATIO = 1 / PX_TO_PT_RATIO;
4
3
  export default function convertToCSSPTValue(styleValue) {
5
- var matches = styleValue.match(SIZE_PATTERN);
6
- if (!matches) {
7
- return 0;
8
- }
9
- var value = parseFloat(matches[1]);
10
- var unit = matches[2];
11
- if (!value || !unit) {
4
+ var unit = styleValue.slice(-2).toLowerCase(); // Extract the last two characters for the unit
5
+ var value = Number(styleValue.slice(0, -2)); // Extract and convert the number part
6
+
7
+ if (!value || unit !== 'px' && unit !== 'pt') {
12
8
  return 0;
13
9
  }
14
10
  if (unit === 'px') {
15
- value = PX_TO_PT_RATIO * value;
11
+ return PX_TO_PT_RATIO * value;
16
12
  }
17
- return value;
13
+ return value; // If 'pt', return the value unchanged
18
14
  }
@@ -1,22 +1,19 @@
1
1
  // @flow
2
2
 
3
- const SIZE_PATTERN = /([\d\.]+)(px|pt)/i;
4
-
5
3
  export const PX_TO_PT_RATIO = 0.75292857;
6
4
  export const PT_TO_PX_RATIO = 1 / PX_TO_PT_RATIO;
7
5
 
8
6
  export default function convertToCSSPTValue(styleValue: string): number {
9
- const matches = styleValue.match(SIZE_PATTERN);
10
- if (!matches) {
11
- return 0;
12
- }
13
- let value = parseFloat(matches[1]);
14
- const unit = matches[2];
15
- if (!value || !unit) {
7
+ const unit = styleValue.slice(-2).toLowerCase(); // Extract the last two characters for the unit
8
+ const value = Number(styleValue.slice(0, -2)); // Extract and convert the number part
9
+
10
+ if (!value || (unit !== 'px' && unit !== 'pt')) {
16
11
  return 0;
17
12
  }
13
+
18
14
  if (unit === 'px') {
19
- value = PX_TO_PT_RATIO * value;
15
+ return PX_TO_PT_RATIO * value;
20
16
  }
21
- return value;
17
+
18
+ return value; // If 'pt', return the value unchanged
22
19
  }
package/createCommand.js CHANGED
@@ -1,15 +1,15 @@
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
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
3
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
4
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
2
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
3
+ 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); } }
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 _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
6
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
7
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
6
+ function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
7
+ function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
8
8
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
9
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
10
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
11
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
12
- 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; }
9
+ function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
10
+ function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
11
+ function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
12
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
13
13
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
14
14
  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); }
15
15
  import { EditorState } from 'prosemirror-state';
@@ -1,5 +1,5 @@
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
- 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; }
2
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
3
3
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
4
4
  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); }
5
5
  import { EditorState } from 'prosemirror-state';
@@ -1,6 +1,5 @@
1
1
  import { Schema } from 'prosemirror-model';
2
- import { EditorState } from 'prosemirror-state';
3
- import { Plugin } from 'prosemirror-state';
2
+ import { EditorState, Plugin } from 'prosemirror-state';
4
3
  import convertFromJSON from './convertFromJSON.js';
5
4
  import EditorSchema from './EditorSchema.js';
6
5
  export var EMPTY_DOC_JSON = {
@@ -12,5 +11,5 @@ export var EMPTY_DOC_JSON = {
12
11
  };
13
12
  export default function createEmptyEditorState(schema, defaultSchema, plugins) {
14
13
  // TODO: Check if schema support doc and paragraph nodes.
15
- return convertFromJSON(EMPTY_DOC_JSON, schema, defaultSchema ? defaultSchema : EditorSchema, plugins);
14
+ return convertFromJSON(EMPTY_DOC_JSON, schema, defaultSchema || EditorSchema, plugins);
16
15
  }
@@ -1,9 +1,7 @@
1
1
  // @flow
2
2
 
3
3
  import { Schema } from 'prosemirror-model';
4
- import { EditorState } from 'prosemirror-state';
5
- import { Plugin } from 'prosemirror-state';
6
-
4
+ import { EditorState, Plugin } from 'prosemirror-state';
7
5
  import convertFromJSON from './convertFromJSON.js';
8
6
  import EditorSchema from './EditorSchema.js';
9
7
 
@@ -25,7 +23,7 @@ export default function createEmptyEditorState(
25
23
  return convertFromJSON(
26
24
  EMPTY_DOC_JSON,
27
25
  schema,
28
- defaultSchema ? defaultSchema : EditorSchema,
26
+ defaultSchema || EditorSchema,
29
27
  plugins
30
28
  );
31
29
  }
@@ -7,7 +7,7 @@ var TABLE_VIEW = undefined;
7
7
  var TABLE_LAST_COLUMN_RESIZABLE = false;
8
8
  function lookUpTableWrapper(event) {
9
9
  var target = event.target;
10
- if (!target || !target.closest) {
10
+ if (!(target !== null && target !== void 0 && target.closest)) {
11
11
  return null;
12
12
  }
13
13
  return target.closest('.tableWrapper');
@@ -39,15 +39,15 @@ export default function createTableResizingPlugin() {
39
39
 
40
40
  // https://github.com/ProseMirror/prosemirror-tables/blob/master/src/columnresizing.js
41
41
  var plugin = columnResizing(TABLE_HANDLE_WIDTH, TABLE_CELL_MINWIDTH, TABLE_VIEW, TABLE_LAST_COLUMN_RESIZABLE);
42
- var captureMouse = function captureMouse(event) {
42
+ var _captureMouse = function captureMouse(event) {
43
43
  if (event.clientX > maxClientX) {
44
44
  // Current mouse event will make table too wide. Stop it and
45
45
  // fires a simulated event instead.
46
46
  event.stopImmediatePropagation();
47
47
  dispatchMouseEvent(event.type, maxClientX);
48
48
  } else if (event.type === 'mouseup') {
49
- window.removeEventListener('mousemove', captureMouse, true);
50
- window.removeEventListener('mouseup', captureMouse, true);
49
+ window.removeEventListener('mousemove', _captureMouse, true);
50
+ window.removeEventListener('mouseup', _captureMouse, true);
51
51
  }
52
52
  };
53
53
  var _mousedown = plugin.props.handleDOMEvents.mousedown;
@@ -58,8 +58,8 @@ export default function createTableResizingPlugin() {
58
58
  mousedown: function mousedown(view, event) {
59
59
  var targetTable = lookUpTableWrapper(event);
60
60
  maxClientX = targetTable ? calculateMaxClientX(event, targetTable) : Number.MAX_VALUE;
61
- window.addEventListener('mousemove', captureMouse, true);
62
- window.addEventListener('mouseup', captureMouse, true);
61
+ window.addEventListener('mousemove', _captureMouse, true);
62
+ window.addEventListener('mouseup', _captureMouse, true);
63
63
  _mousedown(view, event);
64
64
  return false;
65
65
  }
@@ -11,7 +11,7 @@ const TABLE_LAST_COLUMN_RESIZABLE = false;
11
11
 
12
12
  function lookUpTableWrapper(event: Event): ?HTMLElement {
13
13
  const target: any = event.target;
14
- if (!target || !target.closest) {
14
+ if (!target?.closest) {
15
15
  return null;
16
16
  }
17
17
  return target.closest('.tableWrapper');
package/findActiveMark.js CHANGED
@@ -11,7 +11,7 @@ export default function findActiveMark(doc, from, to, markType) {
11
11
  to = Math.min(to, doc.nodeSize - 2);
12
12
  while (ii <= to) {
13
13
  var node = doc.nodeAt(ii);
14
- if (!node || !node.marks) {
14
+ if (!(node !== null && node !== void 0 && node.marks)) {
15
15
  ii++;
16
16
  continue;
17
17
  }
@@ -18,7 +18,7 @@ export default function findActiveMark(
18
18
 
19
19
  while (ii <= to) {
20
20
  const node = doc.nodeAt(ii);
21
- if (!node || !node.marks) {
21
+ if (!node?.marks) {
22
22
  ii++;
23
23
  continue;
24
24
  }
package/insertTable.js CHANGED
@@ -2,9 +2,6 @@ import { Fragment, Schema } from 'prosemirror-model';
2
2
  import { TextSelection } from 'prosemirror-state';
3
3
  import { Transform } from 'prosemirror-transform';
4
4
  import { PARAGRAPH, TABLE, TABLE_CELL, TABLE_ROW } from './NodeNames.js';
5
-
6
- // const ZERO_WIDTH_SPACE_CHAR = '\u200b';
7
-
8
5
  export default function insertTable(tr, schema, rows, cols) {
9
6
  if (!tr.selection || !tr.doc) {
10
7
  return tr;
@@ -6,8 +6,6 @@ import { Transform } from 'prosemirror-transform';
6
6
 
7
7
  import { PARAGRAPH, TABLE, TABLE_CELL, TABLE_ROW } from './NodeNames.js';
8
8
 
9
- // const ZERO_WIDTH_SPACE_CHAR = '\u200b';
10
-
11
9
  export default function insertTable(
12
10
  tr: Transform,
13
11
  schema: Schema,
package/joinDown.js CHANGED
@@ -1,8 +1,6 @@
1
1
  // https://github.com/ProseMirror/prosemirror-commands/blob/master/src/commands.js
2
2
  import { NodeSelection } from 'prosemirror-state';
3
- import { Transform } from 'prosemirror-transform';
4
- import { canJoin } from 'prosemirror-transform';
5
- import { joinPoint } from 'prosemirror-transform';
3
+ import { Transform, canJoin, joinPoint } from 'prosemirror-transform';
6
4
 
7
5
  // Join the selected block, or the closest ancestor of the selection
8
6
  // that can be joined, with the sibling after it.
package/joinDown.js.flow CHANGED
@@ -2,9 +2,7 @@
2
2
  // https://github.com/ProseMirror/prosemirror-commands/blob/master/src/commands.js
3
3
 
4
4
  import { NodeSelection } from 'prosemirror-state';
5
- import { Transform } from 'prosemirror-transform';
6
- import { canJoin } from 'prosemirror-transform';
7
- import { joinPoint } from 'prosemirror-transform';
5
+ import { Transform , canJoin, joinPoint} from 'prosemirror-transform';
8
6
 
9
7
  // Join the selected block, or the closest ancestor of the selection
10
8
  // that can be joined, with the sibling after it.
package/joinUp.js CHANGED
@@ -1,8 +1,6 @@
1
1
  // https://github.com/ProseMirror/prosemirror-commands/blob/master/src/commands.js
2
2
  import { NodeSelection } from 'prosemirror-state';
3
- import { Transform } from 'prosemirror-transform';
4
- import { canJoin } from 'prosemirror-transform';
5
- import { joinPoint } from 'prosemirror-transform';
3
+ import { Transform, canJoin, joinPoint } from 'prosemirror-transform';
6
4
 
7
5
  // Join the selected block or, if there is a text selection, the
8
6
  // closest ancestor block of the selection that can be joined, with
package/joinUp.js.flow CHANGED
@@ -2,9 +2,7 @@
2
2
  // https://github.com/ProseMirror/prosemirror-commands/blob/master/src/commands.js
3
3
 
4
4
  import { NodeSelection } from 'prosemirror-state';
5
- import { Transform } from 'prosemirror-transform';
6
- import { canJoin } from 'prosemirror-transform';
7
- import { joinPoint } from 'prosemirror-transform';
5
+ import { Transform, canJoin, joinPoint } from 'prosemirror-transform';
8
6
 
9
7
  // Join the selected block or, if there is a text selection, the
10
8
  // closest ancestor block of the selection that can be joined, with
package/lookUpElement.js CHANGED
@@ -1,5 +1,6 @@
1
1
  export default function lookUpElement(el, predict) {
2
- while (el && el.nodeName) {
2
+ while ((_el = el) !== null && _el !== void 0 && _el.nodeName) {
3
+ var _el;
3
4
  if (predict(el)) {
4
5
  return el;
5
6
  }
@@ -4,7 +4,7 @@ export default function lookUpElement(
4
4
  el: ?Element,
5
5
  predict: (el: Element) => boolean
6
6
  ): ?Element {
7
- while (el && el.nodeName) {
7
+ while (el?.nodeName) {
8
8
  if (predict(el)) {
9
9
  return el;
10
10
  }
package/normalizeHTML.js CHANGED
@@ -13,7 +13,7 @@ var LONG_UNDERLINE_PATTERN = /_+/g;
13
13
 
14
14
  // This is a workround to convert "&nbsp;&nbsp;......&nbsp;" into wider tab
15
15
  // tab spacers. For every 6 "&nbsp;", they will be converted into tab spacers.
16
- var LONG_TAB_SPACE_PATTERN = /(\&nbsp;){6}/g;
16
+ var LONG_TAB_SPACE_PATTERN = /(&nbsp;){6}/g;
17
17
  var TAB_SPACER_HTML = new Array(6).join("<span ".concat(DOM_ATTRIBUTE_SIZE, "=\"").concat(SPACER_SIZE_TAB, "\">").concat(HAIR_SPACE_CHAR, "</span>"));
18
18
  function replaceNOBR(matched) {
19
19
  // This is a workround to convert "_______" into none-wrapped text
@@ -31,6 +31,8 @@ export default function normalizeHTML(html) {
31
31
 
32
32
  // Convert every two consecutive "&nbsp;" into a spacer tab.
33
33
  html = html.replace(LONG_TAB_SPACE_PATTERN, TAB_SPACER_HTML);
34
+ // fix for jspdf copy paste text, from jspdf its always getting transparent
35
+ html = html.replace(/color:\s*transparent;/g, 'color: black;');
34
36
  var doc = toSafeHTMLDocument(html);
35
37
  if (doc) {
36
38
  // styles.