qms-angular 1.0.70 → 1.0.74

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 (250) hide show
  1. package/bundles/qms-angular.umd.js +2010 -606
  2. package/bundles/qms-angular.umd.js.map +1 -1
  3. package/esm2015/lib/components/button/button.js +2 -2
  4. package/esm2015/lib/components/qms-navigation-drawer/qms-navigation-drawer.component.js +5 -3
  5. package/esm2015/lib/components/qms-navigation-drawer/qms-navigation-drawer.module.js +4 -4
  6. package/esm2015/lib/components/qms-paginator/index.js +2 -0
  7. package/esm2015/lib/components/qms-paginator/public_api.js +3 -0
  8. package/esm2015/lib/components/qms-paginator/qms-paginator.component.js +173 -0
  9. package/esm2015/lib/components/qms-paginator/qms-paginator.module.js +34 -0
  10. package/esm2015/lib/components/qms-status-dropdown/qms-status-dropdown.component.js +2 -2
  11. package/esm2015/lib/components/range-slider/directives/range-slider-lockup.directive.js +20 -0
  12. package/esm2015/lib/components/range-slider/directives/range-slider.directive.js +34 -0
  13. package/esm2015/lib/components/range-slider/index.js +2 -0
  14. package/esm2015/lib/components/range-slider/public-api.js +4 -0
  15. package/esm2015/lib/components/range-slider/range-slider.module.js +22 -0
  16. package/esm2015/lib/components/related/popup/related-popup.component.js +1 -1
  17. package/esm2015/lib/components/select-include-children/select-include-children.component.js +112 -45
  18. package/esm2015/lib/components/select-one/select-one.component.js +50 -3
  19. package/esm2015/lib/components/side-sheet/directives/drawer-content.directive.js +20 -0
  20. package/esm2015/lib/components/side-sheet/directives/drawer-header-action.directive.js +20 -0
  21. package/esm2015/lib/components/side-sheet/directives/drawer-header.directive.js +20 -0
  22. package/esm2015/lib/components/side-sheet/directives/drawer.directive.js +20 -0
  23. package/esm2015/lib/components/side-sheet/index.js +2 -0
  24. package/esm2015/lib/components/side-sheet/public-api.js +6 -0
  25. package/esm2015/lib/components/side-sheet/side-sheet.module.js +28 -0
  26. package/esm2015/lib/components/tree/tree.component.js +15 -19
  27. package/esm2015/lib/components/treeNew/tree.component.js +6 -3
  28. package/esm2015/lib/directives/table/table-row.directive.js +42 -0
  29. package/esm2015/lib/directives/table/table.directive.js +13 -60
  30. package/esm2015/lib/model/en.js +38 -3
  31. package/esm2015/lib/model/no.js +37 -2
  32. package/esm2015/lib/qms-angular.module.js +5 -24
  33. package/esm2015/lib/qms-ckeditor-components/common/bpmn/inspector.function.js +68 -16
  34. package/esm2015/lib/qms-ckeditor-components/common/classes/qmsUploadAdapter.js +89 -0
  35. package/esm2015/lib/qms-ckeditor-components/common/constants/ckeditorEvent.constant.js +7 -1
  36. package/esm2015/lib/qms-ckeditor-components/common/constants/ckeditorFlowchart.const.js +10 -1
  37. package/esm2015/lib/qms-ckeditor-components/common/constants/ckeditorLink.constant.js +7 -0
  38. package/esm2015/lib/qms-ckeditor-components/common/enums/document-type.enum.js +2 -1
  39. package/esm2015/lib/qms-ckeditor-components/common/enums/shape-flow-chart-connection-type.js +8 -0
  40. package/esm2015/lib/qms-ckeditor-components/common/models/qms-ckeditor-data.model.js +1 -1
  41. package/esm2015/lib/qms-ckeditor-components/common/models/qms-ckeditor-flowchart-template.model.js +9 -0
  42. package/esm2015/lib/qms-ckeditor-components/common/models/qms-ckeditor-flowchart.model.js +9 -0
  43. package/esm2015/lib/qms-ckeditor-components/common/models/qms-ckeditor-save-as-template.model.js +3 -0
  44. package/esm2015/lib/qms-ckeditor-components/common/models/qms-ckeditor-video-tree.model.js +4 -0
  45. package/esm2015/lib/qms-ckeditor-components/common/models/wproofreader-config.model.js +6 -0
  46. package/esm2015/lib/qms-ckeditor-components/common/module/confirm/qms-ckeditor-confirm.component.js +1 -1
  47. package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-about/qms-ckeditor-about.component.js +38 -0
  48. package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-bpmn/qms-ckeditor-bpmn.component.js +564 -34
  49. package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-bpmn/save-template/save-template.component.js +46 -18
  50. package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-fullscreen/qms-ckeditor-fullscreen.component.js +1 -46
  51. package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-imagemap/qms-ckeditor-imagemap.component.js +9 -8
  52. package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-link/attachments/link-attachment.component.js +1 -1
  53. package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-link/qms-ckeditor-link.component.js +5 -2
  54. package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-load-template/qms-ckeditor-load-template.component.js +1 -1
  55. package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-relation/qmsckeditor-related.component.js +1 -1
  56. package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-template/qms-ckeditor-template.component.js +1 -1
  57. package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-tooltip/qms-ckeditor-tooltip.component.js +4 -5
  58. package/esm2015/lib/qms-ckeditor-components/models/qms-ckeditor-bpmn-data.model.js +8 -0
  59. package/esm2015/lib/qms-ckeditor-components/qms-ckeditor.component.js +184 -28
  60. package/esm2015/lib/qms-ckeditor-components/qms-ckeditor.module.js +8 -2
  61. package/esm2015/lib/qms-ckeditor-components/services/qms-ckeditor-bpmn.service.js +58 -20
  62. package/esm2015/lib/qms-ckeditor-components/services/qms-ckeditor-flowchart.service.js +26 -0
  63. package/esm2015/lib/qms-ckeditor-components/services/qms-ckeditor-tree.service.js +4 -1
  64. package/esm2015/lib/qms-ckeditor-components/services/qms-ckeditor-upload.service.js +20 -0
  65. package/esm2015/public-api.js +10 -7
  66. package/esm2015/qms-angular.js +12 -8
  67. package/fesm2015/qms-angular.js +1900 -572
  68. package/fesm2015/qms-angular.js.map +1 -1
  69. package/lib/components/button/button.d.ts +1 -1
  70. package/lib/components/qms-navigation-drawer/qms-navigation-drawer.component.d.ts +1 -0
  71. package/lib/components/qms-paginator/index.d.ts +1 -0
  72. package/lib/components/qms-paginator/public_api.d.ts +2 -0
  73. package/lib/components/qms-paginator/qms-paginator.component.d.ts +51 -0
  74. package/lib/components/qms-paginator/qms-paginator.module.d.ts +2 -0
  75. package/lib/{directives/range-slider → components/range-slider/directives}/range-slider-lockup.directive.d.ts +0 -0
  76. package/lib/{directives/range-slider → components/range-slider/directives}/range-slider.directive.d.ts +0 -0
  77. package/lib/components/range-slider/index.d.ts +1 -0
  78. package/lib/components/range-slider/public-api.d.ts +3 -0
  79. package/lib/components/range-slider/range-slider.module.d.ts +2 -0
  80. package/lib/components/select-include-children/select-include-children.component.d.ts +2 -1
  81. package/lib/components/select-one/select-one.component.d.ts +4 -0
  82. package/lib/{directives/side-sheet → components/side-sheet/directives}/drawer-content.directive.d.ts +0 -0
  83. package/lib/{directives/side-sheet → components/side-sheet/directives}/drawer-header-action.directive.d.ts +0 -0
  84. package/lib/{directives/side-sheet → components/side-sheet/directives}/drawer-header.directive.d.ts +0 -0
  85. package/lib/{directives/side-sheet → components/side-sheet/directives}/drawer.directive.d.ts +0 -0
  86. package/lib/components/side-sheet/index.d.ts +1 -0
  87. package/lib/components/side-sheet/public-api.d.ts +5 -0
  88. package/lib/components/side-sheet/side-sheet.module.d.ts +2 -0
  89. package/lib/directives/table/table-row.directive.d.ts +13 -0
  90. package/lib/directives/table/table.directive.d.ts +1 -11
  91. package/lib/model/en.d.ts +35 -0
  92. package/lib/model/no.d.ts +35 -0
  93. package/lib/qms-ckeditor-components/common/bpmn/inspector.function.d.ts +28 -0
  94. package/lib/qms-ckeditor-components/common/classes/qmsUploadAdapter.d.ts +18 -0
  95. package/lib/qms-ckeditor-components/common/constants/ckeditorEvent.constant.d.ts +6 -0
  96. package/lib/qms-ckeditor-components/common/constants/ckeditorFlowchart.const.d.ts +9 -0
  97. package/lib/qms-ckeditor-components/common/constants/ckeditorLink.constant.d.ts +6 -0
  98. package/lib/qms-ckeditor-components/common/enums/document-type.enum.d.ts +1 -0
  99. package/lib/qms-ckeditor-components/common/enums/shape-flow-chart-connection-type.d.ts +6 -0
  100. package/lib/qms-ckeditor-components/common/models/qms-ckeditor-data.model.d.ts +5 -0
  101. package/lib/qms-ckeditor-components/common/models/qms-ckeditor-flowchart-template.model.d.ts +7 -0
  102. package/lib/qms-ckeditor-components/common/models/qms-ckeditor-flowchart.model.d.ts +7 -0
  103. package/lib/qms-ckeditor-components/common/models/qms-ckeditor-save-as-template.model.d.ts +5 -0
  104. package/lib/qms-ckeditor-components/common/models/qms-ckeditor-video-tree.model.d.ts +5 -0
  105. package/lib/qms-ckeditor-components/common/models/wproofreader-config.model.d.ts +25 -0
  106. package/lib/qms-ckeditor-components/components/qms-ckeditor-about/qms-ckeditor-about.component.d.ts +15 -0
  107. package/lib/qms-ckeditor-components/components/qms-ckeditor-bpmn/qms-ckeditor-bpmn.component.d.ts +88 -4
  108. package/lib/qms-ckeditor-components/components/qms-ckeditor-bpmn/save-template/save-template.component.d.ts +8 -2
  109. package/lib/qms-ckeditor-components/components/qms-ckeditor-imagemap/qms-ckeditor-imagemap.component.d.ts +2 -1
  110. package/lib/qms-ckeditor-components/models/qms-ckeditor-bpmn-data.model.d.ts +7 -0
  111. package/lib/qms-ckeditor-components/qms-ckeditor.component.d.ts +17 -5
  112. package/lib/qms-ckeditor-components/services/qms-ckeditor-bpmn.service.d.ts +1 -0
  113. package/lib/qms-ckeditor-components/services/qms-ckeditor-flowchart.service.d.ts +10 -0
  114. package/lib/qms-ckeditor-components/services/qms-ckeditor-tree.service.d.ts +2 -0
  115. package/lib/qms-ckeditor-components/services/qms-ckeditor-upload.service.d.ts +5 -0
  116. package/lib.theme.scss +1 -0
  117. package/package.json +1 -1
  118. package/public-api.d.ts +6 -6
  119. package/qms-angular.d.ts +11 -7
  120. package/qms-angular.metadata.json +1 -1
  121. package/src/assets/images/ckeditor5.svg +1 -0
  122. package/src/assets/jointjs/js/rappid.js +55919 -55836
  123. package/src/assets/jointjs/scss/bpmn.scss +2 -1
  124. package/src/assets/qms-ckeditor-plugin/build/ckeditor.js +1 -1
  125. package/src/assets/qms-ckeditor-plugin/build/ckeditor.js.map +1 -1
  126. package/src/assets/qms-ckeditor-plugin/build/translations/az.js +1 -1
  127. package/src/assets/qms-ckeditor-plugin/build/translations/cs.js +1 -1
  128. package/src/assets/qms-ckeditor-plugin/build/translations/da.js +1 -1
  129. package/src/assets/qms-ckeditor-plugin/build/translations/de-ch.js +1 -1
  130. package/src/assets/qms-ckeditor-plugin/build/translations/de.js +1 -1
  131. package/src/assets/qms-ckeditor-plugin/build/translations/en-au.js +1 -1
  132. package/src/assets/qms-ckeditor-plugin/build/translations/es.js +1 -1
  133. package/src/assets/qms-ckeditor-plugin/build/translations/et.js +1 -1
  134. package/src/assets/qms-ckeditor-plugin/build/translations/fa.js +1 -1
  135. package/src/assets/qms-ckeditor-plugin/build/translations/fr.js +1 -1
  136. package/src/assets/qms-ckeditor-plugin/build/translations/gl.js +1 -1
  137. package/src/assets/qms-ckeditor-plugin/build/translations/he.js +1 -1
  138. package/src/assets/qms-ckeditor-plugin/build/translations/hi.js +1 -1
  139. package/src/assets/qms-ckeditor-plugin/build/translations/hr.js +1 -1
  140. package/src/assets/qms-ckeditor-plugin/build/translations/hu.js +1 -1
  141. package/src/assets/qms-ckeditor-plugin/build/translations/id.js +1 -1
  142. package/src/assets/qms-ckeditor-plugin/build/translations/it.js +1 -1
  143. package/src/assets/qms-ckeditor-plugin/build/translations/ja.js +1 -1
  144. package/src/assets/qms-ckeditor-plugin/build/translations/ko.js +1 -1
  145. package/src/assets/qms-ckeditor-plugin/build/translations/ku.js +1 -1
  146. package/src/assets/qms-ckeditor-plugin/build/translations/lv.js +1 -1
  147. package/src/assets/qms-ckeditor-plugin/build/translations/nl.js +1 -1
  148. package/src/assets/qms-ckeditor-plugin/build/translations/no.js +1 -1
  149. package/src/assets/qms-ckeditor-plugin/build/translations/pl.js +1 -1
  150. package/src/assets/qms-ckeditor-plugin/build/translations/pt-br.js +1 -1
  151. package/src/assets/qms-ckeditor-plugin/build/translations/ru.js +1 -1
  152. package/src/assets/qms-ckeditor-plugin/build/translations/sk.js +1 -1
  153. package/src/assets/qms-ckeditor-plugin/build/translations/sl.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/th.js +1 -1
  157. package/src/assets/qms-ckeditor-plugin/build/translations/tk.js +1 -1
  158. package/src/assets/qms-ckeditor-plugin/build/translations/tr.js +1 -1
  159. package/src/assets/qms-ckeditor-plugin/build/translations/uk.js +1 -1
  160. package/src/assets/qms-ckeditor-plugin/build/translations/vi.js +1 -1
  161. package/src/assets/qms-ckeditor-plugin/build/translations/zh-cn.js +1 -1
  162. package/src/assets/qms-ckeditor-plugin/build/translations/zh.js +1 -1
  163. package/src/assets/qms-ckeditor-plugin/package-lock.json +23 -0
  164. package/src/assets/qms-ckeditor-plugin/package.json +2 -0
  165. package/src/assets/qms-ckeditor-plugin/src/ckeditor.js +18 -4
  166. package/src/assets/qms-ckeditor-plugin/src/plugins/aboutckeditor/aboutckeditor.js +28 -0
  167. package/src/assets/qms-ckeditor-plugin/src/plugins/bpmn/bpmndialogcommand.js +74 -0
  168. package/src/assets/qms-ckeditor-plugin/src/plugins/bpmn/qmsCKEditorBpmnPlugin.js +6 -44
  169. package/src/assets/qms-ckeditor-plugin/src/plugins/ckeditor5-source-editing/lang/contexts.json +3 -0
  170. package/src/assets/qms-ckeditor-plugin/src/plugins/ckeditor5-source-editing/lang/translations/de.po +21 -0
  171. package/src/assets/qms-ckeditor-plugin/src/plugins/ckeditor5-source-editing/lang/translations/en.po +21 -0
  172. package/src/assets/qms-ckeditor-plugin/src/plugins/ckeditor5-source-editing/lang/translations/gl.po +21 -0
  173. package/src/assets/qms-ckeditor-plugin/src/plugins/ckeditor5-source-editing/lang/translations/hu.po +21 -0
  174. package/src/assets/qms-ckeditor-plugin/src/plugins/ckeditor5-source-editing/lang/translations/it.po +21 -0
  175. package/src/assets/qms-ckeditor-plugin/src/plugins/ckeditor5-source-editing/lang/translations/ru.po +21 -0
  176. package/src/assets/qms-ckeditor-plugin/src/plugins/ckeditor5-source-editing/lang/translations/zh.po +21 -0
  177. package/src/assets/qms-ckeditor-plugin/src/plugins/ckeditor5-source-editing/src/index.js +10 -0
  178. package/src/assets/qms-ckeditor-plugin/src/plugins/ckeditor5-source-editing/src/sourceediting.js +386 -0
  179. package/src/assets/qms-ckeditor-plugin/src/plugins/ckeditor5-source-editing/src/utils/formathtml.js +142 -0
  180. package/src/assets/qms-ckeditor-plugin/src/plugins/ckeditor5-source-editing/theme/icons/source-editing.svg +1 -0
  181. package/src/assets/qms-ckeditor-plugin/src/plugins/ckeditor5-source-editing/theme/sourceediting.css +48 -0
  182. package/src/assets/qms-ckeditor-plugin/src/plugins/common/qmsCKEditorConstant.js +11 -1
  183. package/src/assets/qms-ckeditor-plugin/src/plugins/common/qmsCKEditorService.js +21 -0
  184. package/src/assets/qms-ckeditor-plugin/src/plugins/common/qmsCKEditorUtil.js +29 -7
  185. package/src/assets/qms-ckeditor-plugin/src/plugins/fullscreen/qmsCKEditorFullscreenPlugin.js +22 -15
  186. package/src/assets/qms-ckeditor-plugin/src/plugins/imagemap/converters.js +93 -92
  187. package/src/assets/qms-ckeditor-plugin/src/plugins/imagemap/imagemap.js +4 -4
  188. package/src/assets/qms-ckeditor-plugin/src/plugins/imagemap/imagemapcommand.js +93 -0
  189. package/src/assets/qms-ckeditor-plugin/src/plugins/imagemap/imagemapdialogcommand.js +59 -0
  190. package/src/assets/qms-ckeditor-plugin/src/plugins/imagemap/imagemapediting.js +92 -87
  191. package/src/assets/qms-ckeditor-plugin/src/plugins/imagemap/imagemapui.js +13 -14
  192. package/src/assets/qms-ckeditor-plugin/src/plugins/imagemap/resizeimagemapcommand.js +25 -24
  193. package/src/assets/qms-ckeditor-plugin/src/plugins/imagemap/utils.js +40 -49
  194. package/src/assets/qms-ckeditor-plugin/src/plugins/link/linkcommand.js +131 -176
  195. package/src/assets/qms-ckeditor-plugin/src/plugins/link/linkdialogcommand.js +88 -0
  196. package/src/assets/qms-ckeditor-plugin/src/plugins/link/linkediting.js +2 -0
  197. package/src/assets/qms-ckeditor-plugin/src/plugins/link/linkui.js +41 -32
  198. package/src/assets/qms-ckeditor-plugin/src/plugins/tableofcontents/tableofcontents.js +14 -0
  199. package/src/assets/qms-ckeditor-plugin/src/plugins/tableofcontents/tableofcontentscommand.js +87 -0
  200. package/src/assets/qms-ckeditor-plugin/src/plugins/tableofcontents/tableofcontentsediting.js +59 -0
  201. package/src/assets/qms-ckeditor-plugin/src/plugins/tableofcontents/tableofcontentsui.js +35 -0
  202. package/src/assets/qms-ckeditor-plugin/src/plugins/tableofcontents/utils.js +62 -0
  203. package/src/assets/qms-ckeditor-plugin/src/plugins/template/loadtemplatedialogcommand.js +14 -0
  204. package/src/assets/qms-ckeditor-plugin/src/plugins/template/qmsCKEditorLoadTemplatePlugin.js +10 -12
  205. package/src/assets/qms-ckeditor-plugin/src/plugins/template/qmsCKEdtiorTemplatePlugin.js +10 -7
  206. package/src/assets/qms-ckeditor-plugin/src/plugins/template/templatedialogcommand.js +9 -0
  207. package/src/assets/qms-ckeditor-plugin/src/plugins/timestamp/timestamp.js +15 -18
  208. package/src/assets/qms-ckeditor-plugin/src/plugins/timestamp/timestampcommand.js +17 -0
  209. package/src/assets/qms-ckeditor-plugin/src/plugins/tooltip/removetooltipcommand.js +42 -26
  210. package/src/assets/qms-ckeditor-plugin/src/plugins/tooltip/tooltip.js +3 -3
  211. package/src/assets/qms-ckeditor-plugin/src/plugins/tooltip/tooltipcommand.js +75 -0
  212. package/src/assets/qms-ckeditor-plugin/src/plugins/tooltip/tooltipdialogcommand.js +68 -0
  213. package/src/assets/qms-ckeditor-plugin/src/plugins/tooltip/tooltipediting.js +206 -131
  214. package/src/assets/qms-ckeditor-plugin/src/plugins/tooltip/tooltipui.js +424 -136
  215. package/src/assets/qms-ckeditor-plugin/src/plugins/tooltip/ui/actionsview.js +67 -12
  216. package/src/assets/qms-ckeditor-plugin/src/plugins/tooltip/utils.js +17 -55
  217. package/src/assets/qms-ckeditor-plugin/src/plugins/video/autovideo.js +1 -5
  218. package/src/assets/qms-ckeditor-plugin/src/plugins/video/video/videoediting.js +5 -2
  219. package/src/assets/qms-ckeditor-plugin/src/plugins/video/videoupload/browsevideodialogcommand.js +25 -0
  220. package/src/assets/qms-ckeditor-plugin/src/plugins/video/videoupload/uploadvideocommand.js +3 -16
  221. package/src/assets/qms-ckeditor-plugin/src/plugins/video/videoupload/videouploadediting.js +4 -0
  222. package/src/assets/qms-ckeditor-plugin/src/plugins/video/videoupload/videouploadui.js +12 -23
  223. package/src/assets/qms-ckeditor-plugin/src/themes/icons/fullscreen_exit.svg +1 -0
  224. package/src/assets/qms-ckeditor-plugin/src/themes/icons/information.svg +1 -50
  225. package/src/assets/qms-ckeditor-plugin/src/themes/icons/table-excel.svg +44 -0
  226. package/src/assets/qms-ckeditor-plugin/src/themes/icons/timestamp.svg +1 -1
  227. package/src/assets/qms-ckeditor-plugin/src/themes/icons/tooltip.svg +1 -0
  228. package/src/assets/qms-ckeditor-plugin/src/themes/styles/heading.css +54 -0
  229. package/src/assets/qms-ckeditor-plugin/src/themes/styles/tooltip.css +11 -53
  230. package/src/lib/components/button/button-icon.scss +5 -1
  231. package/src/lib/components/qms-navigation-drawer/qms-navigation-drawer.component.scss +36 -22
  232. package/src/lib/components/qms-paginator/qms-paginator.component.scss +143 -0
  233. package/src/lib/qms-ckeditor-components/components/qms-ckeditor-about/qms-ckeditor-about.component.scss +16 -0
  234. package/src/lib/qms-ckeditor-components/components/qms-ckeditor-bpmn/qms-ckeditor-bpmn.component.scss +69 -17
  235. package/src/lib/qms-ckeditor-components/components/qms-ckeditor-imagemap/qms-ckeditor-imagemap.component.scss +26 -23
  236. package/src/lib/qms-ckeditor-components/qms-ckeditor.component.scss +24 -0
  237. package/src/lib/qms-ckeditor-components/styles/_modules.scss +9 -1
  238. package/src/themes/core/_range-slider.scss +61 -42
  239. package/src/themes/core/_side-sheet.scss +2 -2
  240. package/src/themes/core/_table.scss +158 -37
  241. package/esm2015/lib/directives/range-slider/range-slider-lockup.directive.js +0 -20
  242. package/esm2015/lib/directives/range-slider/range-slider.directive.js +0 -36
  243. package/esm2015/lib/directives/side-sheet/drawer-content.directive.js +0 -20
  244. package/esm2015/lib/directives/side-sheet/drawer-header-action.directive.js +0 -20
  245. package/esm2015/lib/directives/side-sheet/drawer-header.directive.js +0 -20
  246. package/esm2015/lib/directives/side-sheet/drawer.directive.js +0 -20
  247. package/esm2015/lib/qms-ckeditor-components/common/classes/uploadAdapter.js +0 -26
  248. package/lib/qms-ckeditor-components/common/classes/uploadAdapter.d.ts +0 -5
  249. package/src/assets/qms-ckeditor-plugin/src/plugins/imagemap/insertimagemapcommand.js +0 -128
  250. package/src/assets/qms-ckeditor-plugin/src/plugins/tooltip/inserttooltipcommand.js +0 -88
@@ -11,8 +11,6 @@ import { Command } from '@ckeditor/ckeditor5-core';
11
11
  import { findAttributeRange } from '@ckeditor/ckeditor5-typing';
12
12
  import { Collection, first, toMap } from '@ckeditor/ckeditor5-utils';
13
13
  import * as QMSCKEditorConstant from '../common/qmsCKEditorConstant';
14
- import * as QMSCKEditorEnum from '../common/qmsCKEditorEnum';
15
- import * as QMSCKEditorService from '../common/qmsCKEditorService';
16
14
  import { isImageAllowed } from './utils';
17
15
  import AutomaticDecorators from './utils/automaticdecorators';
18
16
 
@@ -150,168 +148,143 @@ export default class LinkCommand extends Command {
150
148
  * @param {String} href Link destination.
151
149
  * @param {Object} [manualDecoratorIds={}] The information about manual decorator attributes to be applied or removed upon execution.
152
150
  */
153
- execute() {
154
-
151
+ execute(options) {
155
152
  const model = this.editor.model;
156
153
  const selection = model.document.selection;
157
- const ranges = selection.getFirstRange();
158
154
  const manualDecoratorIds = {};
159
155
  const linkDecorators = this.editor.config.get( 'link.decorators' );
160
156
  const selectedRange = 'link'+ linkDecorators.length;
157
+
158
+ const url = options.url;
159
+ const href = url.substring(2, url.length);
160
+ const title = options.title ? options.title : url;
161
161
 
162
- let link = QMSCKEditorEnum.hyperLink;
163
- link.typeId = 0;
164
- link.targetId = 0;
165
- link.protocolId = 0;
166
- link.url = '';
167
- link.title = '';
168
- link.editorContent = '';
169
- for (const item of ranges.getItems()) {
170
- if (item.data) {
171
- link.title = item.data;
172
- }
173
- }
174
- QMSCKEditorService.linkNotify(link);
175
- window[QMSCKEditorConstant.QMSCK_LINKED] = false;
176
- window.addEventListener(QMSCKEditorConstant.QMSCK_LINK_PLUGIN_RESP, function(evt) {
177
- if (window[QMSCKEditorConstant.QMSCK_LINKED]){
178
- return;
179
- }
180
- const response = evt.detail;
181
- const target = QMSCKEditorEnum.protocolEnum[response.protocolId];
182
- const url = response.url;
183
- const href = url.substring(2, url.length);
184
- const title = response.title ? response.title : url;
185
-
186
- for(let i= 0; i < linkDecorators.length-2; i++){
187
- manualDecoratorIds['link' + i] = (i === response.targetId)? true : false;
188
- }
189
- // Stores information about manual decorators to turn them on/off when command is applied.
190
- const truthyManualDecorators = [];
191
- const falsyManualDecorators = [];
192
-
193
- for ( const name in manualDecoratorIds ) {
194
- if ( manualDecoratorIds[ name ] ) {
195
- truthyManualDecorators.push( name );
196
- } else {
197
- falsyManualDecorators.push( name );
198
- }
199
- }
200
-
201
- model.change( writer => {
202
- // set link option value
203
- window[QMSCKEditorConstant.QMSCK_LINK_OPTION] = url.substring(0, 2);
204
- // If selection is collapsed then update selected link or insert new one at the place of caret.
205
- if ( selection.isCollapsed ) {
206
- const position = selection.getFirstPosition();
207
-
208
- // When selection is inside text with `linkHref` attribute.
209
- if ( selection.hasAttribute( 'linkHref' ) ) {
210
- // Then update `linkHref` value.
211
- const linkRange = findAttributeRange( position, 'linkHref', selection.getAttribute( 'linkHref' ), model );
212
- if (!selection.hasAttribute(selectedRange)) {
213
- writer.remove(linkRange);
214
- const newPosition = selection.getFirstPosition();
215
- const attributes = toMap( selection.getAttributes() );
216
- attributes.set( 'linkHref', href );
217
- truthyManualDecorators.forEach( item => {
218
- attributes.set( item, true );
219
- } );
220
- const { end: positionAfter } = model.insertContent( writer.createText( title, attributes ), newPosition );
221
- writer.setSelection( positionAfter );
222
- }
223
- else {
224
- writer.setAttribute( 'linkHref', href, linkRange );
225
- truthyManualDecorators.forEach( item => {
226
- writer.setAttribute( item, true, linkRange );
227
- } );
228
- falsyManualDecorators.forEach( item => {
229
- writer.removeAttribute( item, linkRange );
230
- } );
231
- // Put the selection at the end of the updated link.
232
- writer.setSelection( writer.createPositionAfter( linkRange.end.nodeBefore ) );
233
- }
234
- }
235
- // If not then insert text node with `linkHref` attribute in place of caret.
236
- // However, since selection is collapsed, attribute value will be used as data for text node.
237
- // So, if `href` is empty, do not create text node.
238
- else if ( href !== '' ) {
239
- const attributes = toMap( selection.getAttributes() );
240
-
241
- attributes.set( 'linkHref', href );
242
-
243
- truthyManualDecorators.forEach( item => {
244
- attributes.set( item, true );
245
- } );
246
-
247
- const { end: positionAfter } = model.insertContent( writer.createText( title, attributes ), position );
248
-
249
- // Put the selection at the end of the inserted link.
250
- // Using end of range returned from insertContent in case nodes with the same attributes got merged.
251
- writer.setSelection( positionAfter );
252
- }
253
-
254
- // Remove the `linkHref` attribute and all link decorators from the selection.
255
- // It stops adding a new content into the link element.
256
- [ 'linkHref', ...truthyManualDecorators, ...falsyManualDecorators ].forEach( item => {
257
- writer.removeSelectionAttribute( item );
258
- } );
259
- } else {
260
- // If selection has non-collapsed ranges, we change attribute on nodes inside those ranges
261
- // omitting nodes where the `linkHref` attribute is disallowed.
262
- const ranges = model.schema.getValidRanges( selection.getRanges(), 'linkHref' );
263
-
264
- // But for the first, check whether the `linkHref` attribute is allowed on selected blocks (e.g. the "image" element).
265
- const allowedRanges = [];
266
-
267
- for ( const element of selection.getSelectedBlocks() ) {
268
- if ( model.schema.checkAttribute( element, 'linkHref' ) ) {
269
- allowedRanges.push( writer.createRangeOn( element ) );
270
- }
271
- }
272
-
273
- // Ranges that accept the `linkHref` attribute. Since we will iterate over `allowedRanges`, let's clone it.
274
- const rangesToUpdate = allowedRanges.slice();
275
-
276
- // eslint-disable-next-line max-len
277
- // For all selection ranges we want to check whether given range is inside an element that accepts the `linkHref` attribute.
278
- // If so, we don't want to propagate applying the attribute to its children.
279
- // for ( const range of ranges ) {
280
- // if ( this._isRangeToUpdate( range, allowedRanges ) ) {
281
- // rangesToUpdate.push( range );
282
- // }
283
- // }
284
-
285
- for ( const range of ranges ) {
286
- const _isRangeToUpdate = true;
287
- for ( const allowedRange of allowedRanges ) {
288
- if ( allowedRange.containsRange( range ) ) {
289
- _isRangeToUpdate = false;
290
- break;
291
- }
292
- }
293
- if (_isRangeToUpdate) {
294
- rangesToUpdate.push( range );
295
- }
296
- }
297
-
298
- for ( const range of rangesToUpdate ) {
299
- writer.setAttribute('linkHref', href, range);
300
- writer.setAttribute(selectedRange, true, range);
301
-
302
- truthyManualDecorators.forEach( item => {
303
- writer.setAttribute( item, true, range );
304
- } );
305
-
306
- falsyManualDecorators.forEach( item => {
307
- writer.removeAttribute( item, range );
308
- } );
309
- }
310
- }
311
- } );
312
- window[QMSCKEditorConstant.QMSCK_LINKED] = true;
313
- },
314
- { once: true });
162
+ for(let i= 0; i < linkDecorators.length-2; i++){
163
+ manualDecoratorIds['link' + i] = (i === options.targetId)? true : false;
164
+ }
165
+ // Stores information about manual decorators to turn them on/off when command is applied.
166
+ const truthyManualDecorators = [];
167
+ const falsyManualDecorators = [];
168
+
169
+ for ( const name in manualDecoratorIds ) {
170
+ if ( manualDecoratorIds[ name ] ) {
171
+ truthyManualDecorators.push( name );
172
+ } else {
173
+ falsyManualDecorators.push( name );
174
+ }
175
+ }
176
+
177
+ model.change( writer => {
178
+ // set link option value
179
+ window[QMSCKEditorConstant.QMSCK_LINK_OPTION] = url.substring(0, 2);
180
+ // If selection is collapsed then update selected link or insert new one at the place of caret.
181
+ if ( selection.isCollapsed ) {
182
+ const position = selection.getFirstPosition();
183
+
184
+ // When selection is inside text with `linkHref` attribute.
185
+ if ( selection.hasAttribute( 'linkHref' ) ) {
186
+ // Then update `linkHref` value.
187
+ const linkRange = findAttributeRange( position, 'linkHref', selection.getAttribute( 'linkHref' ), model );
188
+ if (!selection.hasAttribute(selectedRange)) {
189
+ writer.remove(linkRange);
190
+ const newPosition = selection.getFirstPosition();
191
+ const attributes = toMap( selection.getAttributes() );
192
+ attributes.set( 'linkHref', href );
193
+ truthyManualDecorators.forEach( item => {
194
+ attributes.set( item, true );
195
+ } );
196
+ const { end: positionAfter } = model.insertContent( writer.createText( title, attributes ), newPosition );
197
+ writer.setSelection( positionAfter );
198
+ }
199
+ else {
200
+ writer.setAttribute( 'linkHref', href, linkRange );
201
+ truthyManualDecorators.forEach( item => {
202
+ writer.setAttribute( item, true, linkRange );
203
+ } );
204
+ falsyManualDecorators.forEach( item => {
205
+ writer.removeAttribute( item, linkRange );
206
+ } );
207
+ // Put the selection at the end of the updated link.
208
+ writer.setSelection( writer.createPositionAfter( linkRange.end.nodeBefore ) );
209
+ }
210
+ }
211
+ // If not then insert text node with `linkHref` attribute in place of caret.
212
+ // However, since selection is collapsed, attribute value will be used as data for text node.
213
+ // So, if `href` is empty, do not create text node.
214
+ else if ( href !== '' ) {
215
+ const attributes = toMap( selection.getAttributes() );
216
+
217
+ attributes.set( 'linkHref', href );
218
+
219
+ truthyManualDecorators.forEach( item => {
220
+ attributes.set( item, true );
221
+ } );
222
+
223
+ const { end: positionAfter } = model.insertContent( writer.createText( title, attributes ), position );
224
+
225
+ // Put the selection at the end of the inserted link.
226
+ // Using end of range returned from insertContent in case nodes with the same attributes got merged.
227
+ writer.setSelection( positionAfter );
228
+ }
229
+
230
+ // Remove the `linkHref` attribute and all link decorators from the selection.
231
+ // It stops adding a new content into the link element.
232
+ [ 'linkHref', ...truthyManualDecorators, ...falsyManualDecorators ].forEach( item => {
233
+ writer.removeSelectionAttribute( item );
234
+ } );
235
+ } else {
236
+ // If selection has non-collapsed ranges, we change attribute on nodes inside those ranges
237
+ // omitting nodes where the `linkHref` attribute is disallowed.
238
+ const ranges = model.schema.getValidRanges( selection.getRanges(), 'linkHref' );
239
+
240
+ // But for the first, check whether the `linkHref` attribute is allowed on selected blocks (e.g. the "image" element).
241
+ const allowedRanges = [];
242
+
243
+ for ( const element of selection.getSelectedBlocks() ) {
244
+ if ( model.schema.checkAttribute( element, 'linkHref' ) ) {
245
+ allowedRanges.push( writer.createRangeOn( element ) );
246
+ }
247
+ }
248
+
249
+ // Ranges that accept the `linkHref` attribute. Since we will iterate over `allowedRanges`, let's clone it.
250
+ const rangesToUpdate = allowedRanges.slice();
251
+
252
+ // eslint-disable-next-line max-len
253
+ // For all selection ranges we want to check whether given range is inside an element that accepts the `linkHref` attribute.
254
+ // If so, we don't want to propagate applying the attribute to its children.
255
+ // for ( const range of ranges ) {
256
+ // if ( this._isRangeToUpdate( range, allowedRanges ) ) {
257
+ // rangesToUpdate.push( range );
258
+ // }
259
+ // }
260
+
261
+ for ( const range of ranges ) {
262
+ const _isRangeToUpdate = true;
263
+ for ( const allowedRange of allowedRanges ) {
264
+ if ( allowedRange.containsRange( range ) ) {
265
+ _isRangeToUpdate = false;
266
+ break;
267
+ }
268
+ }
269
+ if (_isRangeToUpdate) {
270
+ rangesToUpdate.push( range );
271
+ }
272
+ }
273
+
274
+ for ( const range of rangesToUpdate ) {
275
+ writer.setAttribute('linkHref', href, range);
276
+ writer.setAttribute(selectedRange, true, range);
277
+
278
+ truthyManualDecorators.forEach( item => {
279
+ writer.setAttribute( item, true, range );
280
+ } );
281
+
282
+ falsyManualDecorators.forEach( item => {
283
+ writer.removeAttribute( item, range );
284
+ } );
285
+ }
286
+ }
287
+ } );
315
288
  }
316
289
 
317
290
  /**
@@ -336,22 +309,4 @@ export default class LinkCommand extends Command {
336
309
  return doc.selection.getAttribute( decoratorName );
337
310
  }
338
311
 
339
- /**
340
- * Checks whether specified `range` is inside an element that accepts the `linkHref` attribute.
341
- *
342
- * @private
343
- * @param {module:engine/view/range~Range} range A range to check.
344
- * @param {Array.<module:engine/view/range~Range>} allowedRanges An array of ranges created on elements where the attribute is accepted.
345
- * @returns {Boolean}
346
- */
347
- _isRangeToUpdate( range, allowedRanges ) {
348
- for ( const allowedRange of allowedRanges ) {
349
- // A range is inside an element that will have the `linkHref` attribute. Do not modify its nodes.
350
- if ( allowedRange.containsRange( range ) ) {
351
- return false;
352
- }
353
- }
354
-
355
- return true;
356
- }
357
312
  }
@@ -0,0 +1,88 @@
1
+
2
+ import { Command } from '@ckeditor/ckeditor5-core';
3
+ import { Collection, first } from '@ckeditor/ckeditor5-utils';
4
+ import * as QMSCKEditorConstant from '../common/qmsCKEditorConstant';
5
+ import * as QMSCKEditorEnum from '../common/qmsCKEditorEnum';
6
+ import * as QMSCKEditorService from '../common/qmsCKEditorService';
7
+ import { isImageAllowed } from './utils';
8
+ import AutomaticDecorators from './utils/automaticdecorators';
9
+
10
+ export default class LinkDialogCommand extends Command {
11
+ constructor( editor ) {
12
+ super( editor );
13
+ this.manualDecorators = new Collection();
14
+ this.automaticDecorators = new AutomaticDecorators();
15
+ }
16
+
17
+ restoreManualDecoratorStates() {
18
+ for ( const manualDecorator of this.manualDecorators ) {
19
+ manualDecorator.value = this._getDecoratorStateFromModel( manualDecorator.id );
20
+ }
21
+ }
22
+
23
+ refresh() {
24
+ const model = this.editor.model;
25
+ const doc = model.document;
26
+
27
+ const selectedElement = first( doc.selection.getSelectedBlocks() );
28
+
29
+ // A check for the `LinkImage` plugin. If the selection contains an element, get values from the element.
30
+ // Currently the selection reads attributes from text nodes only. See #7429 and #7465.
31
+ if ( isImageAllowed( selectedElement, model.schema ) ) {
32
+ this.value = selectedElement.getAttribute( 'linkHref' );
33
+ this.isEnabled = model.schema.checkAttribute( selectedElement, 'linkHref' );
34
+ } else {
35
+ this.value = doc.selection.getAttribute( 'linkHref' );
36
+ this.isEnabled = model.schema.checkAttributeInSelection( doc.selection, 'linkHref' );
37
+ }
38
+
39
+ for ( const manualDecorator of this.manualDecorators ) {
40
+ manualDecorator.value = this._getDecoratorStateFromModel( manualDecorator.id );
41
+ }
42
+ }
43
+
44
+ execute() {
45
+ const editor = this.editor;
46
+ const model = editor.model;
47
+ const selection = model.document.selection;
48
+ const ranges = selection.getFirstRange();
49
+
50
+ let link = QMSCKEditorEnum.hyperLink;
51
+ link.typeId = 0;
52
+ link.targetId = 0;
53
+ link.protocolId = 0;
54
+ link.url = '';
55
+ link.title = '';
56
+ link.editorContent = '';
57
+ for (const item of ranges.getItems()) {
58
+ if (item.data) {
59
+ link.title = item.data;
60
+ }
61
+ }
62
+ QMSCKEditorService.linkNotify(link);
63
+ window[QMSCKEditorConstant.QMSCK_LINKED] = false;
64
+ window.addEventListener(QMSCKEditorConstant.QMSCK_LINK_PLUGIN_RESP, function(evt) {
65
+ if (window[QMSCKEditorConstant.QMSCK_LINKED]){
66
+ return;
67
+ }
68
+ window[QMSCKEditorConstant.QMSCK_LINKED] = true;
69
+ const options = evt.detail;
70
+ editor.commands.get('link').execute(options);
71
+ }, { once: true });
72
+ }
73
+
74
+ _getDecoratorStateFromModel( decoratorName ) {
75
+ const model = this.editor.model;
76
+ const doc = model.document;
77
+ const selectedElement = first( doc.selection.getSelectedBlocks() );
78
+
79
+ // A check for the `LinkImage` plugin. If the selection contains an element, get values from the element.
80
+ // Currently the selection reads attributes from text nodes only. See #7429 and #7465.
81
+ if ( isImageAllowed( selectedElement, model.schema ) ) {
82
+ return selectedElement.getAttribute( decoratorName );
83
+ }
84
+
85
+ return doc.selection.getAttribute( decoratorName );
86
+ }
87
+ }
88
+
@@ -20,6 +20,7 @@ import { createLinkElement, ensureSafeUrl, getLocalizedDecorators, normalizeDeco
20
20
  import * as QMSCKEditorConstant from '../common/qmsCKEditorConstant';
21
21
  import '../../themes/styles/link.css';
22
22
  import { isLinkElement } from './utils';
23
+ import LinkDialogCommand from './linkdialogcommand';
23
24
 
24
25
  const HIGHLIGHT_CLASS = 'ck-link_selected';
25
26
  const DECORATOR_AUTOMATIC = 'automatic';
@@ -94,6 +95,7 @@ export default class LinkEditing extends Plugin {
94
95
 
95
96
  // Create linking commands.
96
97
  editor.commands.add( 'link', new LinkCommand( editor ) );
98
+ editor.commands.add( 'linkdialog', new LinkDialogCommand( editor ) );
97
99
  editor.commands.add( 'unlink', new UnlinkCommand( editor ) );
98
100
 
99
101
  const linkDecorators = getLocalizedDecorators( editor.t, normalizeDecorators( editor.config.get( 'link.decorators' ) ) );
@@ -130,31 +130,40 @@ export default class LinkUI extends Plugin {
130
130
  // Execute unlink command after clicking on the "Edit" button.
131
131
  this.listenTo( actionsView, 'edit', () => {
132
132
  //this._addFormView();
133
- let link = QMSCKEditorEnum.hyperLink;
134
- const href = this.actionsView.href;
135
- const hasLink = this.isImageLinked( editor.editing.view.document.selection.getSelectedElement(), editor.plugins.get('Image') );
136
- let parentLink;
137
- if (hasLink) {
138
- parentLink = editor.editing.view.document.selection.getSelectedElement().getChild(0);
139
- }
140
- else {
141
- parentLink = this._getSelectedLinkElement();
142
- }
143
- const linkOption = parentLink.getAttribute('url');
144
- link.typeId = QMSCKEditorUtil.getLinkType(linkOption);
145
- link.targetId = parentLink.getAttribute('target') ? QMSCKEditorEnum.targetEnum[parentLink.getAttribute('target')] : 0;
146
- if (parentLink._children.length > 0) {
147
- link.title = parentLink._children[0]._textData ? parentLink._children[0]._textData.trim() : '';
148
- }
149
- else {
150
- link.title = '';
151
- }
152
- link.protocolId = QMSCKEditorUtil.getProtocolId(linkOption);
153
- link.url = href;
154
- link.edit = true;
155
- window[QMSCKEditorConstant.QMSCK_LINKED] = false;
156
- QMSCKEditorService.linkNotify(link);
157
- this._hideUI();
133
+ let link = QMSCKEditorEnum.hyperLink;
134
+ const href = this.actionsView.href;
135
+ const hasLink = this.isImageLinked( editor.editing.view.document.selection.getSelectedElement(), editor.plugins.get('Image') );
136
+ let parentLink;
137
+ if (hasLink) {
138
+ parentLink = editor.editing.view.document.selection.getSelectedElement().getChild(0);
139
+ }
140
+ else {
141
+ parentLink = this._getSelectedLinkElement();
142
+ }
143
+
144
+ const linkOption = parentLink.getAttribute('url');
145
+ link.typeId = QMSCKEditorUtil.getLinkType(linkOption);
146
+ link.targetId = parentLink.getAttribute('target') ? QMSCKEditorEnum.targetEnum[parentLink.getAttribute('target')] : 0;
147
+ if (parentLink._children.length > 0) {
148
+ link.title = parentLink._children[0]._textData ? parentLink._children[0]._textData.trim() : '';
149
+ }
150
+ else {
151
+ link.title = '';
152
+ }
153
+ link.protocolId = QMSCKEditorUtil.getProtocolId(linkOption);
154
+ link.url = href;
155
+ link.edit = true;
156
+ QMSCKEditorService.linkNotify(link);
157
+ window[QMSCKEditorConstant.QMSCK_LINKED] = false;
158
+ window.addEventListener(QMSCKEditorConstant.QMSCK_LINK_PLUGIN_RESP, function(evt) {
159
+ if (window[QMSCKEditorConstant.QMSCK_LINKED]){
160
+ return;
161
+ }
162
+ window[QMSCKEditorConstant.QMSCK_LINKED] = true;
163
+ const options = evt.detail;
164
+ editor.commands.get('link').execute(options);
165
+ }, { once: true });
166
+ this._hideUI();
158
167
  } );
159
168
 
160
169
  // Execute unlink command after clicking on the "Unlink" button.
@@ -240,7 +249,7 @@ export default class LinkUI extends Plugin {
240
249
  */
241
250
  _createToolbarLinkButton() {
242
251
  const editor = this.editor;
243
- const linkCommand = editor.commands.get( 'link' );
252
+ const linkDialogCommand = editor.commands.get( 'linkdialog' );
244
253
  const t = editor.t;
245
254
 
246
255
  // Handle the `Ctrl+K` keystroke and show the panel.
@@ -248,9 +257,9 @@ export default class LinkUI extends Plugin {
248
257
  // Prevent focusing the search bar in FF, Chrome and Edge. See https://github.com/ckeditor/ckeditor5/issues/4811.
249
258
  cancel();
250
259
 
251
- if ( linkCommand.isEnabled ) {
260
+ if ( linkDialogCommand.isEnabled ) {
252
261
  // this._showUI( true );
253
- this.editor.execute('link');
262
+ this.editor.execute('linkdialog');
254
263
  }
255
264
  } );
256
265
 
@@ -265,14 +274,14 @@ export default class LinkUI extends Plugin {
265
274
  button.isToggleable = true;
266
275
 
267
276
  // Bind button to the command.
268
- const linkCommand = editor.commands.get('link');
269
- button.bind( 'isEnabled' ).to( linkCommand, 'isEnabled' );
270
- button.bind( 'isOn' ).to( linkCommand, 'value', value => !!value );
277
+ const linkDialogCommand = editor.commands.get( 'linkdialog' );
278
+ button.bind( 'isEnabled' ).to( linkDialogCommand, 'isEnabled' );
279
+ button.bind( 'isOn' ).to( linkDialogCommand, 'value', value => !!value );
271
280
 
272
281
  // Show the panel on button click.
273
282
  //this.listenTo( button, 'execute', () => this._showUI( true ) );
274
283
  this.listenTo(button, 'execute', () => {
275
- this.editor.execute('link');
284
+ this.editor.execute('linkdialog');
276
285
  });
277
286
 
278
287
  return button;
@@ -0,0 +1,14 @@
1
+ import { Plugin } from '@ckeditor/ckeditor5-core';
2
+ import TableOfContentsEditing from './tableofcontentsediting';
3
+ import TableOfContentsUI from './tableofcontentsui';
4
+
5
+ export default class TableOfContents extends Plugin {
6
+ static get requires() {
7
+ return [TableOfContentsEditing, TableOfContentsUI];
8
+ }
9
+
10
+ static get pluginName() {
11
+ return 'TableOfContents';
12
+ }
13
+ }
14
+
@@ -0,0 +1,87 @@
1
+ import { Command } from '@ckeditor/ckeditor5-core';
2
+ import { rangeToText, getAttributeValueOn, setAttributeOn, TOC_ELEMENTS, TOC_ATTRIBUTES} from './utils';
3
+ import { findOptimalInsertionPosition } from '@ckeditor/ckeditor5-widget/src/utils';
4
+ import { trimStart } from '../common/qmsCKEditorUtil';
5
+
6
+ export default class TableOfContentsCommand extends Command {
7
+
8
+ execute( options = {} ) {
9
+ const editor = this.editor;
10
+ const model = editor.model;
11
+ model.change(writer => {
12
+ const headingObject = this._findHeadingElements(options.headings);
13
+ if(Object.keys(headingObject).length > 0){
14
+ const tocObject = this._buildTOCElements(headingObject);
15
+ this._setAnchorIdAttribute(headingObject, tocObject, writer);
16
+ this._insertTOCElements(tocObject, writer);
17
+ }
18
+ });
19
+ }
20
+
21
+ _insertTOCElements(tocObject, writer){
22
+ let position;
23
+ Object.keys(tocObject).forEach((key) => {
24
+ const section = tocObject[key];
25
+ const paragraphElement = writer.createElement(TOC_ELEMENTS.PARAGRAPH, { ...section.attributes });
26
+ const textElement = writer.createText(section.text, { [TOC_ATTRIBUTES.LINK_HREF]: '#' + section.id });
27
+ writer.insert(textElement, writer.createPositionAt(paragraphElement, 0));
28
+ if(!position){
29
+ position = findOptimalInsertionPosition(this.editor.model.document.selection, this.editor.model);
30
+ }
31
+ const { end: positionAfter } = this.editor.model.insertContent(paragraphElement, position);
32
+ position = positionAfter;
33
+ });
34
+ }
35
+
36
+ _setAnchorIdAttribute(headingObject, tocObject, writer){
37
+ Object.keys(tocObject).forEach((key) =>{
38
+ const node = headingObject[key];
39
+ const sectionOject = tocObject[key];
40
+ if(!sectionOject.hasAnchorId){
41
+ const range = this.editor.model.createRangeIn(node);
42
+ const attribute = { key: TOC_ATTRIBUTES.ANCHOR_ID, value: sectionOject.id }
43
+ const hasAnchorId = setAttributeOn(range, this.editor.model.schema, writer, attribute);
44
+ if(!hasAnchorId){
45
+ let childNode = writer.createText('\u00A0', { [TOC_ATTRIBUTES.ANCHOR_ID]: sectionOject.id });//insert non-breaking space
46
+ writer.insert(childNode, writer.createPositionAt(node, 0));
47
+ }
48
+ }
49
+ });
50
+ }
51
+
52
+ _buildTOCElements(headingObject){
53
+ const tocObject = {};
54
+ let index = 1;
55
+ Object.keys(headingObject).forEach(key =>{
56
+ const node = headingObject[key];
57
+ const range = this.editor.model.createRangeIn(node);
58
+ const attributes = Object.fromEntries(node.getAttributes());
59
+ const name = node.name.toLowerCase();
60
+ attributes[TOC_ATTRIBUTES.HEADING_CLASS] = name;
61
+ const text = rangeToText(range) || '';
62
+ let id = trimStart(text, '#').replace(/[^a-z0-9\+]/gi, '').toLowerCase() + index;
63
+ let hasAnchorId = false;
64
+ const anchorId = getAttributeValueOn(range, TOC_ATTRIBUTES.ANCHOR_ID);
65
+ if(!!anchorId){
66
+ id = trimStart(anchorId, '#');
67
+ hasAnchorId = true;
68
+ }
69
+ tocObject[key] = { id, name, text, hasAnchorId, attributes };
70
+ index++;
71
+ });
72
+ return tocObject;
73
+ }
74
+
75
+ _findHeadingElements(supportedHeadings){
76
+ const headingObject = {};
77
+ const range = this.editor.model.createRangeIn(this.editor.model.document.getRoot());
78
+ for (const value of range.getWalker()) {
79
+ const node = value.item;
80
+ if (node.is('element') && supportedHeadings.indexOf(node.name) > -1) {
81
+ let path = node.getPath();
82
+ headingObject[path] = node;
83
+ }
84
+ }
85
+ return headingObject;
86
+ }
87
+ }