qms-angular 1.0.72 → 1.0.73

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 (134) hide show
  1. package/bundles/qms-angular.umd.js +509 -116
  2. package/bundles/qms-angular.umd.js.map +1 -1
  3. package/esm2015/lib/components/qms-navigation-drawer/qms-navigation-drawer.component.js +2 -2
  4. package/esm2015/lib/components/qms-navigation-drawer/qms-navigation-drawer.module.js +1 -3
  5. package/esm2015/lib/components/select-include-children/select-include-children.component.js +112 -45
  6. package/esm2015/lib/components/tree/tree.component.js +10 -14
  7. package/esm2015/lib/model/en.js +19 -2
  8. package/esm2015/lib/model/no.js +19 -2
  9. package/esm2015/lib/qms-ckeditor-components/common/classes/qmsUploadAdapter.js +89 -0
  10. package/esm2015/lib/qms-ckeditor-components/common/constants/ckeditorEvent.constant.js +3 -1
  11. package/esm2015/lib/qms-ckeditor-components/common/models/qms-ckeditor-data.model.js +1 -1
  12. package/esm2015/lib/qms-ckeditor-components/common/models/qms-ckeditor-video-tree.model.js +4 -0
  13. package/esm2015/lib/qms-ckeditor-components/common/models/wproofreader-config.model.js +6 -0
  14. package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-about/qms-ckeditor-about.component.js +38 -0
  15. package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-bpmn/qms-ckeditor-bpmn.component.js +22 -3
  16. package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-imagemap/qms-ckeditor-imagemap.component.js +9 -8
  17. package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-link/qms-ckeditor-link.component.js +4 -1
  18. package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-tooltip/qms-ckeditor-tooltip.component.js +3 -4
  19. package/esm2015/lib/qms-ckeditor-components/qms-ckeditor.component.js +160 -10
  20. package/esm2015/lib/qms-ckeditor-components/qms-ckeditor.module.js +7 -3
  21. package/esm2015/lib/qms-ckeditor-components/services/qms-ckeditor-tree.service.js +4 -1
  22. package/esm2015/lib/qms-ckeditor-components/services/qms-ckeditor-upload.service.js +20 -0
  23. package/esm2015/qms-angular.js +6 -4
  24. package/fesm2015/qms-angular.js +475 -95
  25. package/fesm2015/qms-angular.js.map +1 -1
  26. package/lib/components/select-include-children/select-include-children.component.d.ts +2 -1
  27. package/lib/model/en.d.ts +17 -0
  28. package/lib/model/no.d.ts +17 -0
  29. package/lib/qms-ckeditor-components/common/classes/qmsUploadAdapter.d.ts +18 -0
  30. package/lib/qms-ckeditor-components/common/constants/ckeditorEvent.constant.d.ts +2 -0
  31. package/lib/qms-ckeditor-components/common/models/qms-ckeditor-data.model.d.ts +4 -0
  32. package/lib/qms-ckeditor-components/common/models/qms-ckeditor-video-tree.model.d.ts +5 -0
  33. package/lib/qms-ckeditor-components/common/models/wproofreader-config.model.d.ts +25 -0
  34. package/lib/qms-ckeditor-components/components/qms-ckeditor-about/qms-ckeditor-about.component.d.ts +15 -0
  35. package/lib/qms-ckeditor-components/components/qms-ckeditor-bpmn/qms-ckeditor-bpmn.component.d.ts +4 -1
  36. package/lib/qms-ckeditor-components/components/qms-ckeditor-imagemap/qms-ckeditor-imagemap.component.d.ts +2 -1
  37. package/lib/qms-ckeditor-components/qms-ckeditor.component.d.ts +15 -1
  38. package/lib/qms-ckeditor-components/services/qms-ckeditor-tree.service.d.ts +2 -0
  39. package/lib/qms-ckeditor-components/services/qms-ckeditor-upload.service.d.ts +5 -0
  40. package/lib.theme.scss +1 -0
  41. package/package.json +1 -1
  42. package/qms-angular.d.ts +5 -3
  43. package/qms-angular.metadata.json +1 -1
  44. package/src/assets/images/ckeditor5.svg +1 -0
  45. package/src/assets/qms-ckeditor-plugin/build/ckeditor.js +1 -1
  46. package/src/assets/qms-ckeditor-plugin/build/ckeditor.js.map +1 -1
  47. package/src/assets/qms-ckeditor-plugin/build/translations/az.js +1 -1
  48. package/src/assets/qms-ckeditor-plugin/build/translations/cs.js +1 -1
  49. package/src/assets/qms-ckeditor-plugin/build/translations/da.js +1 -1
  50. package/src/assets/qms-ckeditor-plugin/build/translations/de-ch.js +1 -1
  51. package/src/assets/qms-ckeditor-plugin/build/translations/de.js +1 -1
  52. package/src/assets/qms-ckeditor-plugin/build/translations/en-au.js +1 -1
  53. package/src/assets/qms-ckeditor-plugin/build/translations/es.js +1 -1
  54. package/src/assets/qms-ckeditor-plugin/build/translations/et.js +1 -1
  55. package/src/assets/qms-ckeditor-plugin/build/translations/fa.js +1 -1
  56. package/src/assets/qms-ckeditor-plugin/build/translations/fr.js +1 -1
  57. package/src/assets/qms-ckeditor-plugin/build/translations/gl.js +1 -1
  58. package/src/assets/qms-ckeditor-plugin/build/translations/he.js +1 -1
  59. package/src/assets/qms-ckeditor-plugin/build/translations/hi.js +1 -1
  60. package/src/assets/qms-ckeditor-plugin/build/translations/hr.js +1 -1
  61. package/src/assets/qms-ckeditor-plugin/build/translations/hu.js +1 -1
  62. package/src/assets/qms-ckeditor-plugin/build/translations/id.js +1 -1
  63. package/src/assets/qms-ckeditor-plugin/build/translations/it.js +1 -1
  64. package/src/assets/qms-ckeditor-plugin/build/translations/ja.js +1 -1
  65. package/src/assets/qms-ckeditor-plugin/build/translations/ko.js +1 -1
  66. package/src/assets/qms-ckeditor-plugin/build/translations/ku.js +1 -1
  67. package/src/assets/qms-ckeditor-plugin/build/translations/lv.js +1 -1
  68. package/src/assets/qms-ckeditor-plugin/build/translations/nl.js +1 -1
  69. package/src/assets/qms-ckeditor-plugin/build/translations/no.js +1 -1
  70. package/src/assets/qms-ckeditor-plugin/build/translations/pl.js +1 -1
  71. package/src/assets/qms-ckeditor-plugin/build/translations/pt-br.js +1 -1
  72. package/src/assets/qms-ckeditor-plugin/build/translations/ru.js +1 -1
  73. package/src/assets/qms-ckeditor-plugin/build/translations/sk.js +1 -1
  74. package/src/assets/qms-ckeditor-plugin/build/translations/sl.js +1 -1
  75. package/src/assets/qms-ckeditor-plugin/build/translations/sr-latn.js +1 -1
  76. package/src/assets/qms-ckeditor-plugin/build/translations/sr.js +1 -1
  77. package/src/assets/qms-ckeditor-plugin/build/translations/th.js +1 -1
  78. package/src/assets/qms-ckeditor-plugin/build/translations/tk.js +1 -1
  79. package/src/assets/qms-ckeditor-plugin/build/translations/tr.js +1 -1
  80. package/src/assets/qms-ckeditor-plugin/build/translations/uk.js +1 -1
  81. package/src/assets/qms-ckeditor-plugin/build/translations/vi.js +1 -1
  82. package/src/assets/qms-ckeditor-plugin/build/translations/zh-cn.js +1 -1
  83. package/src/assets/qms-ckeditor-plugin/build/translations/zh.js +1 -1
  84. package/src/assets/qms-ckeditor-plugin/package-lock.json +23 -0
  85. package/src/assets/qms-ckeditor-plugin/package.json +2 -0
  86. package/src/assets/qms-ckeditor-plugin/src/ckeditor.js +16 -4
  87. package/src/assets/qms-ckeditor-plugin/src/plugins/aboutckeditor/aboutckeditor.js +28 -0
  88. package/src/assets/qms-ckeditor-plugin/src/plugins/bpmn/bpmndialogcommand.js +74 -0
  89. package/src/assets/qms-ckeditor-plugin/src/plugins/bpmn/qmsCKEditorBpmnPlugin.js +5 -68
  90. package/src/assets/qms-ckeditor-plugin/src/plugins/common/qmsCKEditorConstant.js +4 -0
  91. package/src/assets/qms-ckeditor-plugin/src/plugins/common/qmsCKEditorService.js +21 -0
  92. package/src/assets/qms-ckeditor-plugin/src/plugins/imagemap/imagemapcommand.js +1 -0
  93. package/src/assets/qms-ckeditor-plugin/src/plugins/imagemap/utils.js +1 -1
  94. package/src/assets/qms-ckeditor-plugin/src/plugins/link/linkcommand.js +131 -176
  95. package/src/assets/qms-ckeditor-plugin/src/plugins/link/linkdialogcommand.js +88 -0
  96. package/src/assets/qms-ckeditor-plugin/src/plugins/link/linkediting.js +2 -0
  97. package/src/assets/qms-ckeditor-plugin/src/plugins/link/linkui.js +41 -32
  98. package/src/assets/qms-ckeditor-plugin/src/plugins/tableofcontents/tableofcontents.js +14 -0
  99. package/src/assets/qms-ckeditor-plugin/src/plugins/tableofcontents/tableofcontentscommand.js +87 -0
  100. package/src/assets/qms-ckeditor-plugin/src/plugins/tableofcontents/tableofcontentsediting.js +59 -0
  101. package/src/assets/qms-ckeditor-plugin/src/plugins/tableofcontents/tableofcontentsui.js +35 -0
  102. package/src/assets/qms-ckeditor-plugin/src/plugins/tableofcontents/utils.js +62 -0
  103. package/src/assets/qms-ckeditor-plugin/src/plugins/template/loadtemplatedialogcommand.js +14 -0
  104. package/src/assets/qms-ckeditor-plugin/src/plugins/template/qmsCKEditorLoadTemplatePlugin.js +10 -12
  105. package/src/assets/qms-ckeditor-plugin/src/plugins/template/qmsCKEdtiorTemplatePlugin.js +10 -7
  106. package/src/assets/qms-ckeditor-plugin/src/plugins/template/templatedialogcommand.js +9 -0
  107. package/src/assets/qms-ckeditor-plugin/src/plugins/timestamp/timestamp.js +15 -18
  108. package/src/assets/qms-ckeditor-plugin/src/plugins/timestamp/timestampcommand.js +17 -0
  109. package/src/assets/qms-ckeditor-plugin/src/plugins/tooltip/removetooltipcommand.js +42 -26
  110. package/src/assets/qms-ckeditor-plugin/src/plugins/tooltip/tooltip.js +3 -3
  111. package/src/assets/qms-ckeditor-plugin/src/plugins/tooltip/tooltipcommand.js +75 -0
  112. package/src/assets/qms-ckeditor-plugin/src/plugins/tooltip/tooltipdialogcommand.js +68 -0
  113. package/src/assets/qms-ckeditor-plugin/src/plugins/tooltip/tooltipediting.js +206 -131
  114. package/src/assets/qms-ckeditor-plugin/src/plugins/tooltip/tooltipui.js +424 -136
  115. package/src/assets/qms-ckeditor-plugin/src/plugins/tooltip/ui/actionsview.js +67 -12
  116. package/src/assets/qms-ckeditor-plugin/src/plugins/tooltip/utils.js +17 -55
  117. package/src/assets/qms-ckeditor-plugin/src/plugins/video/autovideo.js +1 -5
  118. package/src/assets/qms-ckeditor-plugin/src/plugins/video/video/videoediting.js +5 -2
  119. package/src/assets/qms-ckeditor-plugin/src/plugins/video/videoupload/browsevideodialogcommand.js +25 -0
  120. package/src/assets/qms-ckeditor-plugin/src/plugins/video/videoupload/uploadvideocommand.js +3 -16
  121. package/src/assets/qms-ckeditor-plugin/src/plugins/video/videoupload/videouploadediting.js +4 -0
  122. package/src/assets/qms-ckeditor-plugin/src/plugins/video/videoupload/videouploadui.js +12 -23
  123. package/src/assets/qms-ckeditor-plugin/src/themes/icons/information.svg +1 -50
  124. package/src/assets/qms-ckeditor-plugin/src/themes/icons/table-excel.svg +44 -0
  125. package/src/assets/qms-ckeditor-plugin/src/themes/icons/timestamp.svg +1 -1
  126. package/src/assets/qms-ckeditor-plugin/src/themes/icons/tooltip.svg +1 -0
  127. package/src/assets/qms-ckeditor-plugin/src/themes/styles/heading.css +54 -0
  128. package/src/assets/qms-ckeditor-plugin/src/themes/styles/tooltip.css +11 -53
  129. package/src/lib/qms-ckeditor-components/components/qms-ckeditor-about/qms-ckeditor-about.component.scss +16 -0
  130. package/src/lib/qms-ckeditor-components/components/qms-ckeditor-imagemap/qms-ckeditor-imagemap.component.scss +26 -23
  131. package/src/themes/core/_range-slider.scss +10 -12
  132. package/esm2015/lib/qms-ckeditor-components/common/classes/uploadAdapter.js +0 -26
  133. package/lib/qms-ckeditor-components/common/classes/uploadAdapter.d.ts +0 -5
  134. package/src/assets/qms-ckeditor-plugin/src/plugins/tooltip/inserttooltipcommand.js +0 -88
@@ -1,27 +1,30 @@
1
1
  @import '../../styles/style.scss';
2
- .qmsckeditor__imagemap__container {
3
- .mat-form-field {
4
- width: 100%;
5
- }
6
-
7
- .qmsckeditor__imagemap__information{
8
- position: relative;
9
- }
10
2
 
11
- .qmsckeditor__imagemap__map {
12
- overflow: auto;
13
- width: 800px;
14
- min-height: 371px;
15
- position: relative;
16
- max-height: 460px;
17
- }
18
-
19
- .mat-button-toggle-checked {
20
- border: 1px solid #000000 !important;
21
- }
3
+ ::ng-deep .qmsckeditor__imagemap__container {
4
+ .mat-form-field {
5
+ width: 100%;
6
+ }
22
7
 
23
- .hidden {
24
- visibility: hidden;
25
- }
26
- }
8
+ .qmsckeditor__imagemap__information {
9
+ position: relative;
10
+ }
11
+
12
+ .qmsckeditor__imagemap__map {
13
+ overflow: auto;
14
+ width: 800px;
15
+ min-height: 371px;
16
+ position: relative;
17
+ max-height: 460px;
18
+ display: flex;
19
+ justify-content: center;
20
+ align-items: flex-start;
21
+ }
27
22
 
23
+ .mat-button-toggle-checked {
24
+ border: 1px solid #000000 !important;
25
+ }
26
+
27
+ .hidden {
28
+ visibility: hidden;
29
+ }
30
+ }
@@ -91,12 +91,9 @@
91
91
  background-image: repeating-linear-gradient(to right, $slider-tick-color, $slider-tick-color 2px, transparent 0, transparent);
92
92
  opacity: 1;
93
93
  }
94
-
95
94
  .mat-slider-focus-ring{
96
95
  background-color: transparent;
97
96
  }
98
-
99
-
100
97
  }
101
98
  }
102
99
 
@@ -147,9 +144,9 @@
147
144
  }
148
145
  }
149
146
 
150
- .mat-slider{
147
+ .mat-slider:hover{
151
148
  &.qms-range-slider{
152
- &:not(.mat-slider-disabled):hover{
149
+ &:not(.mat-slider-disabled){
153
150
  &.mat-slider-min-value:not(.mat-slider-thumb-label-showing):hover{
154
151
  .mat-slider-thumb{
155
152
  border-color: $slider-hover-border;
@@ -176,9 +173,9 @@
176
173
  }
177
174
 
178
175
  .mat-slider{
179
- &.qms-range-slider{
180
- &:not(.mat-slider-disabled){
181
- &.cdk-mouse-focused, &.cdk-touch-focused, &.cdk-program-focused{
176
+ &.qms-range-slider{
177
+ &.cdk-focused, &.cdk-keyboard-focused, &.cdk-mouse-focused, &.cdk-touch-focused, &.cdk-program-focused{
178
+ &:not(.mat-slider-disabled){
182
179
  .mat-slider-thumb {
183
180
  transform: scale(0.7);
184
181
  height: 48px;
@@ -190,13 +187,14 @@
190
187
  background-clip: padding-box;
191
188
  }
192
189
  }
193
- }
194
190
 
195
- &.mat-slider-disabled{
196
- .mat-slider-thumb{
197
- border-color: transparent;
191
+ &.mat-slider-disabled{
192
+ .mat-slider-thumb{
193
+ border-color: transparent;
194
+ }
198
195
  }
199
196
  }
197
+
200
198
  }
201
199
  }
202
200
 
@@ -1,26 +0,0 @@
1
- export class UploadAdapter {
2
- constructor(loader) {
3
- this.loader = loader;
4
- }
5
- upload() {
6
- return this.loader.file
7
- .then((file) => {
8
- return new Promise((resolve, reject) => {
9
- const myReader = new FileReader();
10
- myReader.onloadend = () => {
11
- resolve({ default: myReader.result });
12
- };
13
- // if (file.size > 512000) {
14
- // const msg = `${file.name} is more than 500kb. Sorry, it has to be less than or equal to 500kb`;
15
- // QMSCKEditorToastService.error(msg);
16
- // reject();
17
- // }
18
- myReader.readAsDataURL(file);
19
- });
20
- })
21
- .catch((error) => {
22
- throw error;
23
- });
24
- }
25
- }
26
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXBsb2FkQWRhcHRlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uL3Byb2plY3RzL3Ftcy1hbmd1bGFyL3NyYy9saWIvcW1zLWNrZWRpdG9yLWNvbXBvbmVudHMvY29tbW9uL2NsYXNzZXMvdXBsb2FkQWRhcHRlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFDQSxNQUFNLE9BQU8sYUFBYTtJQUV4QixZQUFZLE1BQU07UUFDaEIsSUFBSSxDQUFDLE1BQU0sR0FBRyxNQUFNLENBQUM7SUFDdkIsQ0FBQztJQUVELE1BQU07UUFDSixPQUFPLElBQUksQ0FBQyxNQUFNLENBQUMsSUFBSTthQUNwQixJQUFJLENBQUMsQ0FBQyxJQUFJLEVBQUUsRUFBRTtZQUNiLE9BQU8sSUFBSSxPQUFPLENBQUMsQ0FBQyxPQUFPLEVBQUUsTUFBTSxFQUFFLEVBQUU7Z0JBQ3JDLE1BQU0sUUFBUSxHQUFHLElBQUksVUFBVSxFQUFFLENBQUM7Z0JBQ2xDLFFBQVEsQ0FBQyxTQUFTLEdBQUcsR0FBRyxFQUFFO29CQUN4QixPQUFPLENBQUMsRUFBRSxPQUFPLEVBQUUsUUFBUSxDQUFDLE1BQU0sRUFBRSxDQUFDLENBQUM7Z0JBQ3hDLENBQUMsQ0FBQztnQkFDRiw0QkFBNEI7Z0JBQzVCLG9HQUFvRztnQkFDcEcsd0NBQXdDO2dCQUN4QyxjQUFjO2dCQUNkLElBQUk7Z0JBQ0osUUFBUSxDQUFDLGFBQWEsQ0FBQyxJQUFJLENBQUMsQ0FBQztZQUMvQixDQUFDLENBQUMsQ0FBQztRQUNMLENBQUMsQ0FBQzthQUNELEtBQUssQ0FBQyxDQUFDLEtBQUssRUFBRSxFQUFFO1lBQ2YsTUFBTSxLQUFLLENBQUM7UUFDZCxDQUFDLENBQUMsQ0FBQztJQUNQLENBQUM7Q0FDRiIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IFFNU0NLRWRpdG9yVG9hc3RTZXJ2aWNlIH0gZnJvbSAnLi4vdG9hc3QvcW1zLWNrZWRpdG9yLXRvYXN0LnNlcnZpY2UnO1xyXG5leHBvcnQgY2xhc3MgVXBsb2FkQWRhcHRlciB7XHJcbiAgbG9hZGVyOiBhbnk7XHJcbiAgY29uc3RydWN0b3IobG9hZGVyKSB7XHJcbiAgICB0aGlzLmxvYWRlciA9IGxvYWRlcjtcclxuICB9XHJcblxyXG4gIHVwbG9hZCgpIHtcclxuICAgIHJldHVybiB0aGlzLmxvYWRlci5maWxlXHJcbiAgICAgIC50aGVuKChmaWxlKSA9PiB7XHJcbiAgICAgICAgcmV0dXJuIG5ldyBQcm9taXNlKChyZXNvbHZlLCByZWplY3QpID0+IHtcclxuICAgICAgICAgIGNvbnN0IG15UmVhZGVyID0gbmV3IEZpbGVSZWFkZXIoKTtcclxuICAgICAgICAgIG15UmVhZGVyLm9ubG9hZGVuZCA9ICgpID0+IHtcclxuICAgICAgICAgICAgcmVzb2x2ZSh7IGRlZmF1bHQ6IG15UmVhZGVyLnJlc3VsdCB9KTtcclxuICAgICAgICAgIH07XHJcbiAgICAgICAgICAvLyBpZiAoZmlsZS5zaXplID4gNTEyMDAwKSB7XHJcbiAgICAgICAgICAvLyAgIGNvbnN0IG1zZyA9IGAke2ZpbGUubmFtZX0gaXMgbW9yZSB0aGFuIDUwMGtiLiBTb3JyeSwgaXQgaGFzIHRvIGJlIGxlc3MgdGhhbiBvciBlcXVhbCB0byA1MDBrYmA7XHJcbiAgICAgICAgICAvLyAgIFFNU0NLRWRpdG9yVG9hc3RTZXJ2aWNlLmVycm9yKG1zZyk7XHJcbiAgICAgICAgICAvLyAgIHJlamVjdCgpO1xyXG4gICAgICAgICAgLy8gfVxyXG4gICAgICAgICAgbXlSZWFkZXIucmVhZEFzRGF0YVVSTChmaWxlKTtcclxuICAgICAgICB9KTtcclxuICAgICAgfSlcclxuICAgICAgLmNhdGNoKChlcnJvcikgPT4ge1xyXG4gICAgICAgIHRocm93IGVycm9yO1xyXG4gICAgICB9KTtcclxuICB9XHJcbn1cclxuIl19
@@ -1,5 +0,0 @@
1
- export declare class UploadAdapter {
2
- loader: any;
3
- constructor(loader: any);
4
- upload(): any;
5
- }
@@ -1,88 +0,0 @@
1
- import { Command } from '@ckeditor/ckeditor5-core';
2
- import { findAttributeRange } from '@ckeditor/ckeditor5-typing';
3
- import { toMap } from '@ckeditor/ckeditor5-utils';
4
- import * as QMSCKEditorConstant from '../common/qmsCKEditorConstant';
5
- import * as QMSCKEditorService from '../common/qmsCKEditorService';
6
- import { TOOLTIP_ATTRIBUTE, findTooltipElementAncestor } from './utils';
7
-
8
- export default class InsertTooltipCommand extends Command {
9
- refresh() {
10
- const model = this.editor.model;
11
- this.isEnabled = model.schema.checkAttributeInSelection(model.document.selection, TOOLTIP_ATTRIBUTE);
12
- }
13
-
14
- execute() {
15
- const model = this.editor.model;
16
- const selection = model.document.selection;
17
- let text= '';
18
- let content = '';
19
- if(selection.isCollapsed){
20
- if(selection.hasAttribute(TOOLTIP_ATTRIBUTE)){
21
- const view = this.editor.editing.view;
22
- const viewSelection = view.document.selection;
23
- const selectedElement = findTooltipElementAncestor(viewSelection.getFirstPosition());
24
- if(selectedElement){
25
- text = selectedElement.getChild(0).data;
26
- content = selectedElement.getAttribute(TOOLTIP_ATTRIBUTE);
27
- }
28
- }
29
- }
30
- else
31
- {
32
- const ranges = selection.getFirstRange();
33
- if(ranges)
34
- {
35
- for (const item of ranges.getItems()) {
36
- if (item.data) {
37
- text = text + item.data;
38
- }
39
- }
40
- }
41
- }
42
-
43
- QMSCKEditorService.tooltipNotify({'text': text, 'content': content});
44
- window[QMSCKEditorConstant.QMSCK_TOOLTIP_IS_PROCESSING] = false;
45
- window.addEventListener(QMSCKEditorConstant.QMSCK_TOOLTIP_PLUGIN_RESP, function (evt) {
46
- if (window[QMSCKEditorConstant.QMSCK_TOOLTIP_IS_PROCESSING]) {
47
- return;
48
- }
49
- window[QMSCKEditorConstant.QMSCK_TOOLTIP_IS_PROCESSING] = true;
50
-
51
- model.change(writer => {
52
- const position = selection.getFirstPosition();
53
- const attributes = toMap(selection.getAttributes());
54
- attributes.set(TOOLTIP_ATTRIBUTE, evt.detail.content);
55
-
56
- if (selection.isCollapsed) {
57
- // When selection is inside text with `data-tooltip` attribute.
58
- if (selection.hasAttribute(TOOLTIP_ATTRIBUTE)) {
59
- // Then update `data-tooltip` value.
60
- const linkRange = findAttributeRange(position, TOOLTIP_ATTRIBUTE, selection.getAttribute(TOOLTIP_ATTRIBUTE), model);
61
- writer.remove(linkRange);
62
- const newPosition = selection.getFirstPosition();
63
- const { end: positionAfter } = model.insertContent(writer.createText(evt.detail.text, attributes), newPosition);
64
- writer.setSelection(positionAfter);
65
- }
66
- // If not then insert text node with `data-tooltip` attribute in place of caret.
67
- // However, since selection is collapsed, attribute value will be used as data for text node.
68
- // So, if `evt.detail.content` is empty, do not create text node.
69
- else if (!!evt.detail.content && evt.detail.content !== '') {
70
- const { end: positionAfter } = model.insertContent(writer.createText(evt.detail.text, attributes), position);
71
- // Put the selection at the end of the inserted link.
72
- // Using end of range returned from insertContent in case nodes with the same attributes got merged.
73
- writer.setSelection(positionAfter);
74
- }
75
- } else {
76
-
77
- const { end: positionAfter } = model.insertContent(writer.createText(evt.detail.text, attributes), selection);
78
- // Put the selection at the end of the inserted link.
79
- writer.setSelection(positionAfter);
80
- }
81
- // Remove the `data-tooltip` attribute from the selection.
82
- // It stops adding a new content into the link element.
83
- writer.removeSelectionAttribute(TOOLTIP_ATTRIBUTE);
84
- });
85
- },
86
- { once: true });
87
- }
88
- }