@modusoperandi/licit 0.1.4 → 0.1.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 (692) hide show
  1. package/.babelrc +54 -54
  2. package/.dockerignore +4 -4
  3. package/.eslintignore +3 -3
  4. package/.eslintrc.js +80 -80
  5. package/.flowconfig +37 -37
  6. package/.github/workflows/build.yml +35 -29
  7. package/.github/workflows/lint.yml +30 -30
  8. package/.prettierignore +5 -5
  9. package/.prettierrc +4 -4
  10. package/.stylelintignore +1 -1
  11. package/.stylelintrc.json +13 -13
  12. package/.travis.yml +18 -18
  13. package/CODEOWNERS +40 -40
  14. package/LICENSE +22 -22
  15. package/README.md +286 -284
  16. package/build_collab_server.py +7 -7
  17. package/build_customstyle_server.py +7 -7
  18. package/build_image_server.py +7 -7
  19. package/dist/BlockquoteInsertNewLineCommand.js.flow +55 -55
  20. package/dist/BlockquoteNodeSpec.js.flow +30 -30
  21. package/dist/BlockquoteToggleCommand.js.flow +34 -34
  22. package/dist/BookmarkNodeSpec.js.flow +39 -39
  23. package/dist/BulletListNodeSpec.js.flow +61 -61
  24. package/dist/CZIProseMirror.js.flow +90 -90
  25. package/dist/CodeBlockCommand.js.flow +43 -43
  26. package/dist/CodeBlockNodeSpec.js.flow +24 -24
  27. package/dist/CodeMarkSpec.js.flow +14 -14
  28. package/dist/ContentPlaceholderPlugin.js.flow +187 -187
  29. package/dist/CursorPlaceholderPlugin.js.flow +115 -115
  30. package/dist/DocLayoutCommand.js.flow +94 -94
  31. package/dist/DocNodeSpec.js.flow +64 -64
  32. package/dist/EMMarkSpec.js.flow +14 -14
  33. package/dist/EditorCommands.js.flow +128 -128
  34. package/dist/EditorKeyMap.js.flow +187 -187
  35. package/dist/EditorMarks.js.flow +71 -71
  36. package/dist/EditorNodes.js.flow +60 -60
  37. package/dist/EditorPageLayoutPlugin.js.flow +67 -67
  38. package/dist/EditorPlugins.js.flow +8 -8
  39. package/dist/EditorSchema.js.flow +12 -12
  40. package/dist/EditorState.js.flow +7 -7
  41. package/dist/FontSizeCommand.js +0 -8
  42. package/dist/FontSizeCommand.js.flow +57 -73
  43. package/dist/FontSizeMarkSpec.js.flow +49 -49
  44. package/dist/FontTypeCommand.js +0 -8
  45. package/dist/FontTypeCommand.js.flow +100 -116
  46. package/dist/FontTypeMarkSpec.js.flow +80 -80
  47. package/dist/HTMLMutator.js.flow +59 -59
  48. package/dist/HardBreakNodeSpec.js.flow +15 -15
  49. package/dist/HeadingCommand.js.flow +51 -51
  50. package/dist/HeadingNodeSpec.js.flow +54 -54
  51. package/dist/HistoryRedoCommand.js.flow +20 -20
  52. package/dist/HistoryUndoCommand.js.flow +20 -20
  53. package/dist/HorizontalRuleCommand.js.flow +49 -49
  54. package/dist/HorizontalRuleNodeSpec.js.flow +39 -39
  55. package/dist/ImageFromURLCommand.js.flow +14 -14
  56. package/dist/ImageNodeSpec.js.flow +90 -90
  57. package/dist/ImageSourceCommand.js.flow +117 -117
  58. package/dist/ImageUploadCommand.js.flow +36 -36
  59. package/dist/ImageUploadPlaceholderPlugin.js.flow +192 -192
  60. package/dist/IndentCommand.js +0 -9
  61. package/dist/IndentCommand.js.flow +41 -54
  62. package/dist/LinkMarkSpec.js.flow +32 -32
  63. package/dist/LinkSetURLCommand.js.flow +103 -103
  64. package/dist/LinkTooltipPlugin.js.flow +203 -203
  65. package/dist/ListItemInsertNewLineCommand.js.flow +55 -55
  66. package/dist/ListItemMergeCommand.js.flow +177 -177
  67. package/dist/ListItemNodeSpec.js.flow +51 -51
  68. package/dist/ListSplitCommand.js.flow +32 -32
  69. package/dist/ListToggleCommand.js +3 -45
  70. package/dist/ListToggleCommand.js.flow +77 -117
  71. package/dist/MarkNames.js +2 -4
  72. package/dist/MarkNames.js.flow +18 -19
  73. package/dist/MarkToggleCommand.js +3 -114
  74. package/dist/MarkToggleCommand.js.flow +66 -168
  75. package/dist/MarksClearCommand.js +1 -18
  76. package/dist/MarksClearCommand.js.flow +42 -55
  77. package/dist/MathEditCommand.js.flow +110 -110
  78. package/dist/MathNodeSpec.js.flow +46 -46
  79. package/dist/NodeNames.js.flow +23 -23
  80. package/dist/OrderedListNodeSpec.js.flow +132 -132
  81. package/dist/ParagraphNodeSpec.js +6 -115
  82. package/dist/ParagraphNodeSpec.js.flow +160 -250
  83. package/dist/ParagraphSpacingCommand.js.flow +121 -121
  84. package/dist/PrintCommand.js.flow +31 -31
  85. package/dist/SelectionPlaceholderPlugin.js.flow +131 -131
  86. package/dist/SpacerMarkSpec.js.flow +47 -47
  87. package/dist/StrikeMarkSpec.js.flow +21 -21
  88. package/dist/StrongMarkSpec.js.flow +25 -25
  89. package/dist/StyleView.js.flow +19 -19
  90. package/dist/TableBackgroundColorCommand.js.flow +75 -75
  91. package/dist/TableBorderColorCommand.js.flow +75 -75
  92. package/dist/TableCellColorCommand.js.flow +71 -71
  93. package/dist/TableCellMenuPlugin.js.flow +125 -125
  94. package/dist/TableInsertCommand.js.flow +112 -112
  95. package/dist/TableMergeCellsCommand.js.flow +90 -90
  96. package/dist/TableNodesSpecs.js.flow +78 -78
  97. package/dist/TablePlugins.js.flow +14 -14
  98. package/dist/TableResizePlugin.js.flow +631 -631
  99. package/dist/TextAlignCommand.js +0 -8
  100. package/dist/TextAlignCommand.js.flow +122 -138
  101. package/dist/TextColorCommand.js +0 -16
  102. package/dist/TextColorCommand.js.flow +87 -112
  103. package/dist/TextColorMarkSpec.js.flow +35 -35
  104. package/dist/TextHighlightCommand.js +0 -12
  105. package/dist/TextHighlightCommand.js.flow +91 -110
  106. package/dist/TextHighlightMarkSpec.js.flow +38 -38
  107. package/dist/TextInsertTabSpaceCommand.js +2 -5
  108. package/dist/TextInsertTabSpaceCommand.js.flow +83 -85
  109. package/dist/TextLineSpacingCommand.js.flow +157 -157
  110. package/dist/TextNoWrapMarkSpec.js.flow +14 -14
  111. package/dist/TextNodeSpec.js.flow +7 -7
  112. package/dist/TextSelectionMarkSpec.js.flow +24 -24
  113. package/dist/TextSubMarkSpec.js.flow +20 -20
  114. package/dist/TextSuperMarkSpec.js.flow +20 -20
  115. package/dist/TextUnderlineMarkSpec.js.flow +27 -27
  116. package/dist/Types.js +2 -121
  117. package/dist/Types.js.flow +75 -155
  118. package/dist/WebFontLoader.js.flow +22 -22
  119. package/dist/applyMark.js +3 -4
  120. package/dist/applyMark.js.flow +61 -64
  121. package/dist/blockQuoteInputRule.js.flow +36 -36
  122. package/dist/bom.xml +89 -89
  123. package/dist/browser.js.flow +7 -7
  124. package/dist/buildEditorPlugins.js +1 -3
  125. package/dist/buildEditorPlugins.js.flow +51 -53
  126. package/dist/buildInputRules.js.flow +81 -81
  127. package/dist/clearMarks.js +2 -5
  128. package/dist/clearMarks.js.flow +128 -132
  129. package/dist/client/CollabConnector.js +7 -7
  130. package/dist/client/CollabConnector.js.flow +71 -75
  131. package/dist/client/EditorConnection.js.flow +307 -307
  132. package/dist/client/Licit.js +197 -117
  133. package/dist/client/Licit.js.flow +562 -495
  134. package/dist/client/Licit.test.js +3 -57
  135. package/dist/client/Licit.test.js.flow +65 -120
  136. package/dist/client/Reporter.js.flow +37 -37
  137. package/dist/client/SimpleConnector.js.flow +53 -53
  138. package/dist/client/http.js.flow +66 -66
  139. package/dist/client/licit.css +12 -12
  140. package/dist/client/throttle.js.flow +27 -27
  141. package/dist/compareNumber.js.flow +11 -11
  142. package/dist/consolidateListNodes.js +27 -27
  143. package/dist/consolidateListNodes.js.flow +281 -281
  144. package/dist/convertFromDOMElement.js.flow +36 -36
  145. package/dist/convertFromHTML.js.flow +19 -19
  146. package/dist/convertFromJSON.js.flow +78 -78
  147. package/dist/convertToCSSPTValue.js.flow +22 -22
  148. package/dist/convertToJSON.js.flow +7 -7
  149. package/dist/createCommand.js.flow +40 -40
  150. package/dist/createEditorKeyMap.js.flow +94 -94
  151. package/dist/createEmptyEditorState.js.flow +41 -41
  152. package/dist/createTableResizingPlugin.js.flow +86 -86
  153. package/dist/findActionableCell.js.flow +74 -74
  154. package/dist/findActiveMark.js.flow +32 -32
  155. package/dist/findNodesWithSameMark.js.flow +89 -89
  156. package/dist/hyphenize.js.flow +17 -17
  157. package/dist/index.js +0 -14
  158. package/dist/index.js.flow +10 -11
  159. package/dist/insertTable.js.flow +56 -56
  160. package/dist/isBulletListNode.js.flow +9 -9
  161. package/dist/isEditorStateEmpty.js.flow +32 -32
  162. package/dist/isInsideListItem.js.flow +13 -13
  163. package/dist/isListNode.js.flow +13 -13
  164. package/dist/isNodeSelectionForNodeType.js.flow +15 -15
  165. package/dist/isOrderedListNode.js.flow +9 -9
  166. package/dist/isTableNode.js.flow +15 -15
  167. package/dist/isTextStyleMarkCommandEnabled.js.flow +49 -49
  168. package/dist/joinDown.js.flow +27 -27
  169. package/dist/joinListNode.js.flow +55 -55
  170. package/dist/joinUp.js.flow +39 -39
  171. package/dist/keymaps.js.flow +185 -185
  172. package/dist/lookUpElement.js.flow +14 -14
  173. package/dist/nodeAt.js.flow +12 -12
  174. package/dist/noop.js.flow +5 -5
  175. package/dist/normalizeHTML.js.flow +78 -78
  176. package/dist/patchAnchorElements.js.flow +38 -38
  177. package/dist/patchBreakElements.js.flow +22 -22
  178. package/dist/patchElementInlineStyles.js.flow +92 -92
  179. package/dist/patchListElements.js.flow +276 -276
  180. package/dist/patchMathElements.js.flow +60 -60
  181. package/dist/patchParagraphElements.js.flow +20 -20
  182. package/dist/patchStyleElements.js.flow +194 -194
  183. package/dist/patchTableElements.js.flow +89 -89
  184. package/dist/rebaseDocWithSteps.js.flow +42 -42
  185. package/dist/sanitizeURL.js.flow +13 -13
  186. package/dist/splitListItem.js.flow +191 -191
  187. package/dist/styles.css +19 -21
  188. package/dist/styles0.css +29 -30
  189. package/dist/toClosestFontPtSize.js.flow +22 -22
  190. package/dist/toSafeHTMLDocument.js.flow +9 -9
  191. package/dist/toggleBlockquote.js.flow +91 -91
  192. package/dist/toggleCodeBlock.js.flow +102 -102
  193. package/dist/toggleHeading.js.flow +113 -113
  194. package/dist/toggleList.js.flow +450 -450
  195. package/dist/transformAndPreserveTextSelection.js.flow +151 -151
  196. package/dist/ui/AlertInfo.js +1 -1
  197. package/dist/ui/AlertInfo.js.flow +64 -64
  198. package/dist/ui/BookmarkNodeView.js.flow +66 -66
  199. package/dist/ui/ColorEditor.js.flow +101 -101
  200. package/dist/ui/CommandButton.js.flow +68 -68
  201. package/dist/ui/CommandMenu.js.flow +75 -75
  202. package/dist/ui/CommandMenuButton.js.flow +131 -131
  203. package/dist/ui/CustomButton.js.flow +33 -33
  204. package/dist/ui/CustomEditorView.js.flow +28 -28
  205. package/dist/ui/CustomMenu.js.flow +17 -17
  206. package/dist/ui/CustomMenuItem.js.flow +36 -36
  207. package/dist/ui/CustomNodeView.js +6 -1
  208. package/dist/ui/CustomNodeView.js.flow +200 -196
  209. package/dist/ui/CustomRadioButton.js.flow +65 -65
  210. package/dist/ui/DocLayoutEditor.js.flow +146 -146
  211. package/dist/ui/Editor.js.flow +291 -291
  212. package/dist/ui/EditorFrameset.js.flow +81 -81
  213. package/dist/ui/EditorToolbar.js.flow +211 -211
  214. package/dist/ui/EditorToolbarConfig.js +0 -6
  215. package/dist/ui/EditorToolbarConfig.js.flow +172 -178
  216. package/dist/ui/FontSizeCommandMenuButton.js.flow +66 -66
  217. package/dist/ui/FontTypeCommandMenuButton.js.flow +49 -49
  218. package/dist/ui/Frag.js.flow +13 -13
  219. package/dist/ui/Icon.js.flow +89 -89
  220. package/dist/ui/ImageAlignEditor.js.flow +60 -60
  221. package/dist/ui/ImageInlineEditor.js.flow +67 -67
  222. package/dist/ui/ImageNodeView.js +1 -10
  223. package/dist/ui/ImageNodeView.js.flow +404 -414
  224. package/dist/ui/ImageResizeBox.js.flow +219 -219
  225. package/dist/ui/ImageURLEditor.js.flow +119 -119
  226. package/dist/ui/ImageUploadEditor.js.flow +117 -117
  227. package/dist/ui/KeyCodes.js.flow +12 -12
  228. package/dist/ui/LinkTooltip.js.flow +85 -85
  229. package/dist/ui/LinkURLEditor.js.flow +111 -111
  230. package/dist/ui/ListItemNodeView.js.flow +98 -98
  231. package/dist/ui/ListTypeButton.js.flow +131 -131
  232. package/dist/ui/ListTypeCommandButton.js +1 -1
  233. package/dist/ui/ListTypeCommandButton.js.flow +85 -86
  234. package/dist/ui/ListTypeMenu.js.flow +70 -70
  235. package/dist/ui/LoadingIndicator.js.flow +20 -20
  236. package/dist/ui/MathEditor.js.flow +78 -78
  237. package/dist/ui/MathInlineEditor.js.flow +102 -102
  238. package/dist/ui/MathNodeView.js.flow +175 -175
  239. package/dist/ui/PasteMenu.js.flow +57 -57
  240. package/dist/ui/PointerSurface.js.flow +141 -141
  241. package/dist/ui/PopUp.js.flow +77 -77
  242. package/dist/ui/PopUpManager.js.flow +213 -213
  243. package/dist/ui/PopUpPosition.js +0 -0
  244. package/dist/ui/PopUpPosition.js.flow +104 -104
  245. package/dist/ui/ResizeObserver.js.flow +106 -106
  246. package/dist/ui/RichTextEditor.js.flow +133 -133
  247. package/dist/ui/SelectionObserver.js.flow +134 -134
  248. package/dist/ui/TableCellMenu.js.flow +38 -38
  249. package/dist/ui/TableGridSizeEditor.js.flow +184 -184
  250. package/dist/ui/TableNodeView.js.flow +22 -22
  251. package/dist/ui/TooltipSurface.js.flow +76 -76
  252. package/dist/ui/bindScrollHandler.js.flow +46 -46
  253. package/dist/ui/canUseCSSFont.js.flow +43 -43
  254. package/dist/ui/clamp.js.flow +11 -11
  255. package/dist/ui/createPopUp.js.flow +205 -205
  256. package/dist/ui/czi-animations.css +15 -15
  257. package/dist/ui/czi-body-layout-editor.css +16 -16
  258. package/dist/ui/czi-bookmark-view.css +10 -10
  259. package/dist/ui/czi-color-editor.css +56 -56
  260. package/dist/ui/czi-cursor-placeholder.css +36 -36
  261. package/dist/ui/czi-custom-button.css +93 -93
  262. package/dist/ui/czi-custom-menu-button.css +18 -18
  263. package/dist/ui/czi-custom-menu-item.css +30 -30
  264. package/dist/ui/czi-custom-menu.css +8 -8
  265. package/dist/ui/czi-custom-radio-button.css +80 -80
  266. package/dist/ui/czi-custom-scrollbar.css +21 -21
  267. package/dist/ui/czi-editor-frameset.css +81 -81
  268. package/dist/ui/czi-editor-toolbar.css +122 -122
  269. package/dist/ui/czi-editor.css +220 -221
  270. package/dist/ui/czi-form.css +104 -104
  271. package/dist/ui/czi-frag.css +3 -3
  272. package/dist/ui/czi-heading.css +40 -40
  273. package/dist/ui/czi-icon.css +72 -72
  274. package/dist/ui/czi-image-resize-box.css +165 -165
  275. package/dist/ui/czi-image-upload-editor.css +57 -57
  276. package/dist/ui/czi-image-upload-placeholder.css +50 -50
  277. package/dist/ui/czi-image-url-editor.css +38 -38
  278. package/dist/ui/czi-image-view.css +125 -125
  279. package/dist/ui/czi-indent.css +137 -137
  280. package/dist/ui/czi-inline-editor.css +20 -20
  281. package/dist/ui/czi-link-tooltip.css +71 -71
  282. package/dist/ui/czi-list.css +410 -410
  283. package/dist/ui/czi-loading-indicator.css +111 -111
  284. package/dist/ui/czi-math-view.css +62 -62
  285. package/dist/ui/czi-pop-up.css +32 -32
  286. package/dist/ui/czi-selection-placeholder.css +24 -24
  287. package/dist/ui/czi-table-cell-menu.css +14 -14
  288. package/dist/ui/czi-table-grid-size-editor.css +37 -37
  289. package/dist/ui/czi-table.css +86 -86
  290. package/dist/ui/czi-tooltip-surface.css +45 -45
  291. package/dist/ui/czi-vars.css +46 -46
  292. package/dist/ui/findActiveFontSize.js.flow +58 -58
  293. package/dist/ui/findActiveFontType.js.flow +38 -38
  294. package/dist/ui/fonts.css +471 -471
  295. package/dist/ui/handleEditorDrop.js.flow +28 -28
  296. package/dist/ui/handleEditorKeyDown.js.flow +39 -39
  297. package/dist/ui/handleEditorPaste.js.flow +33 -33
  298. package/dist/ui/htmlElementToRect.js.flow +18 -18
  299. package/dist/ui/icon-font.css +10 -10
  300. package/dist/ui/injectStyleSheet.js.flow +42 -42
  301. package/dist/ui/isElementFullyVisible.js.flow +23 -23
  302. package/dist/ui/isOffline.js.flow +8 -8
  303. package/dist/ui/isReactClass.js.flow +12 -12
  304. package/dist/ui/listType.css +21 -21
  305. package/dist/ui/mathquill-editor/MathQuillEditor.js.flow +159 -159
  306. package/dist/ui/mathquill-editor/MathQuillEditorSymbols.js.flow +483 -483
  307. package/dist/ui/mathquill-editor/MathQuillEditorSymbolsPanel.js.flow +48 -48
  308. package/dist/ui/mathquill-editor/czi-mathquill-editor-symbols-panel.css +39 -39
  309. package/dist/ui/mathquill-editor/czi-mathquill-editor.css +50 -50
  310. package/dist/ui/mathquill-editor/mathquill-import-kludge.js.flow +24 -24
  311. package/dist/ui/preventEventDefault.js.flow +5 -5
  312. package/dist/ui/rects.js.flow +47 -47
  313. package/dist/ui/renderLaTeXAsHTML.js.flow +46 -46
  314. package/dist/ui/resolveImage.js.flow +123 -123
  315. package/dist/ui/toCSSColor.js.flow +51 -51
  316. package/dist/ui/toCSSLineSpacing.js.flow +82 -82
  317. package/dist/ui/toHexColor.js.flow +26 -26
  318. package/dist/ui/uuid.js.flow +9 -9
  319. package/dist/updateIndentLevel.js +1 -47
  320. package/dist/updateIndentLevel.js.flow +211 -260
  321. package/dist/uuid.js.flow +9 -9
  322. package/flow-typed/@modusoperandilicit-customstyles.js +5 -0
  323. package/flow-typed/@modusoperandilicit-doc-attrs-step.js +5 -5
  324. package/flow-typed/@molicit-citation.js +5 -5
  325. package/flow-typed/create-emotion.js +5 -5
  326. package/flow-typed/docs-editor.js +3 -3
  327. package/flow-typed/draft-convert.js +3 -3
  328. package/flow-typed/draft-js.js +3 -3
  329. package/flow-typed/flatted.js +5 -5
  330. package/flow-typed/jquery.js +5 -5
  331. package/flow-typed/katex.js +6 -6
  332. package/flow-typed/mathquill.js +5 -5
  333. package/flow-typed/prosemirror-collab.js +5 -5
  334. package/flow-typed/prosemirror-commands.js +5 -5
  335. package/flow-typed/prosemirror-dev-tools.js +5 -5
  336. package/flow-typed/prosemirror-dropcursor.js +5 -5
  337. package/flow-typed/prosemirror-gapcursor.js +5 -5
  338. package/flow-typed/prosemirror-history.js +5 -5
  339. package/flow-typed/prosemirror-inputrules.js +5 -5
  340. package/flow-typed/prosemirror-keymap.js +5 -5
  341. package/flow-typed/prosemirror-model.js +5 -5
  342. package/flow-typed/prosemirror-state.js +5 -5
  343. package/flow-typed/prosemirror-tables.js +5 -5
  344. package/flow-typed/prosemirror-transform.js +5 -5
  345. package/flow-typed/prosemirror-utils.js +5 -5
  346. package/flow-typed/prosemirror-view.js +5 -5
  347. package/flow-typed/resize-observer-polyfill.js +5 -5
  348. package/flow-typed/uuid.js +5 -5
  349. package/jest.setup.js +5 -5
  350. package/licit/client/CustomLicitRuntime.js +95 -200
  351. package/licit/client/CustomStyleRuntime.js +136 -0
  352. package/licit/client/index.js +366 -365
  353. package/licit/index.html +11 -11
  354. package/licit/server/collab/instance.js +221 -221
  355. package/licit/server/collab/route.js +69 -69
  356. package/licit/server/collab/server.js +297 -296
  357. package/licit/server/collab/start.js +13 -13
  358. package/licit/server/customstyles/start.js +184 -184
  359. package/licit/server/image/start.js +58 -58
  360. package/lint.sh +4 -4
  361. package/package.json +165 -165
  362. package/run_collab_server.py +21 -21
  363. package/run_customstyle_server.py +20 -20
  364. package/run_image_server.py +20 -20
  365. package/run_web_server.py +25 -25
  366. package/scripts/build_bin.js +10 -10
  367. package/scripts/build_bin.py +103 -103
  368. package/scripts/ci_check_dist.sh +13 -13
  369. package/scripts/env.js +6 -6
  370. package/scripts/webserver.js +35 -35
  371. package/sonar-project.properties +11 -11
  372. package/src/BlockquoteInsertNewLineCommand.js +55 -55
  373. package/src/BlockquoteNodeSpec.js +30 -30
  374. package/src/BlockquoteToggleCommand.js +34 -34
  375. package/src/BookmarkNodeSpec.js +39 -39
  376. package/src/BulletListNodeSpec.js +61 -61
  377. package/src/CZIProseMirror.js +90 -90
  378. package/src/CodeBlockCommand.js +43 -43
  379. package/src/CodeBlockNodeSpec.js +24 -24
  380. package/src/CodeMarkSpec.js +14 -14
  381. package/src/ContentPlaceholderPlugin.js +187 -187
  382. package/src/CursorPlaceholderPlugin.js +115 -115
  383. package/src/DocLayoutCommand.js +94 -94
  384. package/src/DocNodeSpec.js +64 -64
  385. package/src/EMMarkSpec.js +14 -14
  386. package/src/EditorCommands.js +128 -128
  387. package/src/EditorKeyMap.js +187 -187
  388. package/src/EditorMarks.js +71 -71
  389. package/src/EditorNodes.js +60 -60
  390. package/src/EditorPageLayoutPlugin.js +67 -67
  391. package/src/EditorPlugins.js +8 -8
  392. package/src/EditorSchema.js +12 -12
  393. package/src/EditorState.js +7 -7
  394. package/src/FontSizeCommand.js +57 -73
  395. package/src/FontSizeMarkSpec.js +49 -49
  396. package/src/FontTypeCommand.js +100 -116
  397. package/src/FontTypeMarkSpec.js +80 -80
  398. package/src/HTMLMutator.js +59 -59
  399. package/src/HardBreakNodeSpec.js +15 -15
  400. package/src/HeadingCommand.js +51 -51
  401. package/src/HeadingNodeSpec.js +54 -54
  402. package/src/HistoryRedoCommand.js +20 -20
  403. package/src/HistoryUndoCommand.js +20 -20
  404. package/src/HorizontalRuleCommand.js +49 -49
  405. package/src/HorizontalRuleNodeSpec.js +39 -39
  406. package/src/ImageFromURLCommand.js +14 -14
  407. package/src/ImageNodeSpec.js +90 -90
  408. package/src/ImageSourceCommand.js +117 -117
  409. package/src/ImageUploadCommand.js +36 -36
  410. package/src/ImageUploadPlaceholderPlugin.js +192 -192
  411. package/src/IndentCommand.js +41 -54
  412. package/src/LinkMarkSpec.js +32 -32
  413. package/src/LinkSetURLCommand.js +103 -103
  414. package/src/LinkTooltipPlugin.js +203 -203
  415. package/src/ListItemInsertNewLineCommand.js +55 -55
  416. package/src/ListItemMergeCommand.js +177 -177
  417. package/src/ListItemNodeSpec.js +51 -51
  418. package/src/ListSplitCommand.js +32 -32
  419. package/src/ListToggleCommand.js +77 -117
  420. package/src/MarkNames.js +18 -19
  421. package/src/MarkToggleCommand.js +66 -168
  422. package/src/MarksClearCommand.js +42 -55
  423. package/src/MathEditCommand.js +110 -110
  424. package/src/MathNodeSpec.js +46 -46
  425. package/src/NodeNames.js +23 -23
  426. package/src/OrderedListNodeSpec.js +132 -132
  427. package/src/ParagraphNodeSpec.js +160 -250
  428. package/src/ParagraphSpacingCommand.js +121 -121
  429. package/src/PrintCommand.js +31 -31
  430. package/src/SelectionPlaceholderPlugin.js +131 -131
  431. package/src/SpacerMarkSpec.js +47 -47
  432. package/src/StrikeMarkSpec.js +21 -21
  433. package/src/StrongMarkSpec.js +25 -25
  434. package/src/StyleView.js +19 -19
  435. package/src/TableBackgroundColorCommand.js +75 -75
  436. package/src/TableBorderColorCommand.js +75 -75
  437. package/src/TableCellColorCommand.js +71 -71
  438. package/src/TableCellMenuPlugin.js +125 -125
  439. package/src/TableInsertCommand.js +112 -112
  440. package/src/TableMergeCellsCommand.js +90 -90
  441. package/src/TableNodesSpecs.js +78 -78
  442. package/src/TablePlugins.js +14 -14
  443. package/src/TableResizePlugin.js +631 -631
  444. package/src/TextAlignCommand.js +122 -138
  445. package/src/TextColorCommand.js +87 -112
  446. package/src/TextColorMarkSpec.js +35 -35
  447. package/src/TextHighlightCommand.js +91 -110
  448. package/src/TextHighlightMarkSpec.js +38 -38
  449. package/src/TextInsertTabSpaceCommand.js +83 -85
  450. package/src/TextLineSpacingCommand.js +157 -157
  451. package/src/TextNoWrapMarkSpec.js +14 -14
  452. package/src/TextNodeSpec.js +7 -7
  453. package/src/TextSelectionMarkSpec.js +24 -24
  454. package/src/TextSubMarkSpec.js +20 -20
  455. package/src/TextSuperMarkSpec.js +20 -20
  456. package/src/TextUnderlineMarkSpec.js +27 -27
  457. package/src/Types.js +75 -155
  458. package/src/WebFontLoader.js +22 -22
  459. package/src/applyMark.js +61 -64
  460. package/src/blockQuoteInputRule.js +36 -36
  461. package/src/browser.js +7 -7
  462. package/src/buildEditorPlugins.js +51 -53
  463. package/src/buildInputRules.js +81 -81
  464. package/src/clearMarks.js +128 -132
  465. package/src/client/CollabConnector.js +71 -75
  466. package/src/client/EditorConnection.js +307 -307
  467. package/src/client/Licit.js +562 -495
  468. package/src/client/Licit.test.js +65 -120
  469. package/src/client/Reporter.js +37 -37
  470. package/src/client/SimpleConnector.js +53 -53
  471. package/src/client/http.js +66 -66
  472. package/src/client/licit.css +12 -12
  473. package/src/client/throttle.js +27 -27
  474. package/src/compareNumber.js +11 -11
  475. package/src/consolidateListNodes.js +281 -281
  476. package/src/convertFromDOMElement.js +36 -36
  477. package/src/convertFromHTML.js +19 -19
  478. package/src/convertFromJSON.js +78 -78
  479. package/src/convertToCSSPTValue.js +22 -22
  480. package/src/convertToJSON.js +7 -7
  481. package/src/createCommand.js +40 -40
  482. package/src/createEditorKeyMap.js +94 -94
  483. package/src/createEmptyEditorState.js +41 -41
  484. package/src/createTableResizingPlugin.js +86 -86
  485. package/src/findActionableCell.js +74 -74
  486. package/src/findActiveMark.js +32 -32
  487. package/src/findNodesWithSameMark.js +89 -89
  488. package/src/hyphenize.js +17 -17
  489. package/src/index.js +10 -11
  490. package/src/insertTable.js +56 -56
  491. package/src/isBulletListNode.js +9 -9
  492. package/src/isEditorStateEmpty.js +32 -32
  493. package/src/isInsideListItem.js +13 -13
  494. package/src/isListNode.js +13 -13
  495. package/src/isNodeSelectionForNodeType.js +15 -15
  496. package/src/isOrderedListNode.js +9 -9
  497. package/src/isTableNode.js +15 -15
  498. package/src/isTextStyleMarkCommandEnabled.js +49 -49
  499. package/src/joinDown.js +27 -27
  500. package/src/joinListNode.js +55 -55
  501. package/src/joinUp.js +39 -39
  502. package/src/keymaps.js +185 -185
  503. package/src/lookUpElement.js +14 -14
  504. package/src/nodeAt.js +12 -12
  505. package/src/noop.js +5 -5
  506. package/src/normalizeHTML.js +78 -78
  507. package/src/patchAnchorElements.js +38 -38
  508. package/src/patchBreakElements.js +22 -22
  509. package/src/patchElementInlineStyles.js +92 -92
  510. package/src/patchListElements.js +276 -276
  511. package/src/patchMathElements.js +60 -60
  512. package/src/patchParagraphElements.js +20 -20
  513. package/src/patchStyleElements.js +194 -194
  514. package/src/patchTableElements.js +89 -89
  515. package/src/rebaseDocWithSteps.js +42 -42
  516. package/src/sanitizeURL.js +13 -13
  517. package/src/splitListItem.js +191 -191
  518. package/src/styles.css +19 -21
  519. package/src/styles0.css +29 -30
  520. package/src/toClosestFontPtSize.js +22 -22
  521. package/src/toSafeHTMLDocument.js +9 -9
  522. package/src/toggleBlockquote.js +91 -91
  523. package/src/toggleCodeBlock.js +102 -102
  524. package/src/toggleHeading.js +113 -113
  525. package/src/toggleList.js +450 -450
  526. package/src/transformAndPreserveTextSelection.js +151 -151
  527. package/src/ui/AlertInfo.js +64 -64
  528. package/src/ui/BookmarkNodeView.js +66 -66
  529. package/src/ui/ColorEditor.js +101 -101
  530. package/src/ui/CommandButton.js +68 -68
  531. package/src/ui/CommandMenu.js +75 -75
  532. package/src/ui/CommandMenuButton.js +131 -131
  533. package/src/ui/CustomButton.js +33 -33
  534. package/src/ui/CustomEditorView.js +28 -28
  535. package/src/ui/CustomMenu.js +17 -17
  536. package/src/ui/CustomMenuItem.js +36 -36
  537. package/src/ui/CustomNodeView.js +200 -196
  538. package/src/ui/CustomRadioButton.js +65 -65
  539. package/src/ui/DocLayoutEditor.js +146 -146
  540. package/src/ui/Editor.js +291 -291
  541. package/src/ui/EditorFrameset.js +81 -81
  542. package/src/ui/EditorToolbar.js +211 -211
  543. package/src/ui/EditorToolbarConfig.js +172 -178
  544. package/src/ui/FontSizeCommandMenuButton.js +66 -66
  545. package/src/ui/FontTypeCommandMenuButton.js +49 -49
  546. package/src/ui/Frag.js +13 -13
  547. package/src/ui/Icon.js +89 -89
  548. package/src/ui/ImageAlignEditor.js +60 -60
  549. package/src/ui/ImageInlineEditor.js +67 -67
  550. package/src/ui/ImageNodeView.js +404 -414
  551. package/src/ui/ImageResizeBox.js +219 -219
  552. package/src/ui/ImageURLEditor.js +119 -119
  553. package/src/ui/ImageUploadEditor.js +117 -117
  554. package/src/ui/KeyCodes.js +12 -12
  555. package/src/ui/LinkTooltip.js +85 -85
  556. package/src/ui/LinkURLEditor.js +111 -111
  557. package/src/ui/ListItemNodeView.js +98 -98
  558. package/src/ui/ListTypeButton.js +131 -131
  559. package/src/ui/ListTypeCommandButton.js +85 -86
  560. package/src/ui/ListTypeMenu.js +70 -70
  561. package/src/ui/LoadingIndicator.js +20 -20
  562. package/src/ui/MathEditor.js +78 -78
  563. package/src/ui/MathInlineEditor.js +102 -102
  564. package/src/ui/MathNodeView.js +175 -175
  565. package/src/ui/PasteMenu.js +57 -57
  566. package/src/ui/PointerSurface.js +141 -141
  567. package/src/ui/PopUp.js +77 -77
  568. package/src/ui/PopUpManager.js +213 -213
  569. package/src/ui/PopUpPosition.js +104 -104
  570. package/src/ui/ResizeObserver.js +106 -106
  571. package/src/ui/RichTextEditor.js +133 -133
  572. package/src/ui/SelectionObserver.js +134 -134
  573. package/src/ui/TableCellMenu.js +38 -38
  574. package/src/ui/TableGridSizeEditor.js +184 -184
  575. package/src/ui/TableNodeView.js +22 -22
  576. package/src/ui/TooltipSurface.js +76 -76
  577. package/src/ui/bindScrollHandler.js +46 -46
  578. package/src/ui/canUseCSSFont.js +43 -43
  579. package/src/ui/clamp.js +11 -11
  580. package/src/ui/createPopUp.js +205 -205
  581. package/src/ui/czi-animations.css +15 -15
  582. package/src/ui/czi-body-layout-editor.css +16 -16
  583. package/src/ui/czi-bookmark-view.css +10 -10
  584. package/src/ui/czi-color-editor.css +56 -56
  585. package/src/ui/czi-cursor-placeholder.css +36 -36
  586. package/src/ui/czi-custom-button.css +93 -93
  587. package/src/ui/czi-custom-menu-button.css +18 -18
  588. package/src/ui/czi-custom-menu-item.css +30 -30
  589. package/src/ui/czi-custom-menu.css +8 -8
  590. package/src/ui/czi-custom-radio-button.css +80 -80
  591. package/src/ui/czi-custom-scrollbar.css +21 -21
  592. package/src/ui/czi-editor-frameset.css +81 -81
  593. package/src/ui/czi-editor-toolbar.css +122 -122
  594. package/src/ui/czi-editor.css +220 -221
  595. package/src/ui/czi-form.css +104 -104
  596. package/src/ui/czi-frag.css +3 -3
  597. package/src/ui/czi-heading.css +40 -40
  598. package/src/ui/czi-icon.css +72 -72
  599. package/src/ui/czi-image-resize-box.css +165 -165
  600. package/src/ui/czi-image-upload-editor.css +57 -57
  601. package/src/ui/czi-image-upload-placeholder.css +50 -50
  602. package/src/ui/czi-image-url-editor.css +38 -38
  603. package/src/ui/czi-image-view.css +125 -125
  604. package/src/ui/czi-indent.css +137 -137
  605. package/src/ui/czi-inline-editor.css +20 -20
  606. package/src/ui/czi-link-tooltip.css +71 -71
  607. package/src/ui/czi-list.css +410 -410
  608. package/src/ui/czi-loading-indicator.css +111 -111
  609. package/src/ui/czi-math-view.css +62 -62
  610. package/src/ui/czi-pop-up.css +32 -32
  611. package/src/ui/czi-selection-placeholder.css +24 -24
  612. package/src/ui/czi-table-cell-menu.css +14 -14
  613. package/src/ui/czi-table-grid-size-editor.css +37 -37
  614. package/src/ui/czi-table.css +86 -86
  615. package/src/ui/czi-tooltip-surface.css +45 -45
  616. package/src/ui/czi-vars.css +46 -46
  617. package/src/ui/findActiveFontSize.js +58 -58
  618. package/src/ui/findActiveFontType.js +38 -38
  619. package/src/ui/fonts.css +471 -471
  620. package/src/ui/handleEditorDrop.js +28 -28
  621. package/src/ui/handleEditorKeyDown.js +39 -39
  622. package/src/ui/handleEditorPaste.js +33 -33
  623. package/src/ui/htmlElementToRect.js +18 -18
  624. package/src/ui/icon-font.css +10 -10
  625. package/src/ui/injectStyleSheet.js +42 -42
  626. package/src/ui/isElementFullyVisible.js +23 -23
  627. package/src/ui/isOffline.js +8 -8
  628. package/src/ui/isReactClass.js +12 -12
  629. package/src/ui/listType.css +21 -21
  630. package/src/ui/mathquill-editor/MathQuillEditor.js +159 -159
  631. package/src/ui/mathquill-editor/MathQuillEditorSymbols.js +483 -483
  632. package/src/ui/mathquill-editor/MathQuillEditorSymbolsPanel.js +48 -48
  633. package/src/ui/mathquill-editor/czi-mathquill-editor-symbols-panel.css +39 -39
  634. package/src/ui/mathquill-editor/czi-mathquill-editor.css +50 -50
  635. package/src/ui/mathquill-editor/mathquill-import-kludge.js +24 -24
  636. package/src/ui/preventEventDefault.js +5 -5
  637. package/src/ui/rects.js +47 -47
  638. package/src/ui/renderLaTeXAsHTML.js +46 -46
  639. package/src/ui/resolveImage.js +123 -123
  640. package/src/ui/toCSSColor.js +51 -51
  641. package/src/ui/toCSSLineSpacing.js +82 -82
  642. package/src/ui/toHexColor.js +26 -26
  643. package/src/ui/uuid.js +9 -9
  644. package/src/updateIndentLevel.js +211 -260
  645. package/src/uuid.js +9 -9
  646. package/style-service.Dockerfile +26 -26
  647. package/utils/build_bin.js +9 -9
  648. package/utils/build_customstyle_server.js +71 -71
  649. package/utils/build_image_server.js +71 -71
  650. package/utils/build_licit_collab_server.js +75 -75
  651. package/utils/build_web_server.js +40 -40
  652. package/utils/env.js +6 -6
  653. package/webpack.config.js +126 -126
  654. package/dist/CustomStyleCommand.js +0 -1534
  655. package/dist/CustomStyleCommand.js.flow +0 -1690
  656. package/dist/StylePlugin.js +0 -533
  657. package/dist/StylePlugin.js.flow +0 -548
  658. package/dist/clearCustomStyleMarks.js +0 -43
  659. package/dist/clearCustomStyleMarks.js.flow +0 -34
  660. package/dist/customStyle.js +0 -185
  661. package/dist/customStyle.js.flow +0 -171
  662. package/dist/ui/CustomMenuButton.js +0 -155
  663. package/dist/ui/CustomMenuButton.js.flow +0 -129
  664. package/dist/ui/CustomMenuUI.js +0 -479
  665. package/dist/ui/CustomMenuUI.js.flow +0 -464
  666. package/dist/ui/CustomStyleEditor.js +0 -1216
  667. package/dist/ui/CustomStyleEditor.js.flow +0 -1325
  668. package/dist/ui/CustomStyleItem.js +0 -164
  669. package/dist/ui/CustomStyleItem.js.flow +0 -152
  670. package/dist/ui/CustomStyleSubMenu.js +0 -62
  671. package/dist/ui/CustomStyleSubMenu.js.flow +0 -54
  672. package/dist/ui/HeadingCommandMenuButton.js +0 -157
  673. package/dist/ui/HeadingCommandMenuButton.js.flow +0 -147
  674. package/dist/ui/custom-dropdown.css +0 -90
  675. package/dist/ui/custom-style-edit.css +0 -430
  676. package/dist/ui/czi-cust-style-numbered.css +0 -137
  677. package/dist/ui/findActiveCustomStyle.js +0 -53
  678. package/dist/ui/findActiveCustomStyle.js.flow +0 -38
  679. package/src/CustomStyleCommand.js +0 -1690
  680. package/src/StylePlugin.js +0 -548
  681. package/src/clearCustomStyleMarks.js +0 -34
  682. package/src/customStyle.js +0 -171
  683. package/src/ui/CustomMenuButton.js +0 -129
  684. package/src/ui/CustomMenuUI.js +0 -464
  685. package/src/ui/CustomStyleEditor.js +0 -1325
  686. package/src/ui/CustomStyleItem.js +0 -152
  687. package/src/ui/CustomStyleSubMenu.js +0 -54
  688. package/src/ui/HeadingCommandMenuButton.js +0 -147
  689. package/src/ui/custom-dropdown.css +0 -90
  690. package/src/ui/custom-style-edit.css +0 -430
  691. package/src/ui/czi-cust-style-numbered.css +0 -137
  692. package/src/ui/findActiveCustomStyle.js +0 -38
@@ -1,1325 +0,0 @@
1
- // @flow
2
- // [FS] IRAD-1048 2020-09-24
3
- // UI for Custom Style edit
4
- //Need to change the button binding implementation
5
- import * as React from 'react';
6
- import './custom-style-edit.css';
7
- import ColorEditor from './ColorEditor';
8
- import createPopUp from './createPopUp';
9
- import { FONT_PT_SIZES } from './FontSizeCommandMenuButton';
10
- import { FONT_TYPE_NAMES } from '../FontTypeMarkSpec';
11
- import { getLineSpacingValue } from './toCSSLineSpacing';
12
- import { isCustomStyleExists } from '../customStyle';
13
- import { RESERVED_STYLE_NONE } from '../ParagraphNodeSpec';
14
- import { EditorState } from 'prosemirror-state';
15
- import type { EditorRuntime, StyleProps } from '../Types';
16
-
17
- let customStyles: StyleProps[] = [];
18
- const otherStyleSelected = false;
19
- const editedStyles = [];
20
-
21
- // Values to show in Linespacing drop-down
22
- const LINE_SPACE = ['Single', '1.15', '1.5', 'Double'];
23
- // Values to show in numbering/indent drop-down
24
- const LEVEL_VALUES = [
25
- 'None',
26
- '1',
27
- '2',
28
- '3',
29
- '4',
30
- '5',
31
- '6',
32
- '7',
33
- '8',
34
- '9',
35
- '10',
36
- ];
37
-
38
- const SAMPLE_TEXT = `Sample Text Sample Text Sample Text Sample Text Sample Text Sample Text Sample Text Sample.
39
- Sample Text Sample Text Sample Text Sample Text Sample Text`;
40
- class CustomStyleEditor extends React.PureComponent<any, any> {
41
- _unmounted = false;
42
- _popUp = null;
43
-
44
- constructor(props: any) {
45
- super(props);
46
- this.state = {
47
- ...props,
48
- otherStyleSelected,
49
- customStyles,
50
- };
51
- // set default values for text alignment and boldNumbering checkbox.
52
- if (!this.state.styles.align) {
53
- this.state.styles.align = 'left';
54
- }
55
- if (0 === this.state.mode) {
56
- this.state.styles.boldNumbering = true;
57
- this.state.styles.boldSentence = true;
58
- this.state.styles.nextLineStyleName = RESERVED_STYLE_NONE;
59
- }
60
- if (!this.state.styles.fontName) {
61
- this.state.styles.fontName = 'Arial';
62
- }
63
- if (!this.state.styles.fontSize) {
64
- this.state.styles.fontSize = 11;
65
- }
66
- this.getCustomStyles(props.editorView.runtime);
67
- }
68
-
69
- componentWillUnmount(): void {
70
- this._unmounted = true;
71
- }
72
- // To set the selected style values
73
- onStyleClick(style: string, event: any) {
74
- let state = null;
75
- switch (style) {
76
- // simple toggles where style matches the key to change.
77
- case 'strong':
78
- case 'em':
79
- case 'strike':
80
- case 'super':
81
- case 'underline':
82
- // copy the current style values, and flip the matching value
83
- state = { styles: { ...this.state.styles } };
84
- state.styles[style] = !state.styles[style];
85
- break;
86
-
87
- case 'name':
88
- if (event) {
89
- const oldName = this.state.styleName;
90
- const newName = event.target.value;
91
- state = { styleName: newName, styles: null };
92
- state.styles = { ...this.state.styles };
93
- if (this.state.styles.nextLineStyleName === oldName) {
94
- // Update next line style as well.
95
- state.styles.nextLineStyleName = newName;
96
- }
97
- }
98
- break;
99
-
100
- case 'description':
101
- if (event) {
102
- state = { description: event.target.value };
103
- }
104
- break;
105
-
106
- // [FS] IRAD-1497 2021-06-30
107
- // Not able to set paragraph spacing before and after.
108
- case 'before':
109
- if (event) {
110
- state = { styles: { ...this.state.styles } };
111
- state.styles['paragraphSpacingBefore'] = event.target.value;
112
- }
113
- break;
114
- case 'after':
115
- if (event) {
116
- state = { styles: { ...this.state.styles } };
117
- state.styles['paragraphSpacingAfter'] = event.target.value;
118
- }
119
- break;
120
- default:
121
- break;
122
- }
123
-
124
- // save changes and update
125
- if (state) {
126
- this.setState(state, () => this.buildStyle());
127
- }
128
- }
129
-
130
- // Build styles to display the example piece
131
- buildStyle() {
132
- const style = {};
133
- if (this.state.styles.fontName) {
134
- style.fontFamily = this.state.styles.fontName;
135
- }
136
- if (this.state.styles.fontSize) {
137
- style.fontSize = `${this.state.styles.fontSize}px`;
138
- }
139
- if (this.state.styles.strong) {
140
- style.fontWeight = 'bold';
141
- }
142
- if (this.state.styles.color) {
143
- style.color = this.state.styles.color;
144
- }
145
- if (this.state.styles.underline) {
146
- style.textDecoration =
147
- undefined !== style.textDecoration
148
- ? `${style.textDecoration}${' underline'}`
149
- : 'underline';
150
- }
151
- if (this.state.styles.strike) {
152
- style.textDecoration =
153
- undefined !== style.textDecoration
154
- ? `${style.textDecoration}${' line-through'}`
155
- : 'line-through';
156
- }
157
- if (this.state.styles.em) {
158
- style.fontStyle = 'italic';
159
- }
160
- if (this.state.styles.textHighlight) {
161
- style.backgroundColor = this.state.styles.textHighlight;
162
- }
163
- if (this.state.styles.align) {
164
- style.textAlign = this.state.styles.align;
165
- }
166
- if (this.state.styles.lineHeight) {
167
- // [FS] IRAD-1104 2020-11-13
168
- // Issue fix : Linespacing Double and Single not applied in the sample text paragraph
169
- style.lineHeight = getLineSpacingValue(this.state.styles.lineHeight);
170
- }
171
- // [FS] IRAD-1111 2020-12-10
172
- // Issue fix : Paragraph space before is not applied in the sample text.
173
- if (this.state.styles.paragraphSpacingBefore) {
174
- style.marginTop = `${this.state.styles.paragraphSpacingBefore}px`;
175
- }
176
- // [FS] IRAD-1111 2020-12-10
177
- // Issue fix : Paragraph space after is not applied in the sample text.
178
- if (this.state.styles.paragraphSpacingAfter) {
179
- style.marginBottom = `${this.state.styles.paragraphSpacingAfter}px`;
180
- }
181
- // [FS] IRAD-1111 2020-12-10
182
- // Issue fix : Indent is not applied in the sample text.
183
- if (!this.state.styles.isLevelbased) {
184
- if (this.state.styles.indent) {
185
- style.marginLeft = `${this.state.styles.indent * 2}px`;
186
- }
187
- } else {
188
- const levelValue = document && document.getElementById('levelValue');
189
- if (
190
- // this covers null & undefined
191
- levelValue instanceof window.HTMLSelectElement &&
192
- levelValue.value
193
- ) {
194
- style.marginLeft = `${parseInt(levelValue.value) * 2}px`;
195
- }
196
- }
197
-
198
- const sampleDiv = document.getElementById('sampletextdiv');
199
- if (sampleDiv) {
200
- // [FS] IRAD-1394 2021-06-02
201
- // Issue: numbering sample not working when select Bold first sentence
202
- let textSample = SAMPLE_TEXT;
203
- if (this.state.styles.boldPartial) {
204
- if (this.state.styles.boldSentence) {
205
- const content = SAMPLE_TEXT.split('.');
206
- sampleDiv.innerHTML = `<strong>${content[0]}</strong> ${content[1]}`;
207
- } else {
208
- const content = SAMPLE_TEXT.split(' ');
209
- sampleDiv.innerHTML = `<strong>${content[0]}</strong> ${SAMPLE_TEXT}`;
210
- }
211
- textSample = sampleDiv.innerHTML;
212
- // [FS] IRAD-1473 2021-06-30
213
- // Style Example not showing properly when select Bold and Bold First Sentence
214
- style.fontWeight = 'normal';
215
- }
216
- if (this.state.styles.styleLevel && this.state.styles.hasNumbering) {
217
- // [FS] IRAD-1137 2021-01-11
218
- // Issue fix : The Preview text is not showing the numbering in bold after Bold Numbering is enabled.
219
- const sampleDiv = document.getElementById('sampletextdiv');
220
- if (sampleDiv) {
221
- if (this.state.styles.boldNumbering) {
222
- sampleDiv.innerHTML = `<strong>${this.getNumberingLevel(
223
- this.state.styles.styleLevel
224
- )}</strong>${textSample}`;
225
- } else {
226
- sampleDiv.innerText = `${this.getNumberingLevel(
227
- this.state.styles.styleLevel
228
- )}${textSample}`;
229
- }
230
- }
231
- } else {
232
- sampleDiv.innerText = `${SAMPLE_TEXT}`;
233
- sampleDiv.innerHTML = textSample;
234
- }
235
- }
236
- return style;
237
- }
238
- // [FS] IRAD-1111 2020-12-10
239
- // get the numbering corresponding to the level
240
- getNumberingLevel(level: string) {
241
- let levelStyle = '';
242
- for (let i = 0; i < parseInt(level); i++) {
243
- levelStyle = levelStyle + '1.';
244
- }
245
- return levelStyle + ' ';
246
- }
247
-
248
- // handles font name change
249
- onFontNameChange(e: any) {
250
- this.setState({
251
- styles: { ...this.state.styles, fontName: e.target.value },
252
- });
253
- }
254
- // handles indent radio button event
255
- onIndentRadioChanged(e: any) {
256
- if ('0' == e.target.value) {
257
- this.setState({ styles: { ...this.state.styles, isLevelbased: true } });
258
- } else {
259
- this.setState({ styles: { ...this.state.styles, isLevelbased: false } });
260
- }
261
- }
262
-
263
- // handles scentece bold event
264
- onScentenceRadioChanged(e: any) {
265
- if ('0' == e.target.value) {
266
- this.setState({ styles: { ...this.state.styles, boldSentence: true } });
267
- } else {
268
- this.setState({ styles: { ...this.state.styles, boldSentence: false } });
269
- }
270
- }
271
-
272
- // handles font size change
273
- onFontSizeChange(e: any) {
274
- this.setState({
275
- styles: { ...this.state.styles, fontSize: e.target.value },
276
- });
277
- }
278
-
279
- // handles line space change
280
- onLineSpaceChange(e: any) {
281
- this.setState({
282
- styles: { ...this.state.styles, lineHeight: e.target.value },
283
- });
284
- }
285
- // handles Level drop down change
286
- onLevelChange(e: any) {
287
- const val = RESERVED_STYLE_NONE === e.target.value ? null : e.target.value;
288
- this.setState({ styles: { ...this.state.styles, styleLevel: val } });
289
- }
290
-
291
- // handles indent dropdown change
292
- onIndentChange(e: any) {
293
- this.setState({
294
- styles: {
295
- ...this.state.styles,
296
- indent: 'None' === e.target.value ? 0 : e.target.value,
297
- },
298
- });
299
- }
300
-
301
- // [FS] IRAD-1201 2021-02-18
302
- // set the nextLineStyle to JSON on style selection changed
303
- onOtherStyleSelectionChanged(e: any) {
304
- if (this.state.otherStyleSelected) {
305
- this.setState({
306
- styles: { ...this.state.styles, nextLineStyleName: e.target.value },
307
- });
308
- }
309
- }
310
-
311
- // [FS] IRAD-1201 2021-02-18
312
- // set the nextLineStyle to JSON according to the selected option
313
- onNextLineStyleSelected(selectedOption: number) {
314
- const hiddenDiv = document.getElementById('nextStyle');
315
- if (hiddenDiv) {
316
- hiddenDiv.style.display = 'none';
317
- }
318
- if (0 === selectedOption) {
319
- this.setState({
320
- otherStyleSelected: false,
321
- });
322
- this.setState({
323
- styles: { ...this.state.styles, nextLineStyleName: 'None' },
324
- });
325
- } else if (1 === selectedOption) {
326
- this.setState({
327
- otherStyleSelected: false,
328
- });
329
- this.setState({
330
- styles: {
331
- ...this.state.styles,
332
- nextLineStyleName: this.state.styleName,
333
- },
334
- });
335
- } else {
336
- if (hiddenDiv) {
337
- hiddenDiv.style.display = 'block';
338
- }
339
- const selectedStyle = document.getElementById('nextStyleValue');
340
- if (selectedStyle instanceof window.HTMLSelectElement) {
341
- this.setState({
342
- otherStyleSelected: true,
343
- styles: {
344
- ...this.state.styles,
345
- nextLineStyleName:
346
- selectedStyle.options[selectedStyle.selectedIndex].text,
347
- },
348
- });
349
- }
350
- }
351
- }
352
-
353
- // [FS] IRAD-1127 2020-12-31
354
- // to populate the selected custom styles.
355
- onSelectCustomStyle(e: any) {
356
- if (null !== customStyles) {
357
- const value = this.state.customStyles.find(
358
- (u) => u.styleName === e.target.value
359
- );
360
- // FIX: not able to modify and save the populated style
361
- value.mode = 3;
362
- this.state = {
363
- ...value,
364
- };
365
- this.setState(this.state);
366
- this.setNextLineStyle(this.state.styles.nextLineStyleName);
367
- }
368
- }
369
-
370
- // shows color dialog based on input text-color/text-heighlight
371
- showColorDialog(isTextColor: Boolean, event: SyntheticEvent<*>) {
372
- const anchor = event ? event.currentTarget : null;
373
- const hex = null;
374
- this._popUp = createPopUp(
375
- ColorEditor,
376
- { hex },
377
- {
378
- anchor,
379
- autoDismiss: true,
380
- IsChildDialog: true,
381
- onClose: (val) => {
382
- if (this._popUp) {
383
- this._popUp = null;
384
- if (undefined !== val) {
385
- if (isTextColor) {
386
- this.setState({ styles: { ...this.state.styles, color: val } });
387
- } else {
388
- this.setState({
389
- styles: { ...this.state.styles, textHighlight: val },
390
- });
391
- }
392
- }
393
- }
394
- },
395
- }
396
- );
397
- }
398
-
399
- //handles the option button click, close the popup with selected values
400
- onAlignButtonClick(val: String) {
401
- this.setState({ styles: { ...this.state.styles, align: val } });
402
- }
403
-
404
- handleNumbering(val: any) {
405
- // if user select numbering, then always set nextLineStyle as continues this style.
406
- // [FS] IRAD-1221 2021-03-01
407
- // Issue fix: The next line style not switch back to 'None' when disable the numbering.
408
- this.setState({
409
- styles: {
410
- ...this.state.styles,
411
- hasNumbering: val.target.checked,
412
- nextLineStyleName: val.target.checked
413
- ? this.state.styleName
414
- : RESERVED_STYLE_NONE,
415
- },
416
- });
417
- }
418
-
419
- // handles the boldNumbering checkbox actions
420
- handleBoldNumbering(val: any) {
421
- this.setState({
422
- styles: { ...this.state.styles, boldNumbering: val.target.checked },
423
- });
424
- }
425
-
426
- // handles the boldNumbering checkbox actions
427
- handleBoldPartial(val: any) {
428
- this.setState({
429
- styles: { ...this.state.styles, boldPartial: val.target.checked },
430
- });
431
- // this.setState({ styles: { ...this.state.styles, boldSentence: val.target.checked ? true : false } });
432
- }
433
-
434
- // [FS] IRAD-1201 2021-02-17
435
- // to check if the "select style" option selected by user
436
- selectStyleCheckboxState() {
437
- let chceked = false;
438
- if (this.state.styles.nextLineStyleName) {
439
- chceked =
440
- this.state.styles.nextLineStyleName !== 'None' &&
441
- this.state.styles.nextLineStyleName !== this.state.styleName;
442
- }
443
- return chceked;
444
- }
445
-
446
- componentDidMount() {
447
- const acc = document.getElementsByClassName('licit-accordion');
448
- let i;
449
-
450
- for (i = 0; i < acc.length; i++) {
451
- acc[i].addEventListener('click', function () {
452
- this.classList.toggle('accactive');
453
- const panel = this.nextElementSibling;
454
- if (panel.style.maxHeight) {
455
- panel.style.maxHeight = null;
456
- } else {
457
- panel.style.maxHeight = panel.scrollHeight + 'px';
458
- }
459
- });
460
- }
461
- const mp = document.getElementsByClassName('panel')[0];
462
- mp.style.maxHeight = mp.scrollHeight + 'px';
463
- const mp1 = document.getElementsByClassName('panel1')[0];
464
- mp1.style.maxHeight = mp1.scrollHeight + 'px';
465
- const mp2 = document.getElementsByClassName('panel2')[0];
466
- mp2.style.maxHeight = mp2.scrollHeight + 'px';
467
- const mp3 = document.getElementsByClassName('panel3')[0];
468
- mp3.style.maxHeight = mp3.scrollHeight + 'px';
469
-
470
- this.setNextLineStyle(this.state.styles.nextLineStyleName);
471
- // [FS] IRAD-1153 2021-02-25
472
- // Numbering level not showing in Preview text when modify style
473
- if (
474
- 1 == this.props.mode &&
475
- this.state.styles.styleLevel &&
476
- this.state.styles.hasNumbering
477
- ) {
478
- this.buildStyle();
479
- }
480
- }
481
-
482
- render(): React.Element<any> {
483
- return (
484
- <div className="customedit-div">
485
- <div className="customedit-head">
486
- <span>{this.state.mode == 0 ? 'Create Style' : 'Edit Style'}</span>
487
- </div>
488
- <div className="customedit-body">
489
- <div className="sectiondiv">
490
- <div
491
- style={
492
- 3 > this.props.mode ? { display: 'none' } : { display: 'block' }
493
- }
494
- >
495
- <p className="formp">Styles:</p>
496
- <select
497
- className="stylenameinput fontstyle"
498
- defaultValue={'DEFAULT'}
499
- onChange={this.onSelectCustomStyle.bind(this)}
500
- style={{ height: '24px' }}
501
- >
502
- <option disabled value="DEFAULT">
503
- {' '}
504
- -- select a style --{' '}
505
- </option>
506
- {this.state.customStyles.map((style) => (
507
- <option key={style.styleName} value={style.styleName}>
508
- {style.styleName}
509
- </option>
510
- ))}
511
- </select>
512
- </div>
513
- <p className="formp">
514
- Style Name:{' '}
515
- <span id="errormsg" style={{ display: 'none', color: 'red' }}>
516
- {isCustomStyleExists(this.state.styleName)
517
- ? 'Style name already exists'
518
- : ''}
519
- </span>
520
- </p>
521
- <span>
522
- <input
523
- autoFocus
524
- className="stylenameinput fontstyle"
525
- disabled={
526
- this.state.mode == 1 || this.state.mode == 3 ? true : false
527
- }
528
- id="txtName"
529
- key="name"
530
- onChange={this.onStyleClick.bind(this, 'name')}
531
- type="text"
532
- value={this.state.styleName || ''}
533
- />
534
- </span>
535
- <p className="formp">Description:</p>
536
- <span>
537
- <input
538
- className="stylenameinput fontstyle"
539
- key="description"
540
- onChange={this.onStyleClick.bind(this, 'description')}
541
- type="text"
542
- value={this.state.description || ''}
543
- />
544
- </span>
545
-
546
- <p className="formp">Preview:</p>
547
- <div
548
- className="textareadiv"
549
- name="body"
550
- style={
551
- 3 == this.props.mode ? { height: '164px' } : { height: '215px' }
552
- }
553
- >
554
- <div className="sampletext">
555
- Paragraph Paragraph Paragraph Paragraph Paragraph Paragraph
556
- Paragraph Paragraph Paragraph Paragraph
557
- </div>
558
- <div
559
- className={
560
- this.state.styles.super
561
- ? 'hide-sampletext'
562
- : 'visible-sampletext'
563
- }
564
- id="sampletextdiv"
565
- style={this.buildStyle()}
566
- >
567
- {SAMPLE_TEXT}
568
- </div>
569
- <sup
570
- className={
571
- this.state.styles.super
572
- ? 'visible-sampletext'
573
- : 'hide-sampletext'
574
- }
575
- id="mo-sup"
576
- style={this.buildStyle()}
577
- >
578
- {SAMPLE_TEXT}
579
- </sup>
580
- <div className="sampletext">
581
- Paragraph Paragraph Paragraph Paragraph Paragraph Paragraph
582
- Paragraph Paragraph Paragraph Paragraph Paragraph Paragraph
583
- Paragraph Paragraph Paragraph Paragraph Paragraph Paragraph
584
- Paragraph Paragraph
585
- </div>
586
- </div>
587
- </div>
588
-
589
- <div
590
- className="sectiondiv editorsection"
591
- style={this.disableRename()}
592
- >
593
- <p className="formp">Style Attributes:</p>
594
- <div
595
- style={{
596
- height: '329px',
597
- overflow: 'hidden auto',
598
- overflowX: 'hidden',
599
- border: '1px solid',
600
- }}
601
- >
602
- <button className="licit-accordion accactive" id="accordion1">
603
- <div className="indentdiv">
604
- <span
605
- className="iconspan czi-icon text_format"
606
- style={{ marginTop: '1px' }}
607
- >
608
- text_format
609
- </span>
610
- <label
611
- style={{
612
- marginLeft: '-10px',
613
- marginTop: '2px',
614
- color: '#444',
615
- }}
616
- >
617
- Font
618
- </label>
619
- </div>
620
- </button>
621
- <div className="panel">
622
- <div className="sectiondiv">
623
- <select
624
- className="fonttype fontstyle"
625
- onChange={this.onFontNameChange.bind(this)}
626
- value={this.state.styles.fontName || 'Arial'}
627
- >
628
- {FONT_TYPE_NAMES.map((value) => (
629
- <option key={value} value={value}>
630
- {value}
631
- </option>
632
- ))}
633
- </select>
634
- <select
635
- className="fontsize fontstyle"
636
- onChange={this.onFontSizeChange.bind(this)}
637
- value={this.state.styles.fontSize || 11}
638
- >
639
- {FONT_PT_SIZES.map((value) => (
640
- <option key={value} value={value}>
641
- {value}
642
- </option>
643
- ))}
644
- </select>
645
- </div>
646
- <div className="font-buttons">
647
- <span
648
- aria-label=" Bold"
649
- className="czi-tooltip-surface markbutton-container"
650
- data-tooltip=" Bold"
651
- id="86ba3aa0-ff11-11ea-930a-95c69ca4f97f"
652
- onClick={this.onStyleClick.bind(this, 'strong')}
653
- role="tooltip"
654
- style={{ marginLeft: '5px', marginRight: '5px' }}
655
- >
656
- <span
657
- aria-disabled="false"
658
- aria-pressed="false"
659
- className={
660
- this.state.styles.strong
661
- ? 'czi-custom-button use-icon active markbuttons'
662
- : 'czi-custom-button use-icon markbuttons'
663
- }
664
- role="button"
665
- >
666
- <span className="iconspan czi-icon format_bold editor-markbuttons">
667
- format_bold
668
- </span>
669
- </span>
670
- </span>
671
- <span
672
- aria-label=" Italic"
673
- className="czi-tooltip-surface fontstyle markbutton-container"
674
- data-tooltip=" Italic"
675
- id="86ba61b0-ff11-11ea-930a-95c69ca4f97f"
676
- onClick={this.onStyleClick.bind(this, 'em')}
677
- role="tooltip"
678
- >
679
- <span
680
- aria-disabled="false"
681
- aria-pressed="false"
682
- className={
683
- this.state.styles.em
684
- ? 'czi-custom-button use-icon active markbuttons'
685
- : 'czi-custom-button use-icon markbuttons'
686
- }
687
- role="button"
688
- >
689
- <span className="iconspan czi-icon format_italic editor-markbuttons">
690
- format_italic
691
- </span>
692
- <span> </span>
693
- </span>
694
- </span>
695
- <span
696
- aria-label=" Underline"
697
- className="czi-tooltip-surface fontstyle markbutton-container"
698
- data-tooltip=" Underline"
699
- id="86ba88c0-ff11-11ea-930a-95c69ca4f97f"
700
- onClick={this.onStyleClick.bind(this, 'underline')}
701
- role="tooltip"
702
- >
703
- <span
704
- aria-disabled="false"
705
- aria-pressed="false"
706
- className={
707
- this.state.styles.underline
708
- ? 'czi-custom-button use-icon active markbuttons'
709
- : 'czi-custom-button use-icon markbuttons'
710
- }
711
- role="button"
712
- >
713
- <span className="iconspan czi-icon format_underline editor-markbuttons">
714
- format_underline
715
- </span>
716
- <span> </span>
717
- </span>
718
- </span>
719
- <span
720
- aria-label=" Text color"
721
- className="czi-tooltip-surface fontstyle markbutton-container"
722
- data-tooltip=" Text color"
723
- id="86bad6e1-ff11-11ea-930a-95c69ca4f97f"
724
- onClick={this.showColorDialog.bind(this, true)}
725
- role="tooltip"
726
- >
727
- <span
728
- aria-disabled="false"
729
- aria-pressed="false"
730
- className="czi-custom-button use-icon markbuttons"
731
- role="button"
732
- >
733
- <span
734
- className="iconspan czi-icon format_color_text editor-markbuttons"
735
- style={{
736
- color:
737
- this.state.styles.color !== 'rgba(0,0,0,0)'
738
- ? this.state.styles.color
739
- : '#666',
740
- }}
741
- >
742
- format_color_text
743
- </span>
744
- <span> </span>
745
- </span>
746
- </span>
747
- <span
748
- aria-label=" Highlight color"
749
- className="czi-tooltip-surface fontstyle markbutton-container"
750
- data-tooltip=" Highlight color"
751
- id="86bafdf0-ff11-11ea-930a-95c69ca4f97f"
752
- onClick={this.showColorDialog.bind(this, false)}
753
- role="tooltip"
754
- >
755
- <span
756
- aria-disabled="false"
757
- aria-pressed="false"
758
- className="czi-custom-button use-icon markbuttons"
759
- role="button"
760
- >
761
- <span
762
- className=" iconspan czi-icon border_color editor-markbuttons"
763
- style={{
764
- color:
765
- this.state.styles.textHighlight !== 'rgba(0,0,0,0)'
766
- ? this.state.styles.textHighlight
767
- : '#666',
768
- }}
769
- >
770
- border_color
771
- </span>
772
- <span> </span>
773
- </span>
774
- </span>
775
- </div>
776
-
777
- <div className="formp hierarchydiv">
778
- <span style={{ float: 'left' }}>
779
- <label>
780
- <input
781
- checked={this.state.styles.boldPartial}
782
- onChange={this.handleBoldPartial.bind(this)}
783
- type="checkbox"
784
- />
785
- Bold the
786
- </label>
787
- </span>
788
- <span>
789
- <input
790
- checked={this.state.styles.boldSentence}
791
- disabled={this.state.styles.boldPartial ? false : true}
792
- name="boldscentence"
793
- onChange={this.onScentenceRadioChanged.bind(this)}
794
- style={{ marginLeft: '20px' }}
795
- type="radio"
796
- value="0"
797
- />
798
- <label
799
- style={{
800
- marginLeft: '4px',
801
- marginTop: '3px',
802
- marginBottom: '0',
803
- }}
804
- >
805
- First Sentence
806
- </label>
807
- <input
808
- checked={!this.state.styles.boldSentence}
809
- disabled={this.state.styles.boldPartial ? false : true}
810
- name="boldscentence"
811
- onChange={this.onScentenceRadioChanged.bind(this)}
812
- style={{ marginLeft: '20px' }}
813
- type="radio"
814
- value="1"
815
- />
816
- <label
817
- style={{
818
- marginLeft: '4px',
819
- marginTop: '3px',
820
- marginBottom: '0',
821
- }}
822
- >
823
- First Word
824
- </label>
825
- </span>
826
- </div>
827
- </div>
828
- <button className="licit-accordion accactive">
829
- <div className="indentdiv">
830
- <span
831
- className="iconspan czi-icon format_textdirection_l_to_r"
832
- style={{ marginTop: '1px' }}
833
- >
834
- format_textdirection_l_to_r
835
- </span>
836
- <label
837
- style={{
838
- marginLeft: '-10px',
839
- marginTop: '2px',
840
- color: '#444',
841
- }}
842
- >
843
- Paragraph
844
- </label>
845
- </div>
846
- </button>
847
- <div className="panel1">
848
- <p className="formp">Alignment:</p>
849
- <div className="czi-custom-buttons">
850
- <span
851
- aria-label=" Align Left"
852
- className="czi-tooltip-surface"
853
- data-tooltip=" Align Left"
854
- id="86ba3aa0-ff11-11ea-930a-95c69ca4f97f"
855
- role="tooltip"
856
- >
857
- <span
858
- aria-disabled="false"
859
- aria-pressed="false"
860
- className={
861
- this.state.styles.align == 'left'
862
- ? 'czi-custom-button use-icon activealignbuttons'
863
- : 'czi-custom-button alignbuttons'
864
- }
865
- onClick={this.onAlignButtonClick.bind(this, 'left')}
866
- role="button"
867
- >
868
- <span className="iconspan czi-icon format_align_left">
869
- format_align_left
870
- </span>
871
- </span>
872
- </span>
873
- <span
874
- aria-label=" Align Center"
875
- className="czi-tooltip-surface alignbuttons"
876
- data-tooltip=" Align Center"
877
- id="86ba61b0-ff11-11ea-930a-95c69ca4f97f"
878
- role="tooltip"
879
- >
880
- <span
881
- aria-disabled="false"
882
- aria-pressed="false"
883
- className={
884
- this.state.styles.align == 'center'
885
- ? 'czi-custom-button use-icon activealignbuttons'
886
- : 'czi-custom-button alignbuttons'
887
- }
888
- onClick={this.onAlignButtonClick.bind(this, 'center')}
889
- role="button"
890
- >
891
- <span className="iconspan czi-icon format_align_center">
892
- format_align_center
893
- </span>
894
- </span>
895
- </span>
896
- <span
897
- aria-label=" Align Right"
898
- className="czi-tooltip-surface alignbuttons"
899
- data-tooltip=" Align Right"
900
- id="86ba88c0-ff11-11ea-930a-95c69ca4f97f"
901
- role="tooltip"
902
- >
903
- <span
904
- aria-disabled="false"
905
- aria-pressed="false"
906
- className={
907
- this.state.styles.align == 'right'
908
- ? 'czi-custom-button use-icon activealignbuttons'
909
- : 'czi-custom-button alignbuttons'
910
- }
911
- onClick={this.onAlignButtonClick.bind(this, 'right')}
912
- role="button"
913
- >
914
- <span className="iconspan czi-icon format_align_right">
915
- format_align_right
916
- </span>
917
- </span>
918
- </span>
919
- <span
920
- aria-label=" Justify"
921
- className="czi-tooltip-surface alignbuttons"
922
- data-tooltip=" Justify"
923
- id="86baafd0-ff11-11ea-930a-95c69ca4f97f"
924
- role="tooltip"
925
- >
926
- <span
927
- aria-disabled="false"
928
- aria-pressed="false"
929
- className={
930
- this.state.styles.align == 'justify'
931
- ? 'czi-custom-button use-icon activealignbuttons'
932
- : 'czi-custom-button alignbuttons'
933
- }
934
- onClick={this.onAlignButtonClick.bind(this, 'justify')}
935
- role="button"
936
- >
937
- <span className="iconspan czi-icon format_align_justify">
938
- format_align_justify
939
- </span>
940
- </span>
941
- </span>
942
- </div>
943
- <p className="formp">Line Spacing:</p>
944
- <select
945
- className="linespacing fontstyle"
946
- onChange={this.onLineSpaceChange.bind(this)}
947
- value={this.state.styles.lineHeight || ''}
948
- >
949
- {LINE_SPACE.map((value) => (
950
- <option key={value} value={value}>
951
- {value}
952
- </option>
953
- ))}
954
- </select>
955
- <p className="formp">Paragraph Spacing:</p>
956
-
957
- <div className="spacingdiv">
958
- <label>Before: </label>
959
- <span>
960
- <input
961
- className="spacinginput fontstyle"
962
- key="before"
963
- onChange={this.onStyleClick.bind(this, 'before')}
964
- type="text"
965
- value={this.state.styles.paragraphSpacingBefore || ''}
966
- />
967
- </span>
968
- <label style={{ marginLeft: '3px' }}> pts</label>
969
-
970
- <label style={{ marginLeft: '23px' }}>After: </label>
971
- <span>
972
- <input
973
- className="spacinginput fontstyle"
974
- key="after"
975
- onChange={this.onStyleClick.bind(this, 'after')}
976
- type="text"
977
- value={this.state.styles.paragraphSpacingAfter || ''}
978
- />
979
- </span>
980
- <label style={{ marginLeft: '3px' }}>pts</label>
981
- </div>
982
- </div>
983
- <button className="licit-accordion accactive">
984
- <div className="indentdiv">
985
- <span className="iconspan czi-icon account_tree">
986
- account_tree
987
- </span>
988
- <label
989
- style={{
990
- marginLeft: '-7px',
991
- marginTop: '2px',
992
- color: '#444',
993
- }}
994
- >
995
- Hierarchy
996
- </label>
997
- </div>
998
- </button>
999
- <div className="panel2 formp">
1000
- <p className="formp">Level:</p>
1001
- <div className="hierarchydiv">
1002
- <span style={{ float: 'left', marginTop: '8px' }}>
1003
- <select
1004
- className="leveltype fontstyle"
1005
- id="levelValue"
1006
- onChange={this.onLevelChange.bind(this)}
1007
- value={this.state.styles.styleLevel || ''}
1008
- >
1009
- {LEVEL_VALUES.map((value) => (
1010
- <option key={value} value={value}>
1011
- {value}
1012
- </option>
1013
- ))}
1014
- </select>
1015
- </span>
1016
- <span>
1017
- <label>
1018
- <input
1019
- checked={this.state.styles.hasNumbering}
1020
- className="chknumbering"
1021
- disabled={this.state.styles.styleLevel ? false : true}
1022
- onChange={this.handleNumbering.bind(this)}
1023
- type="checkbox"
1024
- />
1025
- Numbering(1.1)
1026
- </label>
1027
- <label>
1028
- <input
1029
- checked={this.state.styles.boldNumbering}
1030
- className="chkboldnumbering"
1031
- disabled={this.state.styles.hasNumbering ? false : true}
1032
- onChange={this.handleBoldNumbering.bind(this)}
1033
- type="checkbox"
1034
- />
1035
- Bold numbering
1036
- </label>
1037
- </span>
1038
- </div>
1039
- <p className="formp">Indenting:</p>
1040
- <div className="hierarchydiv">
1041
- <div className="indentdiv">
1042
- <input
1043
- checked={this.state.styles.isLevelbased}
1044
- name="indenting"
1045
- onChange={this.onIndentRadioChanged.bind(this)}
1046
- type="radio"
1047
- value="0"
1048
- />
1049
- <label
1050
- style={{
1051
- marginLeft: '4px',
1052
- marginTop: '3px',
1053
- marginBottom: '0',
1054
- }}
1055
- >
1056
- Based On Level
1057
- </label>
1058
- </div>
1059
- <div className="indentdiv">
1060
- <input
1061
- checked={!this.state.styles.isLevelbased}
1062
- name="indenting"
1063
- onChange={this.onIndentRadioChanged.bind(this)}
1064
- type="radio"
1065
- value="1"
1066
- />
1067
- <label
1068
- style={{
1069
- marginLeft: '4px',
1070
- marginTop: '3px',
1071
- marginBottom: '0',
1072
- }}
1073
- >
1074
- Specified
1075
- </label>
1076
- <span>
1077
- <select
1078
- className="leveltype specifiedindent fontstyle"
1079
- onChange={this.onIndentChange.bind(this)}
1080
- style={{ width: '99px !important' }}
1081
- value={this.state.styles.indent || ''}
1082
- >
1083
- {LEVEL_VALUES.map((value) => (
1084
- <option key={value} value={value}>
1085
- {value}
1086
- </option>
1087
- ))}
1088
- </select>
1089
- </span>
1090
- </div>
1091
- </div>
1092
- </div>
1093
-
1094
- <button className="licit-accordion accactive">
1095
- <div className="indentdiv">
1096
- <label
1097
- style={{
1098
- marginLeft: '-7px',
1099
- marginTop: '2px',
1100
- color: '#444',
1101
- }}
1102
- >
1103
- Style Settings
1104
- </label>
1105
- </div>
1106
- </button>
1107
-
1108
- <div className="panel3 formp">
1109
- <p className="formp">Select style for next line:</p>
1110
- <div className="hierarchydiv">
1111
- <div className="settingsdiv">
1112
- <input
1113
- checked={
1114
- this.state.styles.nextLineStyleName ===
1115
- this.state.styleName && !this.state.otherStyleSelected
1116
- }
1117
- name="nextlinestyle"
1118
- onChange={this.onNextLineStyleSelected.bind(this, 1)}
1119
- type="radio"
1120
- value="1"
1121
- />
1122
- <label
1123
- style={{
1124
- marginLeft: '4px',
1125
- marginTop: '3px',
1126
- marginBottom: '0',
1127
- }}
1128
- >
1129
- Continue this style
1130
- </label>
1131
- </div>
1132
- <div className="settingsdiv">
1133
- <input
1134
- checked={this.state.styles.nextLineStyleName === 'None'}
1135
- name="nextlinestyle"
1136
- onChange={this.onNextLineStyleSelected.bind(this, 0)}
1137
- style={{
1138
- marginLeft: '20px',
1139
- }}
1140
- type="radio"
1141
- value="2"
1142
- />
1143
- <label
1144
- style={{
1145
- marginLeft: '4px',
1146
- marginTop: '3px',
1147
- marginBottom: '0',
1148
- }}
1149
- >
1150
- None
1151
- </label>
1152
- </div>
1153
- <div className="indentdiv">
1154
- <input
1155
- checked={this.state.otherStyleSelected}
1156
- name="nextlinestyle"
1157
- onChange={this.onNextLineStyleSelected.bind(this, 2)}
1158
- type="radio"
1159
- value="0"
1160
- />
1161
- <label
1162
- style={{
1163
- marginLeft: '4px',
1164
- marginTop: '3px',
1165
- marginBottom: '0',
1166
- width: '62px',
1167
- }}
1168
- >
1169
- Select style
1170
- </label>
1171
- <span id="nextStyle" style={{ display: 'none' }}>
1172
- <select
1173
- className="fontstyle stylenameinput"
1174
- // defaultValue={'DEFAULT'}
1175
- id="nextStyleValue"
1176
- onChange={this.onOtherStyleSelectionChanged.bind(this)}
1177
- style={{
1178
- height: '20px',
1179
- marginLeft: '7px',
1180
- width: '97px',
1181
- }}
1182
- value={this.state.styles.nextLineStyleName}
1183
- >
1184
- {customStyles.map((style) => (
1185
- <option key={style.styleName}>
1186
- {style.styleName}
1187
- </option>
1188
- ))}
1189
- </select>
1190
- </span>
1191
- </div>
1192
- </div>
1193
- </div>
1194
- </div>
1195
- </div>
1196
- </div>
1197
- <div className="btns">
1198
- <button className="buttonstyle" onClick={this._cancel}>
1199
- {this.state.mode == 3 ? 'Close' : 'Cancel'}
1200
- </button>
1201
- <button
1202
- className="btnsave buttonstyle"
1203
- onClick={this._save.bind(this)}
1204
- onKeyDown={this.handleKeyDown}
1205
- >
1206
- Save
1207
- </button>
1208
- </div>
1209
- </div>
1210
- );
1211
- }
1212
-
1213
- _cancel = (): void => {
1214
- // [FS] IRAD-1231 2021-03-02
1215
- // FIX: edited custom styles not applied to the document
1216
- if (3 === this.state.mode) {
1217
- delete this.state.customStyles;
1218
- this.props.close(editedStyles);
1219
- } else {
1220
- this.props.close();
1221
- }
1222
- };
1223
-
1224
- _save = (): void => {
1225
- delete this.state.otherStyleSelected;
1226
- // [FS] IRAD-1137 2021-01-15
1227
- // FIX: able to save a custom style name with already exist style name
1228
- if (0 === this.state.mode && isCustomStyleExists(this.state.styleName)) {
1229
- const errMsg = document.getElementById('errormsg');
1230
- if (errMsg && errMsg.style) {
1231
- errMsg.style.display = '';
1232
- }
1233
-
1234
- // [FS] IRAD-1176 2021-02-08
1235
- // save the custom styles from Edit all option.
1236
- } else if (3 === this.state.mode) {
1237
- this.modifyCustomStyle(this.state);
1238
- editedStyles.push(this.state.styleName);
1239
- } else {
1240
- if ('' != this.state.styleName) {
1241
- delete this.state.customStyles;
1242
- this.props.close(this.state);
1243
- }
1244
- }
1245
- };
1246
-
1247
- handleKeyDown = (e: KeyboardEvent): void => {
1248
- const txtName = document.getElementById('txtName');
1249
- if (txtName) {
1250
- txtName.focus();
1251
- }
1252
- };
1253
- // [FS] IRAD-1176 2021-02-08
1254
- // save the custom styles from Edit all option.
1255
- modifyCustomStyle(val: EditorState) {
1256
- const { runtime } = this.props.editorView;
1257
- if (runtime && typeof runtime.saveStyle === 'function') {
1258
- delete val.editorView;
1259
- runtime.saveStyle(val).then((result) => { });
1260
- }
1261
- }
1262
-
1263
- // To fetch the custom styles from server and set to the state.
1264
- getCustomStyles(runtime: EditorRuntime) {
1265
- if (runtime && typeof runtime.getStylesAsync === 'function') {
1266
- runtime.getStylesAsync().then((result) => {
1267
- customStyles = result;
1268
- // [FS] IRAD-1222 2021-03-01
1269
- // Issue fix: In edit all, the style list not showing the first time.
1270
- this.setState({
1271
- customStyles: result,
1272
- });
1273
- });
1274
- }
1275
- }
1276
-
1277
- // [FS] IRAD-1231 2021-03-03
1278
- // Issue fix: Selected style for next line not retaining when modify.
1279
- setNextLineStyle(nextLineStyleName: string) {
1280
- // [FS] IRAD-1241 2021-03-05
1281
- // The selcted Style in the Next line setting not retaing in Edit All and modify
1282
- let display = '';
1283
-
1284
- if (
1285
- 0 < this.props.mode &&
1286
- nextLineStyleName &&
1287
- RESERVED_STYLE_NONE !== nextLineStyleName &&
1288
- nextLineStyleName !== this.state.styleName
1289
- ) {
1290
- this.setState({
1291
- otherStyleSelected: true,
1292
- });
1293
-
1294
- display = 'block';
1295
- const selectedStyle = document.getElementById('nextStyleValue');
1296
- if (selectedStyle instanceof window.HTMLSelectElement) {
1297
- selectedStyle.value = nextLineStyleName;
1298
- }
1299
- } else {
1300
- this.setState({
1301
- otherStyleSelected: false,
1302
- });
1303
-
1304
- display = 'none';
1305
- }
1306
-
1307
- const hiddenDiv = document.getElementById('nextStyle');
1308
- if (hiddenDiv && hiddenDiv.style) {
1309
- hiddenDiv.style.display = display;
1310
- }
1311
- }
1312
-
1313
- // Disable the style attribute div on Rename
1314
- disableRename() {
1315
- const style = {};
1316
- if (2 === this.state.mode) {
1317
- style.opacity = 0.4;
1318
- style.pointerEvents = 'none';
1319
- }
1320
-
1321
- return style;
1322
- }
1323
- }
1324
-
1325
- export default CustomStyleEditor;