qms-angular 1.0.86 → 1.0.89

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 (289) hide show
  1. package/README.md +5 -1
  2. package/bundles/qms-angular.umd.js +6943 -219
  3. package/bundles/qms-angular.umd.js.map +1 -1
  4. package/esm2015/lib/components/badges/qms-badges.component.js +1 -1
  5. package/esm2015/lib/components/banner/qms-banner/qms-banner.component.js +1 -1
  6. package/esm2015/lib/components/banner/qms-banner-confirm/qms-banner-confirm.component.js +1 -1
  7. package/esm2015/lib/components/banner/qms-banner-loading/qms-banner-loading.component.js +1 -1
  8. package/esm2015/lib/components/button/button-toggle.js +1 -1
  9. package/esm2015/lib/components/button/button.js +3 -3
  10. package/esm2015/lib/components/comment/comment.js +6 -3
  11. package/esm2015/lib/components/dialog/dialog.js +2 -2
  12. package/esm2015/lib/components/list/list.js +2 -2
  13. package/esm2015/lib/components/qms-navigation-drawer/qms-navigation-drawer.component.js +3 -3
  14. package/esm2015/lib/components/qms-paginator/qms-paginator.component.js +16 -7
  15. package/esm2015/lib/components/related/content/related-content.component.js +2 -2
  16. package/esm2015/lib/components/related/list-other-related/list-related.component.js +1 -1
  17. package/esm2015/lib/components/related/risk/list/list.component.js +1 -1
  18. package/esm2015/lib/components/related/risk/result/result.component.js +1 -1
  19. package/esm2015/lib/components/rich-text/rich-text.js +1 -1
  20. package/esm2015/lib/components/table/table-action.js +2 -2
  21. package/esm2015/lib/components/table/table.module.js +4 -4
  22. package/esm2015/lib/components/tooltip/tooltip.js +1 -1
  23. package/esm2015/lib/components/tree/tree.component.js +1 -1
  24. package/esm2015/lib/components/treeNew/tree.component.js +18 -2
  25. package/esm2015/lib/directives/file-upload/file-upload-multiple-selector.directive.js +3 -1
  26. package/esm2015/lib/directives/file-upload/file-upload-selector.directive.js +3 -1
  27. package/esm2015/lib/directives/file-upload/file-upload.directive.js +1 -1
  28. package/esm2015/lib/directives/text-truncate/text-truncate.directive.js +58 -0
  29. package/esm2015/lib/model/en.js +63 -2
  30. package/esm2015/lib/model/no.js +63 -2
  31. package/esm2015/lib/qms-angular.module.js +4 -1
  32. package/esm2015/lib/qms-ckeditor-components/common/flowchart/config/halo.function.js +87 -0
  33. package/esm2015/lib/qms-ckeditor-components/common/flowchart/config/inspector.function.js +3767 -0
  34. package/esm2015/lib/qms-ckeditor-components/common/flowchart/config/selection.function.js +56 -0
  35. package/esm2015/lib/qms-ckeditor-components/common/flowchart/config/stencil.function.js +1003 -0
  36. package/esm2015/lib/qms-ckeditor-components/common/flowchart/config/toolbar.function.js +302 -0
  37. package/esm2015/lib/qms-ckeditor-components/common/flowchart/models/app-shapes.js +320 -0
  38. package/esm2015/lib/qms-ckeditor-components/common/flowchart/service/keyboard-service.js +69 -0
  39. package/esm2015/lib/qms-ckeditor-components/common/flowchart/service/kitchensink-service.js +412 -0
  40. package/esm2015/lib/qms-ckeditor-components/common/flowchart/themes/theme-picker.js +80 -0
  41. package/esm2015/lib/qms-ckeditor-components/common/functions/common.function.js +34 -1
  42. package/esm2015/lib/qms-ckeditor-components/common/models/qms-ckeditor-save-as-template.model.js +1 -1
  43. package/esm2015/lib/qms-ckeditor-components/common/module/confirm/qms-ckeditor-confirm.component.js +3 -3
  44. package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-about/qms-ckeditor-about.component.js +1 -1
  45. package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-bpmn/qms-ckeditor-bpmn.component.js +2 -2
  46. package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-bpmn/save-template/save-template.component.js +2 -2
  47. package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-flowchart/qms-ckeditor-flowchart.component.js +317 -0
  48. package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-imagemap/qms-ckeditor-imagemap.component.js +3 -3
  49. package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-link/attachments/link-attachment.component.js +3 -3
  50. package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-link/qms-ckeditor-link.component.js +3 -3
  51. package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-load-template/qms-ckeditor-load-template.component.js +3 -3
  52. package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-relation/qmsckeditor-related.component.js +3 -3
  53. package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-template/qms-ckeditor-template.component.js +3 -3
  54. package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-tooltip/qms-ckeditor-tooltip.component.js +3 -3
  55. package/esm2015/lib/qms-ckeditor-components/qms-ckeditor.component.js +35 -3
  56. package/esm2015/lib/qms-ckeditor-components/qms-ckeditor.module.js +4 -2
  57. package/esm2015/public-api.js +8 -1
  58. package/esm2015/qms-angular.js +2 -1
  59. package/fesm2015/qms-angular.js +6882 -213
  60. package/fesm2015/qms-angular.js.map +1 -1
  61. package/lib/components/comment/comment.d.ts +1 -0
  62. package/lib/components/qms-paginator/qms-paginator.component.d.ts +1 -0
  63. package/lib/components/treeNew/tree.component.d.ts +1 -0
  64. package/lib/directives/text-truncate/text-truncate.directive.d.ts +15 -0
  65. package/lib/model/en.d.ts +61 -0
  66. package/lib/model/no.d.ts +61 -0
  67. package/lib/qms-ckeditor-components/common/flowchart/config/halo.function.d.ts +37 -0
  68. package/lib/qms-ckeditor-components/common/flowchart/config/inspector.function.d.ts +7 -0
  69. package/lib/qms-ckeditor-components/common/flowchart/config/selection.function.d.ts +39 -0
  70. package/lib/qms-ckeditor-components/common/flowchart/config/stencil.function.d.ts +11 -0
  71. package/lib/qms-ckeditor-components/common/flowchart/config/toolbar.function.d.ts +224 -0
  72. package/lib/qms-ckeditor-components/common/flowchart/models/app-shapes.d.ts +58 -0
  73. package/lib/qms-ckeditor-components/common/flowchart/service/keyboard-service.d.ts +16 -0
  74. package/lib/qms-ckeditor-components/common/flowchart/service/kitchensink-service.d.ts +56 -0
  75. package/lib/qms-ckeditor-components/common/flowchart/themes/theme-picker.d.ts +35 -0
  76. package/lib/qms-ckeditor-components/common/functions/common.function.d.ts +12 -0
  77. package/lib/qms-ckeditor-components/common/models/qms-ckeditor-save-as-template.model.d.ts +2 -0
  78. package/lib/qms-ckeditor-components/components/qms-ckeditor-flowchart/qms-ckeditor-flowchart.component.d.ts +41 -0
  79. package/lib/qms-ckeditor-components/qms-ckeditor.component.d.ts +4 -0
  80. package/lib.theme.scss +179 -0
  81. package/package.json +1 -1
  82. package/public-api.d.ts +7 -0
  83. package/qms-angular.d.ts +1 -0
  84. package/qms-angular.metadata.json +1 -1
  85. package/src/assets/fonts/Material/flUhRq6tzZclQEJ-Vdg-IuiaDsNc.woff2 +0 -0
  86. package/src/assets/fonts/Material/gok-H7zzDkdnRel8-DQ6KAXJ69wP1tGnf4ZGhUce.woff2 +0 -0
  87. package/src/assets/fonts/OpenSans/mem8YaGs126MiZpBA-UFUZ0bbck.woff2 +0 -0
  88. package/src/assets/fonts/OpenSans/mem8YaGs126MiZpBA-UFVZ0b.woff2 +0 -0
  89. package/src/assets/fonts/OpenSans/mem8YaGs126MiZpBA-UFVp0bbck.woff2 +0 -0
  90. package/src/assets/fonts/OpenSans/mem8YaGs126MiZpBA-UFW50bbck.woff2 +0 -0
  91. package/src/assets/fonts/OpenSans/mem8YaGs126MiZpBA-UFWJ0bbck.woff2 +0 -0
  92. package/src/assets/fonts/OpenSans/mem8YaGs126MiZpBA-UFWZ0bbck.woff2 +0 -0
  93. package/src/assets/fonts/OpenSans/mem8YaGs126MiZpBA-UFWp0bbck.woff2 +0 -0
  94. package/src/assets/fonts/Raleway/1Ptxg8zYS_SKggPN4iEgvnHyvveLxVvaorCFPrEHJA.woff2 +0 -0
  95. package/src/assets/fonts/Raleway/1Ptxg8zYS_SKggPN4iEgvnHyvveLxVvaorCGPrEHJA.woff2 +0 -0
  96. package/src/assets/fonts/Raleway/1Ptxg8zYS_SKggPN4iEgvnHyvveLxVvaorCHPrEHJA.woff2 +0 -0
  97. package/src/assets/fonts/Raleway/1Ptxg8zYS_SKggPN4iEgvnHyvveLxVvaorCIPrE.woff2 +0 -0
  98. package/src/assets/fonts/Raleway/1Ptxg8zYS_SKggPN4iEgvnHyvveLxVvaorCMPrEHJA.woff2 +0 -0
  99. package/src/assets/jointjs/images/delete-icon-modern.png +0 -0
  100. package/src/assets/jointjs/images/reset-icon-modern.png +0 -0
  101. package/src/assets/jointjs/images/save-icon-modern.png +0 -0
  102. package/src/assets/jointjs/images/to-front-icon-modern.png +0 -0
  103. package/src/assets/jointjs/images/toback-icon-modern.png +0 -0
  104. package/src/assets/jointjs/images/toolbar-icons-material.png +0 -0
  105. package/src/assets/jointjs/images/toolbar-icons-modern.png +0 -0
  106. package/src/assets/jointjs/scss/rappid.scss +326 -0
  107. package/src/assets/jointjs/scss/theme-picker.scss +22 -0
  108. package/src/assets/qms-ckeditor-plugin/build/ckeditor.js +1 -1
  109. package/src/assets/qms-ckeditor-plugin/build/ckeditor.js.map +1 -1
  110. package/src/assets/qms-ckeditor-plugin/build/translations/ar.js +1 -1
  111. package/src/assets/qms-ckeditor-plugin/build/translations/az.js +1 -1
  112. package/src/assets/qms-ckeditor-plugin/build/translations/bg.js +1 -1
  113. package/src/assets/qms-ckeditor-plugin/build/translations/ca.js +1 -1
  114. package/src/assets/qms-ckeditor-plugin/build/translations/cs.js +1 -1
  115. package/src/assets/qms-ckeditor-plugin/build/translations/da.js +1 -1
  116. package/src/assets/qms-ckeditor-plugin/build/translations/de-ch.js +1 -1
  117. package/src/assets/qms-ckeditor-plugin/build/translations/de.js +1 -1
  118. package/src/assets/qms-ckeditor-plugin/build/translations/el.js +1 -1
  119. package/src/assets/qms-ckeditor-plugin/build/translations/en-au.js +1 -1
  120. package/src/assets/qms-ckeditor-plugin/build/translations/en-gb.js +1 -1
  121. package/src/assets/qms-ckeditor-plugin/build/translations/eo.js +1 -1
  122. package/src/assets/qms-ckeditor-plugin/build/translations/es.js +1 -1
  123. package/src/assets/qms-ckeditor-plugin/build/translations/et.js +1 -1
  124. package/src/assets/qms-ckeditor-plugin/build/translations/eu.js +1 -1
  125. package/src/assets/qms-ckeditor-plugin/build/translations/fa.js +1 -1
  126. package/src/assets/qms-ckeditor-plugin/build/translations/fi.js +1 -1
  127. package/src/assets/qms-ckeditor-plugin/build/translations/fr.js +1 -1
  128. package/src/assets/qms-ckeditor-plugin/build/translations/gl.js +1 -1
  129. package/src/assets/qms-ckeditor-plugin/build/translations/he.js +1 -1
  130. package/src/assets/qms-ckeditor-plugin/build/translations/hi.js +1 -1
  131. package/src/assets/qms-ckeditor-plugin/build/translations/hr.js +1 -1
  132. package/src/assets/qms-ckeditor-plugin/build/translations/hu.js +1 -1
  133. package/src/assets/qms-ckeditor-plugin/build/translations/id.js +1 -1
  134. package/src/assets/qms-ckeditor-plugin/build/translations/it.js +1 -1
  135. package/src/assets/qms-ckeditor-plugin/build/translations/ja.js +1 -1
  136. package/src/assets/qms-ckeditor-plugin/build/translations/km.js +1 -1
  137. package/src/assets/qms-ckeditor-plugin/build/translations/kn.js +1 -1
  138. package/src/assets/qms-ckeditor-plugin/build/translations/ko.js +1 -1
  139. package/src/assets/qms-ckeditor-plugin/build/translations/ku.js +1 -1
  140. package/src/assets/qms-ckeditor-plugin/build/translations/lt.js +1 -1
  141. package/src/assets/qms-ckeditor-plugin/build/translations/lv.js +1 -1
  142. package/src/assets/qms-ckeditor-plugin/build/translations/nb.js +1 -1
  143. package/src/assets/qms-ckeditor-plugin/build/translations/ne.js +1 -1
  144. package/src/assets/qms-ckeditor-plugin/build/translations/nl.js +1 -1
  145. package/src/assets/qms-ckeditor-plugin/build/translations/no.js +1 -1
  146. package/src/assets/qms-ckeditor-plugin/build/translations/pl.js +1 -1
  147. package/src/assets/qms-ckeditor-plugin/build/translations/pt-br.js +1 -1
  148. package/src/assets/qms-ckeditor-plugin/build/translations/pt.js +1 -1
  149. package/src/assets/qms-ckeditor-plugin/build/translations/ro.js +1 -1
  150. package/src/assets/qms-ckeditor-plugin/build/translations/ru.js +1 -1
  151. package/src/assets/qms-ckeditor-plugin/build/translations/sk.js +1 -1
  152. package/src/assets/qms-ckeditor-plugin/build/translations/sl.js +1 -1
  153. package/src/assets/qms-ckeditor-plugin/build/translations/sq.js +1 -1
  154. package/src/assets/qms-ckeditor-plugin/build/translations/sr-latn.js +1 -1
  155. package/src/assets/qms-ckeditor-plugin/build/translations/sr.js +1 -1
  156. package/src/assets/qms-ckeditor-plugin/build/translations/sv.js +1 -1
  157. package/src/assets/qms-ckeditor-plugin/build/translations/th.js +1 -1
  158. package/src/assets/qms-ckeditor-plugin/build/translations/tk.js +1 -1
  159. package/src/assets/qms-ckeditor-plugin/build/translations/tr.js +1 -1
  160. package/src/assets/qms-ckeditor-plugin/build/translations/ug.js +1 -1
  161. package/src/assets/qms-ckeditor-plugin/build/translations/uk.js +1 -1
  162. package/src/assets/qms-ckeditor-plugin/build/translations/vi.js +1 -1
  163. package/src/assets/qms-ckeditor-plugin/build/translations/zh-cn.js +1 -1
  164. package/src/assets/qms-ckeditor-plugin/build/translations/zh.js +1 -1
  165. package/src/assets/qms-ckeditor-plugin/package-lock.json +12632 -345
  166. package/src/assets/qms-ckeditor-plugin/package.json +0 -2
  167. package/src/assets/qms-ckeditor-plugin/src/ckeditor.js +8 -8
  168. package/src/assets/qms-ckeditor-plugin/src/plugins/common/qmsCKEditorService.js +9 -0
  169. package/src/assets/qms-ckeditor-plugin/src/plugins/flowchart/flowchartdialogcommand.js +47 -0
  170. package/src/assets/qms-ckeditor-plugin/src/plugins/flowchart/qmsCKEditorFlowchartPlugin.js +30 -0
  171. package/src/assets/qms-ckeditor-plugin/src/plugins/heading/heading.js +119 -0
  172. package/src/assets/qms-ckeditor-plugin/src/plugins/heading/headingbuttonsui.js +103 -0
  173. package/src/assets/qms-ckeditor-plugin/src/plugins/heading/headingcommand.js +96 -0
  174. package/src/assets/qms-ckeditor-plugin/src/plugins/heading/headingediting.js +163 -0
  175. package/src/assets/qms-ckeditor-plugin/src/plugins/heading/headingui.js +115 -0
  176. package/src/assets/qms-ckeditor-plugin/src/plugins/heading/index.js +22 -0
  177. package/src/assets/qms-ckeditor-plugin/src/plugins/heading/theme/heading.css +35 -0
  178. package/src/assets/qms-ckeditor-plugin/src/plugins/heading/theme/icons/heading1.svg +1 -0
  179. package/src/assets/qms-ckeditor-plugin/src/plugins/heading/theme/icons/heading2.svg +1 -0
  180. package/src/assets/qms-ckeditor-plugin/src/plugins/heading/theme/icons/heading3.svg +1 -0
  181. package/src/assets/qms-ckeditor-plugin/src/plugins/heading/theme/icons/heading4.svg +1 -0
  182. package/src/assets/qms-ckeditor-plugin/src/plugins/heading/theme/icons/heading5.svg +1 -0
  183. package/src/assets/qms-ckeditor-plugin/src/plugins/heading/theme/icons/heading6.svg +1 -0
  184. package/src/assets/qms-ckeditor-plugin/src/plugins/heading/title.js +598 -0
  185. package/src/assets/qms-ckeditor-plugin/src/plugins/heading/utils.js +42 -0
  186. package/src/assets/qms-ckeditor-plugin/src/plugins/table/commands/insertcolumncommand.js +83 -0
  187. package/src/assets/qms-ckeditor-plugin/src/plugins/table/commands/insertrowcommand.js +82 -0
  188. package/src/assets/qms-ckeditor-plugin/src/plugins/table/commands/inserttablecommand.js +76 -0
  189. package/src/assets/qms-ckeditor-plugin/src/plugins/table/commands/mergecellcommand.js +272 -0
  190. package/src/assets/qms-ckeditor-plugin/src/plugins/table/commands/mergecellscommand.js +122 -0
  191. package/src/assets/qms-ckeditor-plugin/src/plugins/table/commands/removecolumncommand.js +122 -0
  192. package/src/assets/qms-ckeditor-plugin/src/plugins/table/commands/removerowcommand.js +97 -0
  193. package/src/assets/qms-ckeditor-plugin/src/plugins/table/commands/selectcolumncommand.js +63 -0
  194. package/src/assets/qms-ckeditor-plugin/src/plugins/table/commands/selectrowcommand.js +56 -0
  195. package/src/assets/qms-ckeditor-plugin/src/plugins/table/commands/setheadercolumncommand.js +95 -0
  196. package/src/assets/qms-ckeditor-plugin/src/plugins/table/commands/setheaderrowcommand.js +105 -0
  197. package/src/assets/qms-ckeditor-plugin/src/plugins/table/commands/splitcellcommand.js +68 -0
  198. package/src/assets/qms-ckeditor-plugin/src/plugins/table/converters/downcast.js +529 -0
  199. package/src/assets/qms-ckeditor-plugin/src/plugins/table/converters/table-cell-paragraph-post-fixer.js +136 -0
  200. package/src/assets/qms-ckeditor-plugin/src/plugins/table/converters/table-cell-refresh-post-fixer.js +75 -0
  201. package/src/assets/qms-ckeditor-plugin/src/plugins/table/converters/table-heading-rows-refresh-post-fixer.js +55 -0
  202. package/src/assets/qms-ckeditor-plugin/src/plugins/table/converters/table-layout-post-fixer.js +399 -0
  203. package/src/assets/qms-ckeditor-plugin/src/plugins/table/converters/tableproperties.js +126 -0
  204. package/src/assets/qms-ckeditor-plugin/src/plugins/table/converters/upcasttable.js +211 -0
  205. package/src/assets/qms-ckeditor-plugin/src/plugins/table/index.js +42 -0
  206. package/src/assets/qms-ckeditor-plugin/src/plugins/table/table.js +103 -0
  207. package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablecellproperties/commands/tablecellbackgroundcolorcommand.js +35 -0
  208. package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablecellproperties/commands/tablecellbordercolorcommand.js +47 -0
  209. package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablecellproperties/commands/tablecellborderstylecommand.js +47 -0
  210. package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablecellproperties/commands/tablecellborderwidthcommand.js +62 -0
  211. package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablecellproperties/commands/tablecellheightcommand.js +51 -0
  212. package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablecellproperties/commands/tablecellhorizontalalignmentcommand.js +35 -0
  213. package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablecellproperties/commands/tablecellpaddingcommand.js +62 -0
  214. package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablecellproperties/commands/tablecellpropertycommand.js +110 -0
  215. package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablecellproperties/commands/tablecellverticalalignmentcommand.js +43 -0
  216. package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablecellproperties/commands/tablecellwidthcommand.js +51 -0
  217. package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablecellproperties/tablecellpropertiesediting.js +204 -0
  218. package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablecellproperties/tablecellpropertiesui.js +401 -0
  219. package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablecellproperties/ui/tablecellpropertiesview.js +829 -0
  220. package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablecellproperties.js +80 -0
  221. package/src/assets/qms-ckeditor-plugin/src/plugins/table/tableclipboard.js +586 -0
  222. package/src/assets/qms-ckeditor-plugin/src/plugins/table/tableediting.js +160 -0
  223. package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablekeyboard.js +343 -0
  224. package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablemouse/mouseeventsobserver.js +72 -0
  225. package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablemouse.js +218 -0
  226. package/src/assets/qms-ckeditor-plugin/src/plugins/table/tableproperties/commands/tablealignmentcommand.js +35 -0
  227. package/src/assets/qms-ckeditor-plugin/src/plugins/table/tableproperties/commands/tablebackgroundcolorcommand.js +35 -0
  228. package/src/assets/qms-ckeditor-plugin/src/plugins/table/tableproperties/commands/tablebordercolorcommand.js +47 -0
  229. package/src/assets/qms-ckeditor-plugin/src/plugins/table/tableproperties/commands/tableborderstylecommand.js +47 -0
  230. package/src/assets/qms-ckeditor-plugin/src/plugins/table/tableproperties/commands/tableborderwidthcommand.js +62 -0
  231. package/src/assets/qms-ckeditor-plugin/src/plugins/table/tableproperties/commands/tableheightcommand.js +51 -0
  232. package/src/assets/qms-ckeditor-plugin/src/plugins/table/tableproperties/commands/tablepropertycommand.js +98 -0
  233. package/src/assets/qms-ckeditor-plugin/src/plugins/table/tableproperties/commands/tablewidthcommand.js +51 -0
  234. package/src/assets/qms-ckeditor-plugin/src/plugins/table/tableproperties/tablepropertiesediting.js +182 -0
  235. package/src/assets/qms-ckeditor-plugin/src/plugins/table/tableproperties/tablepropertiesui.js +397 -0
  236. package/src/assets/qms-ckeditor-plugin/src/plugins/table/tableproperties/ui/tablepropertiesview.js +714 -0
  237. package/src/assets/qms-ckeditor-plugin/src/plugins/table/tableproperties.js +81 -0
  238. package/src/assets/qms-ckeditor-plugin/src/plugins/table/tableselection.js +357 -0
  239. package/src/assets/qms-ckeditor-plugin/src/plugins/table/tabletoolbar.js +111 -0
  240. package/src/assets/qms-ckeditor-plugin/src/plugins/table/tableui.js +359 -0
  241. package/src/assets/qms-ckeditor-plugin/src/plugins/table/tableutils.js +909 -0
  242. package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablewalker.js +538 -0
  243. package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/colorinput.css +39 -0
  244. package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/form.css +11 -0
  245. package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/formrow.css +23 -0
  246. package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/icons/table-cell-properties.svg +1 -0
  247. package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/icons/table-column.svg +1 -0
  248. package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/icons/table-merge-cell.svg +1 -0
  249. package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/icons/table-properties.svg +1 -0
  250. package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/icons/table-row.svg +1 -0
  251. package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/icons/table.svg +1 -0
  252. package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/inserttable.css +10 -0
  253. package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/snippet.css +3876 -0
  254. package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/table.css +67 -0
  255. package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/tablecaption.css +53 -0
  256. package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/tablecellproperties.css +28 -0
  257. package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/tableediting.css +10 -0
  258. package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/tableform.css +59 -0
  259. package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/tableproperties.css +18 -0
  260. package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/tableselection.css +10 -0
  261. package/src/assets/qms-ckeditor-plugin/src/plugins/table/ui/colorinputview.js +343 -0
  262. package/src/assets/qms-ckeditor-plugin/src/plugins/table/ui/formrowview.js +103 -0
  263. package/src/assets/qms-ckeditor-plugin/src/plugins/table/ui/inserttableview.js +222 -0
  264. package/src/assets/qms-ckeditor-plugin/src/plugins/table/utils/common.js +57 -0
  265. package/src/assets/qms-ckeditor-plugin/src/plugins/table/utils/selection.js +276 -0
  266. package/src/assets/qms-ckeditor-plugin/src/plugins/table/utils/structure.js +543 -0
  267. package/src/assets/qms-ckeditor-plugin/src/plugins/table/utils/table-properties.js +66 -0
  268. package/src/assets/qms-ckeditor-plugin/src/plugins/table/utils/ui/contextualballoon.js +130 -0
  269. package/src/assets/qms-ckeditor-plugin/src/plugins/table/utils/ui/table-properties.js +397 -0
  270. package/src/assets/qms-ckeditor-plugin/src/plugins/table/utils/ui/widget.js +62 -0
  271. package/src/assets/qms-ckeditor-plugin/src/themes/icons/flowchart.svg +507 -0
  272. package/src/lib/components/comment/comment.scss +1 -0
  273. package/src/lib/components/qms-navigation-drawer/qms-navigation-drawer.component.scss +1 -0
  274. package/src/lib/components/qms-paginator/qms-paginator.component.scss +4 -1
  275. package/src/lib/qms-ckeditor-components/common/flowchart/assets/image-icon1.svg +1 -0
  276. package/src/lib/qms-ckeditor-components/common/flowchart/assets/image-icon2.svg +6 -0
  277. package/src/lib/qms-ckeditor-components/common/flowchart/assets/image-icon3.svg +11 -0
  278. package/src/lib/qms-ckeditor-components/common/flowchart/assets/image-icon4.svg +8 -0
  279. package/src/lib/qms-ckeditor-components/common/flowchart/assets/member-female.png +0 -0
  280. package/src/lib/qms-ckeditor-components/common/flowchart/assets/member-male.png +0 -0
  281. package/src/lib/qms-ckeditor-components/common/flowchart/assets/no-color-icon.svg +72 -0
  282. package/src/lib/qms-ckeditor-components/common/flowchart/assets/toolbar-icons-material.png +0 -0
  283. package/src/lib/qms-ckeditor-components/common/flowchart/assets/toolbar-icons-modern.png +0 -0
  284. package/src/lib/qms-ckeditor-components/common/flowchart/assets/transparent-icon.svg +50 -0
  285. package/src/lib/qms-ckeditor-components/components/qms-ckeditor-flowchart/qms-ckeditor-flowchart.component.scss +68 -0
  286. package/src/lib/qms-ckeditor-components/styles/_modules.scss +9 -0
  287. package/src/themes/core/_mat-icon.scss +60 -60
  288. package/src/themes/core/_table.scss +72 -4
  289. package/src/themes/core/_typography.scss +108 -108
@@ -38,7 +38,6 @@
38
38
  "@ckeditor/ckeditor5-dev-webpack-plugin": "^24.4.2",
39
39
  "@ckeditor/ckeditor5-editor-classic": "^27.1.0",
40
40
  "@ckeditor/ckeditor5-essentials": "^27.1.0",
41
- "@ckeditor/ckeditor5-heading": "^27.1.0",
42
41
  "@ckeditor/ckeditor5-image": "^27.1.0",
43
42
  "@ckeditor/ckeditor5-indent": "^27.1.0",
44
43
  "@ckeditor/ckeditor5-inspector": "^2.2.2",
@@ -47,7 +46,6 @@
47
46
  "@ckeditor/ckeditor5-media-embed": "^27.1.0",
48
47
  "@ckeditor/ckeditor5-paragraph": "^27.1.0",
49
48
  "@ckeditor/ckeditor5-paste-from-office": "^27.1.0",
50
- "@ckeditor/ckeditor5-table": "^27.1.0",
51
49
  "@ckeditor/ckeditor5-theme-lark": "^27.1.0",
52
50
  "@ckeditor/ckeditor5-word-count": "^27.1.0",
53
51
  "@ckeditor/ckeditor5-find-and-replace": "^28.0.1",
@@ -14,7 +14,7 @@ import CKFinder from '@ckeditor/ckeditor5-ckfinder/src/ckfinder.js';
14
14
  import ClassicEditor from '@ckeditor/ckeditor5-editor-classic/src/classiceditor.js';
15
15
  import Essentials from '@ckeditor/ckeditor5-essentials/src/essentials.js';
16
16
  import Font from '@ckeditor/ckeditor5-font/src/font.js';
17
- import Heading from '@ckeditor/ckeditor5-heading/src/heading.js';
17
+ import Heading from './plugins/heading/heading.js';
18
18
  import Image from '@ckeditor/ckeditor5-image/src/image.js';
19
19
  import ImageCaption from '@ckeditor/ckeditor5-image/src/imagecaption.js';
20
20
  import ImageResize from '@ckeditor/ckeditor5-image/src/imageresize.js';
@@ -24,11 +24,11 @@ import ImageUpload from '@ckeditor/ckeditor5-image/src/imageupload.js';
24
24
  import List from '@ckeditor/ckeditor5-list/src/list.js';
25
25
  import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph.js';
26
26
  import PasteFromOffice from '@ckeditor/ckeditor5-paste-from-office/src/pastefromoffice';
27
- import Table from '@ckeditor/ckeditor5-table/src/table.js';
28
- import TableProperties from '@ckeditor/ckeditor5-table/src/tableproperties';
29
- import TableCellProperties from '@ckeditor/ckeditor5-table/src/tablecellproperties.js';
30
- import TableSelection from '@ckeditor/ckeditor5-table/src/tableselection.js';
31
- import TableToolbar from '@ckeditor/ckeditor5-table/src/tabletoolbar.js';
27
+ import Table from './plugins/table/table.js';
28
+ import TableProperties from './plugins/table/tableproperties';
29
+ import TableCellProperties from './plugins/table/tablecellproperties.js';
30
+ import TableSelection from './plugins/table/tableselection.js';
31
+ import TableToolbar from './plugins/table/tabletoolbar.js';
32
32
  import TextTransformation from '@ckeditor/ckeditor5-typing/src/texttransformation.js';
33
33
  import WordCount from '@ckeditor/ckeditor5-word-count/src/wordcount';
34
34
  import Anchor from './plugins/anchor/anchor.js';
@@ -67,7 +67,7 @@ import IndentBlock from '@ckeditor/ckeditor5-indent/src/indentblock';
67
67
  import HorizontalLine from '@ckeditor/ckeditor5-horizontal-line/src/horizontalline';
68
68
  import ToggleToolbar from './plugins/toggletoolbar/toggletoolbar.js';
69
69
  import QMSCKEditorBpmnPlugin from './plugins/bpmn/qmsCKEditorBpmnPlugin.js';
70
- //import QMSCKEditorFlowchartPlugin from './plugins/flowchart/qmsCKEditorFlowchartPlugin.js';
70
+ import QMSCKEditorFlowchartPlugin from './plugins/flowchart/qmsCKEditorFlowchartPlugin.js';
71
71
  import TableOfContents from './plugins/tableofcontents/tableofcontents';
72
72
  import AboutCKEditor from './plugins/aboutckeditor/aboutckeditor.js';
73
73
  //import WProofreader from '@webspellchecker/wproofreader-ckeditor5/src/wproofreader';
@@ -142,7 +142,7 @@ Editor.builtinPlugins = [
142
142
  HorizontalLine,
143
143
  QMSCKEditorBpmnPlugin,
144
144
  AboutCKEditor,
145
- //QMSCKEditorFlowchartPlugin,
145
+ QMSCKEditorFlowchartPlugin,
146
146
  ToggleToolbar,
147
147
  TableOfContents,
148
148
  //WProofreader,
@@ -80,6 +80,15 @@ export function bpmnNotify(value) {
80
80
  );
81
81
  }
82
82
 
83
+ export function flowchartNotify(value) {
84
+ window.postMessage(
85
+ {
86
+ eventName: constant.QMSCK_FLOWCHART_PLUGIN_MSG,
87
+ value
88
+ },
89
+ '*'
90
+ );
91
+ }
83
92
 
84
93
  export function uploadVideoNotify(value) {
85
94
  window.postMessage(
@@ -0,0 +1,47 @@
1
+ import { Command } from '@ckeditor/ckeditor5-core';
2
+ import * as QMSCKEditorConstant from '../common/qmsCKEditorConstant';
3
+ import * as QMSCKEditorService from '../common/qmsCKEditorService';
4
+
5
+ export default class FlowchartDialogCommand extends Command {
6
+ execute() {
7
+ const editor = this.editor;
8
+ const isFlowchart = this.isFlowchartImage(editor.editing.view.document.selection.getSelectedElement(), editor.plugins.get('Image'))
9
+ if (isFlowchart) {
10
+ const parentElement = editor.editing.view.document.selection.getSelectedElement();
11
+ const altAtr = parentElement.getChild(0).getAttribute('alt');
12
+ const arrAtr = altAtr.split("#");
13
+ const id = arrAtr[1];
14
+ QMSCKEditorService.flowchartNotify(id);
15
+ }
16
+ else {
17
+ QMSCKEditorService.flowchartNotify('');
18
+ }
19
+ window.addEventListener(QMSCKEditorConstant.QMSCK_FLOWCHART_PLUGIN_RESP, function (evt) {
20
+ editor.model.change( writer => {
21
+ const imageElement = writer.createElement( 'image', {
22
+ src: evt.detail.values,
23
+ alt: evt.detail.key
24
+ } );
25
+ // Insert the image in the current selection location.
26
+ editor.model.insertContent( imageElement, editor.model.document.selection );
27
+ });
28
+ }, { once: true });
29
+ }
30
+
31
+ isFlowchartImage( element, image ) {
32
+ const isImage = element && image.isImageWidget( element );
33
+
34
+ if ( !isImage ) {
35
+ return false;
36
+ }
37
+
38
+ const altAtr = element.getChild(0).getAttribute('alt')
39
+ if (altAtr && altAtr.includes(QMSCKEditorConstant.QMSCK_FLOWCHART)) {
40
+ return true;
41
+ }
42
+ else {
43
+ return false;
44
+ }
45
+ }
46
+ }
47
+
@@ -0,0 +1,30 @@
1
+ import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
2
+ import ButtonView from '@ckeditor/ckeditor5-ui/src/button/buttonview';
3
+ import FlowchartIcon from '../../themes/icons/flowchart.svg';
4
+ import FlowchartDialogCommand from './flowchartdialogcommand';
5
+
6
+ export default class QMSCKEditorFlowchartPlugin extends Plugin {
7
+ init() {
8
+ const editor = this.editor;
9
+ const t = editor.t;
10
+ editor.ui.componentFactory.add('qmsFlowchart', locale => {
11
+ const view = new ButtonView(locale);
12
+ const command = editor.commands.get('flowchartDialog');
13
+ view.set({
14
+ label: t('Flowchart'),
15
+ icon: FlowchartIcon,
16
+ tooltip: true
17
+ });
18
+
19
+ view.bind('isEnabled').to(command);
20
+
21
+ view.on('execute', () => {
22
+ command.execute();
23
+ });
24
+
25
+ return view;
26
+ });
27
+
28
+ editor.commands.add('flowchartDialog', new FlowchartDialogCommand(editor));
29
+ }
30
+ }
@@ -0,0 +1,119 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+
6
+ /**
7
+ * @module heading/heading
8
+ */
9
+
10
+ import { Plugin } from 'ckeditor5/src/core';
11
+
12
+ import HeadingEditing from './headingediting';
13
+ import HeadingUI from './headingui';
14
+
15
+ import './theme/heading.css';
16
+
17
+ /**
18
+ * The headings feature.
19
+ *
20
+ * For a detailed overview, check the {@glink features/headings Headings feature documentation}
21
+ * and the {@glink api/heading package page}.
22
+ *
23
+ * This is a "glue" plugin which loads the {@link module:heading/headingediting~HeadingEditing heading editing feature}
24
+ * and {@link module:heading/headingui~HeadingUI heading UI feature}.
25
+ *
26
+ * @extends module:core/plugin~Plugin
27
+ */
28
+ export default class Heading extends Plugin {
29
+ /**
30
+ * @inheritDoc
31
+ */
32
+ static get requires() {
33
+ return [ HeadingEditing, HeadingUI ];
34
+ }
35
+
36
+ /**
37
+ * @inheritDoc
38
+ */
39
+ static get pluginName() {
40
+ return 'Heading';
41
+ }
42
+ }
43
+
44
+ /**
45
+ * The configuration of the heading feature. Introduced by the {@link module:heading/headingediting~HeadingEditing} feature.
46
+ *
47
+ * Read more in {@link module:heading/heading~HeadingConfig}.
48
+ *
49
+ * @member {module:heading/heading~HeadingConfig} module:core/editor/editorconfig~EditorConfig#heading
50
+ */
51
+
52
+ /**
53
+ * The configuration of the heading feature.
54
+ * The option is used by the {@link module:heading/headingediting~HeadingEditing} feature.
55
+ *
56
+ * ClassicEditor
57
+ * .create( {
58
+ * heading: ... // Heading feature config.
59
+ * } )
60
+ * .then( ... )
61
+ * .catch( ... );
62
+ *
63
+ * See {@link module:core/editor/editorconfig~EditorConfig all editor options}.
64
+ *
65
+ * @interface HeadingConfig
66
+ */
67
+
68
+ /**
69
+ * The available heading options.
70
+ *
71
+ * The default value is:
72
+ *
73
+ * const headingConfig = {
74
+ * options: [
75
+ * { model: 'paragraph', title: 'Paragraph', class: 'ck-heading_paragraph' },
76
+ * { model: 'heading1', view: 'h2', title: 'Heading 1', class: 'ck-heading_heading1' },
77
+ * { model: 'heading2', view: 'h3', title: 'Heading 2', class: 'ck-heading_heading2' },
78
+ * { model: 'heading3', view: 'h4', title: 'Heading 3', class: 'ck-heading_heading3' }
79
+ * ]
80
+ * };
81
+ *
82
+ * It defines 3 levels of headings. In the editor model they will use `heading1`, `heading2`, and `heading3` elements.
83
+ * Their respective view elements (so the elements output by the editor) will be: `h2`, `h3`, and `h4`. This means that
84
+ * if you choose "Heading 1" in the headings dropdown the editor will turn the current block to `<heading1>` in the model
85
+ * which will result in rendering (and outputting to data) the `<h2>` element.
86
+ *
87
+ * The `title` and `class` properties will be used by the `headings` dropdown to render available options.
88
+ * Usually, the first option in the headings dropdown is the "Paragraph" option, hence it's also defined on the list.
89
+ * However, you don't need to define its view representation because it's handled by
90
+ * the {@link module:paragraph/paragraph~Paragraph} feature (which is required by
91
+ * the {@link module:heading/headingediting~HeadingEditing} feature).
92
+ *
93
+ * You can **read more** about configuring heading levels and **see more examples** in
94
+ * the {@glink features/headings Headings} guide.
95
+ *
96
+ * Note: In the model you should always start from `heading1`, regardless of how the headings are represented in the view.
97
+ * That's assumption is used by features like {@link module:autoformat/autoformat~Autoformat} to know which element
98
+ * they should use when applying the first level heading.
99
+ *
100
+ * The defined headings are also available as values passed to the `'heading'` command under their model names.
101
+ * For example, the below code will apply `<heading1>` to the current selection:
102
+ *
103
+ * editor.execute( 'heading', { value: 'heading1' } );
104
+ *
105
+ * @member {Array.<module:heading/heading~HeadingOption>} module:heading/heading~HeadingConfig#options
106
+ */
107
+
108
+ /**
109
+ * Heading option descriptor.
110
+ *
111
+ * @typedef {Object} module:heading/heading~HeadingOption
112
+ * @property {String} model Name of the model element to convert.
113
+ * @property {module:engine/view/elementdefinition~ElementDefinition} view Definition of a view element to convert from/to.
114
+ * @property {String} title The user-readable title of the option.
115
+ * @property {String} class The class which will be added to the dropdown item representing this option.
116
+ * @property {String} [icon] Icon used by {@link module:heading/headingbuttonsui~HeadingButtonsUI}. It can be omitted when using
117
+ * the default configuration.
118
+ * @extends module:engine/conversion/conversion~ConverterDefinition
119
+ */
@@ -0,0 +1,103 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+
6
+ /**
7
+ * @module heading/headingbuttonsui
8
+ */
9
+
10
+ import { Plugin } from 'ckeditor5/src/core';
11
+ import { ButtonView } from 'ckeditor5/src/ui';
12
+
13
+ import { getLocalizedOptions } from './utils';
14
+ import iconHeading1 from './theme/icons/heading1.svg';
15
+ import iconHeading2 from './theme/icons/heading2.svg';
16
+ import iconHeading3 from './theme/icons/heading3.svg';
17
+ import iconHeading4 from './theme/icons/heading4.svg';
18
+ import iconHeading5 from './theme/icons/heading5.svg';
19
+ import iconHeading6 from './theme/icons/heading6.svg';
20
+
21
+ const defaultIcons = {
22
+ heading1: iconHeading1,
23
+ heading2: iconHeading2,
24
+ heading3: iconHeading3,
25
+ heading4: iconHeading4,
26
+ heading5: iconHeading5,
27
+ heading6: iconHeading6
28
+ };
29
+
30
+ /**
31
+ * The `HeadingButtonsUI` plugin defines a set of UI buttons that can be used instead of the
32
+ * standard drop down component.
33
+ *
34
+ * This feature is not enabled by default by the {@link module:heading/heading~Heading} plugin and needs to be
35
+ * installed manually to the editor configuration.
36
+ *
37
+ * Plugin introduces button UI elements, which names are same as `model` property from {@link module:heading/heading~HeadingOption}.
38
+ *
39
+ * ClassicEditor
40
+ * .create( {
41
+ * plugins: [ ..., Heading, Paragraph, HeadingButtonsUI, ParagraphButtonUI ]
42
+ * heading: {
43
+ * options: [
44
+ * { model: 'paragraph', title: 'Paragraph', class: 'ck-heading_paragraph' },
45
+ * { model: 'heading1', view: 'h2', title: 'Heading 1', class: 'ck-heading_heading1' },
46
+ * { model: 'heading2', view: 'h3', title: 'Heading 2', class: 'ck-heading_heading2' },
47
+ * { model: 'heading3', view: 'h4', title: 'Heading 3', class: 'ck-heading_heading3' }
48
+ * ]
49
+ * },
50
+ * toolbar: [ 'paragraph', 'heading1', 'heading2', 'heading3' ]
51
+ * } )
52
+ * .then( ... )
53
+ * .catch( ... );
54
+ *
55
+ * NOTE: The `'paragraph'` button is defined in by the {@link module:paragraph/paragraphbuttonui~ParagraphButtonUI} plugin
56
+ * which needs to be loaded manually as well.
57
+ *
58
+ * It is possible to use custom icons by providing `icon` config option in {@link module:heading/heading~HeadingOption}.
59
+ * For the default configuration standard icons are used.
60
+ *
61
+ * @extends module:core/plugin~Plugin
62
+ */
63
+ export default class HeadingButtonsUI extends Plugin {
64
+ /**
65
+ * @inheritDoc
66
+ */
67
+ init() {
68
+ const options = getLocalizedOptions( this.editor );
69
+
70
+ options
71
+ .filter( item => item.model !== 'paragraph' )
72
+ .map( item => this._createButton( item ) );
73
+ }
74
+
75
+ /**
76
+ * Creates single button view from provided configuration option.
77
+ *
78
+ * @private
79
+ * @param {Object} option
80
+ */
81
+ _createButton( option ) {
82
+ const editor = this.editor;
83
+
84
+ editor.ui.componentFactory.add( option.model, locale => {
85
+ const view = new ButtonView( locale );
86
+ const command = editor.commands.get( 'heading' );
87
+
88
+ view.label = option.title;
89
+ view.icon = option.icon || defaultIcons[ option.model ];
90
+ view.tooltip = true;
91
+ view.isToggleable = true;
92
+ view.bind( 'isEnabled' ).to( command );
93
+ view.bind( 'isOn' ).to( command, 'value', value => value == option.model );
94
+
95
+ view.on( 'execute', () => {
96
+ editor.execute( 'heading', { value: option.model } );
97
+ editor.editing.view.focus();
98
+ } );
99
+
100
+ return view;
101
+ } );
102
+ }
103
+ }
@@ -0,0 +1,96 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+
6
+ /**
7
+ * @module heading/headingcommand
8
+ */
9
+
10
+ import { Command } from 'ckeditor5/src/core';
11
+ import { first } from 'ckeditor5/src/utils';
12
+
13
+ /**
14
+ * The heading command. It is used by the {@link module:heading/heading~Heading heading feature} to apply headings.
15
+ *
16
+ * @extends module:core/command~Command
17
+ */
18
+ export default class HeadingCommand extends Command {
19
+ /**
20
+ * Creates an instance of the command.
21
+ *
22
+ * @param {module:core/editor/editor~Editor} editor Editor instance.
23
+ * @param {Array.<String>} modelElements Names of the element which this command can apply in the model.
24
+ */
25
+ constructor( editor, modelElements ) {
26
+ super( editor );
27
+
28
+ /**
29
+ * If the selection starts in a heading (which {@link #modelElements is supported by this command})
30
+ * the value is set to the name of that heading model element.
31
+ * It is set to `false` otherwise.
32
+ *
33
+ * @observable
34
+ * @readonly
35
+ * @member {Boolean|String} #value
36
+ */
37
+
38
+ /**
39
+ * Set of defined model's elements names that this command support.
40
+ * See {@link module:heading/heading~HeadingOption}.
41
+ *
42
+ * @readonly
43
+ * @member {Array.<String>}
44
+ */
45
+ this.modelElements = modelElements;
46
+ }
47
+
48
+ /**
49
+ * @inheritDoc
50
+ */
51
+ refresh() {
52
+ const block = first( this.editor.model.document.selection.getSelectedBlocks() );
53
+
54
+ this.value = !!block && this.modelElements.includes( block.name ) && block.name;
55
+ this.isEnabled = !!block && this.modelElements.some( heading => checkCanBecomeHeading( block, heading, this.editor.model.schema ) );
56
+ }
57
+
58
+ /**
59
+ * Executes the command. Applies the heading to the selected blocks or, if the first selected
60
+ * block is a heading already, turns selected headings (of this level only) to paragraphs.
61
+ *
62
+ * @param {Object} options
63
+ * @param {String} options.value Name of the element which this command will apply in the model.
64
+ * @fires execute
65
+ */
66
+ execute( options ) {
67
+ const model = this.editor.model;
68
+ const document = model.document;
69
+
70
+ const modelElement = options.value;
71
+
72
+ model.change( writer => {
73
+ const blocks = Array.from( document.selection.getSelectedBlocks() )
74
+ .filter( block => {
75
+ return checkCanBecomeHeading( block, modelElement, model.schema );
76
+ } );
77
+
78
+ for ( const block of blocks ) {
79
+ if ( !block.is( 'element', modelElement ) ) {
80
+ writer.rename( block, modelElement );
81
+ }
82
+ }
83
+ } );
84
+ }
85
+ }
86
+
87
+ // Checks whether the given block can be replaced by a specific heading.
88
+ //
89
+ // @private
90
+ // @param {module:engine/model/element~Element} block A block to be tested.
91
+ // @param {module:heading/headingcommand~HeadingCommand#modelElement} heading Command element name in the model.
92
+ // @param {module:engine/model/schema~Schema} schema The schema of the document.
93
+ // @returns {Boolean}
94
+ function checkCanBecomeHeading( block, heading, schema ) {
95
+ return schema.checkChild( block.parent, heading ) && !schema.isObject( block );
96
+ }
@@ -0,0 +1,163 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+
6
+ /**
7
+ * @module heading/headingediting
8
+ */
9
+
10
+ import { Plugin } from 'ckeditor5/src/core';
11
+ import { Paragraph } from 'ckeditor5/src/paragraph';
12
+ import { priorities } from 'ckeditor5/src/utils';
13
+
14
+ import HeadingCommand from './headingcommand';
15
+
16
+ const defaultModelElement = 'paragraph';
17
+
18
+ /**
19
+ * The headings engine feature. It handles switching between block formats &ndash; headings and paragraph.
20
+ * This class represents the engine part of the heading feature. See also {@link module:heading/heading~Heading}.
21
+ * It introduces `heading1`-`headingN` commands which allow to convert paragraphs into headings.
22
+ *
23
+ * @extends module:core/plugin~Plugin
24
+ */
25
+ export default class HeadingEditing extends Plugin {
26
+ /**
27
+ * @inheritDoc
28
+ */
29
+ static get pluginName() {
30
+ return 'HeadingEditing';
31
+ }
32
+
33
+ /**
34
+ * @inheritDoc
35
+ */
36
+ constructor( editor ) {
37
+ super( editor );
38
+
39
+ editor.config.define( 'heading', {
40
+ options: [
41
+ { model: 'paragraph', title: 'Paragraph', class: 'ck-heading_paragraph' },
42
+ { model: 'heading1', view: 'h1', title: 'Heading 1', class: 'ck-heading_heading1' },
43
+ { model: 'heading2', view: 'h2', title: 'Heading 2', class: 'ck-heading_heading2' },
44
+ { model: 'heading3', view: 'h3', title: 'Heading 3', class: 'ck-heading_heading3' }
45
+ ]
46
+ } );
47
+ }
48
+
49
+ /**
50
+ * @inheritDoc
51
+ */
52
+ static get requires() {
53
+ return [ Paragraph ];
54
+ }
55
+
56
+ /**
57
+ * @inheritDoc
58
+ */
59
+ init() {
60
+ const editor = this.editor;
61
+ const options = editor.config.get( 'heading.options' );
62
+
63
+ const modelElements = [];
64
+
65
+ for ( const option of options ) {
66
+ // Skip paragraph - it is defined in required Paragraph feature.
67
+ if ( option.model !== defaultModelElement ) {
68
+ // Schema.
69
+ editor.model.schema.register( option.model, {
70
+ allowIn: '$root',
71
+ inheritAllFrom: '$block'
72
+ } );
73
+
74
+ editor.conversion.elementToElement( option );
75
+
76
+ modelElements.push( option.model );
77
+ }
78
+ }
79
+
80
+ this._addClassToAllHeading( editor );
81
+
82
+ // Register the heading command for this option.
83
+ editor.commands.add( 'heading', new HeadingCommand( editor, modelElements ) );
84
+ }
85
+
86
+ /**
87
+ * @inheritDoc
88
+ */
89
+ afterInit() {
90
+ // If the enter command is added to the editor, alter its behavior.
91
+ // Enter at the end of a heading element should create a paragraph.
92
+ const editor = this.editor;
93
+ const enterCommand = editor.commands.get( 'enter' );
94
+ const options = editor.config.get( 'heading.options' );
95
+
96
+ if ( enterCommand ) {
97
+ this.listenTo( enterCommand, 'afterExecute', ( evt, data ) => {
98
+ const positionParent = editor.model.document.selection.getFirstPosition().parent;
99
+ const isHeading = options.some( option => positionParent.is( 'element', option.model ) );
100
+
101
+ if ( isHeading && !positionParent.is( 'element', defaultModelElement ) && positionParent.childCount === 0 ) {
102
+ data.writer.rename( positionParent, defaultModelElement );
103
+ }
104
+ } );
105
+ }
106
+ }
107
+
108
+ /**
109
+ * Adds default conversion for `h1` -> `heading1` with a low priority.
110
+ *
111
+ * @private
112
+ * @param {module:core/editor/editor~Editor} editor Editor instance on which to add the `h1` conversion.
113
+ */
114
+ _addDefaultH1Conversion( editor ) {
115
+ editor.conversion.for( 'upcast' ).elementToElement( {
116
+ model: 'heading1',
117
+ view: 'h1',
118
+ // With a `low` priority, `paragraph` plugin autoparagraphing mechanism is executed. Make sure
119
+ // this listener is called before it. If not, `h1` will be transformed into a paragraph.
120
+ converterPriority: priorities.get( 'low' ) + 1
121
+ } )
122
+ }
123
+
124
+ /**
125
+ * This plugin brings customization to the downcast pipeline of the editor.
126
+ *
127
+ * @private
128
+ * @param {module:core/editor/editor~Editor} editor
129
+ */
130
+ _addClassToAllHeading( editor ) {
131
+ // Both the data and the editing pipelines are affected by this conversion.
132
+ editor.conversion.for( 'downcast' ).add( dispatcher => {
133
+ // Headings are represented in the model as a "heading1" element.
134
+ // Use the "low" listener priority to apply the changes after the headings feature.
135
+ dispatcher.on( 'insert:heading1', ( evt, data, conversionApi ) => {
136
+ const viewWriter = conversionApi.writer;
137
+
138
+ viewWriter.addClass( 'radEdH1', conversionApi.mapper.toViewElement( data.item ) );
139
+ }, { priority: 'low' } );
140
+ } );
141
+
142
+ editor.conversion.for( 'downcast' ).add( dispatcher => {
143
+ // Headings are represented in the model as a "heading2" element.
144
+ // Use the "low" listener priority to apply the changes after the headings feature.
145
+ dispatcher.on( 'insert:heading2', ( evt, data, conversionApi ) => {
146
+ const viewWriter = conversionApi.writer;
147
+
148
+ viewWriter.addClass( 'radEdH2', conversionApi.mapper.toViewElement( data.item ) );
149
+ }, { priority: 'low' } );
150
+ } );
151
+
152
+ editor.conversion.for( 'downcast' ).add( dispatcher => {
153
+ // Headings are represented in the model as a "heading3" element.
154
+ // Use the "low" listener priority to apply the changes after the headings feature.
155
+ dispatcher.on( 'insert:heading3', ( evt, data, conversionApi ) => {
156
+ const viewWriter = conversionApi.writer;
157
+
158
+ viewWriter.addClass( 'radEdH3', conversionApi.mapper.toViewElement( data.item ) );
159
+ }, { priority: 'low' } );
160
+ } );
161
+ }
162
+
163
+ }