qms-angular 1.0.71 → 1.0.75

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 (206) hide show
  1. package/bundles/qms-angular.umd.js +960 -583
  2. package/bundles/qms-angular.umd.js.map +1 -1
  3. package/esm2015/lib/components/button/button.js +1 -1
  4. package/esm2015/lib/components/comment/comment.js +2 -2
  5. package/esm2015/lib/components/qms-navigation-drawer/qms-navigation-drawer.component.js +7 -6
  6. package/esm2015/lib/components/qms-navigation-drawer/qms-navigation-drawer.module.js +4 -4
  7. package/esm2015/lib/components/qms-paginator/qms-paginator.component.js +3 -3
  8. package/esm2015/lib/components/qms-stepper/qms-stepper.component.js +1 -1
  9. package/esm2015/lib/components/range-slider/directives/range-slider-lockup.directive.js +20 -0
  10. package/esm2015/lib/components/range-slider/directives/range-slider.directive.js +34 -0
  11. package/esm2015/lib/components/range-slider/index.js +2 -0
  12. package/esm2015/lib/components/range-slider/public-api.js +4 -0
  13. package/esm2015/lib/components/range-slider/range-slider.module.js +22 -0
  14. package/esm2015/lib/components/related/popup/related-popup.component.js +1 -1
  15. package/esm2015/lib/components/select-include-children/select-include-children.component.js +112 -45
  16. package/esm2015/lib/components/select-one/select-one.component.js +50 -3
  17. package/esm2015/lib/components/select-process-document/select-process-document.component.js +64 -143
  18. package/esm2015/lib/components/side-sheet/directives/drawer-content.directive.js +20 -0
  19. package/esm2015/lib/components/side-sheet/directives/drawer-header-action.directive.js +20 -0
  20. package/esm2015/lib/components/side-sheet/directives/drawer-header.directive.js +20 -0
  21. package/esm2015/lib/components/side-sheet/directives/drawer.directive.js +20 -0
  22. package/esm2015/lib/components/side-sheet/index.js +2 -0
  23. package/esm2015/lib/components/side-sheet/public-api.js +6 -0
  24. package/esm2015/lib/components/side-sheet/side-sheet.module.js +28 -0
  25. package/esm2015/lib/components/tree/tree.component.js +15 -19
  26. package/esm2015/lib/components/treeNew/tree.component.js +6 -3
  27. package/esm2015/lib/directives/table/table-row.directive.js +50 -0
  28. package/esm2015/lib/directives/table/table.directive.js +18 -61
  29. package/esm2015/lib/model/en.js +19 -2
  30. package/esm2015/lib/model/no.js +19 -2
  31. package/esm2015/lib/qms-angular.module.js +5 -24
  32. package/esm2015/lib/qms-ckeditor-components/common/classes/qmsUploadAdapter.js +89 -0
  33. package/esm2015/lib/qms-ckeditor-components/common/constants/ckeditorEvent.constant.js +3 -1
  34. package/esm2015/lib/qms-ckeditor-components/common/models/qms-ckeditor-data.model.js +1 -1
  35. package/esm2015/lib/qms-ckeditor-components/common/models/qms-ckeditor-video-tree.model.js +4 -0
  36. package/esm2015/lib/qms-ckeditor-components/common/models/wproofreader-config.model.js +6 -0
  37. package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-about/qms-ckeditor-about.component.js +38 -0
  38. package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-bpmn/qms-ckeditor-bpmn.component.js +22 -3
  39. package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-fullscreen/qms-ckeditor-fullscreen.component.js +1 -46
  40. package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-imagemap/qms-ckeditor-imagemap.component.js +9 -8
  41. package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-link/qms-ckeditor-link.component.js +4 -1
  42. package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-tooltip/qms-ckeditor-tooltip.component.js +3 -4
  43. package/esm2015/lib/qms-ckeditor-components/qms-ckeditor.component.js +178 -28
  44. package/esm2015/lib/qms-ckeditor-components/qms-ckeditor.module.js +7 -3
  45. package/esm2015/lib/qms-ckeditor-components/services/qms-ckeditor-tree.service.js +4 -1
  46. package/esm2015/lib/qms-ckeditor-components/services/qms-ckeditor-upload.service.js +20 -0
  47. package/esm2015/public-api.js +6 -7
  48. package/esm2015/qms-angular.js +6 -4
  49. package/fesm2015/qms-angular.js +862 -524
  50. package/fesm2015/qms-angular.js.map +1 -1
  51. package/lib/components/button/button.d.ts +1 -1
  52. package/lib/components/qms-navigation-drawer/qms-navigation-drawer.component.d.ts +1 -1
  53. package/lib/{directives/range-slider → components/range-slider/directives}/range-slider-lockup.directive.d.ts +0 -0
  54. package/lib/{directives/range-slider → components/range-slider/directives}/range-slider.directive.d.ts +0 -0
  55. package/lib/components/range-slider/index.d.ts +1 -0
  56. package/lib/components/range-slider/public-api.d.ts +3 -0
  57. package/lib/components/range-slider/range-slider.module.d.ts +2 -0
  58. package/lib/components/select-include-children/select-include-children.component.d.ts +2 -1
  59. package/lib/components/select-one/select-one.component.d.ts +4 -0
  60. package/lib/components/select-process-document/select-process-document.component.d.ts +3 -0
  61. package/lib/{directives/side-sheet → components/side-sheet/directives}/drawer-content.directive.d.ts +0 -0
  62. package/lib/{directives/side-sheet → components/side-sheet/directives}/drawer-header-action.directive.d.ts +0 -0
  63. package/lib/{directives/side-sheet → components/side-sheet/directives}/drawer-header.directive.d.ts +0 -0
  64. package/lib/{directives/side-sheet → components/side-sheet/directives}/drawer.directive.d.ts +0 -0
  65. package/lib/components/side-sheet/index.d.ts +1 -0
  66. package/lib/components/side-sheet/public-api.d.ts +5 -0
  67. package/lib/components/side-sheet/side-sheet.module.d.ts +2 -0
  68. package/lib/directives/table/table-row.directive.d.ts +13 -0
  69. package/lib/directives/table/table.directive.d.ts +2 -11
  70. package/lib/model/en.d.ts +17 -0
  71. package/lib/model/no.d.ts +17 -0
  72. package/lib/qms-ckeditor-components/common/classes/qmsUploadAdapter.d.ts +18 -0
  73. package/lib/qms-ckeditor-components/common/constants/ckeditorEvent.constant.d.ts +2 -0
  74. package/lib/qms-ckeditor-components/common/models/qms-ckeditor-data.model.d.ts +5 -0
  75. package/lib/qms-ckeditor-components/common/models/qms-ckeditor-video-tree.model.d.ts +5 -0
  76. package/lib/qms-ckeditor-components/common/models/wproofreader-config.model.d.ts +25 -0
  77. package/lib/qms-ckeditor-components/components/qms-ckeditor-about/qms-ckeditor-about.component.d.ts +15 -0
  78. package/lib/qms-ckeditor-components/components/qms-ckeditor-bpmn/qms-ckeditor-bpmn.component.d.ts +4 -1
  79. package/lib/qms-ckeditor-components/components/qms-ckeditor-imagemap/qms-ckeditor-imagemap.component.d.ts +2 -1
  80. package/lib/qms-ckeditor-components/qms-ckeditor.component.d.ts +17 -5
  81. package/lib/qms-ckeditor-components/services/qms-ckeditor-tree.service.d.ts +2 -0
  82. package/lib/qms-ckeditor-components/services/qms-ckeditor-upload.service.d.ts +5 -0
  83. package/lib.theme.scss +1 -0
  84. package/package.json +1 -1
  85. package/public-api.d.ts +3 -6
  86. package/qms-angular.d.ts +5 -3
  87. package/qms-angular.metadata.json +1 -1
  88. package/src/assets/images/ckeditor5.svg +1 -0
  89. package/src/assets/qms-ckeditor-plugin/build/ckeditor.js +1 -1
  90. package/src/assets/qms-ckeditor-plugin/build/ckeditor.js.map +1 -1
  91. package/src/assets/qms-ckeditor-plugin/build/translations/az.js +1 -1
  92. package/src/assets/qms-ckeditor-plugin/build/translations/cs.js +1 -1
  93. package/src/assets/qms-ckeditor-plugin/build/translations/da.js +1 -1
  94. package/src/assets/qms-ckeditor-plugin/build/translations/de-ch.js +1 -1
  95. package/src/assets/qms-ckeditor-plugin/build/translations/de.js +1 -1
  96. package/src/assets/qms-ckeditor-plugin/build/translations/en-au.js +1 -1
  97. package/src/assets/qms-ckeditor-plugin/build/translations/es.js +1 -1
  98. package/src/assets/qms-ckeditor-plugin/build/translations/et.js +1 -1
  99. package/src/assets/qms-ckeditor-plugin/build/translations/fa.js +1 -1
  100. package/src/assets/qms-ckeditor-plugin/build/translations/fr.js +1 -1
  101. package/src/assets/qms-ckeditor-plugin/build/translations/gl.js +1 -1
  102. package/src/assets/qms-ckeditor-plugin/build/translations/he.js +1 -1
  103. package/src/assets/qms-ckeditor-plugin/build/translations/hi.js +1 -1
  104. package/src/assets/qms-ckeditor-plugin/build/translations/hr.js +1 -1
  105. package/src/assets/qms-ckeditor-plugin/build/translations/hu.js +1 -1
  106. package/src/assets/qms-ckeditor-plugin/build/translations/id.js +1 -1
  107. package/src/assets/qms-ckeditor-plugin/build/translations/it.js +1 -1
  108. package/src/assets/qms-ckeditor-plugin/build/translations/ja.js +1 -1
  109. package/src/assets/qms-ckeditor-plugin/build/translations/ko.js +1 -1
  110. package/src/assets/qms-ckeditor-plugin/build/translations/ku.js +1 -1
  111. package/src/assets/qms-ckeditor-plugin/build/translations/lv.js +1 -1
  112. package/src/assets/qms-ckeditor-plugin/build/translations/nl.js +1 -1
  113. package/src/assets/qms-ckeditor-plugin/build/translations/no.js +1 -1
  114. package/src/assets/qms-ckeditor-plugin/build/translations/pl.js +1 -1
  115. package/src/assets/qms-ckeditor-plugin/build/translations/pt-br.js +1 -1
  116. package/src/assets/qms-ckeditor-plugin/build/translations/ru.js +1 -1
  117. package/src/assets/qms-ckeditor-plugin/build/translations/sk.js +1 -1
  118. package/src/assets/qms-ckeditor-plugin/build/translations/sl.js +1 -1
  119. package/src/assets/qms-ckeditor-plugin/build/translations/sr-latn.js +1 -1
  120. package/src/assets/qms-ckeditor-plugin/build/translations/sr.js +1 -1
  121. package/src/assets/qms-ckeditor-plugin/build/translations/th.js +1 -1
  122. package/src/assets/qms-ckeditor-plugin/build/translations/tk.js +1 -1
  123. package/src/assets/qms-ckeditor-plugin/build/translations/tr.js +1 -1
  124. package/src/assets/qms-ckeditor-plugin/build/translations/uk.js +1 -1
  125. package/src/assets/qms-ckeditor-plugin/build/translations/vi.js +1 -1
  126. package/src/assets/qms-ckeditor-plugin/build/translations/zh-cn.js +1 -1
  127. package/src/assets/qms-ckeditor-plugin/build/translations/zh.js +1 -1
  128. package/src/assets/qms-ckeditor-plugin/package-lock.json +23 -0
  129. package/src/assets/qms-ckeditor-plugin/package.json +2 -0
  130. package/src/assets/qms-ckeditor-plugin/src/ckeditor.js +18 -4
  131. package/src/assets/qms-ckeditor-plugin/src/plugins/aboutckeditor/aboutckeditor.js +28 -0
  132. package/src/assets/qms-ckeditor-plugin/src/plugins/bpmn/bpmndialogcommand.js +74 -0
  133. package/src/assets/qms-ckeditor-plugin/src/plugins/bpmn/qmsCKEditorBpmnPlugin.js +5 -68
  134. package/src/assets/qms-ckeditor-plugin/src/plugins/ckeditor5-source-editing/lang/contexts.json +3 -0
  135. package/src/assets/qms-ckeditor-plugin/src/plugins/ckeditor5-source-editing/lang/translations/de.po +21 -0
  136. package/src/assets/qms-ckeditor-plugin/src/plugins/ckeditor5-source-editing/lang/translations/en.po +21 -0
  137. package/src/assets/qms-ckeditor-plugin/src/plugins/ckeditor5-source-editing/lang/translations/gl.po +21 -0
  138. package/src/assets/qms-ckeditor-plugin/src/plugins/ckeditor5-source-editing/lang/translations/hu.po +21 -0
  139. package/src/assets/qms-ckeditor-plugin/src/plugins/ckeditor5-source-editing/lang/translations/it.po +21 -0
  140. package/src/assets/qms-ckeditor-plugin/src/plugins/ckeditor5-source-editing/lang/translations/ru.po +21 -0
  141. package/src/assets/qms-ckeditor-plugin/src/plugins/ckeditor5-source-editing/lang/translations/zh.po +21 -0
  142. package/src/assets/qms-ckeditor-plugin/src/plugins/ckeditor5-source-editing/src/index.js +10 -0
  143. package/src/assets/qms-ckeditor-plugin/src/plugins/ckeditor5-source-editing/src/sourceediting.js +386 -0
  144. package/src/assets/qms-ckeditor-plugin/src/plugins/ckeditor5-source-editing/src/utils/formathtml.js +142 -0
  145. package/src/assets/qms-ckeditor-plugin/src/plugins/ckeditor5-source-editing/theme/icons/source-editing.svg +1 -0
  146. package/src/assets/qms-ckeditor-plugin/src/plugins/ckeditor5-source-editing/theme/sourceediting.css +48 -0
  147. package/src/assets/qms-ckeditor-plugin/src/plugins/common/qmsCKEditorConstant.js +4 -0
  148. package/src/assets/qms-ckeditor-plugin/src/plugins/common/qmsCKEditorService.js +21 -0
  149. package/src/assets/qms-ckeditor-plugin/src/plugins/fullscreen/qmsCKEditorFullscreenPlugin.js +22 -15
  150. package/src/assets/qms-ckeditor-plugin/src/plugins/imagemap/imagemapcommand.js +1 -0
  151. package/src/assets/qms-ckeditor-plugin/src/plugins/imagemap/utils.js +1 -1
  152. package/src/assets/qms-ckeditor-plugin/src/plugins/link/linkcommand.js +131 -176
  153. package/src/assets/qms-ckeditor-plugin/src/plugins/link/linkdialogcommand.js +88 -0
  154. package/src/assets/qms-ckeditor-plugin/src/plugins/link/linkediting.js +2 -0
  155. package/src/assets/qms-ckeditor-plugin/src/plugins/link/linkui.js +41 -32
  156. package/src/assets/qms-ckeditor-plugin/src/plugins/tableofcontents/tableofcontents.js +14 -0
  157. package/src/assets/qms-ckeditor-plugin/src/plugins/tableofcontents/tableofcontentscommand.js +87 -0
  158. package/src/assets/qms-ckeditor-plugin/src/plugins/tableofcontents/tableofcontentsediting.js +59 -0
  159. package/src/assets/qms-ckeditor-plugin/src/plugins/tableofcontents/tableofcontentsui.js +35 -0
  160. package/src/assets/qms-ckeditor-plugin/src/plugins/tableofcontents/utils.js +62 -0
  161. package/src/assets/qms-ckeditor-plugin/src/plugins/template/loadtemplatedialogcommand.js +14 -0
  162. package/src/assets/qms-ckeditor-plugin/src/plugins/template/qmsCKEditorLoadTemplatePlugin.js +10 -12
  163. package/src/assets/qms-ckeditor-plugin/src/plugins/template/qmsCKEdtiorTemplatePlugin.js +10 -7
  164. package/src/assets/qms-ckeditor-plugin/src/plugins/template/templatedialogcommand.js +9 -0
  165. package/src/assets/qms-ckeditor-plugin/src/plugins/timestamp/timestamp.js +15 -18
  166. package/src/assets/qms-ckeditor-plugin/src/plugins/timestamp/timestampcommand.js +17 -0
  167. package/src/assets/qms-ckeditor-plugin/src/plugins/tooltip/removetooltipcommand.js +42 -26
  168. package/src/assets/qms-ckeditor-plugin/src/plugins/tooltip/tooltip.js +3 -3
  169. package/src/assets/qms-ckeditor-plugin/src/plugins/tooltip/tooltipcommand.js +75 -0
  170. package/src/assets/qms-ckeditor-plugin/src/plugins/tooltip/tooltipdialogcommand.js +68 -0
  171. package/src/assets/qms-ckeditor-plugin/src/plugins/tooltip/tooltipediting.js +206 -131
  172. package/src/assets/qms-ckeditor-plugin/src/plugins/tooltip/tooltipui.js +424 -136
  173. package/src/assets/qms-ckeditor-plugin/src/plugins/tooltip/ui/actionsview.js +67 -12
  174. package/src/assets/qms-ckeditor-plugin/src/plugins/tooltip/utils.js +17 -55
  175. package/src/assets/qms-ckeditor-plugin/src/plugins/video/autovideo.js +1 -5
  176. package/src/assets/qms-ckeditor-plugin/src/plugins/video/video/videoediting.js +5 -2
  177. package/src/assets/qms-ckeditor-plugin/src/plugins/video/videoupload/browsevideodialogcommand.js +25 -0
  178. package/src/assets/qms-ckeditor-plugin/src/plugins/video/videoupload/uploadvideocommand.js +3 -16
  179. package/src/assets/qms-ckeditor-plugin/src/plugins/video/videoupload/videouploadediting.js +4 -0
  180. package/src/assets/qms-ckeditor-plugin/src/plugins/video/videoupload/videouploadui.js +12 -23
  181. package/src/assets/qms-ckeditor-plugin/src/themes/icons/fullscreen_exit.svg +1 -0
  182. package/src/assets/qms-ckeditor-plugin/src/themes/icons/information.svg +1 -50
  183. package/src/assets/qms-ckeditor-plugin/src/themes/icons/table-excel.svg +44 -0
  184. package/src/assets/qms-ckeditor-plugin/src/themes/icons/timestamp.svg +1 -1
  185. package/src/assets/qms-ckeditor-plugin/src/themes/icons/tooltip.svg +1 -0
  186. package/src/assets/qms-ckeditor-plugin/src/themes/styles/heading.css +54 -0
  187. package/src/assets/qms-ckeditor-plugin/src/themes/styles/tooltip.css +11 -53
  188. package/src/lib/components/qms-navigation-drawer/qms-navigation-drawer.component.scss +37 -20
  189. package/src/lib/components/qms-paginator/qms-paginator.component.scss +15 -0
  190. package/src/lib/components/qms-stepper/qms-stepper.component.scss +2 -1
  191. package/src/lib/components/select-process-document/select-process-document.component.scss +2 -2
  192. package/src/lib/qms-ckeditor-components/components/qms-ckeditor-about/qms-ckeditor-about.component.scss +16 -0
  193. package/src/lib/qms-ckeditor-components/components/qms-ckeditor-imagemap/qms-ckeditor-imagemap.component.scss +25 -23
  194. package/src/lib/qms-ckeditor-components/qms-ckeditor.component.scss +24 -0
  195. package/src/themes/core/_range-slider.scss +61 -42
  196. package/src/themes/core/_side-sheet.scss +2 -2
  197. package/src/themes/core/_table.scss +176 -37
  198. package/esm2015/lib/directives/range-slider/range-slider-lockup.directive.js +0 -20
  199. package/esm2015/lib/directives/range-slider/range-slider.directive.js +0 -36
  200. package/esm2015/lib/directives/side-sheet/drawer-content.directive.js +0 -20
  201. package/esm2015/lib/directives/side-sheet/drawer-header-action.directive.js +0 -20
  202. package/esm2015/lib/directives/side-sheet/drawer-header.directive.js +0 -20
  203. package/esm2015/lib/directives/side-sheet/drawer.directive.js +0 -20
  204. package/esm2015/lib/qms-ckeditor-components/common/classes/uploadAdapter.js +0 -26
  205. package/lib/qms-ckeditor-components/common/classes/uploadAdapter.d.ts +0 -5
  206. package/src/assets/qms-ckeditor-plugin/src/plugins/tooltip/inserttooltipcommand.js +0 -88
@@ -1,89 +1,26 @@
1
1
  import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
2
2
  import ButtonView from '@ckeditor/ckeditor5-ui/src/button/buttonview';
3
3
  import BpmnIcon from '../../themes/icons/bpmn.svg';
4
- import * as QMSCKEditorConstant from '../common/qmsCKEditorConstant';
5
- import * as QMSCKEditorService from '../common/qmsCKEditorService';
6
- import { IMAGEMAP_COMMANDS, createInsertedEvent } from '../imagemap/utils';
7
- import { debounced } from '../common/qmsCKEditorUtil';
8
-
4
+ import BpmnDialogCommand from './bpmndialogcommand';
9
5
  export default class QMSCKEditorBpmnPlugin extends Plugin {
10
6
  init() {
11
7
  const editor = this.editor;
12
8
  const t = editor.t;
13
9
  editor.ui.componentFactory.add('qmsBpmn', locale => {
14
10
  const view = new ButtonView(locale);
15
-
11
+ const command = editor.commands.get('bpmnDialog');
16
12
  view.set({
17
13
  label: t('Business Process Model and Notation'),
18
14
  icon: BpmnIcon,
19
15
  tooltip: true
20
16
  });
21
-
17
+ view.bind('isEnabled').to(command);
22
18
  view.on('execute', () => {
23
- const isBpmn = this.isBpmnImage(editor.editing.view.document.selection.getSelectedElement(), editor.plugins.get('Image'))
24
- if (isBpmn) {
25
- const parentElement = editor.editing.view.document.selection.getSelectedElement();
26
- const altAtr = parentElement.getChild(0).getAttribute('alt');
27
- const arrAtr = altAtr.split("#");
28
- const id = arrAtr[1];
29
- QMSCKEditorService.bpmnNotify(id);
30
- }
31
- else {
32
- QMSCKEditorService.bpmnNotify('');
33
- }
34
- window[QMSCKEditorConstant.QMSCK_BPMN_IS_PROCESSING] = false;
35
- window.addEventListener(QMSCKEditorConstant.QMSCK_BPMN_PLUGIN_RESP, function (evt) {
36
- if (window[QMSCKEditorConstant.QMSCK_BPMN_IS_PROCESSING]) {
37
- return;
38
- }
39
- window[QMSCKEditorConstant.QMSCK_BPMN_IS_PROCESSING] = true;
40
- editor.model.change( writer => {
41
- const options = evt.detail.imagemap || {};
42
- const imageElement = writer.createElement( 'image', {
43
- src: evt.detail.values,
44
- alt: evt.detail.key
45
- });
46
- // Insert the image in the current selection location.
47
- editor.model.insertContent( imageElement, editor.model.document.selection );
48
- if(!!options.areas && options.areas.length > 0){
49
- editor.model.createSelection(imageElement, "in");//Set the current selection in the inserted image
50
- const imageMapCommand = editor.commands.get(IMAGEMAP_COMMANDS.IMAGEMAP);
51
- if(!!imageMapCommand){
52
- imageMapCommand.set('isEnabled', true);//force to run the command
53
- options.oldName = options.name;//Delete old image map if any
54
- imageMapCommand.execute(options);
55
- //resize image map when image width is greater than the widget width (600px)
56
- if(options.imageWidth > 600){
57
- const resizeImageMapCommand = editor.commands.get(IMAGEMAP_COMMANDS.RESIZE_IMAGEMAP);
58
- if(!!resizeImageMapCommand){
59
- imageMapCommand.once(createInsertedEvent(options.name), debounced(() => {
60
- resizeImageMapCommand.set('isEnabled', true);//force to run the command
61
- resizeImageMapCommand.execute();
62
- }, 500));
63
- }
64
- }
65
- }
66
- }
67
- });
68
- }, { once: true });
19
+ command.execute();
69
20
  });
70
21
  return view;
71
22
  });
72
- }
73
-
74
- isBpmnImage( element, image ) {
75
- const isImage = element && image.isImageWidget( element );
76
-
77
- if ( !isImage ) {
78
- return false;
79
- }
80
23
 
81
- const altAtr = element.getChild(0).getAttribute('alt')
82
- if (altAtr && altAtr.includes(QMSCKEditorConstant.QMSCK_BPMN)) {
83
- return true;
84
- }
85
- else {
86
- return false;
87
- }
24
+ editor.commands.add('bpmnDialog', new BpmnDialogCommand(editor));
88
25
  }
89
26
  }
@@ -0,0 +1,3 @@
1
+ {
2
+ "Source": "The label of the source editing feature toolbar button."
3
+ }
@@ -0,0 +1,21 @@
1
+ # Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved.
2
+ #
3
+ # !!! IMPORTANT !!!
4
+ #
5
+ # Before you edit this file, please keep in mind that contributing to the project
6
+ # translations is possible ONLY via the Transifex online service.
7
+ #
8
+ # To submit your translations, visit https://www.transifex.com/ckeditor/ckeditor5.
9
+ #
10
+ # To learn more, check out the official contributor's guide:
11
+ # https://ckeditor.com/docs/ckeditor5/latest/framework/guides/contributing/contributing.html
12
+ #
13
+ msgid ""
14
+ msgstr ""
15
+ "Language-Team: German (https://www.transifex.com/ckeditor/teams/11143/de/)\n"
16
+ "Language: de\n"
17
+ "Plural-Forms: nplurals=2; plural=(n != 1);\n"
18
+
19
+ msgctxt "The label of the source editing feature toolbar button."
20
+ msgid "Source"
21
+ msgstr "Quellcode"
@@ -0,0 +1,21 @@
1
+ # Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved.
2
+ #
3
+ # !!! IMPORTANT !!!
4
+ #
5
+ # Before you edit this file, please keep in mind that contributing to the project
6
+ # translations is possible ONLY via the Transifex online service.
7
+ #
8
+ # To submit your translations, visit https://www.transifex.com/ckeditor/ckeditor5.
9
+ #
10
+ # To learn more, check out the official contributor's guide:
11
+ # https://ckeditor.com/docs/ckeditor5/latest/framework/guides/contributing/contributing.html
12
+ #
13
+ msgid ""
14
+ msgstr ""
15
+ "Language: \n"
16
+ "Language-Team: \n"
17
+ "Plural-Forms: \n"
18
+
19
+ msgctxt "The label of the source editing feature toolbar button."
20
+ msgid "Source"
21
+ msgstr "Source"
@@ -0,0 +1,21 @@
1
+ # Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved.
2
+ #
3
+ # !!! IMPORTANT !!!
4
+ #
5
+ # Before you edit this file, please keep in mind that contributing to the project
6
+ # translations is possible ONLY via the Transifex online service.
7
+ #
8
+ # To submit your translations, visit https://www.transifex.com/ckeditor/ckeditor5.
9
+ #
10
+ # To learn more, check out the official contributor's guide:
11
+ # https://ckeditor.com/docs/ckeditor5/latest/framework/guides/contributing/contributing.html
12
+ #
13
+ msgid ""
14
+ msgstr ""
15
+ "Language-Team: Galician (https://www.transifex.com/ckeditor/teams/11143/gl/)\n"
16
+ "Language: gl\n"
17
+ "Plural-Forms: nplurals=2; plural=(n != 1);\n"
18
+
19
+ msgctxt "The label of the source editing feature toolbar button."
20
+ msgid "Source"
21
+ msgstr "Orixe"
@@ -0,0 +1,21 @@
1
+ # Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved.
2
+ #
3
+ # !!! IMPORTANT !!!
4
+ #
5
+ # Before you edit this file, please keep in mind that contributing to the project
6
+ # translations is possible ONLY via the Transifex online service.
7
+ #
8
+ # To submit your translations, visit https://www.transifex.com/ckeditor/ckeditor5.
9
+ #
10
+ # To learn more, check out the official contributor's guide:
11
+ # https://ckeditor.com/docs/ckeditor5/latest/framework/guides/contributing/contributing.html
12
+ #
13
+ msgid ""
14
+ msgstr ""
15
+ "Language-Team: Hungarian (https://www.transifex.com/ckeditor/teams/11143/hu/)\n"
16
+ "Language: hu\n"
17
+ "Plural-Forms: nplurals=2; plural=(n != 1);\n"
18
+
19
+ msgctxt "The label of the source editing feature toolbar button."
20
+ msgid "Source"
21
+ msgstr "Forrás"
@@ -0,0 +1,21 @@
1
+ # Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved.
2
+ #
3
+ # !!! IMPORTANT !!!
4
+ #
5
+ # Before you edit this file, please keep in mind that contributing to the project
6
+ # translations is possible ONLY via the Transifex online service.
7
+ #
8
+ # To submit your translations, visit https://www.transifex.com/ckeditor/ckeditor5.
9
+ #
10
+ # To learn more, check out the official contributor's guide:
11
+ # https://ckeditor.com/docs/ckeditor5/latest/framework/guides/contributing/contributing.html
12
+ #
13
+ msgid ""
14
+ msgstr ""
15
+ "Language-Team: Italian (https://www.transifex.com/ckeditor/teams/11143/it/)\n"
16
+ "Language: it\n"
17
+ "Plural-Forms: nplurals=2; plural=(n != 1);\n"
18
+
19
+ msgctxt "The label of the source editing feature toolbar button."
20
+ msgid "Source"
21
+ msgstr "Sorgente"
@@ -0,0 +1,21 @@
1
+ # Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved.
2
+ #
3
+ # !!! IMPORTANT !!!
4
+ #
5
+ # Before you edit this file, please keep in mind that contributing to the project
6
+ # translations is possible ONLY via the Transifex online service.
7
+ #
8
+ # To submit your translations, visit https://www.transifex.com/ckeditor/ckeditor5.
9
+ #
10
+ # To learn more, check out the official contributor's guide:
11
+ # https://ckeditor.com/docs/ckeditor5/latest/framework/guides/contributing/contributing.html
12
+ #
13
+ msgid ""
14
+ msgstr ""
15
+ "Language-Team: Russian (https://www.transifex.com/ckeditor/teams/11143/ru/)\n"
16
+ "Language: ru\n"
17
+ "Plural-Forms: nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || (n%100>=11 && n%100<=14)? 2 : 3);\n"
18
+
19
+ msgctxt "The label of the source editing feature toolbar button."
20
+ msgid "Source"
21
+ msgstr "HTML редактор"
@@ -0,0 +1,21 @@
1
+ # Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved.
2
+ #
3
+ # !!! IMPORTANT !!!
4
+ #
5
+ # Before you edit this file, please keep in mind that contributing to the project
6
+ # translations is possible ONLY via the Transifex online service.
7
+ #
8
+ # To submit your translations, visit https://www.transifex.com/ckeditor/ckeditor5.
9
+ #
10
+ # To learn more, check out the official contributor's guide:
11
+ # https://ckeditor.com/docs/ckeditor5/latest/framework/guides/contributing/contributing.html
12
+ #
13
+ msgid ""
14
+ msgstr ""
15
+ "Language-Team: Chinese (Taiwan) (https://www.transifex.com/ckeditor/teams/11143/zh_TW/)\n"
16
+ "Language: zh_TW\n"
17
+ "Plural-Forms: nplurals=1; plural=0;\n"
18
+
19
+ msgctxt "The label of the source editing feature toolbar button."
20
+ msgid "Source"
21
+ msgstr "原始碼"
@@ -0,0 +1,10 @@
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 source-editing
8
+ */
9
+
10
+ export { default as SourceEditing } from './sourceediting';
@@ -0,0 +1,386 @@
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 source-editing/sourceediting
8
+ */
9
+
10
+ /* global console */
11
+
12
+ import { Plugin, PendingActions } from 'ckeditor5/src/core';
13
+ import { ButtonView } from 'ckeditor5/src/ui';
14
+ import { createElement, ElementReplacer } from 'ckeditor5/src/utils';
15
+ import { formatHtml } from './utils/formathtml';
16
+
17
+ import '../theme/sourceediting.css';
18
+
19
+ import sourceEditingIcon from '../theme/icons/source-editing.svg';
20
+
21
+ const COMMAND_FORCE_DISABLE_ID = 'SourceEditingMode';
22
+
23
+ /**
24
+ * The source editing feature.
25
+ *
26
+ * It provides the possibility to view and edit the source of the document.
27
+ *
28
+ * For a detailed overview, check the {@glink features/source-editing source editing feature documentation} and the
29
+ * {@glink api/source-editing package page}.
30
+ *
31
+ * @extends module:core/plugin~Plugin
32
+ */
33
+ export default class SourceEditing extends Plugin {
34
+ /**
35
+ * @inheritDoc
36
+ */
37
+ static get pluginName() {
38
+ return 'SourceEditing';
39
+ }
40
+
41
+ /**
42
+ * @inheritDoc
43
+ */
44
+ static get requires() {
45
+ return [ PendingActions ];
46
+ }
47
+
48
+ /**
49
+ * @inheritDoc
50
+ */
51
+ constructor( editor ) {
52
+ super( editor );
53
+
54
+ /**
55
+ * Flag indicating whether the document source mode is active.
56
+ *
57
+ * @observable
58
+ * @member {Boolean}
59
+ */
60
+ this.set( 'isSourceEditingMode', false );
61
+
62
+ /**
63
+ * The element replacer instance used to replace the editing roots with the wrapper elements containing the document source.
64
+ *
65
+ * @private
66
+ * @member {module:utils/elementreplacer~ElementReplacer}
67
+ */
68
+ this._elementReplacer = new ElementReplacer();
69
+
70
+ /**
71
+ * Maps all root names to wrapper elements containing the document source.
72
+ *
73
+ * @private
74
+ * @member {Map.<String,HTMLElement>}
75
+ */
76
+ this._replacedRoots = new Map();
77
+
78
+ /**
79
+ * Maps all root names to their document data.
80
+ *
81
+ * @private
82
+ * @member {Map.<String,String>}
83
+ */
84
+ this._dataFromRoots = new Map();
85
+ }
86
+
87
+ /**
88
+ * @inheritDoc
89
+ */
90
+ init() {
91
+ const editor = this.editor;
92
+ const t = editor.t;
93
+
94
+ editor.ui.componentFactory.add( 'sourceEditing', locale => {
95
+ const buttonView = new ButtonView( locale );
96
+
97
+ buttonView.set( {
98
+ label: t( 'Source' ),
99
+ icon: sourceEditingIcon,
100
+ tooltip: true,
101
+ withText: true,
102
+ class: 'ck-source-editing-button'
103
+ } );
104
+
105
+ buttonView.bind( 'isOn' ).to( this, 'isSourceEditingMode' );
106
+
107
+ // The button should be disabled if one of the following conditions is met:
108
+ buttonView.bind( 'isEnabled' ).to(
109
+ this, 'isEnabled',
110
+ editor, 'isReadOnly',
111
+ editor.plugins.get( PendingActions ), 'hasAny',
112
+ ( isEnabled, isEditorReadOnly, hasAnyPendingActions ) => {
113
+ // (1) The plugin itself is disabled.
114
+ if ( !isEnabled ) {
115
+ return false;
116
+ }
117
+
118
+ // (2) The editor is in read-only mode.
119
+ if ( isEditorReadOnly ) {
120
+ return false;
121
+ }
122
+
123
+ // (3) Any pending action is scheduled. It may change the model, so modifying the document source should be prevented
124
+ // until the model is finally set.
125
+ if ( hasAnyPendingActions ) {
126
+ return false;
127
+ }
128
+
129
+ return true;
130
+ }
131
+ );
132
+
133
+ this.listenTo( buttonView, 'execute', () => {
134
+ this.isSourceEditingMode = !this.isSourceEditingMode;
135
+ } );
136
+
137
+ return buttonView;
138
+ } );
139
+
140
+ // Currently, the plugin handles the source editing mode by itself only for the classic editor. To use this plugin with other
141
+ // integrations, listen to the `change:isSourceEditingMode` event and act accordingly.
142
+ if ( this._isAllowedToHandleSourceEditingMode() ) {
143
+ this.on( 'change:isSourceEditingMode', ( evt, name, isSourceEditingMode ) => {
144
+ if ( isSourceEditingMode ) {
145
+ this._showSourceEditing();
146
+ this._disableCommands();
147
+ } else {
148
+ this._hideSourceEditing();
149
+ this._enableCommands();
150
+ }
151
+ } );
152
+
153
+ this.on( 'change:isEnabled', ( evt, name, isEnabled ) => this._handleReadOnlyMode( !isEnabled ) );
154
+
155
+ this.listenTo( editor, 'change:isReadOnly', ( evt, name, isReadOnly ) => this._handleReadOnlyMode( isReadOnly ) );
156
+ }
157
+ }
158
+
159
+ /**
160
+ * @inheritDoc
161
+ */
162
+ afterInit() {
163
+ const editor = this.editor;
164
+
165
+ const collaborationPluginNamesToWarn = [
166
+ 'RealTimeCollaborativeEditing',
167
+ 'CommentsEditing',
168
+ 'TrackChangesEditing',
169
+ 'RevisionHistory'
170
+ ];
171
+
172
+ // Currently, the basic integration with Collaboration Features is to display a warning in the console.
173
+ if ( collaborationPluginNamesToWarn.some( pluginName => editor.plugins.has( pluginName ) ) ) {
174
+ console.warn(
175
+ 'You initialized the editor with the source editing feature and at least one of the collaboration features. ' +
176
+ 'Please be advised that the source editing feature may not work, and be careful when editing document source ' +
177
+ 'that contains markers created by the collaboration features.'
178
+ );
179
+ }
180
+
181
+ // Restricted Editing integration can also lead to problems. Warn the user accordingly.
182
+ if ( editor.plugins.has( 'RestrictedEditingModeEditing' ) ) {
183
+ console.warn(
184
+ 'You initialized the editor with the source editing feature and restricted editing feature. ' +
185
+ 'Please be advised that the source editing feature may not work, and be careful when editing document source ' +
186
+ 'that contains markers created by the restricted editing feature.'
187
+ );
188
+ }
189
+ }
190
+
191
+ /**
192
+ * Creates source editing wrappers that replace each editing root. Each wrapper contains the document source from the corresponding
193
+ * root.
194
+ *
195
+ * The wrapper element contains a textarea and it solves the problem, that the textarea element cannot auto expand its height based on
196
+ * the content it contains. The solution is to make the textarea more like a plain div element, which expands in height as much as it
197
+ * needs to, in order to display the whole document source without scrolling. The wrapper element is a parent for the textarea and for
198
+ * the pseudo-element `::after`, that replicates the look, content, and position of the textarea. The pseudo-element replica is hidden,
199
+ * but it is styled to be an identical visual copy of the textarea with the same content. Then, the wrapper is a grid container and both
200
+ * of its children (the textarea and the `::after` pseudo-element) are positioned within a CSS grid to occupy the same grid cell. The
201
+ * content in the pseudo-element `::after` is set in CSS and it stretches the grid to the appropriate size based on the textarea value.
202
+ * Since both children occupy the same grid cell, both have always the same height.
203
+ *
204
+ * @private
205
+ */
206
+ _showSourceEditing() {
207
+ const editor = this.editor;
208
+ const editingView = editor.editing.view;
209
+ const model = editor.model;
210
+
211
+ model.change( writer => {
212
+ writer.setSelection( null );
213
+ writer.removeSelectionAttribute( model.document.selection.getAttributeKeys() );
214
+ } );
215
+
216
+ // It is not needed to iterate through all editing roots, as currently the plugin supports only the Classic Editor with a single
217
+ // main root, but this code may help understand and use this feature in external integrations.
218
+ for ( const [ rootName, domRootElement ] of editingView.domRoots ) {
219
+ const data = formatSource( editor.data.get( { rootName } ) );
220
+
221
+ const domSourceEditingElementTextarea = createElement( domRootElement.ownerDocument, 'textarea', { rows: '1' } );
222
+
223
+ const domSourceEditingElementWrapper = createElement( domRootElement.ownerDocument, 'div', {
224
+ class: 'ck-source-editing-area',
225
+ 'data-value': data
226
+ }, [ domSourceEditingElementTextarea ] );
227
+
228
+ domSourceEditingElementTextarea.value = data;
229
+
230
+ // Setting a value to textarea moves the input cursor to the end. We want the selection at the beginning.
231
+ domSourceEditingElementTextarea.setSelectionRange( 0, 0 );
232
+
233
+ // Bind the textarea's value to the wrapper's `data-value` property. Each change of the textarea's value updates the
234
+ // wrapper's `data-value` property.
235
+ domSourceEditingElementTextarea.addEventListener( 'input', () => {
236
+ domSourceEditingElementWrapper.dataset.value = domSourceEditingElementTextarea.value;
237
+ } );
238
+
239
+ editingView.change( writer => {
240
+ const viewRoot = editingView.document.getRoot( rootName );
241
+
242
+ writer.addClass( 'ck-hidden', viewRoot );
243
+ } );
244
+
245
+ this._replacedRoots.set( rootName, domSourceEditingElementWrapper );
246
+
247
+ this._elementReplacer.replace( domRootElement, domSourceEditingElementWrapper );
248
+
249
+ this._dataFromRoots.set( rootName, data );
250
+ }
251
+
252
+ this._focusSourceEditing();
253
+ }
254
+
255
+ /**
256
+ * Restores all hidden editing roots and sets the source data in them.
257
+ *
258
+ * @private
259
+ */
260
+ _hideSourceEditing() {
261
+ const editor = this.editor;
262
+ const editingView = editor.editing.view;
263
+
264
+ const data = {};
265
+
266
+ for ( const [ rootName, domSourceEditingElementWrapper ] of this._replacedRoots ) {
267
+ const oldData = this._dataFromRoots.get( rootName );
268
+ const newData = domSourceEditingElementWrapper.dataset.value;
269
+
270
+ // Do not set the data unless some changes have been made in the meantime.
271
+ // This prevents empty undo steps after switching to the normal editor.
272
+ if ( oldData !== newData ) {
273
+ data[ rootName ] = newData;
274
+ }
275
+
276
+ editingView.change( writer => {
277
+ const viewRoot = editingView.document.getRoot( rootName );
278
+
279
+ writer.removeClass( 'ck-hidden', viewRoot );
280
+ } );
281
+ }
282
+
283
+ this._elementReplacer.restore();
284
+
285
+ this._replacedRoots.clear();
286
+
287
+ this._dataFromRoots.clear();
288
+
289
+ if ( Object.keys( data ).length ) {
290
+ editor.data.set( data, { batchType: 'default' } );
291
+ }
292
+
293
+ editor.editing.view.focus();
294
+ }
295
+
296
+ /**
297
+ * Focuses the textarea containing document source from the first editing root.
298
+ *
299
+ * @private
300
+ */
301
+ _focusSourceEditing() {
302
+ const [ domSourceEditingElementWrapper ] = this._replacedRoots.values();
303
+
304
+ const textarea = domSourceEditingElementWrapper.querySelector( 'textarea' );
305
+
306
+ textarea.focus();
307
+ }
308
+
309
+ /**
310
+ * Disables all commands.
311
+ *
312
+ * @private
313
+ */
314
+ _disableCommands() {
315
+ const editor = this.editor;
316
+
317
+ for ( const command of editor.commands.commands() ) {
318
+ command.forceDisabled( COMMAND_FORCE_DISABLE_ID );
319
+ }
320
+ }
321
+
322
+ /**
323
+ * Clears forced disable for all commands, that was previously set through {@link #_disableCommands}.
324
+ *
325
+ * @private
326
+ */
327
+ _enableCommands() {
328
+ const editor = this.editor;
329
+
330
+ for ( const command of editor.commands.commands() ) {
331
+ command.clearForceDisabled( COMMAND_FORCE_DISABLE_ID );
332
+ }
333
+ }
334
+
335
+ /**
336
+ * Adds or removes the `readonly` attribute from the textarea from all roots, if document source mode is active.
337
+ *
338
+ * @param {Boolean} isReadOnly Indicates whether all textarea elements should be read-only.
339
+ */
340
+ _handleReadOnlyMode( isReadOnly ) {
341
+ if ( !this.isSourceEditingMode ) {
342
+ return;
343
+ }
344
+
345
+ for ( const [ , domSourceEditingElementWrapper ] of this._replacedRoots ) {
346
+ domSourceEditingElementWrapper.querySelector( 'textarea' ).readOnly = isReadOnly;
347
+ }
348
+ }
349
+
350
+ /**
351
+ * Checks, if the plugin is allowed to handle the source editing mode by itself. Currently, the source editing mode is supported only
352
+ * for the {@link module:editor-classic/classiceditor~ClassicEditor classic editor}.
353
+ *
354
+ * @private
355
+ * @returns {Boolean}
356
+ */
357
+ _isAllowedToHandleSourceEditingMode() {
358
+ const editor = this.editor;
359
+ const editable = editor.ui.view.editable;
360
+
361
+ // Checks, if the editor's editable belongs to the editor's DOM tree.
362
+ return editable && !editable._hasExternalElement;
363
+ }
364
+ }
365
+
366
+ // Formats the content for a better readability.
367
+ //
368
+ // For a non-HTML source the unchanged input string is returned.
369
+ //
370
+ // @param {String} input Input string to check.
371
+ // @returns {Boolean}
372
+ function formatSource( input ) {
373
+ if ( !isHtml( input ) ) {
374
+ return input;
375
+ }
376
+
377
+ return formatHtml( input );
378
+ }
379
+
380
+ // Checks, if the document source is HTML. It is sufficient to just check the first character from the document data.
381
+ //
382
+ // @param {String} input Input string to check.
383
+ // @returns {Boolean}
384
+ function isHtml( input ) {
385
+ return input.startsWith( '<' );
386
+ }