@stratusjs/angular 0.5.2 → 0.5.3

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 (81) hide show
  1. package/dist/angular.bundle.min.js +1 -1
  2. package/package.json +1 -1
  3. package/src/angular.modules.js +33 -18
  4. package/src/angular.modules.js.map +1 -1
  5. package/src/app.module.js +254 -181
  6. package/src/app.module.js.map +1 -1
  7. package/src/backend.service.js +87 -66
  8. package/src/backend.service.js.map +1 -1
  9. package/src/base/base.component.js +124 -101
  10. package/src/base/base.component.js.map +1 -1
  11. package/src/boot.js +55 -42
  12. package/src/boot.js.map +1 -1
  13. package/src/confirm-dialog/confirm-dialog.component.js +60 -41
  14. package/src/confirm-dialog/confirm-dialog.component.js.map +1 -1
  15. package/src/core/base.interface.js +9 -1
  16. package/src/core/base.interface.js.map +1 -1
  17. package/src/core/refresh.interface.js +9 -1
  18. package/src/core/refresh.interface.js.map +1 -1
  19. package/src/core/responsive.component.js +58 -40
  20. package/src/core/responsive.component.js.map +1 -1
  21. package/src/core/responsive.interface.js +9 -1
  22. package/src/core/responsive.interface.js.map +1 -1
  23. package/src/core/root.component.js +43 -24
  24. package/src/core/root.component.js.map +1 -1
  25. package/src/core/trigger.interface.js +9 -1
  26. package/src/core/trigger.interface.js.map +1 -1
  27. package/src/data/contact-meta.interface.js +9 -1
  28. package/src/data/contact-meta.interface.js.map +1 -1
  29. package/src/data/content.interface.js +9 -1
  30. package/src/data/content.interface.js.map +1 -1
  31. package/src/data/convoy.interface.js +9 -1
  32. package/src/data/convoy.interface.js.map +1 -1
  33. package/src/editor/citation-dialog.component.js +207 -174
  34. package/src/editor/citation-dialog.component.js.map +1 -1
  35. package/src/editor/code-mirror-bridge.js +74 -60
  36. package/src/editor/code-mirror-bridge.js.map +1 -1
  37. package/src/editor/code-mirror-bridge.min.js +1 -1
  38. package/src/editor/code-view-dialog.component.js +116 -87
  39. package/src/editor/code-view-dialog.component.js.map +1 -1
  40. package/src/editor/editor.component.js +961 -903
  41. package/src/editor/editor.component.js.map +1 -1
  42. package/src/editor/link-dialog.component.js +395 -356
  43. package/src/editor/link-dialog.component.js.map +1 -1
  44. package/src/editor/media-dialog.component.js +303 -270
  45. package/src/editor/media-dialog.component.js.map +1 -1
  46. package/src/froala/plugins/citationManager.js +191 -170
  47. package/src/froala/plugins/citationManager.js.map +1 -1
  48. package/src/froala/plugins/inputButton.js +138 -122
  49. package/src/froala/plugins/inputButton.js.map +1 -1
  50. package/src/froala/plugins/linkManager.js +104 -89
  51. package/src/froala/plugins/linkManager.js.map +1 -1
  52. package/src/froala/plugins/mediaManager.js +87 -72
  53. package/src/froala/plugins/mediaManager.js.map +1 -1
  54. package/src/froala/plugins/menuButton.js +86 -71
  55. package/src/froala/plugins/menuButton.js.map +1 -1
  56. package/src/main.js +33 -13
  57. package/src/main.js.map +1 -1
  58. package/src/material.js +194 -99
  59. package/src/material.js.map +1 -1
  60. package/src/media-selector/media-selector.component.js +441 -406
  61. package/src/media-selector/media-selector.component.js.map +1 -1
  62. package/src/polyfills.js +16 -3
  63. package/src/polyfills.js.map +1 -1
  64. package/src/quill-plugins/quill-break-blot.plugin.js +35 -19
  65. package/src/quill-plugins/quill-break-blot.plugin.js.map +1 -1
  66. package/src/quill-plugins/quill-html-edit.plugin.js +153 -140
  67. package/src/quill-plugins/quill-html-edit.plugin.js.map +1 -1
  68. package/src/quill-plugins/quill-image-format.plugin.js +47 -33
  69. package/src/quill-plugins/quill-image-format.plugin.js.map +1 -1
  70. package/src/quill-plugins/quill-input-button.plugin.js +95 -77
  71. package/src/quill-plugins/quill-input-button.plugin.js.map +1 -1
  72. package/src/selector/selector.component.js +276 -241
  73. package/src/selector/selector.component.js.map +1 -1
  74. package/src/test/test.directive.js +66 -49
  75. package/src/test/test.directive.js.map +1 -1
  76. package/src/tree/tree-dialog.component.js +231 -202
  77. package/src/tree/tree-dialog.component.js.map +1 -1
  78. package/src/tree/tree-node.component.js +282 -253
  79. package/src/tree/tree-node.component.js.map +1 -1
  80. package/src/tree/tree.component.js +561 -531
  81. package/src/tree/tree.component.js.map +1 -1
@@ -1,301 +1,334 @@
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;
137
- }
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
- };
1
+ System.register(["@angular/core", "@angular/forms", "@angular/material/dialog", "@angular/material/snack-bar", "rxjs/operators", "lodash", "@stratusjs/runtime/stratus", "@stratusjs/core/environment", "../backend.service", "@stratusjs/angularjs/services/model", "../core/responsive.component"], function (exports_1, context_1) {
2
+ "use strict";
3
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
4
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
5
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
6
+ 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;
7
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
8
+ };
9
+ var __metadata = (this && this.__metadata) || function (k, v) {
10
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
11
+ };
12
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
13
+ return function (target, key) { decorator(target, key, paramIndex); }
14
+ };
15
+ var core_1, forms_1, dialog_1, snack_bar_1, operators_1, lodash_1, stratus_1, environment_1, backend_service_1, model_1, responsive_component_1, systemDir, moduleName, parentModuleName, min, localDir, MediaDialogComponent;
16
+ var __moduleName = context_1 && context_1.id;
17
+ return {
18
+ setters: [
19
+ function (core_1_1) {
20
+ core_1 = core_1_1;
21
+ },
22
+ function (forms_1_1) {
23
+ forms_1 = forms_1_1;
24
+ },
25
+ function (dialog_1_1) {
26
+ dialog_1 = dialog_1_1;
27
+ },
28
+ function (snack_bar_1_1) {
29
+ snack_bar_1 = snack_bar_1_1;
30
+ },
31
+ function (operators_1_1) {
32
+ operators_1 = operators_1_1;
33
+ },
34
+ function (lodash_1_1) {
35
+ lodash_1 = lodash_1_1;
36
+ },
37
+ function (stratus_1_1) {
38
+ stratus_1 = stratus_1_1;
39
+ },
40
+ function (environment_1_1) {
41
+ environment_1 = environment_1_1;
42
+ },
43
+ function (backend_service_1_1) {
44
+ backend_service_1 = backend_service_1_1;
45
+ },
46
+ function (model_1_1) {
47
+ model_1 = model_1_1;
48
+ },
49
+ function (responsive_component_1_1) {
50
+ responsive_component_1 = responsive_component_1_1;
178
51
  }
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;
52
+ ],
53
+ execute: function () {
54
+ systemDir = '@stratusjs/angular';
55
+ moduleName = 'media-dialog';
56
+ parentModuleName = 'editor';
57
+ min = !environment_1.cookie('env') ? '.min' : '';
58
+ localDir = `${stratus_1.Stratus.BaseUrl}${boot.configuration.paths[`${systemDir}/*`].replace(/[^/]*$/, '').replace(/\/dist\/$/, '/src/')}`;
59
+ MediaDialogComponent = class MediaDialogComponent extends responsive_component_1.ResponsiveComponent {
60
+ constructor(dialogRef, data, fb, backend, snackBar, ref) {
61
+ super();
62
+ this.dialogRef = dialogRef;
63
+ this.data = data;
64
+ this.fb = fb;
65
+ this.backend = backend;
66
+ this.snackBar = snackBar;
67
+ this.ref = ref;
68
+ this.title = moduleName + '_component';
69
+ this._ = lodash_1.default;
70
+ this.Stratus = stratus_1.Stratus;
71
+ this.apiBase = '/Api/Media';
72
+ this.mediaEntities = [];
73
+ this.isMediaLoading = true;
74
+ this.limit = 20;
75
+ this.eventInsert = true;
76
+ this.selected = [];
77
+ this.embedly = true;
78
+ }
79
+ ngOnInit() {
80
+ this.uid = lodash_1.default.uniqueId(`sa_${lodash_1.default.snakeCase(moduleName)}_component_`);
81
+ stratus_1.Stratus.Instances[this.uid] = this;
82
+ stratus_1.Stratus.Internals.CssLoader(`${localDir}/${parentModuleName}/${moduleName}.component${min}.css`);
83
+ this.model = this.data.model;
84
+ this.property = this.data.property;
85
+ this.editor = this.data.editor;
86
+ this.eventManager = this.data.eventManager;
87
+ if (lodash_1.default.isBoolean(this.data.eventInsert)) {
88
+ this.eventInsert = this.data.eventInsert;
89
+ }
90
+ this.dialogMediaForm = this.fb.group({
91
+ mediaQueryInput: ''
92
+ });
93
+ this.dialogMediaForm
94
+ .get('mediaQueryInput')
95
+ .valueChanges
96
+ .pipe(operators_1.debounceTime(300), operators_1.tap(() => {
97
+ }), operators_1.switchMap((value) => {
98
+ return this.getQuery(value);
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));
185
127
  }
186
- if (this.embedly) {
187
- return {
188
- html: `<div class="fr-embedly"
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);
187
+ }
188
+ createEmbed(media) {
189
+ if (media._embedCode) {
190
+ return {
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"
189
219
  data-original-embed="<a href='${mediaUrl}' data-card-branding='0' class='embedly-card'></a>"
190
220
  style="height: 998px;">
191
221
  <a href="${mediaUrl}" data-card-branding="0" class="embedly-card"></a>
192
222
  </div>`
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"
223
+ };
224
+ }
225
+ return {
226
+ html: `<iframe src="https://www.facebook.com/plugins/video.php?href=${mediaUrl}" ${iframeAttributes}></iframe>`
227
+ };
228
+ }
229
+ if (!media.serviceMediaId) {
230
+ console.warn(`media-dialog: unable to find serviceMediaId for video with media id: ${media.id}`);
231
+ return null;
232
+ }
233
+ if (media.service === 'vimeo') {
234
+ if (this.embedly) {
235
+ return {
236
+ html: `<div class="fr-embedly"
207
237
  data-original-embed="<a href='https://vimeo.com/${media.serviceMediaId}' data-card-branding='0' class='embedly-card'></a>"
208
238
  style="height: 370px;">
209
239
  <a href="https://vimeo.com/${media.serviceMediaId}" data-card-branding="0" class="embedly-card"></a>
210
240
  </div>`
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"
241
+ };
242
+ }
243
+ return {
244
+ html: `<iframe src="https://player.vimeo.com/video/${media.serviceMediaId}" ${iframeAttributes}></iframe>`
245
+ };
246
+ }
247
+ if (media.service === 'youtube') {
248
+ if (this.embedly) {
249
+ return {
250
+ html: `<div class="fr-embedly"
221
251
  data-original-embed="<a href='https://www.youtube.com/watch?v=${media.serviceMediaId}' data-card-branding='0' class='embedly-card'></a>"
222
252
  style="height: 370px;">
223
253
  <a href="https://www.youtube.com/watch?v=${media.serviceMediaId}" data-card-branding="0" class="embedly-card"></a>
224
254
  </div>`
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>
255
+ };
256
+ }
257
+ return {
258
+ html: `<iframe src="https://www.youtube.com/embed/${media.serviceMediaId}" ${iframeAttributes}></iframe>`
259
+ };
260
+ }
261
+ console.warn(`media-dialog: unsupported service: ${media.service} for media id: ${media.id}`);
262
+ return null;
263
+ }
264
+ if (lodash_1.default.startsWith(media.mime, 'audio')) {
265
+ if (!media.url) {
266
+ console.warn(`media-dialog: unable to determine audio source for media id: ${media.id}`);
267
+ return null;
268
+ }
269
+ return {
270
+ html: `<audio controls>
241
271
  <source src="https://${media.url}" type="${media.mime}">
242
272
  <p>
243
273
  Your browser doesn't support HTML5 audio, but you can <a href="https://${media.url}">download the audio here</a>.
244
274
  </p>
245
275
  </audio>`
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"
276
+ };
277
+ }
278
+ if (media.mime === 'application/pdf') {
279
+ if (!media.url) {
280
+ console.warn(`media-dialog: unable to determine PDF source for media id: ${media.id}`);
281
+ return null;
282
+ }
283
+ if (this.embedly) {
284
+ return {
285
+ html: `<div class="fr-embedly"
256
286
  data-original-embed="<a href='https://${media.url}' data-card-branding='0' class='embedly-card'></a>"
257
287
  style="height: 71px;">
258
288
  <a href="https://${media.url}" data-card-branding="0" class="embedly-card"></a>
259
289
  </div>`
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"
290
+ };
291
+ }
292
+ return {
293
+ html: `<iframe src="https://docs.google.com/viewer?url=${media.url}&embedded=true" style="min-height: 500px;" width="100%"></iframe>`
294
+ };
295
+ }
296
+ if (media.mime === 'application/msword') {
297
+ if (!media.url) {
298
+ console.warn(`media-dialog: unable to determine Word Document source for media id: ${media.id}`);
299
+ return null;
300
+ }
301
+ if (this.embedly) {
302
+ return {
303
+ html: `<div class="fr-embedly"
274
304
  data-original-embed="<a href='https://${media.url}' data-card-branding='0' class='embedly-card'></a>"
275
305
  style="height: 71px;">
276
306
  <a href="https://${media.url}" data-card-branding="0" class="embedly-card"></a>
277
307
  </div>`
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>`
308
+ };
309
+ }
310
+ return {
311
+ html: `<iframe src="https://docs.google.com/viewer?url=${media.url}&embedded=true" style="min-height: 500px;" width="100%"></iframe>`
312
+ };
313
+ }
314
+ console.warn(`media-dialog: unsupported mime type: ${media.mime} for media id: ${media.id}`);
315
+ return null;
316
+ }
282
317
  };
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);
283
330
  }
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 };
331
+ };
332
+ });
300
333
 
301
334
  //# sourceMappingURL=media-dialog.component.js.map