@modusoperandi/licit 1.0.5 → 1.0.8

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 (253) 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 -18
  10. package/ContentPlaceholderPlugin.js.flow +10 -14
  11. package/CursorPlaceholderPlugin.js +8 -9
  12. package/CursorPlaceholderPlugin.js.flow +0 -2
  13. package/DocLayoutCommand.js +10 -12
  14. package/DocLayoutCommand.js.flow +1 -3
  15. package/EditorKeyMap.js +0 -1
  16. package/EditorKeyMap.js.flow +0 -2
  17. package/EditorMarks.js +1 -1
  18. package/EditorNodes.js +1 -2
  19. package/EditorNodes.js.flow +0 -1
  20. package/EditorPageLayoutPlugin.js +8 -8
  21. package/FontTypeMarkSpec.js +1 -1
  22. package/FontTypeMarkSpec.js.flow +1 -1
  23. package/HTMLMutator.js +6 -7
  24. package/HTMLMutator.js.flow +2 -3
  25. package/HeadingNodeSpec.js +2 -12
  26. package/HeadingNodeSpec.js.flow +4 -14
  27. package/HistoryRedoCommand.js +9 -9
  28. package/HistoryUndoCommand.js +9 -9
  29. package/HorizontalRuleCommand.js +9 -9
  30. package/ImageUploadPlaceholderPlugin.js +14 -18
  31. package/ImageUploadPlaceholderPlugin.js.flow +6 -11
  32. package/LinkMarkSpec.js +6 -1
  33. package/LinkMarkSpec.js.flow +5 -0
  34. package/LinkSetURLCommand.js +126 -55
  35. package/LinkSetURLCommand.js.flow +61 -37
  36. package/LinkTooltipPlugin.js +119 -31
  37. package/LinkTooltipPlugin.js.flow +91 -22
  38. package/ListItemInsertNewLineCommand.js +10 -11
  39. package/ListItemInsertNewLineCommand.js.flow +1 -2
  40. package/ListItemMergeCommand.js +17 -16
  41. package/ListItemMergeCommand.js.flow +4 -6
  42. package/ListSplitCommand.js +9 -9
  43. package/ListToggleCommand.js +9 -9
  44. package/MarksClearCommand.js +9 -9
  45. package/MathEditCommand.js +10 -11
  46. package/MathEditCommand.js.flow +1 -2
  47. package/OrderedListNodeSpec.js +1 -1
  48. package/ParagraphNodeSpec.js +11 -2
  49. package/ParagraphNodeSpec.js.flow +9 -2
  50. package/ParagraphSpacingCommand.js +13 -14
  51. package/ParagraphSpacingCommand.js.flow +4 -9
  52. package/PrintCommand.js +9 -9
  53. package/SelectionPlaceholderPlugin.js +8 -9
  54. package/SelectionPlaceholderPlugin.js.flow +0 -2
  55. package/SpacerMarkSpec.js +1 -1
  56. package/StyleView.js +3 -4
  57. package/StyleView.js.flow +0 -1
  58. package/TableBackgroundColorCommand.js +13 -16
  59. package/TableBackgroundColorCommand.js.flow +14 -18
  60. package/TableBorderColorCommand.js +13 -16
  61. package/TableBorderColorCommand.js.flow +14 -20
  62. package/TableCellColorCommand.js +11 -13
  63. package/TableCellColorCommand.js.flow +2 -4
  64. package/TableCellMenuPlugin.js +16 -16
  65. package/TableCellMenuPlugin.js.flow +5 -8
  66. package/TableInsertCommand.js +12 -15
  67. package/TableInsertCommand.js.flow +3 -6
  68. package/TableMergeCellsCommand.js +13 -12
  69. package/TableMergeCellsCommand.js.flow +4 -3
  70. package/TableNodesSpecs.js +4 -2
  71. package/TableNodesSpecs.js.flow +4 -2
  72. package/TableResizePlugin.js +18 -18
  73. package/TableResizePlugin.js.flow +2 -3
  74. package/TextInsertTabSpaceCommand.js +9 -9
  75. package/Types.js +1 -0
  76. package/Types.js.flow +2 -5
  77. package/WebFontLoader.js +4 -4
  78. package/bom.xml +20047 -28206
  79. package/buildEditorPlugins.js +4 -4
  80. package/buildInputRules.js +8 -4
  81. package/buildInputRules.js.flow +8 -4
  82. package/client/CollabConnector.js +9 -9
  83. package/client/EditorConnection.js +8 -6
  84. package/client/EditorConnection.js.flow +3 -2
  85. package/client/Licit.js +22 -59
  86. package/client/Licit.js.flow +12 -45
  87. package/client/Licit.test.js +49 -39
  88. package/client/Licit.test.js.flow +40 -34
  89. package/client/Reporter.js +3 -3
  90. package/client/SimpleConnector.js +4 -4
  91. package/client/http.js +0 -6
  92. package/client/http.js.flow +0 -8
  93. package/client/throttle.js +8 -2
  94. package/client/throttle.js.flow +2 -2
  95. package/convertFromDOMElement.js +2 -4
  96. package/convertFromDOMElement.js.flow +2 -5
  97. package/convertFromHTML.js +2 -3
  98. package/convertFromHTML.js.flow +2 -4
  99. package/convertFromJSON.js +1 -2
  100. package/convertFromJSON.js.flow +1 -2
  101. package/convertToCSSPTValue.js +6 -10
  102. package/convertToCSSPTValue.js.flow +8 -11
  103. package/createCommand.js +9 -9
  104. package/createEditorKeyMap.js +1 -1
  105. package/createEmptyEditorState.js +2 -3
  106. package/createEmptyEditorState.js.flow +2 -4
  107. package/createTableResizingPlugin.js +6 -6
  108. package/createTableResizingPlugin.js.flow +1 -1
  109. package/findActiveMark.js +1 -1
  110. package/findActiveMark.js.flow +1 -1
  111. package/insertTable.js +0 -3
  112. package/insertTable.js.flow +0 -2
  113. package/joinDown.js +1 -3
  114. package/joinDown.js.flow +1 -3
  115. package/joinUp.js +1 -3
  116. package/joinUp.js.flow +1 -3
  117. package/lookUpElement.js +2 -1
  118. package/lookUpElement.js.flow +1 -1
  119. package/normalizeHTML.js +3 -1
  120. package/normalizeHTML.js.flow +3 -1
  121. package/package.json +23 -17
  122. package/patchAnchorElements.js +1 -1
  123. package/patchAnchorElements.js.flow +1 -1
  124. package/patchBreakElements.js +3 -2
  125. package/patchBreakElements.js.flow +2 -2
  126. package/patchElementInlineStyles.js +1 -1
  127. package/patchElementInlineStyles.js.flow +1 -1
  128. package/patchListElements.js +6 -7
  129. package/patchListElements.js.flow +7 -8
  130. package/patchMathElements.js +5 -7
  131. package/patchMathElements.js.flow +2 -4
  132. package/patchStyleElements.js +1 -1
  133. package/patchStyleElements.js.flow +7 -6
  134. package/patchTableElements.js +2 -3
  135. package/patchTableElements.js.flow +2 -3
  136. package/sanitizeURL.js +1 -1
  137. package/sanitizeURL.js.flow +1 -1
  138. package/splitListItem.js +2 -2
  139. package/splitListItem.js.flow +1 -1
  140. package/styles.css +32 -3
  141. package/toggleBlockquote.js +4 -5
  142. package/toggleBlockquote.js.flow +5 -12
  143. package/toggleCodeBlock.js +6 -6
  144. package/toggleCodeBlock.js.flow +10 -10
  145. package/ui/AlertInfo.js +9 -10
  146. package/ui/AlertInfo.js.flow +0 -1
  147. package/ui/BookmarkNodeView.js +13 -13
  148. package/ui/BookmarkNodeView.js.flow +0 -2
  149. package/ui/CommandButton.js +9 -9
  150. package/ui/CommandMenu.js +12 -12
  151. package/ui/CommandMenu.js.flow +1 -1
  152. package/ui/CommandMenuButton.js +11 -13
  153. package/ui/CommandMenuButton.js.flow +2 -5
  154. package/ui/CustomEditorView.js +13 -12
  155. package/ui/CustomEditorView.js.flow +1 -0
  156. package/ui/CustomMenu.js +8 -10
  157. package/ui/CustomMenu.js.flow +0 -3
  158. package/ui/CustomMenuItem.js +10 -11
  159. package/ui/CustomMenuItem.js.flow +0 -1
  160. package/ui/CustomNodeView.js +27 -16
  161. package/ui/CustomNodeView.js.flow +16 -9
  162. package/ui/CustomRadioButton.js +13 -16
  163. package/ui/CustomRadioButton.js.flow +2 -4
  164. package/ui/DocLayoutEditor.js +10 -13
  165. package/ui/DocLayoutEditor.js.flow +1 -5
  166. package/ui/Editor.js +16 -16
  167. package/ui/Editor.js.flow +7 -12
  168. package/ui/EditorFrameset.js +9 -10
  169. package/ui/EditorFrameset.js.flow +0 -2
  170. package/ui/EditorToolbar.js +24 -30
  171. package/ui/EditorToolbar.js.flow +22 -43
  172. package/ui/EditorToolbarConfig.js +5 -5
  173. package/ui/EditorToolbarConfig.js.flow +1 -1
  174. package/ui/FontSizeCommandMenuButton.js +10 -10
  175. package/ui/FontSizeCommandMenuButton.js.flow +1 -1
  176. package/ui/FontTypeCommandMenuButton.js +11 -12
  177. package/ui/FontTypeCommandMenuButton.js.flow +4 -5
  178. package/ui/Frag.js +8 -9
  179. package/ui/Frag.js.flow +0 -2
  180. package/ui/Icon.js +12 -18
  181. package/ui/Icon.js.flow +0 -7
  182. package/ui/ImageInlineEditor.js +9 -10
  183. package/ui/ImageInlineEditor.js.flow +0 -1
  184. package/ui/LinkTooltip.js +62 -28
  185. package/ui/LinkTooltip.js.flow +55 -24
  186. package/ui/LinkURLEditor.js +151 -36
  187. package/ui/LinkURLEditor.js.flow +176 -54
  188. package/ui/ListItemNodeView.js +4 -4
  189. package/ui/ListTypeButton.js +11 -15
  190. package/ui/ListTypeButton.js.flow +2 -6
  191. package/ui/ListTypeCommandButton.js +10 -10
  192. package/ui/ListTypeCommandButton.js.flow +1 -1
  193. package/ui/ListTypeMenu.js +11 -12
  194. package/ui/ListTypeMenu.js.flow +1 -2
  195. package/ui/LoadingIndicator.js +8 -9
  196. package/ui/LoadingIndicator.js.flow +0 -1
  197. package/ui/MathEditor.js +10 -15
  198. package/ui/MathEditor.js.flow +1 -9
  199. package/ui/MathInlineEditor.js +13 -14
  200. package/ui/MathInlineEditor.js.flow +3 -5
  201. package/ui/MathNodeView.js +16 -16
  202. package/ui/MathNodeView.js.flow +10 -21
  203. package/ui/PasteMenu.js +11 -15
  204. package/ui/PasteMenu.js.flow +0 -5
  205. package/ui/ResizeObserver.js +4 -4
  206. package/ui/ResizeObserver.js.flow +3 -4
  207. package/ui/RichTextEditor.js +9 -9
  208. package/ui/SelectionObserver.js +6 -6
  209. package/ui/SelectionObserver.js.flow +2 -2
  210. package/ui/TableCellMenu.js +9 -10
  211. package/ui/TableCellMenu.js.flow +0 -2
  212. package/ui/TableGridSizeEditor.js +12 -15
  213. package/ui/TableGridSizeEditor.js.flow +7 -6
  214. package/ui/TableNodeView.js +15 -13
  215. package/ui/TableNodeView.js.flow +3 -3
  216. package/ui/bindScrollHandler.js +2 -1
  217. package/ui/bindScrollHandler.js.flow +1 -1
  218. package/ui/canUseCSSFont.js +5 -4
  219. package/ui/canUseCSSFont.js.flow +4 -5
  220. package/ui/czi-editor.css +1 -4
  221. package/ui/czi-form.css +102 -8
  222. package/ui/czi-image-view.css +1 -5
  223. package/ui/czi-link-tooltip.css +41 -0
  224. package/ui/czi-list.css +0 -4
  225. package/ui/czi-loading-indicator.css +1 -46
  226. package/ui/czi-table-cell-menu.css +3 -1
  227. package/ui/findActiveFontSize.js +2 -1
  228. package/ui/findActiveFontSize.js.flow +1 -4
  229. package/ui/findActiveFontType.js +4 -3
  230. package/ui/findActiveFontType.js.flow +3 -6
  231. package/ui/handleEditorDrop.js +1 -1
  232. package/ui/handleEditorDrop.js.flow +1 -1
  233. package/ui/handleEditorKeyDown.js +1 -1
  234. package/ui/handleEditorKeyDown.js.flow +1 -1
  235. package/ui/handleEditorPaste.js +1 -1
  236. package/ui/handleEditorPaste.js.flow +1 -1
  237. package/ui/injectStyleSheet.js +2 -2
  238. package/ui/injectStyleSheet.js.flow +2 -4
  239. package/ui/isElementFullyVisible.js +1 -10
  240. package/ui/isElementFullyVisible.js.flow +1 -13
  241. package/ui/mathquill-editor/MathQuillEditor.js +12 -14
  242. package/ui/mathquill-editor/MathQuillEditor.js.flow +0 -2
  243. package/ui/mathquill-editor/MathQuillEditorSymbolsPanel.js +9 -10
  244. package/ui/mathquill-editor/MathQuillEditorSymbolsPanel.js.flow +0 -1
  245. package/ui/mathquill-editor/mathquill-import-kludge.js +1 -9
  246. package/ui/mathquill-editor/mathquill-import-kludge.js.flow +0 -9
  247. package/ui/renderLaTeXAsHTML.js +3 -7
  248. package/ui/renderLaTeXAsHTML.js.flow +0 -4
  249. package/ui/resolveImage.js +4 -5
  250. package/ui/resolveImage.js.flow +3 -5
  251. package/ui/toCSSLineSpacing.js +2 -3
  252. package/ui/toCSSLineSpacing.js.flow +2 -4
  253. package/styles0.css +0 -29
@@ -20,7 +20,7 @@ const LONG_UNDERLINE_PATTERN = /_+/g;
20
20
 
21
21
  // This is a workround to convert "  ...... " into wider tab
22
22
  // tab spacers. For every 6 " ", they will be converted into tab spacers.
23
- const LONG_TAB_SPACE_PATTERN = /(\ ){6}/g;
23
+ const LONG_TAB_SPACE_PATTERN = /( ){6}/g;
24
24
 
25
25
  const TAB_SPACER_HTML = new Array(6).join(
26
26
  `<span ${DOM_ATTRIBUTE_SIZE}="${SPACER_SIZE_TAB}">${HAIR_SPACE_CHAR}</span>`
@@ -44,6 +44,8 @@ export default function normalizeHTML(html: string): string {
44
44
 
45
45
  // Convert every two consecutive "&nbsp;" into a spacer tab.
46
46
  html = html.replace(LONG_TAB_SPACE_PATTERN, TAB_SPACER_HTML);
47
+ // fix for jspdf copy paste text, from jspdf its always getting transparent
48
+ html = html.replace(/color:\s*transparent;/g, 'color: black;');
47
49
  const doc = toSafeHTMLDocument(html);
48
50
  if (doc) {
49
51
  // styles.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modusoperandi/licit",
3
- "version": "1.0.5",
3
+ "version": "1.0.8",
4
4
  "type": "module",
5
5
  "subversion": "1",
6
6
  "description": "Rich text editor built with React and ProseMirror",
@@ -27,11 +27,12 @@
27
27
  "ci:build": "npm run build:clean && npm run build:babel && npm run build:flow && npm run build:css && npm run build:fonts && npm run build:bom && copyfiles --up 1 \"src/**/*.d.ts\" dist/ && copyfiles --up 1 \"src/**/*.css\" dist && copyfiles package.json dist",
28
28
  "flow": "flow --show-all-errors",
29
29
  "lint:css": "stylelint \"**/*.css\"",
30
- "lint:js": "eslint \"src/**/*.js\" \"licit/**/*.js\"",
30
+ "lint:js": "eslint \"src/**/*.js\"",
31
31
  "lint": "npm run lint:css & npm run lint:js",
32
32
  "start": "node scripts/webserver.js",
33
33
  "prebuild:style-service-docker": "node utils/build_customstyle_server.js",
34
- "build:style-service-docker": "docker build . -f style-service.Dockerfile -t style-service:latest"
34
+ "build:style-service-docker": "docker build . -f style-service.Dockerfile -t style-service:latest",
35
+ "verify": "npm run lint -- --fix && npm run ci:build && npm run test:coverage && echo 'All Tests Passed!'"
35
36
  },
36
37
  "devDependencies": {
37
38
  "@babel/cli": "^7.19.3",
@@ -60,34 +61,41 @@
60
61
  "babel-loader": "^9.1.3",
61
62
  "babel-plugin-flow-react-proptypes": "^26.0.0",
62
63
  "babel-plugin-transform-react-remove-prop-types": "^0.4.24",
64
+ "body-parser": "^1.19.0",
63
65
  "clean-webpack-plugin": "^4.0.0",
64
66
  "copy-webpack-plugin": "^12.0.2",
65
- "css-loader": "^7.1.1",
66
67
  "copyfiles": "^2.4.1",
67
- "enzyme": "^3.11.0",
68
- "eslint": "^8.57.0",
68
+ "cors": "^2.8.5",
69
+ "css-loader": "^7.1.1",
70
+ "eslint": "^8.0.0",
69
71
  "eslint-config-prettier": "^9.0.0",
70
72
  "eslint-plugin-jest": "^28.2.0",
71
73
  "eslint-plugin-prettier": "^5.1.3",
72
74
  "eslint-plugin-react": "^7.33.2",
73
75
  "exports-loader": "^5.0.0",
76
+ "express": "^4.17.1",
74
77
  "file-loader": "^6.2.0",
75
- "flow-bin": "^0.234.0",
78
+ "flow-bin": "^0.254.2",
76
79
  "flow-copy-source": "^2.0.9",
80
+ "flow-typed": "^4.0.0",
77
81
  "flow-webpack-plugin": "^1.2.0",
82
+ "formidable": "^3.5.1",
78
83
  "html-loader": "^5.0.0",
79
84
  "html-webpack-inline-source-plugin": "1.0.0-beta.2",
80
85
  "html-webpack-plugin": "^5.5.0",
81
86
  "husky": "^9.0.10",
82
87
  "identity-obj-proxy": "^3.0.0",
88
+ "invariant": "^2.2.4",
83
89
  "jest": "^29.2.0",
84
90
  "jest-environment-jsdom": "^29.3.1",
85
91
  "jest-junit": "^16.0.0",
86
- "jest-prosemirror": "^2.1.5",
92
+ "jest-prosemirror": "^3.0.0",
87
93
  "jest-sonar-reporter": "^2.0.0",
88
94
  "lint-staged": "^15.2.2",
89
95
  "mkdirp": "^3.0.1",
96
+ "mv": "^2.1.1",
90
97
  "prettier": "^3.2.5",
98
+ "style-loader": "^4.0.0",
91
99
  "stylelint": "^16.2.1",
92
100
  "stylelint-config-standard": "^36.0.0",
93
101
  "stylelint-prettier": "^5.0.0",
@@ -95,29 +103,24 @@
95
103
  "ts-jest": "^29.1.2",
96
104
  "ts-loader": "^9.5.0",
97
105
  "ts-node": "^10.9.2",
106
+ "typescript": "5.5.4",
98
107
  "webpack": "^5.74.0",
99
108
  "webpack-cli": "^5.1.4",
100
109
  "webpack-dev-server": "^5.0.2",
101
110
  "write-file-webpack-plugin": "^4.5.1"
102
111
  },
103
112
  "dependencies": {
104
- "@cfaester/enzyme-adapter-react-18": "^0.7.1",
105
113
  "@modusoperandi/color-picker": "^1.0.1",
106
114
  "body-parser": "^1.19.0",
107
115
  "browserkeymap": "^2.0.2",
108
- "cors": "^2.8.5",
109
- "express": "^4.17.1",
110
116
  "flatted": "^3.1.0",
111
- "flow-typed": "^3.3.1",
117
+ "flow-typed": "^4.0.0",
112
118
  "formidable": "^3.5.1",
113
119
  "invariant": "^2.2.4",
114
120
  "jquery": "^3.5.1",
115
121
  "katex": "^0.16.9",
116
- "mv": "^2.1.1",
117
122
  "node-mathquill": "^0.10.2",
118
- "prosemirror-collab": "^1.3.1",
119
- "prosemirror-tables": "^1.2.5",
120
- "query-string": "^9.0.0",
123
+ "react-tooltip": "^5.28.0",
121
124
  "resize-observer-polyfill": "^1.5.1",
122
125
  "smooth-scroll-into-view-if-needed": "^2.0.2",
123
126
  "style-loader": "^4.0.0",
@@ -126,11 +129,14 @@
126
129
  },
127
130
  "peerDependencies": {
128
131
  "@modusoperandi/licit-ui-commands": "^1.0.0",
132
+ "jquery": "^3.5.1",
129
133
  "prosemirror-collab": "^1.2.2",
130
134
  "prosemirror-tables": "^1.2.5"
131
135
  },
132
136
  "overrides": {
133
- "semver": "^7.5.2"
137
+ "libxmljs2": "^1.0.0",
138
+ "react": "^18.3.1",
139
+ "react-dom": "^18.3.1"
134
140
  },
135
141
  "importSort": {
136
142
  ".js": {
@@ -15,7 +15,7 @@ function patchAnchorElement(node) {
15
15
  // <a id="t.0"></a>
16
16
  // <table class="c23">
17
17
  // and these anchor link should not be visible.
18
- var visible = node.id.indexOf('t.') !== 0;
18
+ var visible = !node.id.startsWith('t.');
19
19
  visible && node.setAttribute(ATTRIBUTE_BOOKMARK_VISIBLE, 'true');
20
20
  }
21
21
  var nextNode = node.nextElementSibling;
@@ -23,7 +23,7 @@ function patchAnchorElement(node: HTMLElement): void {
23
23
  // <a id="t.0"></a>
24
24
  // <table class="c23">
25
25
  // and these anchor link should not be visible.
26
- const visible = node.id.indexOf('t.') !== 0;
26
+ const visible = !node.id.startsWith('t.');
27
27
 
28
28
  visible && node.setAttribute(ATTRIBUTE_BOOKMARK_VISIBLE, 'true');
29
29
  }
@@ -6,15 +6,16 @@ export default function patchBreakElements(doc) {
6
6
  Array.from(doc.querySelectorAll(selector)).forEach(patchBreakElement);
7
7
  }
8
8
  function patchBreakElement(brElement) {
9
+ var _brElement$parentElem, _div$parentElement;
9
10
  var ownerDocument = brElement.ownerDocument,
10
11
  parentElement = brElement.parentElement;
11
12
  if (!ownerDocument || !parentElement) {
12
13
  return;
13
14
  }
14
- var div = brElement.parentElement && brElement.parentElement.parentElement;
15
+ var div = (_brElement$parentElem = brElement.parentElement) === null || _brElement$parentElem === void 0 ? void 0 : _brElement$parentElem.parentElement;
15
16
  if (!div) {
16
17
  return;
17
18
  }
18
19
  var pp = ownerDocument.createElement('p');
19
- div.parentElement && div.parentElement.replaceChild(pp, div);
20
+ (_div$parentElement = div.parentElement) === null || _div$parentElement === void 0 || _div$parentElement.replaceChild(pp, div);
20
21
  }
@@ -13,10 +13,10 @@ function patchBreakElement(brElement: HTMLElement): void {
13
13
  if (!ownerDocument || !parentElement) {
14
14
  return;
15
15
  }
16
- const div = brElement.parentElement && brElement.parentElement.parentElement;
16
+ const div = brElement.parentElement?.parentElement;
17
17
  if (!div) {
18
18
  return;
19
19
  }
20
20
  const pp = ownerDocument.createElement('p');
21
- div.parentElement && div.parentElement.replaceChild(pp, div);
21
+ div.parentElement?.replaceChild(pp, div);
22
22
  }
@@ -23,7 +23,7 @@ function patchBlockElement(el) {
23
23
  function patchBlockElementStyle(el, inlineStyleName) {
24
24
  var element = el;
25
25
  var elementStyle = element.style;
26
- var value = elementStyle && elementStyle[inlineStyleName];
26
+ var value = elementStyle === null || elementStyle === void 0 ? void 0 : elementStyle[inlineStyleName];
27
27
  if (inlineStyleName === 'textIndent' && value) {
28
28
  // This is the workaround to fix the issue that people with mix both
29
29
  // text-indent and margin-left together.
@@ -49,7 +49,7 @@ function patchBlockElementStyle(
49
49
  ): void {
50
50
  const element: any = el;
51
51
  const elementStyle = element.style;
52
- const value = elementStyle && elementStyle[inlineStyleName];
52
+ const value = elementStyle?.[inlineStyleName];
53
53
 
54
54
  if (inlineStyleName === 'textIndent' && value) {
55
55
  // This is the workaround to fix the issue that people with mix both
@@ -1,5 +1,4 @@
1
1
  import HTMLMutator from './HTMLMutator.js';
2
- import nullthrows from 'nullthrows';
3
2
  import uuid from './ui/uuid.js';
4
3
  import { ATTRIBUTE_LIST_STYLE_TYPE } from './ListItemNodeSpec.js';
5
4
  import { ATTRIBUTE_INDENT, EMPTY_CSS_VALUE, convertMarginLeftToIndentValue } from './ParagraphNodeSpec.js';
@@ -23,12 +22,12 @@ var CHAR_CIRCLE = "\u25CB";
23
22
  var CHAR_SQUARE = "\u25A0";
24
23
  var CHAR_BOX = "\u274F";
25
24
  var CHAR_ZERO_SPACE = "\u200B";
26
- var INLINE_NODE_NAME_PATTERN = /^(#text)|(A|SPAN|B|STRONG)$/;
25
+ var INLINE_NODE_NAME_PATTERN = /^(#text|(A|SPAN|B|STRONG))$/;
27
26
  function patchListElementsElement(listElement) {
28
27
  // If the children of `listElement` all have teh same marginLeft, assume
29
28
  // it to be indented.
30
- var marginLeft = undefined;
31
- var beforeContent = undefined;
29
+ var marginLeft;
30
+ var beforeContent;
32
31
  var parentElement = listElement.parentElement,
33
32
  children = listElement.children;
34
33
 
@@ -50,7 +49,7 @@ function patchListElementsElement(listElement) {
50
49
  if (beforeContent !== bc) {
51
50
  beforeContent = null;
52
51
  }
53
- var ml = style && style.marginLeft || '';
52
+ var ml = (style === null || style === void 0 ? void 0 : style.marginLeft) || '';
54
53
  if (marginLeft === undefined) {
55
54
  marginLeft = ml;
56
55
  }
@@ -174,8 +173,8 @@ function liftNestedListElements(doc) {
174
173
  els.forEach(function (list) {
175
174
  var indent = findIndentLevel(list);
176
175
  list.setAttribute('data-indent', String(indent));
177
- var parentListItem = nullthrows(list.parentElement);
178
- var parentList = nullthrows(parentListItem.parentElement);
176
+ var parentListItem = list === null || list === void 0 ? void 0 : list.parentElement;
177
+ var parentList = parentListItem === null || parentListItem === void 0 ? void 0 : parentListItem.parentElement;
179
178
  var parentListNodeName = parentList.nodeName.toLowerCase();
180
179
  var isLast = parentList.lastElementChild === parentListItem;
181
180
  var style = parentList.getAttribute('style') || '';
@@ -1,7 +1,6 @@
1
1
  // @flow
2
2
 
3
3
  import HTMLMutator from './HTMLMutator.js';
4
- import nullthrows from 'nullthrows';
5
4
  import uuid from './ui/uuid.js';
6
5
 
7
6
  import { ATTRIBUTE_LIST_STYLE_TYPE } from './ListItemNodeSpec.js';
@@ -34,13 +33,13 @@ const CHAR_CIRCLE = '\u25cb';
34
33
  const CHAR_SQUARE = '\u25a0';
35
34
  const CHAR_BOX = '\u274f';
36
35
  const CHAR_ZERO_SPACE = '\u200B';
37
- const INLINE_NODE_NAME_PATTERN = /^(#text)|(A|SPAN|B|STRONG)$/;
36
+ const INLINE_NODE_NAME_PATTERN = /^(#text|(A|SPAN|B|STRONG))$/;
38
37
 
39
38
  function patchListElementsElement(listElement: HTMLElement): void {
40
39
  // If the children of `listElement` all have teh same marginLeft, assume
41
40
  // it to be indented.
42
- let marginLeft = undefined;
43
- let beforeContent = undefined;
41
+ let marginLeft;
42
+ let beforeContent;
44
43
  const { parentElement, children } = listElement;
45
44
 
46
45
  // A workaround to patch the issue when <ul /> or <ol /> is pasted as the
@@ -68,7 +67,7 @@ function patchListElementsElement(listElement: HTMLElement): void {
68
67
  beforeContent = null;
69
68
  }
70
69
 
71
- const ml = (style && style.marginLeft) || '';
70
+ const ml = (style?.marginLeft) || '';
72
71
  if (marginLeft === undefined) {
73
72
  marginLeft = ml;
74
73
  }
@@ -211,8 +210,8 @@ function liftNestedListElements(doc: Document): void {
211
210
  const indent = findIndentLevel(list);
212
211
  list.setAttribute('data-indent', String(indent));
213
212
 
214
- const parentListItem = nullthrows(list.parentElement);
215
- const parentList = nullthrows(parentListItem.parentElement);
213
+ const parentListItem = list?.parentElement;
214
+ const parentList = parentListItem?.parentElement;
216
215
  const parentListNodeName = parentList.nodeName.toLowerCase();
217
216
  const isLast = parentList.lastElementChild === parentListItem;
218
217
  const style = parentList.getAttribute('style') || '';
@@ -238,7 +237,7 @@ function liftNestedListElements(doc: Document): void {
238
237
  // <ol><li>CCC</li></ol>
239
238
 
240
239
  // Close the parent list before the list.
241
- htmlMutator.insertHTMLBefore(`<\/${parentListNodeName}>`, list);
240
+ htmlMutator.insertHTMLBefore(`</${parentListNodeName}>`, list);
242
241
  // Open a new list after list.
243
242
  htmlMutator.insertHTMLAfter(
244
243
  `<${parentListNodeName}
@@ -1,5 +1,3 @@
1
- import queryString from 'query-string';
2
- import url from 'url';
3
1
  export default function patchMathElements(doc) {
4
2
  Array.from(doc.querySelectorAll('img')).forEach(patchGoogleEquationElement);
5
3
  }
@@ -39,14 +37,14 @@ function getGoogleEquationContent(src) {
39
37
  if (!src) {
40
38
  return null;
41
39
  }
42
- var _url$parse = url.parse(src),
43
- host = _url$parse.host,
44
- pathname = _url$parse.pathname,
45
- query = _url$parse.query;
40
+ var _URL = new URL(src),
41
+ host = _URL.host,
42
+ pathname = _URL.pathname,
43
+ query = _URL.query;
46
44
  if (host !== 'www.google.com' || pathname !== '/chart') {
47
45
  return null;
48
46
  }
49
- var params = queryString.parse(query);
47
+ var params = new URL(query);
50
48
  var chartType = params[PARAM_CHART_CHART_TYPE];
51
49
  var label = params[PARAM_CHART_LABEL];
52
50
 
@@ -1,7 +1,5 @@
1
1
  // @flow
2
2
 
3
- import queryString from 'query-string';
4
- import url from 'url';
5
3
  export default function patchMathElements(doc: Document): void {
6
4
  Array.from(doc.querySelectorAll('img')).forEach(patchGoogleEquationElement);
7
5
  }
@@ -41,12 +39,12 @@ function getGoogleEquationContent(src: ?string): ?string {
41
39
  if (!src) {
42
40
  return null;
43
41
  }
44
- const { host, pathname, query } = url.parse(src);
42
+ const { host, pathname, query } = new URL(src);
45
43
  if (host !== 'www.google.com' || pathname !== '/chart') {
46
44
  return null;
47
45
  }
48
46
 
49
- const params = queryString.parse(query);
47
+ const params = new URL(query);
50
48
  const chartType = params[PARAM_CHART_CHART_TYPE];
51
49
  const label = params[PARAM_CHART_LABEL];
52
50
 
@@ -64,7 +64,7 @@ export default function patchStyleElements(doc) {
64
64
  }
65
65
  });
66
66
  if (selectorText.indexOf(',') > -1) {
67
- selectorText.split(/\s*,\s*/).forEach(function (st) {
67
+ selectorText.split('.').trim().forEach(function (st) {
68
68
  buildSelectorTextToCSSText(selectorTextToCSSTexts, st, cssText);
69
69
  });
70
70
  } else {
@@ -1,9 +1,7 @@
1
1
  // @flow
2
2
 
3
3
  import toCSSColor from './ui/toCSSColor.js';
4
- import {
5
- toCSSLineSpacing
6
- } from '@modusoperandi/licit-ui-commands';
4
+ import { toCSSLineSpacing } from '@modusoperandi/licit-ui-commands';
7
5
 
8
6
  const LIST_ITEM_PSEUDO_ELEMENT_BEFORE = /li:+before/;
9
7
  const NODE_NAME_SELECTOR = /^[a-zA-Z]+\d*$/;
@@ -81,9 +79,12 @@ export default function patchStyleElements(doc: Document): void {
81
79
  }
82
80
  });
83
81
  if (selectorText.indexOf(',') > -1) {
84
- selectorText.split(/\s*,\s*/).forEach((st) => {
85
- buildSelectorTextToCSSText(selectorTextToCSSTexts, st, cssText);
86
- });
82
+ selectorText
83
+ .split('.')
84
+ .trim()
85
+ .forEach((st) => {
86
+ buildSelectorTextToCSSText(selectorTextToCSSTexts, st, cssText);
87
+ });
87
88
  } else {
88
89
  buildSelectorTextToCSSText(
89
90
  selectorTextToCSSTexts,
@@ -1,5 +1,4 @@
1
- import { PT_TO_PX_RATIO } from './convertToCSSPTValue.js';
2
- import convertToCSSPTValue from './convertToCSSPTValue.js';
1
+ import convertToCSSPTValue, { PT_TO_PX_RATIO } from './convertToCSSPTValue.js';
3
2
  import toHexColor from './ui/toHexColor.js';
4
3
  export default function patchTableElements(doc) {
5
4
  Array.from(doc.querySelectorAll('td')).forEach(patchTableCell);
@@ -25,7 +24,7 @@ function patchTableCell(tdElement) {
25
24
  spans.some(function (spanElement) {
26
25
  var retVal = true;
27
26
  var spanStyle = spanElement.style;
28
- if (!spanStyle || !spanStyle.backgroundColor) {
27
+ if (!(spanStyle !== null && spanStyle !== void 0 && spanStyle.backgroundColor)) {
29
28
  retVal = false;
30
29
  } else {
31
30
  var spanBgColor = toHexColor(spanStyle.backgroundColor);
@@ -1,6 +1,5 @@
1
1
  // @flow
2
- import { PT_TO_PX_RATIO } from './convertToCSSPTValue.js';
3
- import convertToCSSPTValue from './convertToCSSPTValue.js';
2
+ import convertToCSSPTValue, { PT_TO_PX_RATIO } from './convertToCSSPTValue.js';
4
3
  import toHexColor from './ui/toHexColor.js';
5
4
 
6
5
  export default function patchTableElements(doc: Document): void {
@@ -26,7 +25,7 @@ function patchTableCell(tdElement: HTMLElement): void {
26
25
  spans.some((spanElement) => {
27
26
  let retVal = true;
28
27
  const spanStyle = spanElement.style;
29
- if (!spanStyle || !spanStyle.backgroundColor) {
28
+ if (!spanStyle?.backgroundColor) {
30
29
  retVal = false;
31
30
  } else {
32
31
  const spanBgColor = toHexColor(spanStyle.backgroundColor);
package/sanitizeURL.js CHANGED
@@ -6,5 +6,5 @@ export default function sanitizeURL(url) {
6
6
  if (HTTP_PREFIX.test(url)) {
7
7
  return url;
8
8
  }
9
- return 'http://' + url;
9
+ return 'https://' + url;
10
10
  }
@@ -9,5 +9,5 @@ export default function sanitizeURL(url: ?string): string {
9
9
  if (HTTP_PREFIX.test(url)) {
10
10
  return url;
11
11
  }
12
- return 'http://' + url;
12
+ return 'https://' + url;
13
13
  }
package/splitListItem.js CHANGED
@@ -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
2
  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; }
3
3
  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; }
4
- 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; }
4
+ 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; }
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
  import uuid from './ui/uuid.js';
@@ -71,7 +71,7 @@ export default function splitListItem(tr, schema) {
71
71
  var $from = selection.$from,
72
72
  $to = selection.$to,
73
73
  node = selection.node;
74
- if (node && node.isBlock || $from.depth < 2 || !$from.sameParent($to)) {
74
+ if (node !== null && node !== void 0 && node.isBlock || $from.depth < 2 || !$from.sameParent($to)) {
75
75
  return tr;
76
76
  }
77
77
  var grandParent = $from.node(-1);
@@ -69,7 +69,7 @@ export default function splitListItem(
69
69
  }
70
70
 
71
71
  const { $from, $to, node } = selection;
72
- if ((node && node.isBlock) || $from.depth < 2 || !$from.sameParent($to)) {
72
+ if ((node?.isBlock) || $from.depth < 2 || !$from.sameParent($to)) {
73
73
  return tr;
74
74
  }
75
75
 
package/styles.css CHANGED
@@ -1,11 +1,35 @@
1
- @import './styles0.css';
1
+ @import './ui/czi-vars.css';
2
+ @import './ui/czi-heading.css';
3
+ @import './ui/czi-indent.css';
4
+ @import './ui/czi-list.css';
5
+ @import './ui/czi-table.css';
6
+ @import '~modusoperandi/licit-ui-commands/styles.css';
7
+ @import './ui/czi-bookmark-view.css';
8
+ @import './ui/czi-body-layout-editor.css';
9
+ @import './ui/czi-cursor-placeholder.css';
10
+ @import './ui/czi-custom-menu.css';
11
+ @import './ui/czi-custom-menu-button.css';
12
+ @import './ui/czi-custom-menu-item.css';
13
+ @import './ui/czi-custom-radio-button.css';
14
+ @import './ui/czi-custom-scrollbar.css';
15
+ @import './ui/czi-editor.css';
16
+ @import './ui/czi-editor-frameset.css';
17
+ @import './ui/czi-editor-toolbar.css';
18
+ @import './ui/czi-form.css';
19
+ @import './ui/czi-frag.css';
20
+ @import './ui/czi-icon.css';
21
+ @import './ui/czi-image-resize-box.css';
22
+ @import './ui/czi-image-upload-editor.css';
23
+ @import './ui/czi-image-upload-placeholder.css';
24
+ @import './ui/czi-image-url-editor.css';
25
+ @import './ui/czi-image-view.css';
26
+ @import './ui/czi-inline-editor.css';
27
+ @import './ui/czi-link-tooltip.css';
2
28
  @import './ui/czi-loading-indicator.css';
3
29
  @import './ui/czi-math-view.css';
4
- @import '@modusoperandi/licit-ui-commands/ui/czi-pop-up.css';
5
30
  @import './ui/czi-selection-placeholder.css';
6
31
  @import './ui/czi-table-cell-menu.css';
7
32
  @import './ui/czi-table-grid-size-editor.css';
8
- @import '@modusoperandi/licit-ui-commands/ui/czi-tooltip-surface.css';
9
33
  @import './ui/mathquill-editor/czi-mathquill-editor.css';
10
34
  @import './ui/mathquill-editor/czi-mathquill-editor-symbols-panel.css';
11
35
  @import './client/licit.css';
@@ -17,3 +41,8 @@
17
41
  @import './ui/icon-font.css';
18
42
  @import '~node-mathquill/build/mathquill.css';
19
43
  @import '~katex/dist/katex.min.css';
44
+
45
+ @import '~prosemirror-gapcursor/style/gapcursor.css';
46
+ @import '~prosemirror-view/style/prosemirror.css';
47
+ @import '~react-tooltip/dist/react-tooltip.css';
48
+ @import './ui/listType.css';
@@ -1,10 +1,7 @@
1
1
  import { Schema } from 'prosemirror-model';
2
2
  import { Transform } from 'prosemirror-transform';
3
3
  import { BLOCKQUOTE, HEADING, LIST_ITEM, PARAGRAPH } from './NodeNames.js';
4
- import { compareNumber } from '@modusoperandi/licit-ui-commands';
5
- import { isInsideListItem } from '@modusoperandi/licit-ui-commands';
6
- import { isListNode } from '@modusoperandi/licit-ui-commands';
7
- import { unwrapNodesFromList } from '@modusoperandi/licit-ui-commands';
4
+ import { compareNumber, isInsideListItem, isListNode, unwrapNodesFromList } from '@modusoperandi/licit-ui-commands';
8
5
  export default function toggleBlockquote(tr, schema) {
9
6
  var nodes = schema.nodes;
10
7
  var _tr = tr,
@@ -34,7 +31,9 @@ export default function toggleBlockquote(tr, schema) {
34
31
  return !isListNode(node);
35
32
  });
36
33
  // Update from the bottom to avoid disruptive changes in pos.
37
- poses.sort(compareNumber).reverse().forEach(function (pos) {
34
+ var sortedPoses = [].concat(poses); // Create a shallow copy of poses
35
+ sortedPoses.sort(compareNumber);
36
+ sortedPoses.sort(compareNumber).reverse().forEach(function (pos) {
38
37
  tr = setBlockquoteNode(tr, schema, pos);
39
38
  });
40
39
  return tr;
@@ -14,16 +14,7 @@ import {
14
14
  PARAGRAPH
15
15
  } from './NodeNames.js';
16
16
  import {
17
- compareNumber
18
- } from '@modusoperandi/licit-ui-commands';
19
- import {
20
- isInsideListItem
21
- } from '@modusoperandi/licit-ui-commands';
22
- import {
23
- isListNode
24
- } from '@modusoperandi/licit-ui-commands';
25
- import {
26
- unwrapNodesFromList
17
+ compareNumber, isInsideListItem, isListNode, unwrapNodesFromList
27
18
  } from '@modusoperandi/licit-ui-commands';
28
19
 
29
20
  export default function toggleBlockquote(
@@ -58,8 +49,10 @@ export default function toggleBlockquote(
58
49
  return !isListNode(node);
59
50
  });
60
51
  // Update from the bottom to avoid disruptive changes in pos.
61
- poses
62
- .sort(compareNumber)
52
+ const sortedPoses = [...poses]; // Create a shallow copy of poses
53
+ sortedPoses.sort(compareNumber);
54
+
55
+ sortedPoses.sort(compareNumber)
63
56
  .reverse()
64
57
  .forEach((pos) => {
65
58
  tr = setBlockquoteNode(tr, schema, pos);
@@ -1,11 +1,10 @@
1
+ function _readOnlyError(r) { throw new TypeError('"' + r + '" is read-only'); }
1
2
  import { Schema } from 'prosemirror-model';
2
3
  import { TextSelection } from 'prosemirror-state';
3
4
  import { Transform } from 'prosemirror-transform';
4
5
  import { MARK_LINK } from './MarkNames';
5
6
  import { BLOCKQUOTE, CODE_BLOCK, HEADING, PARAGRAPH } from './NodeNames';
6
- import { clearMarks } from '@modusoperandi/licit-ui-commands';
7
- import { compareNumber } from '@modusoperandi/licit-ui-commands';
8
- import { isListNode } from '@modusoperandi/licit-ui-commands';
7
+ import { clearMarks, compareNumber, isListNode } from '@modusoperandi/licit-ui-commands';
9
8
  export default function toggleCodeBlock(tr, schema) {
10
9
  var nodes = schema.nodes;
11
10
  var _tr = tr,
@@ -37,10 +36,11 @@ export default function toggleCodeBlock(tr, schema) {
37
36
  }
38
37
  return isBlock;
39
38
  });
40
-
39
+ var sortedPoses = [].concat(poses); // Create a shallow copy of poses
41
40
  // Update from the bottom to avoid disruptive changes in pos.
42
- allowed && poses.sort(compareNumber).reverse().forEach(function (pos) {
43
- tr = setCodeBlockNodeEnabled(tr, schema, pos, startWithCodeBlock ? false : true);
41
+ allowed ? poses.toSorted(compareNumber) : poses, _readOnlyError("sortedPoses");
42
+ allowed && sortedPoses.sort(compareNumber).reverse().forEach(function (pos) {
43
+ tr = setCodeBlockNodeEnabled(tr, schema, pos, !startWithCodeBlock);
44
44
  });
45
45
  return tr;
46
46
  }
@@ -6,9 +6,11 @@ import { Transform } from 'prosemirror-transform';
6
6
 
7
7
  import { MARK_LINK } from './MarkNames';
8
8
  import { BLOCKQUOTE, CODE_BLOCK, HEADING, PARAGRAPH } from './NodeNames';
9
- import { clearMarks } from '@modusoperandi/licit-ui-commands';
10
- import { compareNumber } from '@modusoperandi/licit-ui-commands';
11
- import { isListNode } from '@modusoperandi/licit-ui-commands';
9
+ import {
10
+ clearMarks,
11
+ compareNumber,
12
+ isListNode,
13
+ } from '@modusoperandi/licit-ui-commands';
12
14
 
13
15
  export default function toggleCodeBlock(
14
16
  tr: Transform,
@@ -47,18 +49,16 @@ export default function toggleCodeBlock(
47
49
  return isBlock;
48
50
  });
49
51
 
52
+ const sortedPoses = [...poses]; // Create a shallow copy of poses
50
53
  // Update from the bottom to avoid disruptive changes in pos.
54
+ sortedPoses = allowed ? poses.toSorted(compareNumber) : poses;
55
+
51
56
  allowed &&
52
- poses
57
+ sortedPoses
53
58
  .sort(compareNumber)
54
59
  .reverse()
55
60
  .forEach((pos) => {
56
- tr = setCodeBlockNodeEnabled(
57
- tr,
58
- schema,
59
- pos,
60
- startWithCodeBlock ? false : true
61
- );
61
+ tr = setCodeBlockNodeEnabled(tr, schema, pos, !startWithCodeBlock);
62
62
  });
63
63
  return tr;
64
64
  }