qms-angular 1.1.42 → 1.1.43

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 (101) hide show
  1. package/bundles/qms-angular.umd.js +1541 -435
  2. package/bundles/qms-angular.umd.js.map +1 -1
  3. package/esm2015/lib/common/enum/data-type.enum.js +2 -1
  4. package/esm2015/lib/common/enum/process-classification.enum.js +6 -0
  5. package/esm2015/lib/common/qms-icon.const.js +116 -111
  6. package/esm2015/lib/common/themes.const.js +2 -2
  7. package/esm2015/lib/components/app-icon/icon-registry.service.js +5 -2
  8. package/esm2015/lib/components/related/common/video.const.js +3 -1
  9. package/esm2015/lib/components/related/content/related-content.component.js +2 -2
  10. package/esm2015/lib/components/related/list-other-related/list-related.component.js +5 -2
  11. package/esm2015/lib/components/related/model/popup-data.model.js +3 -1
  12. package/esm2015/lib/components/related/model/related-data.model.js +1 -1
  13. package/esm2015/lib/components/related/popup/related-popup.component.js +48 -32
  14. package/esm2015/lib/components/related/related.module.js +3 -2
  15. package/esm2015/lib/components/related/risk/analysis/analysis.component.js +2 -2
  16. package/esm2015/lib/components/select-access-dialog/select-access-dialog.component.js +1 -1
  17. package/esm2015/lib/components/select-department-tree/select-department-tree.component.js +1 -1
  18. package/esm2015/lib/components/select-one/select-one.component.js +2 -2
  19. package/esm2015/lib/components/select-process-document/select-process-document.component.js +15 -11
  20. package/esm2015/lib/components/tree/model/tree-config.model.js +1 -1
  21. package/esm2015/lib/components/tree/tree.component.js +12 -4
  22. package/esm2015/lib/components/treeNew/model/tree-node.model.js +1 -1
  23. package/esm2015/lib/components/treeNew/model/tree.model.js +1 -1
  24. package/esm2015/lib/components/treeNew/tree.component.js +8 -4
  25. package/esm2015/lib/components/treeNew/tree.function.js +8 -4
  26. package/esm2015/lib/model/en.js +86 -2
  27. package/esm2015/lib/model/no.js +87 -3
  28. package/esm2015/lib/model/sv.js +437 -0
  29. package/esm2015/lib/qms-ckeditor-components/common/functions/common.function.js +15 -14
  30. package/esm2015/lib/qms-ckeditor-components/common/functions/resource.function.js +207 -0
  31. package/esm2015/lib/qms-ckeditor-components/common/models/qms-ckeditor-data.model.js +1 -1
  32. package/esm2015/lib/qms-ckeditor-components/common/models/qms-ckeditor-url.model.js +1 -1
  33. package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-imagemap/qms-ckeditor-imagemap.component.js +262 -29
  34. package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-link/qms-ckeditor-link.component.js +102 -36
  35. package/esm2015/lib/qms-ckeditor-components/models/qms-ckeditor-imagemap.model.js +1 -1
  36. package/esm2015/lib/qms-ckeditor-components/models/qms-ckeditor-video.model.js +16 -0
  37. package/esm2015/lib/qms-ckeditor-components/qms-ckeditor.component.js +39 -118
  38. package/esm2015/lib/qms-ckeditor-components/services/qms-ckeditor-bpmn.service.js +10 -3
  39. package/esm2015/lib/qms-ckeditor-components/services/qms-ckeditor-tree.service.js +7 -3
  40. package/esm2015/lib/services/translation-registry.service.js +7 -5
  41. package/fesm2015/qms-angular.js +1576 -497
  42. package/fesm2015/qms-angular.js.map +1 -1
  43. package/lib/common/enum/data-type.enum.d.ts +2 -1
  44. package/lib/common/enum/process-classification.enum.d.ts +4 -0
  45. package/lib/common/qms-icon.const.d.ts +1 -0
  46. package/lib/components/app-icon/icon-registry.service.d.ts +1 -0
  47. package/lib/components/related/common/video.const.d.ts +2 -0
  48. package/lib/components/related/content/related-content.component.d.ts +1 -1
  49. package/lib/components/related/list-other-related/list-related.component.d.ts +2 -2
  50. package/lib/components/related/model/popup-data.model.d.ts +3 -0
  51. package/lib/components/related/model/related-data.model.d.ts +1 -0
  52. package/lib/components/related/popup/related-popup.component.d.ts +7 -3
  53. package/lib/components/select-one/select-one.component.d.ts +1 -1
  54. package/lib/components/select-process-document/select-process-document.component.d.ts +5 -6
  55. package/lib/components/tree/model/tree-config.model.d.ts +1 -1
  56. package/lib/components/tree/tree.component.d.ts +1 -1
  57. package/lib/components/treeNew/model/tree-node.model.d.ts +1 -0
  58. package/lib/components/treeNew/model/tree.model.d.ts +1 -0
  59. package/lib/components/treeNew/tree.component.d.ts +5 -2
  60. package/lib/model/en.d.ts +84 -0
  61. package/lib/model/no.d.ts +84 -0
  62. package/lib/model/sv.d.ts +436 -0
  63. package/lib/qms-ckeditor-components/common/functions/common.function.d.ts +29 -10
  64. package/lib/qms-ckeditor-components/common/functions/resource.function.d.ts +194 -0
  65. package/lib/qms-ckeditor-components/common/models/qms-ckeditor-data.model.d.ts +3 -0
  66. package/lib/qms-ckeditor-components/common/models/qms-ckeditor-url.model.d.ts +2 -0
  67. package/lib/qms-ckeditor-components/components/qms-ckeditor-imagemap/qms-ckeditor-imagemap.component.d.ts +13 -2
  68. package/lib/qms-ckeditor-components/components/qms-ckeditor-link/qms-ckeditor-link.component.d.ts +1 -0
  69. package/lib/qms-ckeditor-components/models/qms-ckeditor-imagemap.model.d.ts +1 -0
  70. package/lib/qms-ckeditor-components/models/qms-ckeditor-video.model.d.ts +10 -0
  71. package/lib/qms-ckeditor-components/qms-ckeditor.component.d.ts +1 -2
  72. package/lib/qms-ckeditor-components/services/qms-ckeditor-tree.service.d.ts +2 -1
  73. package/lib/services/translation-registry.service.d.ts +1 -0
  74. package/package.json +1 -1
  75. package/qms-angular.metadata.json +1 -1
  76. package/src/assets/jointjs/scss/bpmn.scss +914 -906
  77. package/src/assets/qms-ckeditor-plugin/build/ckeditor.js +1 -1
  78. package/src/assets/qms-ckeditor-plugin/build/ckeditor.js.map +1 -1
  79. package/src/assets/qms-ckeditor-plugin/build/translations/no.js +1 -1
  80. package/src/assets/qms-ckeditor-plugin/src/plugins/ckeditor5-find-and-replace/src/findandreplaceui.js +223 -223
  81. package/src/assets/qms-ckeditor-plugin/src/plugins/ckeditor5-source-editing/lang/translations/no.po +21 -0
  82. package/src/assets/qms-ckeditor-plugin/src/plugins/fullscreen/qmsCKEditorFullscreenPlugin.js +52 -50
  83. package/src/assets/qms-ckeditor-plugin/src/plugins/heading/headingui.js +115 -115
  84. package/src/assets/qms-ckeditor-plugin/src/plugins/heading/utils.js +42 -42
  85. package/src/assets/qms-ckeditor-plugin/src/plugins/link/linkcommand.js +1 -1
  86. package/src/assets/qms-ckeditor-plugin/src/plugins/media/mediaembedediting.js +281 -283
  87. package/src/assets/qms-ckeditor-plugin/src/plugins/media/theme/mediaembed.css +30 -30
  88. package/src/assets/qms-ckeditor-plugin/src/plugins/media/theme/mediaembedediting.css +57 -57
  89. package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/snippet.css +3877 -3876
  90. package/src/assets/qms-ckeditor-plugin/src/plugins/video/theme/video.css +17 -17
  91. package/src/assets/qms-ckeditor-plugin/src/plugins/video/theme/videoresize.css +33 -32
  92. package/src/assets/qms-ckeditor-plugin/src/plugins/video/video/videoediting.js +81 -75
  93. package/src/assets/qms-ckeditor-plugin/src/plugins/video/videoresize/resizevideocommand.js +35 -35
  94. package/src/assets/qms-ckeditor-plugin/src/plugins/video/videoresize/videoresizeediting.js +104 -92
  95. package/src/assets/qms-ckeditor-plugin/src/plugins/video/videoupload/browsevideodialogcommand.js +69 -25
  96. package/src/assets/qms-ckeditor-plugin/src/plugins/video/videoupload/uploadvideocommand.js +21 -21
  97. package/src/lib/components/related/popup/related-popup.component.scss +374 -350
  98. package/esm2015/lib/components/related/common/data-type.enum.js +0 -14
  99. package/esm2015/lib/components/select-one/common/data-type.enum.js +0 -14
  100. package/lib/components/related/common/data-type.enum.d.ts +0 -12
  101. package/lib/components/select-one/common/data-type.enum.d.ts +0 -12
@@ -1,17 +1,17 @@
1
- .ck-content .video {
2
- display: table;
3
- clear: both;
4
- text-align: center;
5
- margin: 1em auto;
6
-
7
- & video {
8
- display: block;
9
- margin: 0 auto;
10
- min-width: 50px;
11
- width: 100%;
12
- }
13
- }
14
-
15
- .ck.ck-editor__editable .video > figcaption.ck-placeholder::before {
16
- position: static;
17
- }
1
+ .ck-content .video {
2
+ display: table;
3
+ clear: both;
4
+ text-align: center;
5
+ margin: 1em auto;
6
+
7
+ & video {
8
+ display: block;
9
+ margin: 0 auto;
10
+ min-width: 50px;
11
+ }
12
+ }
13
+
14
+ .ck.ck-editor__editable .video > figcaption.ck-placeholder::before {
15
+ position: static;
16
+ }
17
+
@@ -1,32 +1,33 @@
1
- .ck-content .video.video_resized {
2
- max-width: 100%;
3
- /*
4
- The `<figure>` element for resized videos must not use `display:table` as browsers do not support `max-width` for it well.
5
- See https://stackoverflow.com/questions/4019604/chrome-safari-ignoring-max-width-in-table/14420691#14420691 for more.
6
- Fortunately, since we control the width, there is no risk that the video will look bad.
7
- */
8
- display: block;
9
- box-sizing: border-box;
10
-
11
- & video {
12
- /* For resized videos it is the `<figure>` element that determines the video width. */
13
- width: 100%;
14
- }
15
-
16
- & > figcaption {
17
- /* The `<figure>` element uses `display:block`, so `<figcaption>` also has to. */
18
- display: block;
19
- }
20
- }
21
-
22
- [dir="ltr"] .ck.ck-button.ck-button_with-text.ck-resize-video-button .ck-button__icon {
23
- margin-right: var(--ck-spacing-standard);
24
- }
25
-
26
- [dir="rtl"] .ck.ck-button.ck-button_with-text.ck-resize-video-button .ck-button__icon {
27
- margin-left: var(--ck-spacing-standard);
28
- }
29
-
30
- .ck.ck-dropdown .ck-button.ck-resize-video-button .ck-button__label {
31
- width: 4em;
32
- }
1
+ .ck-content .video.video_resized {
2
+ max-width: 100%;
3
+ /*
4
+ The `<figure>` element for resized videos must not use `display:table` as browsers do not support `max-width` for it well.
5
+ See https://stackoverflow.com/questions/4019604/chrome-safari-ignoring-max-width-in-table/14420691#14420691 for more.
6
+ Fortunately, since we control the width, there is no risk that the video will look bad.
7
+ */
8
+ display: block;
9
+ box-sizing: border-box;
10
+
11
+ & video {
12
+ /* For resized videos it is the `<figure>` element that determines the video width. */
13
+ width: 100%;
14
+ height: 100%;
15
+ }
16
+
17
+ & > figcaption {
18
+ /* The `<figure>` element uses `display:block`, so `<figcaption>` also has to. */
19
+ display: block;
20
+ }
21
+ }
22
+
23
+ [dir="ltr"] .ck.ck-button.ck-button_with-text.ck-resize-video-button .ck-button__icon {
24
+ margin-right: var(--ck-spacing-standard);
25
+ }
26
+
27
+ [dir="rtl"] .ck.ck-button.ck-button_with-text.ck-resize-video-button .ck-button__icon {
28
+ margin-left: var(--ck-spacing-standard);
29
+ }
30
+
31
+ .ck.ck-dropdown .ck-button.ck-resize-video-button .ck-button__label {
32
+ width: 4em;
33
+ }
@@ -1,75 +1,81 @@
1
- import { Plugin } from 'ckeditor5/src/core';
2
- import VideoLoadObserver from './videoloadobserver';
3
-
4
- import {
5
- viewFigureToModel,
6
- modelToViewAttributeConverter
7
- } from './converters';
8
-
9
- import { toVideoWidget } from './utils';
10
-
11
- import InsertVideoCommand from './insertvideocommand';
12
-
13
- export default class VideoEditing extends Plugin {
14
- static get pluginName() {
15
- return 'VideoEditing';
16
- }
17
-
18
- init() {
19
- const editor = this.editor;
20
- const schema = editor.model.schema;
21
- const t = editor.t;
22
- const conversion = editor.conversion;
23
-
24
- editor.editing.view.addObserver( VideoLoadObserver );
25
-
26
- // Configure schema.
27
- schema.register( 'video', {
28
- isObject: true,
29
- isBlock: true,
30
- allowWhere: '$block',
31
- allowAttributes: [ 'src', 'controls', 'poster' ]
32
- } );
33
-
34
- conversion.for( 'dataDowncast' ).elementToElement( {
35
- model: 'video',
36
- view: ( modelElement, { writer } ) => createVideoViewElement( writer )
37
- } );
38
-
39
- conversion.for( 'editingDowncast' ).elementToElement( {
40
- model: 'video',
41
- view: ( modelElement, { writer } ) => toVideoWidget( createVideoViewElement( writer ), writer, t( 'video widget' ) )
42
- } );
43
-
44
- conversion.for( 'downcast' ).add( modelToViewAttributeConverter( 'controls' ) );
45
- conversion.for( 'downcast' ).add( modelToViewAttributeConverter( 'src' ) );
46
- conversion.for( 'downcast' ).add( modelToViewAttributeConverter( 'poster' ) );
47
-
48
- conversion.for( 'upcast' )
49
- .elementToElement( {
50
- view: {
51
- name: 'video',
52
- attributes: {
53
- src: true
54
- }
55
- },
56
- model: ( viewVideo, { writer } ) => writer.createElement( 'video', {
57
- src: viewVideo.getAttribute( 'src' )
58
- } )
59
- } )
60
- .add( viewFigureToModel() );
61
-
62
- const insertVideoCommand = new InsertVideoCommand( editor );
63
- editor.commands.add( 'insertImage', insertVideoCommand );
64
- editor.commands.add( 'videoInsert', insertVideoCommand );
65
- }
66
- }
67
-
68
- export function createVideoViewElement( writer ) {
69
- const emptyElement = writer.createEmptyElement( 'video' );
70
- const figure = writer.createContainerElement( 'figure', { class: 'video' } );
71
-
72
- writer.insert( writer.createPositionAt( figure, 0 ), emptyElement );
73
-
74
- return figure;
75
- }
1
+ import { Plugin } from 'ckeditor5/src/core';
2
+ import VideoLoadObserver from './videoloadobserver';
3
+
4
+ import {
5
+ viewFigureToModel,
6
+ modelToViewAttributeConverter
7
+ } from './converters';
8
+
9
+ import { toVideoWidget } from './utils';
10
+
11
+ import InsertVideoCommand from './insertvideocommand';
12
+
13
+ export default class VideoEditing extends Plugin {
14
+ static get pluginName() {
15
+ return 'VideoEditing';
16
+ }
17
+
18
+ init() {
19
+ const editor = this.editor;
20
+ const schema = editor.model.schema;
21
+ const t = editor.t;
22
+ const conversion = editor.conversion;
23
+
24
+ editor.editing.view.addObserver( VideoLoadObserver );
25
+
26
+ // Configure schema.
27
+ schema.register( 'video', {
28
+ isObject: true,
29
+ isBlock: true,
30
+ allowWhere: '$block',
31
+ allowAttributes: [ 'id','src', 'controls', 'poster', 'width', 'height' ]
32
+ } );
33
+
34
+ conversion.for( 'dataDowncast' ).elementToElement( {
35
+ model: 'video',
36
+ view: ( modelElement, { writer } ) => createVideoViewElement( writer )
37
+ } );
38
+
39
+ conversion.for( 'editingDowncast' ).elementToElement( {
40
+ model: 'video',
41
+ view: ( modelElement, { writer } ) => toVideoWidget( createVideoViewElement( writer ), writer, t( 'video widget' ) )
42
+ } );
43
+
44
+ conversion.for( 'downcast' ).add( modelToViewAttributeConverter( 'id' ) );
45
+ conversion.for( 'downcast' ).add( modelToViewAttributeConverter( 'controls' ) );
46
+ conversion.for( 'downcast' ).add( modelToViewAttributeConverter( 'src' ) );
47
+ conversion.for( 'downcast' ).add( modelToViewAttributeConverter( 'poster' ) );
48
+ conversion.for( 'downcast' ).add( modelToViewAttributeConverter( 'height' ) );
49
+
50
+ conversion.for( 'upcast' )
51
+ .elementToElement( {
52
+ view: {
53
+ name: 'video',
54
+ attributes: {
55
+ src: true
56
+ }
57
+ },
58
+ model: ( viewVideo, { writer } ) => writer.createElement( 'video', {
59
+ id: viewVideo.getAttribute( 'id' ),
60
+ src: viewVideo.getAttribute( 'src' ),
61
+ controls: viewVideo.getAttribute( 'controls' ),
62
+ poster: viewVideo.getAttribute( 'poster' ) || "",
63
+ width: (viewVideo.getAttribute( 'width' ) !== null && viewVideo.getAttribute( 'width' ) !== undefined) ? viewVideo.getAttribute( 'width' ): "",
64
+ height: (viewVideo.getAttribute( 'height' ) !== null && viewVideo.getAttribute( 'height' ) !== undefined) ? viewVideo.getAttribute( 'height' ) : "",
65
+ } )
66
+ } )
67
+ .add( viewFigureToModel() );
68
+
69
+ const insertVideoCommand = new InsertVideoCommand( editor );
70
+ editor.commands.add( 'insertImage', insertVideoCommand );
71
+ editor.commands.add( 'videoInsert', insertVideoCommand );
72
+ }
73
+ }
74
+
75
+ export function createVideoViewElement( writer ) {
76
+ const emptyElement = writer.createEmptyElement( 'video' );
77
+ const figure = writer.createContainerElement( 'figure', { class: 'video' } );
78
+
79
+ writer.insert( writer.createPositionAt( figure, 0 ), emptyElement );
80
+ return figure;
81
+ }
@@ -1,35 +1,35 @@
1
- import { Command } from 'ckeditor5/src/core';
2
- import { isVideo } from '../video/utils';
3
-
4
- export default class ResizeVideoCommand extends Command {
5
- refresh() {
6
- const element = this.editor.model.document.selection.getSelectedElement();
7
-
8
- this.isEnabled = isVideo( element );
9
-
10
- if ( !element || !element.hasAttribute( 'width' ) ) {
11
- this.value = null;
12
- } else {
13
- this.value = {
14
- width: element.getAttribute( 'width' ),
15
- height: null
16
- };
17
- }
18
- }
19
-
20
- execute( options ) {
21
- const model = this.editor.model;
22
- const videoElement = model.document.selection.getSelectedElement();
23
-
24
- this.value = {
25
- width: options.width,
26
- height: null
27
- };
28
-
29
- if ( videoElement ) {
30
- model.change( writer => {
31
- writer.setAttribute( 'width', options.width, videoElement );
32
- } );
33
- }
34
- }
35
- }
1
+ import { Command } from 'ckeditor5/src/core';
2
+ import { isVideo } from '../video/utils';
3
+
4
+ export default class ResizeVideoCommand extends Command {
5
+ refresh() {
6
+ const element = this.editor.model.document.selection.getSelectedElement();
7
+
8
+ this.isEnabled = isVideo( element );
9
+
10
+ if ( !element || !element.hasAttribute( 'width' ) ) {
11
+ this.value = null;
12
+ } else {
13
+ this.value = {
14
+ width: element.getAttribute( 'width' ),
15
+ height: null
16
+ };
17
+ }
18
+ }
19
+
20
+ execute( options ) {
21
+ const model = this.editor.model;
22
+ const videoElement = model.document.selection.getSelectedElement();
23
+ this.value = {
24
+ width: options.width,
25
+ height: null
26
+ };
27
+
28
+ if ( videoElement ) {
29
+ model.change( writer => {
30
+ writer.setAttribute( 'width', options.width, videoElement );
31
+ writer.setAttribute( 'height', "", videoElement );
32
+ } );
33
+ }
34
+ }
35
+ }
@@ -1,92 +1,104 @@
1
- import { Plugin } from 'ckeditor5/src/core';
2
- import ResizeVideoCommand from './resizevideocommand';
3
-
4
- export default class VideoResizeEditing extends Plugin {
5
- static get pluginName() {
6
- return 'VideoResizeEditing';
7
- }
8
-
9
- constructor( editor ) {
10
- super( editor );
11
-
12
- editor.config.define( 'video', {
13
- resizeUnit: '%',
14
- resizeOptions: [ {
15
- name: 'resizeVideo:original',
16
- value: null,
17
- icon: 'original'
18
- },
19
- {
20
- name: 'resizeVideo:25',
21
- value: '25',
22
- icon: 'small'
23
- },
24
- {
25
- name: 'resizeVideo:50',
26
- value: '50',
27
- icon: 'medium'
28
- },
29
- {
30
- name: 'resizeVideo:75',
31
- value: '75',
32
- icon: 'large'
33
- } ]
34
- } );
35
- }
36
-
37
- init() {
38
- const editor = this.editor;
39
- const resizeVideoCommand = new ResizeVideoCommand( editor );
40
-
41
- this._registerSchema();
42
- this._registerConverters();
43
-
44
- editor.commands.add( 'resizeVideo', resizeVideoCommand );
45
- editor.commands.add( 'videoResize', resizeVideoCommand );
46
- }
47
-
48
- _registerSchema() {
49
- this.editor.model.schema.extend( 'video', { allowAttributes: 'width' } );
50
- this.editor.model.schema.setAttributeProperties( 'width', {
51
- isFormatting: true
52
- } );
53
- }
54
-
55
- _registerConverters() {
56
- const editor = this.editor;
57
-
58
- // Dedicated converter to propagate video's attribute to the video tag.
59
- editor.conversion.for( 'downcast' ).add( dispatcher =>
60
- dispatcher.on( 'attribute:width:video', ( evt, data, conversionApi ) => {
61
- if ( !conversionApi.consumable.consume( data.item, evt.name ) ) {
62
- return;
63
- }
64
-
65
- const viewWriter = conversionApi.writer;
66
- const figure = conversionApi.mapper.toViewElement( data.item );
67
-
68
- if ( data.attributeNewValue !== null ) {
69
- viewWriter.setStyle( 'width', data.attributeNewValue, figure );
70
- viewWriter.addClass( 'video_resized', figure );
71
- } else {
72
- viewWriter.removeStyle( 'width', figure );
73
- viewWriter.removeClass( 'video_resized', figure );
74
- }
75
- } )
76
- );
77
-
78
- editor.conversion.for( 'upcast' )
79
- .attributeToAttribute( {
80
- view: {
81
- name: 'figure',
82
- styles: {
83
- width: /.+/
84
- }
85
- },
86
- model: {
87
- key: 'width',
88
- value: viewElement => viewElement.getStyle( 'width' )
89
- }
90
- } );
91
- }
92
- }
1
+ import { Plugin } from 'ckeditor5/src/core';
2
+ import ResizeVideoCommand from './resizevideocommand';
3
+ import { getViewVideoFromWidget } from './../../video/video/utils';
4
+ export default class VideoResizeEditing extends Plugin {
5
+ static get pluginName() {
6
+ return 'VideoResizeEditing';
7
+ }
8
+
9
+ constructor( editor ) {
10
+ super( editor );
11
+
12
+ editor.config.define( 'video', {
13
+ resizeUnit: '%',
14
+ resizeOptions: [ {
15
+ name: 'resizeVideo:original',
16
+ value: null,
17
+ icon: 'original'
18
+ },
19
+ {
20
+ name: 'resizeVideo:25',
21
+ value: '25',
22
+ icon: 'small'
23
+ },
24
+ {
25
+ name: 'resizeVideo:50',
26
+ value: '50',
27
+ icon: 'medium'
28
+ },
29
+ {
30
+ name: 'resizeVideo:75',
31
+ value: '75',
32
+ icon: 'large'
33
+ } ]
34
+ } );
35
+ }
36
+
37
+ init() {
38
+ const editor = this.editor;
39
+ const resizeVideoCommand = new ResizeVideoCommand( editor );
40
+
41
+ this._registerSchema();
42
+ this._registerConverters();
43
+
44
+ editor.commands.add( 'resizeVideo', resizeVideoCommand );
45
+ editor.commands.add( 'videoResize', resizeVideoCommand );
46
+ }
47
+
48
+ _registerSchema() {
49
+ this.editor.model.schema.extend( 'video', { allowAttributes: 'width' } );
50
+ this.editor.model.schema.setAttributeProperties( 'width', {
51
+ isFormatting: true
52
+ } );
53
+ }
54
+
55
+ _registerConverters() {
56
+ const editor = this.editor;
57
+
58
+ // Dedicated converter to propagate video's attribute to the video tag.
59
+ editor.conversion.for( 'downcast' ).add( dispatcher =>
60
+ dispatcher.on( 'attribute:width:video', ( evt, data, conversionApi ) => {
61
+ if ( !conversionApi.consumable.consume( data.item, evt.name ) ) {
62
+ return;
63
+ }
64
+
65
+ const viewWriter = conversionApi.writer;
66
+ const figure = conversionApi.mapper.toViewElement( data.item );
67
+
68
+ if ( data.attributeNewValue !== null && data.attributeNewValue !== undefined ) {
69
+ if(data.attributeNewValue.toString().indexOf('%') >=0)
70
+ {
71
+ viewWriter.setStyle( 'width', data.attributeNewValue, figure );
72
+ viewWriter.addClass( 'video_resized', figure );
73
+ }
74
+ else
75
+ {
76
+ viewWriter.removeStyle( 'width', figure );
77
+ viewWriter.removeClass( 'video_resized', figure );
78
+
79
+ const video = getViewVideoFromWidget( figure );
80
+
81
+ viewWriter.setAttribute( data.attributeKey, data.attributeNewValue || '', video );
82
+ }
83
+ } else {
84
+ viewWriter.removeStyle( 'width', figure );
85
+ viewWriter.removeClass( 'video_resized', figure );
86
+ }
87
+ } )
88
+ );
89
+
90
+ editor.conversion.for( 'upcast' )
91
+ .attributeToAttribute( {
92
+ view: {
93
+ name: 'figure',
94
+ styles: {
95
+ width: /.+/
96
+ }
97
+ },
98
+ model: {
99
+ key: 'width',
100
+ value: viewElement => viewElement.getStyle( 'width' )
101
+ }
102
+ } );
103
+ }
104
+ }
@@ -1,25 +1,69 @@
1
- import { Command } from 'ckeditor5/src/core';
2
- import { isVideoAllowed } from "../video/utils";
3
- import * as QMSCKEditorService from '../../common/qmsCKEditorService';
4
- import * as QMSCKEditorConstant from '../../common/qmsCKEditorConstant';
5
-
6
- export default class BrowseVideoDialogCommand extends Command {
7
- refresh() {
8
- const videoElement = this.editor.model.document.selection.getSelectedElement();
9
- const isVideo = videoElement && videoElement.name === 'video' || false;
10
- this.isEnabled = isVideoAllowed( this.editor.model ) || isVideo;
11
- }
12
-
13
- execute(options) {
14
- const editor = this.editor;
15
- QMSCKEditorService.uploadVideoNotify({...options}, editor.id);
16
- window[QMSCKEditorConstant.QMSCK_BROWSE_VIDEO_IS_PROCESSING] = false;
17
- window.addEventListener(QMSCKEditorConstant.QMSCK_BROWSE_VIDEO_RESP, (evt) => {
18
- if(window[QMSCKEditorConstant.QMSCK_BROWSE_VIDEO_IS_PROCESSING] || !evt.detail){
19
- return;
20
- }
21
- window[QMSCKEditorConstant.QMSCK_BROWSE_VIDEO_IS_PROCESSING] = true;
22
- editor.commands.get('uploadVideo').execute(evt.detail);
23
- }, { once: true});
24
- }
25
- }
1
+ import { Command } from 'ckeditor5/src/core';
2
+ import { isVideoAllowed } from "../video/utils";
3
+ import * as QMSCKEditorService from '../../common/qmsCKEditorService';
4
+ import * as QMSCKEditorConstant from '../../common/qmsCKEditorConstant';
5
+ import { toArray } from 'ckeditor5/src/utils';
6
+
7
+ export default class BrowseVideoDialogCommand extends Command {
8
+ refresh() {
9
+ const videoElement = this.editor.model.document.selection.getSelectedElement();
10
+ const isVideo = videoElement && videoElement.name === 'video' || false;
11
+ this.isEnabled = isVideoAllowed( this.editor.model ) || isVideo;
12
+ }
13
+
14
+ execute(options) {
15
+ const editor = this.editor;
16
+ const videoElement = editor.model.document.selection.getSelectedElement();
17
+ if(videoElement)
18
+ {
19
+ options.src = videoElement.getAttribute( 'src' );
20
+ if(options.src)
21
+ {
22
+ options.selectedId = videoElement.getAttribute( 'src' ).split('id=')[1].split(/&(.*)/s)[0];
23
+ }
24
+ options.poster = videoElement.getAttribute( 'poster' );
25
+ options.width = videoElement.getAttribute( 'width' );
26
+ options.height = videoElement.getAttribute( 'height' );
27
+ options.id = videoElement.getAttribute( 'id' );
28
+ }
29
+
30
+ QMSCKEditorService.uploadVideoNotify({...options}, editor.id);
31
+ window[QMSCKEditorConstant.QMSCK_BROWSE_VIDEO_IS_PROCESSING] = false;
32
+ window.addEventListener(QMSCKEditorConstant.QMSCK_BROWSE_VIDEO_RESP, (evt) => {
33
+ if(window[QMSCKEditorConstant.QMSCK_BROWSE_VIDEO_IS_PROCESSING] || !evt.detail){
34
+ return;
35
+ }
36
+
37
+ if(videoElement)
38
+ {
39
+ editor.model.change( writer => {
40
+ if(evt.detail.urls.length)
41
+ {
42
+ for ( const url of toArray( evt.detail.urls ) ) {
43
+ writer.setAttribute( 'src', url, videoElement );
44
+ }
45
+ }
46
+ if(evt.detail.id)
47
+ {
48
+ writer.setAttribute( 'id', evt.detail.id, videoElement );
49
+ }
50
+
51
+ writer.setAttribute( 'poster', evt.detail.thumbnailUrl || "", videoElement );
52
+
53
+ if(evt.detail.width)
54
+ {
55
+ writer.setAttribute( 'width', evt.detail.width, videoElement );
56
+ }
57
+ if(evt.detail.height)
58
+ {
59
+ writer.setAttribute( 'height', evt.detail.height, videoElement );
60
+ }
61
+ });
62
+ return;
63
+ }
64
+
65
+ window[QMSCKEditorConstant.QMSCK_BROWSE_VIDEO_IS_PROCESSING] = true;
66
+ editor.commands.get('uploadVideo').execute(evt.detail);
67
+ }, { once: true});
68
+ }
69
+ }