qms-angular 1.1.41 → 1.1.43
Sign up to get free protection for your applications and to get access to all the features.
- package/bundles/qms-angular.umd.js +1569 -441
- package/bundles/qms-angular.umd.js.map +1 -1
- package/esm2015/lib/common/enum/data-type.enum.js +2 -1
- package/esm2015/lib/common/enum/process-classification.enum.js +6 -0
- package/esm2015/lib/common/qms-icon.const.js +116 -111
- package/esm2015/lib/common/themes.const.js +2 -2
- package/esm2015/lib/components/app-icon/icon-registry.service.js +5 -2
- package/esm2015/lib/components/related/common/video.const.js +3 -1
- package/esm2015/lib/components/related/content/related-content.component.js +2 -2
- package/esm2015/lib/components/related/list-other-related/list-related.component.js +5 -2
- package/esm2015/lib/components/related/model/popup-data.model.js +3 -1
- package/esm2015/lib/components/related/model/related-data.model.js +1 -1
- package/esm2015/lib/components/related/popup/related-popup.component.js +48 -32
- package/esm2015/lib/components/related/related.module.js +3 -2
- package/esm2015/lib/components/related/risk/analysis/analysis.component.js +2 -2
- package/esm2015/lib/components/select-access-dialog/select-access-dialog.component.js +24 -4
- package/esm2015/lib/components/select-department-tree/select-department-tree.component.js +5 -4
- package/esm2015/lib/components/select-one/select-one.component.js +2 -2
- package/esm2015/lib/components/select-process-document/select-process-document.component.js +15 -11
- package/esm2015/lib/components/tree/model/tree-config.model.js +1 -1
- package/esm2015/lib/components/tree/tree.component.js +12 -4
- package/esm2015/lib/components/treeNew/model/tree-node.model.js +1 -1
- package/esm2015/lib/components/treeNew/model/tree.model.js +1 -1
- package/esm2015/lib/components/treeNew/tree.component.js +8 -4
- package/esm2015/lib/components/treeNew/tree.function.js +8 -4
- package/esm2015/lib/model/en.js +86 -2
- package/esm2015/lib/model/no.js +87 -3
- package/esm2015/lib/model/sv.js +437 -0
- package/esm2015/lib/qms-ckeditor-components/common/functions/common.function.js +15 -14
- package/esm2015/lib/qms-ckeditor-components/common/functions/resource.function.js +207 -0
- package/esm2015/lib/qms-ckeditor-components/common/models/qms-ckeditor-data.model.js +1 -1
- package/esm2015/lib/qms-ckeditor-components/common/models/qms-ckeditor-url.model.js +1 -1
- package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-imagemap/qms-ckeditor-imagemap.component.js +262 -29
- package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-link/qms-ckeditor-link.component.js +102 -36
- package/esm2015/lib/qms-ckeditor-components/models/qms-ckeditor-imagemap.model.js +1 -1
- package/esm2015/lib/qms-ckeditor-components/models/qms-ckeditor-video.model.js +16 -0
- package/esm2015/lib/qms-ckeditor-components/qms-ckeditor.component.js +39 -118
- package/esm2015/lib/qms-ckeditor-components/services/qms-ckeditor-bpmn.service.js +10 -3
- package/esm2015/lib/qms-ckeditor-components/services/qms-ckeditor-tree.service.js +7 -3
- package/esm2015/lib/services/translation-registry.service.js +7 -5
- package/fesm2015/qms-angular.js +1603 -503
- package/fesm2015/qms-angular.js.map +1 -1
- package/lib/common/enum/data-type.enum.d.ts +2 -1
- package/lib/common/enum/process-classification.enum.d.ts +4 -0
- package/lib/common/qms-icon.const.d.ts +1 -0
- package/lib/components/app-icon/icon-registry.service.d.ts +1 -0
- package/lib/components/related/common/video.const.d.ts +2 -0
- package/lib/components/related/content/related-content.component.d.ts +1 -1
- package/lib/components/related/list-other-related/list-related.component.d.ts +2 -2
- package/lib/components/related/model/popup-data.model.d.ts +3 -0
- package/lib/components/related/model/related-data.model.d.ts +1 -0
- package/lib/components/related/popup/related-popup.component.d.ts +7 -3
- package/lib/components/select-access-dialog/select-access-dialog.component.d.ts +3 -2
- package/lib/components/select-one/select-one.component.d.ts +1 -1
- package/lib/components/select-process-document/select-process-document.component.d.ts +5 -6
- package/lib/components/tree/model/tree-config.model.d.ts +1 -1
- package/lib/components/tree/tree.component.d.ts +1 -1
- package/lib/components/treeNew/model/tree-node.model.d.ts +1 -0
- package/lib/components/treeNew/model/tree.model.d.ts +1 -0
- package/lib/components/treeNew/tree.component.d.ts +5 -2
- package/lib/model/en.d.ts +84 -0
- package/lib/model/no.d.ts +84 -0
- package/lib/model/sv.d.ts +436 -0
- package/lib/qms-ckeditor-components/common/functions/common.function.d.ts +29 -10
- package/lib/qms-ckeditor-components/common/functions/resource.function.d.ts +194 -0
- package/lib/qms-ckeditor-components/common/models/qms-ckeditor-data.model.d.ts +3 -0
- package/lib/qms-ckeditor-components/common/models/qms-ckeditor-url.model.d.ts +2 -0
- package/lib/qms-ckeditor-components/components/qms-ckeditor-imagemap/qms-ckeditor-imagemap.component.d.ts +13 -2
- package/lib/qms-ckeditor-components/components/qms-ckeditor-link/qms-ckeditor-link.component.d.ts +1 -0
- package/lib/qms-ckeditor-components/models/qms-ckeditor-imagemap.model.d.ts +1 -0
- package/lib/qms-ckeditor-components/models/qms-ckeditor-video.model.d.ts +10 -0
- package/lib/qms-ckeditor-components/qms-ckeditor.component.d.ts +1 -2
- package/lib/qms-ckeditor-components/services/qms-ckeditor-tree.service.d.ts +2 -1
- package/lib/services/translation-registry.service.d.ts +1 -0
- package/package.json +1 -1
- package/qms-angular.metadata.json +1 -1
- package/src/assets/jointjs/scss/bpmn.scss +914 -906
- package/src/assets/qms-ckeditor-plugin/build/ckeditor.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/ckeditor.js.map +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/no.js +1 -1
- package/src/assets/qms-ckeditor-plugin/src/plugins/ckeditor5-find-and-replace/src/findandreplaceui.js +223 -223
- package/src/assets/qms-ckeditor-plugin/src/plugins/ckeditor5-source-editing/lang/translations/no.po +21 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/fullscreen/qmsCKEditorFullscreenPlugin.js +52 -50
- package/src/assets/qms-ckeditor-plugin/src/plugins/heading/headingui.js +115 -115
- package/src/assets/qms-ckeditor-plugin/src/plugins/heading/utils.js +42 -42
- package/src/assets/qms-ckeditor-plugin/src/plugins/link/linkcommand.js +1 -1
- package/src/assets/qms-ckeditor-plugin/src/plugins/media/mediaembedediting.js +281 -283
- package/src/assets/qms-ckeditor-plugin/src/plugins/media/theme/mediaembed.css +30 -30
- package/src/assets/qms-ckeditor-plugin/src/plugins/media/theme/mediaembedediting.css +57 -57
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/snippet.css +3877 -3876
- package/src/assets/qms-ckeditor-plugin/src/plugins/video/theme/video.css +17 -17
- package/src/assets/qms-ckeditor-plugin/src/plugins/video/theme/videoresize.css +33 -32
- package/src/assets/qms-ckeditor-plugin/src/plugins/video/video/videoediting.js +81 -75
- package/src/assets/qms-ckeditor-plugin/src/plugins/video/videoresize/resizevideocommand.js +35 -35
- package/src/assets/qms-ckeditor-plugin/src/plugins/video/videoresize/videoresizeediting.js +104 -92
- package/src/assets/qms-ckeditor-plugin/src/plugins/video/videoupload/browsevideodialogcommand.js +69 -25
- package/src/assets/qms-ckeditor-plugin/src/plugins/video/videoupload/uploadvideocommand.js +21 -21
- package/src/lib/components/related/popup/related-popup.component.scss +374 -350
- package/esm2015/lib/components/related/common/data-type.enum.js +0 -14
- package/esm2015/lib/components/select-one/common/data-type.enum.js +0 -14
- package/lib/components/related/common/data-type.enum.d.ts +0 -12
- 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
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
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
|
-
|
17
|
-
|
18
|
-
display:
|
19
|
-
|
20
|
-
}
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
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
|
-
|
45
|
-
|
46
|
-
conversion.for( 'downcast' ).add( modelToViewAttributeConverter( '
|
47
|
-
|
48
|
-
conversion.for( '
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
}
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
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
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
writer.setAttribute( '
|
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
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
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
|
+
}
|
package/src/assets/qms-ckeditor-plugin/src/plugins/video/videoupload/browsevideodialogcommand.js
CHANGED
@@ -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
|
-
|
7
|
-
|
8
|
-
|
9
|
-
const
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
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
|
+
}
|