@stratusjs/angular 0.5.0 → 0.5.2
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.
- package/dist/angular.bundle.js +30609 -2673
- package/dist/angular.bundle.min.js +1 -1
- package/package.json +5 -4
- package/src/angular.modules.js +18 -33
- package/src/angular.modules.js.map +1 -1
- package/src/app.module.js +181 -227
- package/src/app.module.js.map +1 -1
- package/src/app.module.min.js +1 -1
- package/src/app.module.ts +17 -17
- package/src/backend.service.js +66 -87
- package/src/backend.service.js.map +1 -1
- package/src/base/base.component.js +101 -124
- package/src/base/base.component.js.map +1 -1
- package/src/boot.js +42 -55
- package/src/boot.js.map +1 -1
- package/src/confirm-dialog/confirm-dialog.component.js +41 -60
- package/src/confirm-dialog/confirm-dialog.component.js.map +1 -1
- package/src/core/base.interface.js +1 -9
- package/src/core/base.interface.js.map +1 -1
- package/src/core/dialog.interface.js.map +1 -0
- package/src/core/refresh.interface.js +1 -9
- package/src/core/refresh.interface.js.map +1 -1
- package/src/core/responsive.component.js +40 -58
- package/src/core/responsive.component.js.map +1 -1
- package/src/core/responsive.interface.js +1 -9
- package/src/core/responsive.interface.js.map +1 -1
- package/src/core/root.component.js +24 -43
- package/src/core/root.component.js.map +1 -1
- package/src/core/trigger.interface.js +1 -9
- package/src/core/trigger.interface.js.map +1 -1
- package/src/data/contact-meta.interface.js +1 -9
- package/src/data/contact-meta.interface.js.map +1 -1
- package/src/data/content.interface.js +1 -9
- package/src/data/content.interface.js.map +1 -1
- package/src/data/convoy.interface.js +1 -9
- package/src/data/convoy.interface.js.map +1 -1
- package/src/editor/citation-dialog.component.js +174 -207
- package/src/editor/citation-dialog.component.js.map +1 -1
- package/src/editor/code-mirror-bridge.js +63 -0
- package/src/editor/code-mirror-bridge.js.map +1 -0
- package/src/editor/code-mirror-bridge.min.js +1 -0
- package/src/editor/code-mirror-bridge.ts +85 -0
- package/src/editor/code-view-dialog.component.js +87 -116
- package/src/editor/code-view-dialog.component.js.map +1 -1
- package/src/editor/editor.component.js +903 -925
- package/src/editor/editor.component.js.map +1 -1
- package/src/editor/editor.component.min.js +1 -1
- package/src/editor/editor.component.ts +60 -21
- package/src/editor/link-dialog.component.js +356 -395
- package/src/editor/link-dialog.component.js.map +1 -1
- package/src/editor/media-dialog.component.js +270 -303
- package/src/editor/media-dialog.component.js.map +1 -1
- package/src/froala/plugins/citationManager.js +170 -191
- package/src/froala/plugins/citationManager.js.map +1 -1
- package/src/froala/plugins/inputButton.js +122 -138
- package/src/froala/plugins/inputButton.js.map +1 -1
- package/src/froala/plugins/linkManager.js +89 -104
- package/src/froala/plugins/linkManager.js.map +1 -1
- package/src/froala/plugins/mediaManager.js +72 -87
- package/src/froala/plugins/mediaManager.js.map +1 -1
- package/src/froala/plugins/menuButton.js +71 -86
- package/src/froala/plugins/menuButton.js.map +1 -1
- package/src/main.js +13 -33
- package/src/main.js.map +1 -1
- package/src/material.js +99 -194
- package/src/material.js.map +1 -1
- package/src/media-selector/media-selector.component.js +406 -441
- package/src/media-selector/media-selector.component.js.map +1 -1
- package/src/polyfills.js +3 -16
- package/src/polyfills.js.map +1 -1
- package/src/quill-plugins/quill-break-blot.plugin.js +19 -35
- package/src/quill-plugins/quill-break-blot.plugin.js.map +1 -1
- package/src/quill-plugins/quill-html-edit.plugin.js +140 -153
- package/src/quill-plugins/quill-html-edit.plugin.js.map +1 -1
- package/src/quill-plugins/quill-image-format.plugin.js +33 -47
- package/src/quill-plugins/quill-image-format.plugin.js.map +1 -1
- package/src/quill-plugins/quill-input-button.plugin.js +77 -95
- package/src/quill-plugins/quill-input-button.plugin.js.map +1 -1
- package/src/selector/selector.component.js +241 -276
- package/src/selector/selector.component.js.map +1 -1
- package/src/test/test.directive.js +49 -66
- package/src/test/test.directive.js.map +1 -1
- package/src/tree/tree-dialog.component.js +202 -231
- package/src/tree/tree-dialog.component.js.map +1 -1
- package/src/tree/tree-node.component.js +253 -279
- package/src/tree/tree-node.component.js.map +1 -1
- package/src/tree/tree-node.component.min.js +1 -1
- package/src/tree/tree-node.component.ts +10 -18
- package/src/tree/tree.component.js +531 -568
- package/src/tree/tree.component.js.map +1 -1
- package/src/tree/tree.component.min.js +1 -1
- package/src/tree/tree.component.ts +7 -10
|
@@ -1,334 +1,301 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
11
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
12
|
+
};
|
|
13
|
+
import { ChangeDetectorRef, Component, Inject } from '@angular/core';
|
|
14
|
+
import { FormBuilder } from '@angular/forms';
|
|
15
|
+
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
|
16
|
+
import { MatSnackBar } from '@angular/material/snack-bar';
|
|
17
|
+
import { debounceTime, finalize, switchMap, tap } from 'rxjs/operators';
|
|
18
|
+
import _ from 'lodash';
|
|
19
|
+
import { Stratus } from '@stratusjs/runtime/stratus';
|
|
20
|
+
import { cookie } from '@stratusjs/core/environment';
|
|
21
|
+
import { BackendService } from '../backend.service';
|
|
22
|
+
import { Model } from '@stratusjs/angularjs/services/model';
|
|
23
|
+
import { ResponsiveComponent } from '../core/responsive.component';
|
|
24
|
+
const systemDir = '@stratusjs/angular';
|
|
25
|
+
const moduleName = 'media-dialog';
|
|
26
|
+
const parentModuleName = 'editor';
|
|
27
|
+
const min = !cookie('env') ? '.min' : '';
|
|
28
|
+
const localDir = `${Stratus.BaseUrl}${boot.configuration.paths[`${systemDir}/*`].replace(/[^/]*$/, '').replace(/\/dist\/$/, '/src/')}`;
|
|
29
|
+
let MediaDialogComponent = class MediaDialogComponent extends ResponsiveComponent {
|
|
30
|
+
constructor(dialogRef, data, fb, backend, snackBar, ref) {
|
|
31
|
+
super();
|
|
32
|
+
this.dialogRef = dialogRef;
|
|
33
|
+
this.data = data;
|
|
34
|
+
this.fb = fb;
|
|
35
|
+
this.backend = backend;
|
|
36
|
+
this.snackBar = snackBar;
|
|
37
|
+
this.ref = ref;
|
|
38
|
+
this.title = moduleName + '_component';
|
|
39
|
+
this._ = _;
|
|
40
|
+
this.Stratus = Stratus;
|
|
41
|
+
this.apiBase = '/Api/Media';
|
|
42
|
+
this.mediaEntities = [];
|
|
43
|
+
this.isMediaLoading = true;
|
|
44
|
+
this.limit = 20;
|
|
45
|
+
this.eventInsert = true;
|
|
46
|
+
this.selected = [];
|
|
47
|
+
this.embedly = true;
|
|
48
|
+
}
|
|
49
|
+
ngOnInit() {
|
|
50
|
+
this.uid = _.uniqueId(`sa_${_.snakeCase(moduleName)}_component_`);
|
|
51
|
+
Stratus.Instances[this.uid] = this;
|
|
52
|
+
Stratus.Internals.CssLoader(`${localDir}/${parentModuleName}/${moduleName}.component${min}.css`);
|
|
53
|
+
this.model = this.data.model;
|
|
54
|
+
this.property = this.data.property;
|
|
55
|
+
this.editor = this.data.editor;
|
|
56
|
+
this.eventManager = this.data.eventManager;
|
|
57
|
+
if (_.isBoolean(this.data.eventInsert)) {
|
|
58
|
+
this.eventInsert = this.data.eventInsert;
|
|
59
|
+
}
|
|
60
|
+
this.dialogMediaForm = this.fb.group({
|
|
61
|
+
mediaQueryInput: ''
|
|
62
|
+
});
|
|
63
|
+
this.dialogMediaForm
|
|
64
|
+
.get('mediaQueryInput')
|
|
65
|
+
.valueChanges
|
|
66
|
+
.pipe(debounceTime(300), tap(() => {
|
|
67
|
+
}), switchMap((value) => {
|
|
68
|
+
return this.getQuery(value);
|
|
69
|
+
}))
|
|
70
|
+
.subscribe((response) => this.processMedia(response));
|
|
71
|
+
this.getQuery().subscribe((response) => this.processMedia(response));
|
|
72
|
+
this.refresh();
|
|
73
|
+
}
|
|
74
|
+
onCancelClick() {
|
|
75
|
+
this.dialogRef.close();
|
|
76
|
+
this.refresh();
|
|
77
|
+
}
|
|
78
|
+
onPage(event) {
|
|
79
|
+
this.pageEvent = event;
|
|
80
|
+
this.getQuery(this.lastMediaQuery).subscribe((response) => this.processMedia(response));
|
|
81
|
+
}
|
|
82
|
+
getQueryUrl(query) {
|
|
83
|
+
let limit = this.limit;
|
|
84
|
+
let paging = 1;
|
|
85
|
+
if (this.pageEvent) {
|
|
86
|
+
limit = this.pageEvent.pageSize;
|
|
87
|
+
paging = this.pageEvent.pageIndex + 1;
|
|
88
|
+
}
|
|
89
|
+
query = (_.isString(query) && !_.isEmpty(query)) ? `"${query}"` : '';
|
|
90
|
+
return `${this.apiBase}?limit=${limit}&p=${paging}&q=${query}`;
|
|
91
|
+
}
|
|
92
|
+
getQuery(query) {
|
|
93
|
+
this.lastMediaQuery = query;
|
|
94
|
+
this.isMediaLoading = true;
|
|
95
|
+
return this.backend.get(this.getQueryUrl(query))
|
|
96
|
+
.pipe(finalize(() => this.isMediaLoading = false));
|
|
97
|
+
}
|
|
98
|
+
processMedia(response) {
|
|
99
|
+
if (!response.ok || response.status !== 200 || _.isEmpty(response.body)) {
|
|
100
|
+
this.meta = {};
|
|
101
|
+
this.mediaEntities = [];
|
|
102
|
+
this.refresh();
|
|
103
|
+
return this.mediaEntities;
|
|
104
|
+
}
|
|
105
|
+
this.meta = _.get(response.body, 'meta') || {};
|
|
106
|
+
const payload = _.get(response.body, 'payload') || response.body;
|
|
107
|
+
if (_.isEmpty(payload) || !Array.isArray(payload)) {
|
|
108
|
+
this.mediaEntities = [];
|
|
109
|
+
this.isMediaLoading = false;
|
|
110
|
+
this.refresh();
|
|
111
|
+
return this.mediaEntities;
|
|
112
|
+
}
|
|
113
|
+
this.mediaEntities = payload;
|
|
114
|
+
this.isMediaLoading = false;
|
|
115
|
+
this.refresh();
|
|
116
|
+
return this.mediaEntities;
|
|
117
|
+
}
|
|
118
|
+
select(media) {
|
|
119
|
+
if (_.isUndefined(media)) {
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
const mediaElement = this.createEmbed(media);
|
|
123
|
+
if (!mediaElement) {
|
|
124
|
+
console.warn(`media-dialog: unable to build embed for Media ID: ${media.id}`);
|
|
125
|
+
this.snackBar.open(`Unable to build embed for Media ID: ${media.id}.`, 'dismiss', {
|
|
126
|
+
duration: 5000,
|
|
127
|
+
horizontalPosition: 'right',
|
|
128
|
+
verticalPosition: 'bottom'
|
|
129
|
+
});
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
this.selected.push(media.id);
|
|
133
|
+
if (!this.eventInsert) {
|
|
134
|
+
if (!(this.model instanceof Model)) {
|
|
135
|
+
console.warn('media-dialog: event manager not available.');
|
|
136
|
+
return;
|
|
51
137
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
}))
|
|
100
|
-
.subscribe((response) => this.processMedia(response));
|
|
101
|
-
this.getQuery().subscribe((response) => this.processMedia(response));
|
|
102
|
-
this.refresh();
|
|
103
|
-
}
|
|
104
|
-
onCancelClick() {
|
|
105
|
-
this.dialogRef.close();
|
|
106
|
-
this.refresh();
|
|
107
|
-
}
|
|
108
|
-
onPage(event) {
|
|
109
|
-
this.pageEvent = event;
|
|
110
|
-
this.getQuery(this.lastMediaQuery).subscribe((response) => this.processMedia(response));
|
|
111
|
-
}
|
|
112
|
-
getQueryUrl(query) {
|
|
113
|
-
let limit = this.limit;
|
|
114
|
-
let paging = 1;
|
|
115
|
-
if (this.pageEvent) {
|
|
116
|
-
limit = this.pageEvent.pageSize;
|
|
117
|
-
paging = this.pageEvent.pageIndex + 1;
|
|
118
|
-
}
|
|
119
|
-
query = (lodash_1.default.isString(query) && !lodash_1.default.isEmpty(query)) ? `"${query}"` : '';
|
|
120
|
-
return `${this.apiBase}?limit=${limit}&p=${paging}&q=${query}`;
|
|
121
|
-
}
|
|
122
|
-
getQuery(query) {
|
|
123
|
-
this.lastMediaQuery = query;
|
|
124
|
-
this.isMediaLoading = true;
|
|
125
|
-
return this.backend.get(this.getQueryUrl(query))
|
|
126
|
-
.pipe(operators_1.finalize(() => this.isMediaLoading = false));
|
|
127
|
-
}
|
|
128
|
-
processMedia(response) {
|
|
129
|
-
if (!response.ok || response.status !== 200 || lodash_1.default.isEmpty(response.body)) {
|
|
130
|
-
this.meta = {};
|
|
131
|
-
this.mediaEntities = [];
|
|
132
|
-
this.refresh();
|
|
133
|
-
return this.mediaEntities;
|
|
134
|
-
}
|
|
135
|
-
this.meta = lodash_1.default.get(response.body, 'meta') || {};
|
|
136
|
-
const payload = lodash_1.default.get(response.body, 'payload') || response.body;
|
|
137
|
-
if (lodash_1.default.isEmpty(payload) || !Array.isArray(payload)) {
|
|
138
|
-
this.mediaEntities = [];
|
|
139
|
-
this.isMediaLoading = false;
|
|
140
|
-
this.refresh();
|
|
141
|
-
return this.mediaEntities;
|
|
142
|
-
}
|
|
143
|
-
this.mediaEntities = payload;
|
|
144
|
-
this.isMediaLoading = false;
|
|
145
|
-
this.refresh();
|
|
146
|
-
return this.mediaEntities;
|
|
147
|
-
}
|
|
148
|
-
select(media) {
|
|
149
|
-
if (lodash_1.default.isUndefined(media)) {
|
|
150
|
-
return;
|
|
151
|
-
}
|
|
152
|
-
const mediaElement = this.createEmbed(media);
|
|
153
|
-
if (!mediaElement) {
|
|
154
|
-
console.warn(`media-dialog: unable to build embed for Media ID: ${media.id}`);
|
|
155
|
-
this.snackBar.open(`Unable to build embed for Media ID: ${media.id}.`, 'dismiss', {
|
|
156
|
-
duration: 5000,
|
|
157
|
-
horizontalPosition: 'right',
|
|
158
|
-
verticalPosition: 'bottom'
|
|
159
|
-
});
|
|
160
|
-
return;
|
|
161
|
-
}
|
|
162
|
-
this.selected.push(media.id);
|
|
163
|
-
if (!this.eventInsert) {
|
|
164
|
-
if (!(this.model instanceof model_1.Model)) {
|
|
165
|
-
console.warn('media-dialog: event manager not available.');
|
|
166
|
-
return;
|
|
167
|
-
}
|
|
168
|
-
if (!lodash_1.default.isString(this.property)) {
|
|
169
|
-
console.warn('media-dialog: event manager not available.');
|
|
170
|
-
return;
|
|
171
|
-
}
|
|
172
|
-
console.warn('media-dialog: disabling eventInsert is not recommended.');
|
|
173
|
-
this.model.set(this.property, this.model.get(this.property) + mediaElement);
|
|
174
|
-
return;
|
|
175
|
-
}
|
|
176
|
-
if (!this.eventManager) {
|
|
177
|
-
console.warn('media-dialog: event manager is not set.');
|
|
178
|
-
return;
|
|
179
|
-
}
|
|
180
|
-
this.eventManager.trigger('insert', mediaElement, this.editor);
|
|
181
|
-
}
|
|
182
|
-
isSelected(media) {
|
|
183
|
-
if (lodash_1.default.isUndefined(media)) {
|
|
184
|
-
return;
|
|
185
|
-
}
|
|
186
|
-
return lodash_1.default.includes(this.selected, media.id);
|
|
138
|
+
if (!_.isString(this.property)) {
|
|
139
|
+
console.warn('media-dialog: event manager not available.');
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
console.warn('media-dialog: disabling eventInsert is not recommended.');
|
|
143
|
+
this.model.set(this.property, this.model.get(this.property) + mediaElement);
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
if (!this.eventManager) {
|
|
147
|
+
console.warn('media-dialog: event manager is not set.');
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
this.eventManager.trigger('insert', mediaElement, this.editor);
|
|
151
|
+
}
|
|
152
|
+
isSelected(media) {
|
|
153
|
+
if (_.isUndefined(media)) {
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
return _.includes(this.selected, media.id);
|
|
157
|
+
}
|
|
158
|
+
createEmbed(media) {
|
|
159
|
+
if (media._embedCode) {
|
|
160
|
+
return {
|
|
161
|
+
html: media._embedCode
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
if (_.startsWith(media.mime, 'image')) {
|
|
165
|
+
if (!media._thumbnailUrl || (media.service === 'directLink' && !media.file)) {
|
|
166
|
+
console.warn(`media-dialog: unable to determine image source for media id: ${media.id}`);
|
|
167
|
+
return null;
|
|
168
|
+
}
|
|
169
|
+
return {
|
|
170
|
+
html: `<img src="${media._thumbnailUrl || media.file}" alt="${media.name || media.filename}" ${media.mime !== 'image/gif' ? 'data-stratus-src' : ''}>`
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
if (media.mime === 'video') {
|
|
174
|
+
if (media.embed) {
|
|
175
|
+
return {
|
|
176
|
+
html: media.embed
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
const iframeAttributes = 'width="100%" scrolling="no" frameborder="0" allowTransparency="true" allowFullScreen="true" webkitAllowFullScreen="" mozAllowFullScreen=""';
|
|
180
|
+
if (media.service === 'facebook') {
|
|
181
|
+
const mediaUrl = media.url || media.file;
|
|
182
|
+
if (!mediaUrl) {
|
|
183
|
+
console.warn(`media-dialog: unable to find url for video with media id: ${media.id}`);
|
|
184
|
+
return null;
|
|
187
185
|
}
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
html: media._embedCode
|
|
192
|
-
};
|
|
193
|
-
}
|
|
194
|
-
if (lodash_1.default.startsWith(media.mime, 'image')) {
|
|
195
|
-
if (!media._thumbnailUrl || (media.service === 'directLink' && !media.file)) {
|
|
196
|
-
console.warn(`media-dialog: unable to determine image source for media id: ${media.id}`);
|
|
197
|
-
return null;
|
|
198
|
-
}
|
|
199
|
-
return {
|
|
200
|
-
html: `<img src="${media._thumbnailUrl || media.file}" alt="${media.name || media.filename}" ${media.mime !== 'image/gif' ? 'data-stratus-src' : ''}>`
|
|
201
|
-
};
|
|
202
|
-
}
|
|
203
|
-
if (media.mime === 'video') {
|
|
204
|
-
if (media.embed) {
|
|
205
|
-
return {
|
|
206
|
-
html: media.embed
|
|
207
|
-
};
|
|
208
|
-
}
|
|
209
|
-
const iframeAttributes = 'width="100%" scrolling="no" frameborder="0" allowTransparency="true" allowFullScreen="true" webkitAllowFullScreen="" mozAllowFullScreen=""';
|
|
210
|
-
if (media.service === 'facebook') {
|
|
211
|
-
const mediaUrl = media.url || media.file;
|
|
212
|
-
if (!mediaUrl) {
|
|
213
|
-
console.warn(`media-dialog: unable to find url for video with media id: ${media.id}`);
|
|
214
|
-
return null;
|
|
215
|
-
}
|
|
216
|
-
if (this.embedly) {
|
|
217
|
-
return {
|
|
218
|
-
html: `<div class="fr-embedly"
|
|
186
|
+
if (this.embedly) {
|
|
187
|
+
return {
|
|
188
|
+
html: `<div class="fr-embedly"
|
|
219
189
|
data-original-embed="<a href='${mediaUrl}' data-card-branding='0' class='embedly-card'></a>"
|
|
220
190
|
style="height: 998px;">
|
|
221
191
|
<a href="${mediaUrl}" data-card-branding="0" class="embedly-card"></a>
|
|
222
192
|
</div>`
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
return {
|
|
196
|
+
html: `<iframe src="https://www.facebook.com/plugins/video.php?href=${mediaUrl}" ${iframeAttributes}></iframe>`
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
if (!media.serviceMediaId) {
|
|
200
|
+
console.warn(`media-dialog: unable to find serviceMediaId for video with media id: ${media.id}`);
|
|
201
|
+
return null;
|
|
202
|
+
}
|
|
203
|
+
if (media.service === 'vimeo') {
|
|
204
|
+
if (this.embedly) {
|
|
205
|
+
return {
|
|
206
|
+
html: `<div class="fr-embedly"
|
|
237
207
|
data-original-embed="<a href='https://vimeo.com/${media.serviceMediaId}' data-card-branding='0' class='embedly-card'></a>"
|
|
238
208
|
style="height: 370px;">
|
|
239
209
|
<a href="https://vimeo.com/${media.serviceMediaId}" data-card-branding="0" class="embedly-card"></a>
|
|
240
210
|
</div>`
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
return {
|
|
214
|
+
html: `<iframe src="https://player.vimeo.com/video/${media.serviceMediaId}" ${iframeAttributes}></iframe>`
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
if (media.service === 'youtube') {
|
|
218
|
+
if (this.embedly) {
|
|
219
|
+
return {
|
|
220
|
+
html: `<div class="fr-embedly"
|
|
251
221
|
data-original-embed="<a href='https://www.youtube.com/watch?v=${media.serviceMediaId}' data-card-branding='0' class='embedly-card'></a>"
|
|
252
222
|
style="height: 370px;">
|
|
253
223
|
<a href="https://www.youtube.com/watch?v=${media.serviceMediaId}" data-card-branding="0" class="embedly-card"></a>
|
|
254
224
|
</div>`
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
return {
|
|
228
|
+
html: `<iframe src="https://www.youtube.com/embed/${media.serviceMediaId}" ${iframeAttributes}></iframe>`
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
console.warn(`media-dialog: unsupported service: ${media.service} for media id: ${media.id}`);
|
|
232
|
+
return null;
|
|
233
|
+
}
|
|
234
|
+
if (_.startsWith(media.mime, 'audio')) {
|
|
235
|
+
if (!media.url) {
|
|
236
|
+
console.warn(`media-dialog: unable to determine audio source for media id: ${media.id}`);
|
|
237
|
+
return null;
|
|
238
|
+
}
|
|
239
|
+
return {
|
|
240
|
+
html: `<audio controls>
|
|
271
241
|
<source src="https://${media.url}" type="${media.mime}">
|
|
272
242
|
<p>
|
|
273
243
|
Your browser doesn't support HTML5 audio, but you can <a href="https://${media.url}">download the audio here</a>.
|
|
274
244
|
</p>
|
|
275
245
|
</audio>`
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
if (media.mime === 'application/pdf') {
|
|
249
|
+
if (!media.url) {
|
|
250
|
+
console.warn(`media-dialog: unable to determine PDF source for media id: ${media.id}`);
|
|
251
|
+
return null;
|
|
252
|
+
}
|
|
253
|
+
if (this.embedly) {
|
|
254
|
+
return {
|
|
255
|
+
html: `<div class="fr-embedly"
|
|
286
256
|
data-original-embed="<a href='https://${media.url}' data-card-branding='0' class='embedly-card'></a>"
|
|
287
257
|
style="height: 71px;">
|
|
288
258
|
<a href="https://${media.url}" data-card-branding="0" class="embedly-card"></a>
|
|
289
259
|
</div>`
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
return {
|
|
263
|
+
html: `<iframe src="https://docs.google.com/viewer?url=${media.url}&embedded=true" style="min-height: 500px;" width="100%"></iframe>`
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
if (media.mime === 'application/msword') {
|
|
267
|
+
if (!media.url) {
|
|
268
|
+
console.warn(`media-dialog: unable to determine Word Document source for media id: ${media.id}`);
|
|
269
|
+
return null;
|
|
270
|
+
}
|
|
271
|
+
if (this.embedly) {
|
|
272
|
+
return {
|
|
273
|
+
html: `<div class="fr-embedly"
|
|
304
274
|
data-original-embed="<a href='https://${media.url}' data-card-branding='0' class='embedly-card'></a>"
|
|
305
275
|
style="height: 71px;">
|
|
306
276
|
<a href="https://${media.url}" data-card-branding="0" class="embedly-card"></a>
|
|
307
277
|
</div>`
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
};
|
|
313
|
-
}
|
|
314
|
-
console.warn(`media-dialog: unsupported mime type: ${media.mime} for media id: ${media.id}`);
|
|
315
|
-
return null;
|
|
316
|
-
}
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
return {
|
|
281
|
+
html: `<iframe src="https://docs.google.com/viewer?url=${media.url}&embedded=true" style="min-height: 500px;" width="100%"></iframe>`
|
|
317
282
|
};
|
|
318
|
-
MediaDialogComponent = __decorate([
|
|
319
|
-
core_1.Component({
|
|
320
|
-
selector: `sa-${moduleName}`,
|
|
321
|
-
templateUrl: `${localDir}/${parentModuleName}/${moduleName}.component${min}.html`,
|
|
322
|
-
}),
|
|
323
|
-
__param(1, core_1.Inject(dialog_1.MAT_DIALOG_DATA)),
|
|
324
|
-
__metadata("design:paramtypes", [dialog_1.MatDialogRef, Object, forms_1.FormBuilder,
|
|
325
|
-
backend_service_1.BackendService,
|
|
326
|
-
snack_bar_1.MatSnackBar,
|
|
327
|
-
core_1.ChangeDetectorRef])
|
|
328
|
-
], MediaDialogComponent);
|
|
329
|
-
exports_1("MediaDialogComponent", MediaDialogComponent);
|
|
330
283
|
}
|
|
331
|
-
|
|
332
|
-
|
|
284
|
+
console.warn(`media-dialog: unsupported mime type: ${media.mime} for media id: ${media.id}`);
|
|
285
|
+
return null;
|
|
286
|
+
}
|
|
287
|
+
};
|
|
288
|
+
MediaDialogComponent = __decorate([
|
|
289
|
+
Component({
|
|
290
|
+
selector: `sa-${moduleName}`,
|
|
291
|
+
templateUrl: `${localDir}/${parentModuleName}/${moduleName}.component${min}.html`,
|
|
292
|
+
}),
|
|
293
|
+
__param(1, Inject(MAT_DIALOG_DATA)),
|
|
294
|
+
__metadata("design:paramtypes", [MatDialogRef, Object, FormBuilder,
|
|
295
|
+
BackendService,
|
|
296
|
+
MatSnackBar,
|
|
297
|
+
ChangeDetectorRef])
|
|
298
|
+
], MediaDialogComponent);
|
|
299
|
+
export { MediaDialogComponent };
|
|
333
300
|
|
|
334
301
|
//# sourceMappingURL=media-dialog.component.js.map
|