@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.
Files changed (92) hide show
  1. package/dist/angular.bundle.js +30609 -2673
  2. package/dist/angular.bundle.min.js +1 -1
  3. package/package.json +5 -4
  4. package/src/angular.modules.js +18 -33
  5. package/src/angular.modules.js.map +1 -1
  6. package/src/app.module.js +181 -227
  7. package/src/app.module.js.map +1 -1
  8. package/src/app.module.min.js +1 -1
  9. package/src/app.module.ts +17 -17
  10. package/src/backend.service.js +66 -87
  11. package/src/backend.service.js.map +1 -1
  12. package/src/base/base.component.js +101 -124
  13. package/src/base/base.component.js.map +1 -1
  14. package/src/boot.js +42 -55
  15. package/src/boot.js.map +1 -1
  16. package/src/confirm-dialog/confirm-dialog.component.js +41 -60
  17. package/src/confirm-dialog/confirm-dialog.component.js.map +1 -1
  18. package/src/core/base.interface.js +1 -9
  19. package/src/core/base.interface.js.map +1 -1
  20. package/src/core/dialog.interface.js.map +1 -0
  21. package/src/core/refresh.interface.js +1 -9
  22. package/src/core/refresh.interface.js.map +1 -1
  23. package/src/core/responsive.component.js +40 -58
  24. package/src/core/responsive.component.js.map +1 -1
  25. package/src/core/responsive.interface.js +1 -9
  26. package/src/core/responsive.interface.js.map +1 -1
  27. package/src/core/root.component.js +24 -43
  28. package/src/core/root.component.js.map +1 -1
  29. package/src/core/trigger.interface.js +1 -9
  30. package/src/core/trigger.interface.js.map +1 -1
  31. package/src/data/contact-meta.interface.js +1 -9
  32. package/src/data/contact-meta.interface.js.map +1 -1
  33. package/src/data/content.interface.js +1 -9
  34. package/src/data/content.interface.js.map +1 -1
  35. package/src/data/convoy.interface.js +1 -9
  36. package/src/data/convoy.interface.js.map +1 -1
  37. package/src/editor/citation-dialog.component.js +174 -207
  38. package/src/editor/citation-dialog.component.js.map +1 -1
  39. package/src/editor/code-mirror-bridge.js +63 -0
  40. package/src/editor/code-mirror-bridge.js.map +1 -0
  41. package/src/editor/code-mirror-bridge.min.js +1 -0
  42. package/src/editor/code-mirror-bridge.ts +85 -0
  43. package/src/editor/code-view-dialog.component.js +87 -116
  44. package/src/editor/code-view-dialog.component.js.map +1 -1
  45. package/src/editor/editor.component.js +903 -925
  46. package/src/editor/editor.component.js.map +1 -1
  47. package/src/editor/editor.component.min.js +1 -1
  48. package/src/editor/editor.component.ts +60 -21
  49. package/src/editor/link-dialog.component.js +356 -395
  50. package/src/editor/link-dialog.component.js.map +1 -1
  51. package/src/editor/media-dialog.component.js +270 -303
  52. package/src/editor/media-dialog.component.js.map +1 -1
  53. package/src/froala/plugins/citationManager.js +170 -191
  54. package/src/froala/plugins/citationManager.js.map +1 -1
  55. package/src/froala/plugins/inputButton.js +122 -138
  56. package/src/froala/plugins/inputButton.js.map +1 -1
  57. package/src/froala/plugins/linkManager.js +89 -104
  58. package/src/froala/plugins/linkManager.js.map +1 -1
  59. package/src/froala/plugins/mediaManager.js +72 -87
  60. package/src/froala/plugins/mediaManager.js.map +1 -1
  61. package/src/froala/plugins/menuButton.js +71 -86
  62. package/src/froala/plugins/menuButton.js.map +1 -1
  63. package/src/main.js +13 -33
  64. package/src/main.js.map +1 -1
  65. package/src/material.js +99 -194
  66. package/src/material.js.map +1 -1
  67. package/src/media-selector/media-selector.component.js +406 -441
  68. package/src/media-selector/media-selector.component.js.map +1 -1
  69. package/src/polyfills.js +3 -16
  70. package/src/polyfills.js.map +1 -1
  71. package/src/quill-plugins/quill-break-blot.plugin.js +19 -35
  72. package/src/quill-plugins/quill-break-blot.plugin.js.map +1 -1
  73. package/src/quill-plugins/quill-html-edit.plugin.js +140 -153
  74. package/src/quill-plugins/quill-html-edit.plugin.js.map +1 -1
  75. package/src/quill-plugins/quill-image-format.plugin.js +33 -47
  76. package/src/quill-plugins/quill-image-format.plugin.js.map +1 -1
  77. package/src/quill-plugins/quill-input-button.plugin.js +77 -95
  78. package/src/quill-plugins/quill-input-button.plugin.js.map +1 -1
  79. package/src/selector/selector.component.js +241 -276
  80. package/src/selector/selector.component.js.map +1 -1
  81. package/src/test/test.directive.js +49 -66
  82. package/src/test/test.directive.js.map +1 -1
  83. package/src/tree/tree-dialog.component.js +202 -231
  84. package/src/tree/tree-dialog.component.js.map +1 -1
  85. package/src/tree/tree-node.component.js +253 -279
  86. package/src/tree/tree-node.component.js.map +1 -1
  87. package/src/tree/tree-node.component.min.js +1 -1
  88. package/src/tree/tree-node.component.ts +10 -18
  89. package/src/tree/tree.component.js +531 -568
  90. package/src/tree/tree.component.js.map +1 -1
  91. package/src/tree/tree.component.min.js +1 -1
  92. package/src/tree/tree.component.ts +7 -10
@@ -1,948 +1,926 @@
1
- System.register(["@angular/core", "@angular/forms", "@angular/material/dialog", "rxjs", "rxjs/operators", "@angular/platform-browser", "@stratusjs/runtime/stratus", "lodash", "../core/root.component", "./citation-dialog.component", "./link-dialog.component", "./media-dialog.component", "@stratusjs/angularjs/services/registry", "@stratusjs/core/environment", "@stratusjs/core/events/eventManager", "./code-view-dialog.component", "html2pdf", "font-awesome", "froala-plugins", "froala-embedly", "froala-font-awesome", "froala-image-tui", "../froala/plugins/citationManager", "../froala/plugins/linkManager", "../froala/plugins/mediaManager"], 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 core_1, forms_1, dialog_1, rxjs_1, operators_1, platform_browser_1, stratus_1, lodash_1, root_component_1, citation_dialog_component_1, link_dialog_component_1, media_dialog_component_1, registry_1, environment_1, eventManager_1, code_view_dialog_component_1, systemPackage, froalaPackage, moduleName, min, localDir, froalaDir, has, EditorComponent;
13
- var __moduleName = context_1 && context_1.id;
14
- return {
15
- setters: [
16
- function (core_1_1) {
17
- core_1 = core_1_1;
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
+ import { ChangeDetectorRef, Component, ElementRef, Input, } from '@angular/core';
11
+ import { FormBuilder, FormControl } from '@angular/forms';
12
+ import { MatDialog } from '@angular/material/dialog';
13
+ import { Observable, Subject, timer } from 'rxjs';
14
+ import { catchError, debounce } from 'rxjs/operators';
15
+ import { DomSanitizer } from '@angular/platform-browser';
16
+ import { Stratus } from '@stratusjs/runtime/stratus';
17
+ import _ from 'lodash';
18
+ import { RootComponent } from '../core/root.component';
19
+ import { CitationDialogComponent } from './citation-dialog.component';
20
+ import { LinkDialogComponent } from './link-dialog.component';
21
+ import { MediaDialogComponent } from './media-dialog.component';
22
+ import { CodeViewDialogComponent } from './code-view-dialog.component';
23
+ import { CodeMirrorBridge } from './code-mirror-bridge';
24
+ import { Registry } from '@stratusjs/angularjs/services/registry';
25
+ import { cookie } from '@stratusjs/core/environment';
26
+ import { EventManager } from '@stratusjs/core/events/eventManager';
27
+ import { EditorView, basicSetup } from 'codemirror';
28
+ import { html } from '@codemirror/lang-html';
29
+ import 'html2pdf';
30
+ import 'font-awesome';
31
+ import 'froala-plugins';
32
+ import 'froala-embedly';
33
+ import 'froala-font-awesome';
34
+ import 'froala-image-tui';
35
+ import '../froala/plugins/citationManager';
36
+ import '../froala/plugins/linkManager';
37
+ import '../froala/plugins/mediaManager';
38
+ const systemPackage = '@stratusjs/angular';
39
+ const froalaPackage = 'froala-editor';
40
+ const moduleName = 'editor';
41
+ const min = !cookie('env') ? '.min' : '';
42
+ const localDir = `${Stratus.BaseUrl}${boot.configuration.paths[`${systemPackage}/*`].replace(/[^\/]*$/, '').replace(/\/dist\/$/, '/src/')}`;
43
+ const froalaDir = `${Stratus.BaseUrl}${boot.configuration.paths[froalaPackage].replace(/js\/[^\/]*$/, '')}`;
44
+ const has = (object, path) => _.has(object, path) && !_.isEmpty(_.get(object, path));
45
+ let EditorComponent = class EditorComponent extends RootComponent {
46
+ constructor(sanitizer, ref, elementRef, fb, dialog) {
47
+ super();
48
+ this.sanitizer = sanitizer;
49
+ this.ref = ref;
50
+ this.elementRef = elementRef;
51
+ this.fb = fb;
52
+ this.dialog = dialog;
53
+ this.title = moduleName + '_component';
54
+ this.dev = !!cookie('env');
55
+ this.editor = 'froala';
56
+ this._ = _;
57
+ this.has = has;
58
+ this.log = console.log;
59
+ this.Stratus = Stratus;
60
+ this.registry = new Registry();
61
+ this.onChange = new Subject();
62
+ this.svgIcons = {};
63
+ this.initialized = false;
64
+ this.styled = false;
65
+ this.blurred = false;
66
+ this.focused = false;
67
+ this.form = this.fb.group({
68
+ dataString: new FormControl(),
69
+ });
70
+ this.dataChangeLog = [];
71
+ this.dataString = '';
72
+ this.debounceSave = true;
73
+ this.debounceTime = 5000;
74
+ this.forceSave = true;
75
+ this.froalaButtons = [
76
+ 'bold', 'italic', 'underline', 'strikeThrough', 'subscript', 'superscript', '|', 'formatBlock',
77
+ 'blockStyle', 'inlineStyle', 'paragraphStyle', 'paragraphFormat', 'align', 'formatOL',
78
+ 'formatUL', 'outdent', 'indent', '|', 'insertLink', 'insertImage', 'insertVideo', 'insertFile',
79
+ 'insertTable', '|', 'undo', 'redo', 'removeFormat', 'wordPaste', 'help', 'html', 'fullscreen'
80
+ ];
81
+ this.froalaStandardButtons = {
82
+ moreText: [
83
+ 'bold',
84
+ 'italic',
85
+ 'underline',
86
+ 'strikeThrough',
87
+ 'subscript',
88
+ 'superscript',
89
+ 'fontFamily',
90
+ 'fontSize',
91
+ 'textColor',
92
+ 'backgroundColor',
93
+ 'inlineClass',
94
+ 'inlineStyle',
95
+ 'clearFormatting'
96
+ ],
97
+ moreParagraph: [
98
+ 'linkManager',
99
+ 'formatOL',
100
+ 'formatUL',
101
+ 'indent',
102
+ 'outdent',
103
+ 'quote',
104
+ 'paragraphFormat',
105
+ 'paragraphStyle',
106
+ 'alignLeft',
107
+ 'alignCenter',
108
+ 'alignRight',
109
+ 'alignJustify',
110
+ ],
111
+ moreRich: [
112
+ 'mediaManager',
113
+ 'insertTable',
114
+ 'insertImage',
115
+ 'insertVideo',
116
+ 'insertFile',
117
+ 'citationInsert',
118
+ 'insertHR',
119
+ 'specialCharacters',
120
+ ],
121
+ moreMisc: [
122
+ 'html',
123
+ 'undo',
124
+ 'redo',
125
+ 'fullscreen',
126
+ 'print',
127
+ 'selectAll',
128
+ 'help'
129
+ ],
130
+ };
131
+ this.froalaConfig = {
132
+ attribution: false,
133
+ key: Stratus.Environment.get('froalaKey'),
134
+ zIndex: 9999,
135
+ events: {
136
+ initialized: (froalaEditorDirective) => {
137
+ this.froalaEditorDirective = froalaEditorDirective;
138
+ },
18
139
  },
19
- function (forms_1_1) {
20
- forms_1 = forms_1_1;
140
+ codeBeautifierOptions: {
141
+ end_with_newline: true,
142
+ indent_inner_html: true,
143
+ extra_liners: '["p", "h1", "h2", "h3", "h4", "h5", "h6", "blockquote", "pre", "ul", "ol", "table", "dl"]',
144
+ brace_style: 'expand',
145
+ indent_char: ' ',
146
+ indent_size: 4,
147
+ wrap_line_length: 0
21
148
  },
22
- function (dialog_1_1) {
23
- dialog_1 = dialog_1_1;
24
- },
25
- function (rxjs_1_1) {
26
- rxjs_1 = rxjs_1_1;
27
- },
28
- function (operators_1_1) {
29
- operators_1 = operators_1_1;
30
- },
31
- function (platform_browser_1_1) {
32
- platform_browser_1 = platform_browser_1_1;
33
- },
34
- function (stratus_1_1) {
35
- stratus_1 = stratus_1_1;
36
- },
37
- function (lodash_1_1) {
38
- lodash_1 = lodash_1_1;
39
- },
40
- function (root_component_1_1) {
41
- root_component_1 = root_component_1_1;
42
- },
43
- function (citation_dialog_component_1_1) {
44
- citation_dialog_component_1 = citation_dialog_component_1_1;
45
- },
46
- function (link_dialog_component_1_1) {
47
- link_dialog_component_1 = link_dialog_component_1_1;
48
- },
49
- function (media_dialog_component_1_1) {
50
- media_dialog_component_1 = media_dialog_component_1_1;
51
- },
52
- function (registry_1_1) {
53
- registry_1 = registry_1_1;
54
- },
55
- function (environment_1_1) {
56
- environment_1 = environment_1_1;
57
- },
58
- function (eventManager_1_1) {
59
- eventManager_1 = eventManager_1_1;
60
- },
61
- function (code_view_dialog_component_1_1) {
62
- code_view_dialog_component_1 = code_view_dialog_component_1_1;
63
- },
64
- function (_1) {
65
- },
66
- function (_2) {
149
+ codeMirror: {
150
+ fromTextArea: (el, opts) => {
151
+ return new CodeMirrorBridge({
152
+ extensions: [
153
+ basicSetup,
154
+ html({}),
155
+ EditorView.lineWrapping
156
+ ]
157
+ }).fromTextArea(el, opts);
158
+ }
67
159
  },
68
- function (_3) {
160
+ codeMirrorOptions: {
161
+ indentWithTabs: false,
162
+ lineNumbers: true,
163
+ lineWrapping: true,
164
+ mode: 'text/html',
165
+ tabMode: 'space',
166
+ tabSize: 4
69
167
  },
70
- function (_4) {
168
+ fileInsertButtons: [
169
+ 'fileBack',
170
+ ],
171
+ fileUploadURL: 'https://app.sitetheory.io/?session=' + cookie('SITETHEORY'),
172
+ fontFamily: {
173
+ 'Arial,Helvetica,sans-serif': 'Arial',
174
+ 'Georgia,serif': 'Georgia',
175
+ 'Impact,Charcoal,sans-serif': 'Impact',
176
+ 'Tahoma,Geneva,sans-serif': 'Tahoma',
177
+ '"Times New Roman",Times,serif': 'Times New Roman',
178
+ 'Verdana,Geneva,sans-serif': 'Verdana'
71
179
  },
72
- function (_5) {
180
+ heightMax: window.innerHeight || document.documentElement.clientHeight || 500,
181
+ htmlAllowedAttrs: [
182
+ 'aria-.+',
183
+ 'data-.+',
184
+ 'ng-.+',
185
+ 'stratus-.+',
186
+ 'sa-.+',
187
+ 'accept', 'accept-charset', 'accesskey', 'action', 'align', 'allow', 'allowfullscreen',
188
+ 'allowtransparency', 'alt', 'async', 'autocomplete', 'autofocus',
189
+ 'autoplay', 'autosave',
190
+ 'background', 'bgcolor', 'border',
191
+ 'charset', 'cellpadding', 'cellspacing', 'checked', 'cite', 'class', 'color',
192
+ 'cols', 'colspan', 'content', 'contenteditable', 'contextmenu', 'controls',
193
+ 'coords',
194
+ 'data', 'datetime', 'default', 'defer', 'dir', 'dirname',
195
+ 'disabled', 'download', 'draggable', 'dropzone',
196
+ 'enctype',
197
+ 'for', 'form', 'formaction', 'frameborder',
198
+ 'headers', 'height', 'hidden', 'high', 'href', 'hreflang', 'http-equiv',
199
+ 'icon', 'id', 'ismap', 'itemprop',
200
+ 'keytype', 'kind',
201
+ 'label', 'lang', 'language', 'list', 'loop', 'low',
202
+ 'max', 'maxlength', 'media', 'method', 'min', 'mozallowfullscreen', 'multiple',
203
+ 'muted',
204
+ 'name', 'novalidate',
205
+ 'open', 'optimum',
206
+ 'pattern', 'ping', 'placeholder', 'playsinline', 'poster', 'preload', 'pubdate',
207
+ 'radiogroup', 'readonly', 'rel', 'required', 'reversed', 'rows', 'rowspan',
208
+ 'sandbox', 'scope', 'scoped', 'scrolling', 'seamless', 'selected', 'shape',
209
+ 'size', 'sizes', 'span', 'src', 'srcdoc', 'srclang', 'srcset', 'start', 'step',
210
+ 'summary', 'spellcheck', 'style',
211
+ 'tabindex', 'target', 'title', 'type', 'translate',
212
+ 'usemap',
213
+ 'value', 'valign',
214
+ 'webkitallowfullscreen', 'width', 'wrap',
215
+ 'xmlns',
216
+ 'xmlns:xlink',
217
+ 'accent-height', 'accumulate', 'additive', 'alignment-baseline', 'alphabetic', 'amplitude', 'arabic-form', 'ascent',
218
+ 'attributeName', 'attributeType', 'azimuth',
219
+ 'baseFrequency', 'baseline-shift', 'baseProfile', 'bbox', 'begin', 'bias', 'by',
220
+ 'calcMode', 'cap-height', 'clip', 'clipPathUnits', 'clip-path', 'clip-rule', 'color-interpolation',
221
+ 'color-interpolation-filters', 'color-profile', 'color-rendering', 'contentScriptType', 'contentStyleType', 'crossorigin',
222
+ 'cursor', 'cx', 'cy',
223
+ 'd', 'decelerate', 'descent', 'diffuseConstant', 'direction', 'display', 'divisor', 'dominant-baseline', 'dur', 'dx', 'dy',
224
+ 'edgeMode', 'elevation', 'enable-background', 'end', 'exponent', 'externalResourcesRequired',
225
+ 'fill', 'fill-opacity', 'fill-rule', 'filter', 'filterRes', 'filterUnits', 'flood-color', 'flood-opacity', 'font-family',
226
+ 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'format', 'from',
227
+ 'fr', 'fx', 'fy',
228
+ 'g1', 'g2', 'glyph-name', 'glyph-orientation-horizontal', 'glyph-orientation-vertical', 'glyphRef', 'gradientTransform',
229
+ 'gradientUnits',
230
+ 'hanging', 'horiz-adv-x', 'horiz-origin-x',
231
+ 'ideographic', 'image-rendering', 'in', 'in2', 'intercept',
232
+ 'k', 'k1', 'k2', 'k3', 'k4', 'kernelMatrix', 'kernelUnitLength', 'kerning', 'keyPoints', 'keySplines', 'keyTimes',
233
+ 'lengthAdjust', 'letter-spacing', 'lighting-color', 'limitingConeAngle', 'local',
234
+ 'marker-end', 'marker-mid', 'marker-start', 'markerHeight', 'markerUnits', 'markerWidth', 'mask', 'maskContentUnits',
235
+ 'maskUnits', 'mathematical', 'mode',
236
+ 'numOctaves',
237
+ 'offset', 'opacity', 'operator', 'order', 'orient', 'orientation', 'origin', 'overflow', 'overline-position',
238
+ 'overline-thickness',
239
+ 'panose-1', 'paint-order', 'path', 'pathLength', 'patternContentUnits', 'patternTransform', 'patternUnits', 'pointer-events',
240
+ 'points', 'pointsAtX', 'pointsAtY', 'pointsAtZ', 'preserveAlpha', 'preserveAspectRatio', 'primitiveUnits',
241
+ 'r', 'radius', 'referrerPolicy', 'refX', 'refY', 'rendering-intent', 'repeatCount', 'repeatDur', 'requiredExtensions',
242
+ 'requiredFeatures', 'restart', 'result', 'rotate', 'rx', 'ry',
243
+ 'scale', 'seed', 'shape-rendering', 'slope', 'spacing', 'specularConstant', 'specularExponent', 'speed', 'spreadMethod',
244
+ 'startOffset', 'stdDeviation', 'stemh', 'stemv', 'stitchTiles', 'stop-color', 'stop-opacity', 'strikethrough-position',
245
+ 'strikethrough-thickness', 'string', 'stroke', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin',
246
+ 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'surfaceScale', 'systemLanguage',
247
+ 'tableValues', 'targetX', 'targetY', 'text-anchor', 'text-decoration', 'text-rendering', 'textLength', 'to', 'transform',
248
+ 'transform-origin',
249
+ 'u1', 'u2', 'underline-position', 'underline-thickness', 'unicode', 'unicode-bidi', 'unicode-range', 'units-per-em',
250
+ 'v-alphabetic', 'v-hanging', 'v-ideographic', 'v-mathematical', 'values', 'vector-effect', 'version', 'vert-adv-y',
251
+ 'vert-origin-x', 'vert-origin-y', 'viewBox', 'viewTarget', 'visibility',
252
+ 'widths', 'word-spacing', 'writing-mode',
253
+ 'x', 'x-height', 'x1', 'x2', 'xChannelSelector',
254
+ 'xlink:actuate', 'xlink:arcrole', 'xlink:href', 'xlink:role', 'xlink:show',
255
+ 'xlink:title', 'xlink:type', 'xml:base', 'xml:lang', 'xml:space',
256
+ 'y', 'y1', 'y2', 'yChannelSelector',
257
+ 'z', 'zoomAndPan'
258
+ ],
259
+ htmlAllowedEmptyTags: [
260
+ 'textarea', 'a', 'iframe', 'object', 'video', 'style', 'script',
261
+ 'hr', 'div',
262
+ 'animate', 'animateMotion', 'animateTransform', 'circle', 'clipPath', 'defs', 'desc', 'discard', 'ellipse',
263
+ 'feBlend', 'feColorMatrix', 'feComponentTransfer', 'feComposite', 'feConvolveMatrix', 'feDiffuseLighting',
264
+ 'feDisplacementMap', 'feDistantLight', 'feDropShadow', 'feFlood', 'feFuncA', 'feFuncB', 'feFuncG',
265
+ 'feFuncR', 'feGaussianBlur', 'feImage', 'feMerge', 'feMergeNode', 'feMorphology', 'feOffset',
266
+ 'fePointLight', 'feSpecularLighting', 'feSpotLight', 'feTile', 'feTurbulence',
267
+ 'filter', 'foreignObject', 'g', 'image', 'line', 'linearGradient', 'marker', 'mask', 'metadata', 'mpath',
268
+ 'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'set', 'stop', 'svg', 'switch',
269
+ 'symbol', 'text', 'textPath', 'tspan', 'unknown', 'use', 'view',
270
+ 'ng-app', 'ng-bind', 'ng-bind-html', 'ng-bind-template', 'ng-blur', 'ng-change', 'ng-checked', 'ng-class', 'ng-class-even',
271
+ 'ng-class-odd', 'ng-click', 'ng-cloak', 'ng-controller', 'ng-copy', 'ng-csp', 'ng-cut', 'ng-dblclick', 'ng-disabled',
272
+ 'ng-focus', 'ng-form', 'ng-hide', 'ng-href', 'ng-if', 'ng-include', 'ng-init', 'ng-jq', 'ng-keydown', 'ng-keypress', 'ng-keyup',
273
+ 'ng-list', 'ng-maxlength', 'ng-minlength', 'ng-model', 'ng-model-options', 'ng-mousedown', 'ng-mouseenter', 'ng-mouseleave',
274
+ 'ng-mousemove', 'ng-mouseover', 'ng-mouseup', 'ng-non-bindable', 'ng-on', 'ng-open', 'ng-options', 'ng-paste', 'ng-pattern',
275
+ 'ng-pluralize', 'ng-prop', 'ng-readonly', 'ng-ref', 'ng-repeat', 'ng-required', 'ng-selected', 'ng-show', 'ng-src', 'ng-srcset',
276
+ 'ng-style', 'ng-submit', 'ng-switch', 'ng-transclude', 'ng-value', 'ng-animate-children', 'ng-animate-swap', 'ng-outlet',
277
+ 'ng-message', 'ng-message-default', 'ng-message-exp', 'ng-messages', 'ng-messages-include', 'ng-view', 'ng-swipe-left',
278
+ 'ng-swipe-right',
279
+ 'md-autocomplete', 'md-autofocus', 'md-button', 'md-calendar', 'md-card', 'md-checkbox', 'md-chip', 'md-chip-remove',
280
+ 'md-chips', 'md-colors', 'md-contact-chips', 'md-content', 'md-datepicker', 'md-dialog', 'md-divider', 'md-fab-actions',
281
+ 'md-fab-speed-dial', 'md-fab-toolbar', 'md-force-height', 'md-grid-list', 'md-grid-tile', 'md-highlight-text', 'md-icon',
282
+ 'md-ink-ripple', 'md-input', 'md-input-container', 'md-list', 'md-list-item', 'md-menu', 'md-menu-bar', 'md-nav-bar',
283
+ 'md-nav-item', 'md-optgroup', 'md-option', 'md-progress-circular', 'md-progress-linear', 'md-radio-button', 'md-radio-group',
284
+ 'md-select', 'md-select-on-focus', 'md-sidenav', 'md-slider', 'md-slider-container', 'md-subheader', 'md-swipe-down',
285
+ 'md-swipe-left', 'md-swipe-right', 'md-swipe-up', 'md-switch', 'md-tab', 'md-tabs', 'md-toolbar', 'md-tooltip', 'md-truncate',
286
+ 'md-virtual-repeat', 'md-virtual-repeat-container', 'md-whiteframe',
287
+ 'md-svg-src',
288
+ 'stratus-citation-notitle',
289
+ 'sa-boot',
290
+ 'sa-editor',
291
+ 'sa-map',
292
+ 'sa-media-selector',
293
+ 'sa-selector',
294
+ 'sa-stripe-payment-method-list',
295
+ 'sa-stripe-payment-method-selector',
296
+ 'sa-tree',
297
+ ],
298
+ htmlAllowedStyleProps: [
299
+ '.*'
300
+ ],
301
+ htmlAllowedTags: [
302
+ 'a', 'abbr', 'address', 'area', 'article', 'aside', 'audio',
303
+ 'b', 'base', 'bdi', 'bdo', 'blockquote', 'br', 'button',
304
+ 'canvas', 'caption', 'cite', 'code', 'col', 'colgroup',
305
+ 'datalist', 'dd', 'del', 'details', 'dfn', 'dialog', 'div', 'dl', 'dt',
306
+ 'em', 'embed',
307
+ 'fieldset', 'figcaption', 'figure', 'footer', 'form',
308
+ 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'header', 'hgroup', 'hr',
309
+ 'i', 'iframe', 'img', 'input', 'ins',
310
+ 'kbd', 'keygen',
311
+ 'label', 'legend', 'li', 'link',
312
+ 'main', 'map', 'mark', 'menu', 'menuitem', 'meter',
313
+ 'nav', 'noscript',
314
+ 'object', 'ol', 'optgroup', 'option', 'output',
315
+ 'p', 'param', 'pre', 'progress',
316
+ 'queue',
317
+ 'rp', 'rt', 'ruby',
318
+ 's', 'samp', 'script', 'style', 'section', 'select', 'small',
319
+ 'source', 'span', 'strike', 'strong', 'sub', 'summary', 'sup',
320
+ 'table', 'tbody', 'td', 'textarea', 'tfoot', 'th', 'thead', 'time', 'title', 'tr', 'track',
321
+ 'u', 'ul',
322
+ 'var', 'video',
323
+ 'wbr',
324
+ 'animate', 'animateMotion', 'animateTransform', 'circle', 'clipPath', 'defs', 'desc', 'discard', 'ellipse',
325
+ 'feBlend', 'feColorMatrix', 'feComponentTransfer', 'feComposite', 'feConvolveMatrix', 'feDiffuseLighting',
326
+ 'feDisplacementMap', 'feDistantLight', 'feDropShadow', 'feFlood', 'feFuncA', 'feFuncB', 'feFuncG',
327
+ 'feFuncR', 'feGaussianBlur', 'feImage', 'feMerge', 'feMergeNode', 'feMorphology', 'feOffset',
328
+ 'fePointLight', 'feSpecularLighting', 'feSpotLight', 'feTile', 'feTurbulence',
329
+ 'filter', 'foreignObject', 'g', 'image', 'line', 'linearGradient', 'marker', 'mask', 'metadata', 'mpath',
330
+ 'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'set', 'stop', 'svg', 'switch',
331
+ 'symbol', 'text', 'textPath', 'tspan', 'unknown', 'use', 'view',
332
+ 'ng-app', 'ng-bind', 'ng-bind-html', 'ng-bind-template', 'ng-blur', 'ng-change', 'ng-checked', 'ng-class', 'ng-class-even',
333
+ 'ng-class-odd', 'ng-click', 'ng-cloak', 'ng-controller', 'ng-copy', 'ng-csp', 'ng-cut', 'ng-dblclick', 'ng-disabled',
334
+ 'ng-focus', 'ng-form', 'ng-hide', 'ng-href', 'ng-if', 'ng-include', 'ng-init', 'ng-jq', 'ng-keydown', 'ng-keypress', 'ng-keyup',
335
+ 'ng-list', 'ng-maxlength', 'ng-minlength', 'ng-model', 'ng-model-options', 'ng-mousedown', 'ng-mouseenter', 'ng-mouseleave',
336
+ 'ng-mousemove', 'ng-mouseover', 'ng-mouseup', 'ng-non-bindable', 'ng-on', 'ng-open', 'ng-options', 'ng-paste', 'ng-pattern',
337
+ 'ng-pluralize', 'ng-prop', 'ng-readonly', 'ng-ref', 'ng-repeat', 'ng-required', 'ng-selected', 'ng-show', 'ng-src', 'ng-srcset',
338
+ 'ng-style', 'ng-submit', 'ng-switch', 'ng-transclude', 'ng-value', 'ng-animate-children', 'ng-animate-swap', 'ng-outlet',
339
+ 'ng-message', 'ng-message-default', 'ng-message-exp', 'ng-messages', 'ng-messages-include', 'ng-view', 'ng-swipe-left',
340
+ 'ng-swipe-right',
341
+ 'md-autocomplete', 'md-autofocus', 'md-button', 'md-calendar', 'md-card', 'md-checkbox', 'md-chip', 'md-chip-remove',
342
+ 'md-chips', 'md-colors', 'md-contact-chips', 'md-content', 'md-datepicker', 'md-dialog', 'md-divider', 'md-fab-actions',
343
+ 'md-fab-speed-dial', 'md-fab-toolbar', 'md-force-height', 'md-grid-list', 'md-grid-tile', 'md-highlight-text', 'md-icon',
344
+ 'md-ink-ripple', 'md-input', 'md-input-container', 'md-list', 'md-list-item', 'md-menu', 'md-menu-bar', 'md-nav-bar',
345
+ 'md-nav-item', 'md-optgroup', 'md-option', 'md-progress-circular', 'md-progress-linear', 'md-radio-button', 'md-radio-group',
346
+ 'md-select', 'md-select-on-focus', 'md-sidenav', 'md-slider', 'md-slider-container', 'md-subheader', 'md-swipe-down',
347
+ 'md-swipe-left', 'md-swipe-right', 'md-swipe-up', 'md-switch', 'md-tab', 'md-tabs', 'md-toolbar', 'md-tooltip', 'md-truncate',
348
+ 'md-virtual-repeat', 'md-virtual-repeat-container', 'md-whiteframe',
349
+ 'md-svg-src',
350
+ 'sa-boot',
351
+ 'sa-editor',
352
+ 'sa-map',
353
+ 'sa-media-selector',
354
+ 'sa-selector',
355
+ 'sa-stripe-payment-method-list',
356
+ 'sa-stripe-payment-method-selector',
357
+ 'sa-tree',
358
+ 'stratus-.+',
359
+ ],
360
+ htmlRemoveTags: [],
361
+ htmlSimpleAmpersand: false,
362
+ imageInsertButtons: [
363
+ 'imageBack',
364
+ '|',
365
+ 'imageUpload',
366
+ 'imageByURL',
367
+ ],
368
+ imageUpload: true,
369
+ imageUploadRemoteUrls: true,
370
+ imageUploadURL: 'https://app.sitetheory.io/?session=' + cookie('SITETHEORY'),
371
+ imageManagerPageSize: 20,
372
+ imageManagerScrollOffset: 10,
373
+ imageManagerLoadMethod: 'GET',
374
+ imageManagerLoadURL: '/Api/Media?payload-only=true',
375
+ linkEditButtons: [
376
+ 'linkOpen',
377
+ 'linkManagerEdit',
378
+ 'linkRemove',
379
+ ],
380
+ linkInsertButtons: [
381
+ 'linkBack',
382
+ ],
383
+ multiLine: true,
384
+ paragraphStyles: {
385
+ btn: 'Button',
386
+ header: 'Header',
387
+ title: 'Title',
388
+ 'alt-title': 'Alt Title (over)',
389
+ subtitle: 'Subtitle',
390
+ pullout: 'Pullout Quote',
73
391
  },
74
- function (_6) {
392
+ pasteDeniedAttrs: [
393
+ 'id',
394
+ 'class',
395
+ 'style',
396
+ 'dir',
397
+ 'data-.+',
398
+ 'aria-.+',
399
+ 'ng-.+',
400
+ 'stratus-.+',
401
+ 'sa-.+'
402
+ ],
403
+ pasteDeniedTags: [
404
+ 'form', 'input', 'label',
405
+ 'style'
406
+ ],
407
+ pastePlain: false,
408
+ pluginsEnabled: [
409
+ 'align',
410
+ 'charCounter',
411
+ 'codeBeautifier',
412
+ 'codeView',
413
+ 'colors',
414
+ 'draggable',
415
+ 'embedly',
416
+ 'entities',
417
+ 'file',
418
+ 'fontAwesome',
419
+ 'fontFamily',
420
+ 'fontSize',
421
+ 'fullscreen',
422
+ 'help',
423
+ 'image',
424
+ 'imageTUI',
425
+ 'inlineStyle',
426
+ 'inlineClass',
427
+ 'lineBreaker',
428
+ 'link',
429
+ 'linkManager',
430
+ 'citationManager',
431
+ 'lists',
432
+ 'mediaManager',
433
+ 'paragraphFormat',
434
+ 'paragraphStyle',
435
+ 'print',
436
+ 'quickInsert',
437
+ 'quote',
438
+ 'save',
439
+ 'specialCharacters',
440
+ 'table',
441
+ 'url',
442
+ 'video',
443
+ 'wordPaste',
444
+ ],
445
+ quickInsertButtons: [
446
+ 'media',
447
+ 'link',
448
+ 'video',
449
+ 'embedly',
450
+ 'table',
451
+ 'ul',
452
+ 'ol',
453
+ 'hr'
454
+ ],
455
+ scrollableContainer: Stratus.Environment.get('viewPort') || 'body',
456
+ spellcheck: true,
457
+ toolbarSticky: true,
458
+ toolbarButtons: {
459
+ moreText: {
460
+ buttons: this.froalaStandardButtons.moreText,
461
+ buttonsVisible: 3
462
+ },
463
+ moreParagraph: {
464
+ buttons: this.froalaStandardButtons.moreParagraph,
465
+ buttonsVisible: 8
466
+ },
467
+ moreRich: {
468
+ buttons: this.froalaStandardButtons.moreRich,
469
+ buttonsVisible: 1
470
+ },
471
+ moreMisc: {
472
+ buttons: this.froalaStandardButtons.moreMisc,
473
+ align: 'right',
474
+ buttonsVisible: 1
475
+ }
75
476
  },
76
- function (_7) {
477
+ toolbarButtonsSM: {
478
+ moreText: {
479
+ buttons: this.froalaStandardButtons.moreText,
480
+ buttonsVisible: 3
481
+ },
482
+ moreParagraph: {
483
+ buttons: this.froalaStandardButtons.moreParagraph,
484
+ buttonsVisible: 0
485
+ },
486
+ moreRich: {
487
+ buttons: this.froalaStandardButtons.moreRich,
488
+ buttonsVisible: 3
489
+ },
490
+ moreMisc: {
491
+ buttons: this.froalaStandardButtons.moreMisc,
492
+ align: 'right',
493
+ buttonsVisible: 0
494
+ }
77
495
  },
78
- function (_8) {
496
+ toolbarButtonsXS: {
497
+ moreText: {
498
+ buttons: this.froalaStandardButtons.moreText,
499
+ buttonsVisible: 0
500
+ },
501
+ moreParagraph: {
502
+ buttons: this.froalaStandardButtons.moreParagraph,
503
+ buttonsVisible: 0
504
+ },
505
+ moreRich: {
506
+ buttons: this.froalaStandardButtons.moreRich,
507
+ buttonsVisible: 0
508
+ },
509
+ moreMisc: {
510
+ buttons: this.froalaStandardButtons.moreMisc,
511
+ align: 'right',
512
+ buttonsVisible: 0
513
+ }
79
514
  },
80
- function (_9) {
515
+ useClasses: true,
516
+ videoInsertButtons: [
517
+ 'videoBack',
518
+ '|',
519
+ 'videoByURL',
520
+ 'videoEmbed',
521
+ 'videoUpload',
522
+ ],
523
+ videoUpload: true,
524
+ videoUploadURL: 'https://app.sitetheory.io/?session=' + cookie('SITETHEORY')
525
+ };
526
+ this.uid = _.uniqueId(`sa_${_.snakeCase(moduleName)}_component_`);
527
+ Stratus.Instances[this.uid] = this;
528
+ Stratus.Internals.LoadCss([
529
+ `${localDir}${moduleName}/${moduleName}.component${min}.css`,
530
+ `${froalaDir}css/froala_editor.pkgd${min}.css`,
531
+ `${froalaDir}css/third_party/embedly${min}.css`,
532
+ `${froalaDir}css/third_party/font_awesome${min}.css`,
533
+ `${froalaDir}css/third_party/image_tui${min}.css`,
534
+ ]).then(() => {
535
+ this.styled = true;
536
+ this.refresh();
537
+ }).catch((e) => {
538
+ console.error(e);
539
+ console.warn('Issue detected in CSS Loader for Component:', this.uid);
540
+ this.styled = true;
541
+ this.refresh();
542
+ });
543
+ this.hydrate(elementRef, sanitizer, ["title", "uid", "dev", "debug", "editor", "target", "targetSuffix", "id", "manifest", "decouple", "direct", "api", "urlRoot", "property", "_", "has", "log", "Stratus", "registry", "fetched", "data", "collection", "model", "dataSub", "onChange", "subscriber", "svgIcons", "initialized", "styled", "blurred", "focused", "codeViewIsOpen", "form", "dataChangeLog", "dataString", "debounceSave", "debounceTime", "forceSave", "froalaEditorDirective", "froalaButtons", "froalaStandardButtons", "froalaConfig", "sanitizer", "ref", "elementRef", "fb", "dialog", "ngOnInit", "modelSave", "listDuplicates", "normalizeIn", "normalizeOut", "changeImgSize", "handleError", "fetchData", "dataDefer", "dataRef", "onDataChange", "created", "changedEditor", "onChangeEvent", "onFocus", "onBlur", "bypassHTML", "trigger", "openCitationDialog", "openLinkDialog", "openMediaDialog", "openCodeViewDialog", "hydrate", "disableRefresh", "stagger", "reloading", "refresh", "ngOnDestroy"]);
544
+ this.fetchData()
545
+ .then(data => {
546
+ if (!data || !(data instanceof EventManager)) {
547
+ console.warn('Unable to bind data from Registry!');
548
+ return;
81
549
  }
82
- ],
83
- execute: function () {
84
- systemPackage = '@stratusjs/angular';
85
- froalaPackage = 'froala-editor';
86
- moduleName = 'editor';
87
- min = !environment_1.cookie('env') ? '.min' : '';
88
- localDir = `${stratus_1.Stratus.BaseUrl}${boot.configuration.paths[`${systemPackage}/*`].replace(/[^\/]*$/, '').replace(/\/dist\/$/, '/src/')}`;
89
- froalaDir = `${stratus_1.Stratus.BaseUrl}${boot.configuration.paths[froalaPackage].replace(/js\/[^\/]*$/, '')}`;
90
- has = (object, path) => lodash_1.default.has(object, path) && !lodash_1.default.isEmpty(lodash_1.default.get(object, path));
91
- EditorComponent = class EditorComponent extends root_component_1.RootComponent {
92
- constructor(sanitizer, ref, elementRef, fb, dialog) {
93
- super();
94
- this.sanitizer = sanitizer;
95
- this.ref = ref;
96
- this.elementRef = elementRef;
97
- this.fb = fb;
98
- this.dialog = dialog;
99
- this.title = moduleName + '_component';
100
- this.dev = !!environment_1.cookie('env');
101
- this.editor = 'froala';
102
- this._ = lodash_1.default;
103
- this.has = has;
104
- this.log = console.log;
105
- this.Stratus = stratus_1.Stratus;
106
- this.registry = new registry_1.Registry();
107
- this.onChange = new rxjs_1.Subject();
108
- this.svgIcons = {};
109
- this.initialized = false;
110
- this.styled = false;
111
- this.blurred = false;
112
- this.focused = false;
113
- this.form = this.fb.group({
114
- dataString: new forms_1.FormControl(),
115
- });
116
- this.dataChangeLog = [];
117
- this.dataString = '';
118
- this.debounceSave = true;
119
- this.debounceTime = 5000;
120
- this.forceSave = true;
121
- this.froalaButtons = [
122
- 'bold', 'italic', 'underline', 'strikeThrough', 'subscript', 'superscript', '|', 'formatBlock',
123
- 'blockStyle', 'inlineStyle', 'paragraphStyle', 'paragraphFormat', 'align', 'formatOL',
124
- 'formatUL', 'outdent', 'indent', '|', 'insertLink', 'insertImage', 'insertVideo', 'insertFile',
125
- 'insertTable', '|', 'undo', 'redo', 'removeFormat', 'wordPaste', 'help', 'html', 'fullscreen'
126
- ];
127
- this.froalaStandardButtons = {
128
- moreText: [
129
- 'bold',
130
- 'italic',
131
- 'underline',
132
- 'strikeThrough',
133
- 'subscript',
134
- 'superscript',
135
- 'fontFamily',
136
- 'fontSize',
137
- 'textColor',
138
- 'backgroundColor',
139
- 'inlineClass',
140
- 'inlineStyle',
141
- 'clearFormatting'
142
- ],
143
- moreParagraph: [
144
- 'linkManager',
145
- 'formatOL',
146
- 'formatUL',
147
- 'indent',
148
- 'outdent',
149
- 'quote',
150
- 'paragraphFormat',
151
- 'paragraphStyle',
152
- 'alignLeft',
153
- 'alignCenter',
154
- 'alignRight',
155
- 'alignJustify',
156
- ],
157
- moreRich: [
158
- 'mediaManager',
159
- 'insertTable',
160
- 'insertImage',
161
- 'insertVideo',
162
- 'insertFile',
163
- 'citationInsert',
164
- 'insertHR',
165
- 'specialCharacters',
166
- ],
167
- moreMisc: [
168
- 'html',
169
- 'undo',
170
- 'redo',
171
- 'fullscreen',
172
- 'print',
173
- 'selectAll',
174
- 'help'
175
- ],
176
- };
177
- this.froalaConfig = {
178
- attribution: false,
179
- key: stratus_1.Stratus.Environment.get('froalaKey'),
180
- zIndex: 9999,
181
- events: {
182
- initialized: (froalaEditorDirective) => {
183
- this.froalaEditorDirective = froalaEditorDirective;
184
- },
185
- },
186
- codeBeautifierOptions: {
187
- end_with_newline: true,
188
- indent_inner_html: true,
189
- extra_liners: '["p", "h1", "h2", "h3", "h4", "h5", "h6", "blockquote", "pre", "ul", "ol", "table", "dl"]',
190
- brace_style: 'expand',
191
- indent_char: ' ',
192
- indent_size: 4,
193
- wrap_line_length: 0
194
- },
195
- fileInsertButtons: [
196
- 'fileBack',
197
- ],
198
- fileUploadURL: 'https://app.sitetheory.io/?session=' + environment_1.cookie('SITETHEORY'),
199
- fontFamily: {
200
- 'Arial,Helvetica,sans-serif': 'Arial',
201
- 'Georgia,serif': 'Georgia',
202
- 'Impact,Charcoal,sans-serif': 'Impact',
203
- 'Tahoma,Geneva,sans-serif': 'Tahoma',
204
- '"Times New Roman",Times,serif': 'Times New Roman',
205
- 'Verdana,Geneva,sans-serif': 'Verdana'
206
- },
207
- heightMax: window.innerHeight || document.documentElement.clientHeight || 500,
208
- htmlAllowedAttrs: [
209
- 'aria-.+',
210
- 'data-.+',
211
- 'ng-.+',
212
- 'stratus-.+',
213
- 'sa-.+',
214
- 'accept', 'accept-charset', 'accesskey', 'action', 'align', 'allow', 'allowfullscreen',
215
- 'allowtransparency', 'alt', 'async', 'autocomplete', 'autofocus',
216
- 'autoplay', 'autosave',
217
- 'background', 'bgcolor', 'border',
218
- 'charset', 'cellpadding', 'cellspacing', 'checked', 'cite', 'class', 'color',
219
- 'cols', 'colspan', 'content', 'contenteditable', 'contextmenu', 'controls',
220
- 'coords',
221
- 'data', 'datetime', 'default', 'defer', 'dir', 'dirname',
222
- 'disabled', 'download', 'draggable', 'dropzone',
223
- 'enctype',
224
- 'for', 'form', 'formaction', 'frameborder',
225
- 'headers', 'height', 'hidden', 'high', 'href', 'hreflang', 'http-equiv',
226
- 'icon', 'id', 'ismap', 'itemprop',
227
- 'keytype', 'kind',
228
- 'label', 'lang', 'language', 'list', 'loop', 'low',
229
- 'max', 'maxlength', 'media', 'method', 'min', 'mozallowfullscreen', 'multiple',
230
- 'muted',
231
- 'name', 'novalidate',
232
- 'open', 'optimum',
233
- 'pattern', 'ping', 'placeholder', 'playsinline', 'poster', 'preload', 'pubdate',
234
- 'radiogroup', 'readonly', 'rel', 'required', 'reversed', 'rows', 'rowspan',
235
- 'sandbox', 'scope', 'scoped', 'scrolling', 'seamless', 'selected', 'shape',
236
- 'size', 'sizes', 'span', 'src', 'srcdoc', 'srclang', 'srcset', 'start', 'step',
237
- 'summary', 'spellcheck', 'style',
238
- 'tabindex', 'target', 'title', 'type', 'translate',
239
- 'usemap',
240
- 'value', 'valign',
241
- 'webkitallowfullscreen', 'width', 'wrap',
242
- 'xmlns',
243
- 'xmlns:xlink',
244
- 'accent-height', 'accumulate', 'additive', 'alignment-baseline', 'alphabetic', 'amplitude', 'arabic-form', 'ascent',
245
- 'attributeName', 'attributeType', 'azimuth',
246
- 'baseFrequency', 'baseline-shift', 'baseProfile', 'bbox', 'begin', 'bias', 'by',
247
- 'calcMode', 'cap-height', 'clip', 'clipPathUnits', 'clip-path', 'clip-rule', 'color-interpolation',
248
- 'color-interpolation-filters', 'color-profile', 'color-rendering', 'contentScriptType', 'contentStyleType', 'crossorigin',
249
- 'cursor', 'cx', 'cy',
250
- 'd', 'decelerate', 'descent', 'diffuseConstant', 'direction', 'display', 'divisor', 'dominant-baseline', 'dur', 'dx', 'dy',
251
- 'edgeMode', 'elevation', 'enable-background', 'end', 'exponent', 'externalResourcesRequired',
252
- 'fill', 'fill-opacity', 'fill-rule', 'filter', 'filterRes', 'filterUnits', 'flood-color', 'flood-opacity', 'font-family',
253
- 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'format', 'from',
254
- 'fr', 'fx', 'fy',
255
- 'g1', 'g2', 'glyph-name', 'glyph-orientation-horizontal', 'glyph-orientation-vertical', 'glyphRef', 'gradientTransform',
256
- 'gradientUnits',
257
- 'hanging', 'horiz-adv-x', 'horiz-origin-x',
258
- 'ideographic', 'image-rendering', 'in', 'in2', 'intercept',
259
- 'k', 'k1', 'k2', 'k3', 'k4', 'kernelMatrix', 'kernelUnitLength', 'kerning', 'keyPoints', 'keySplines', 'keyTimes',
260
- 'lengthAdjust', 'letter-spacing', 'lighting-color', 'limitingConeAngle', 'local',
261
- 'marker-end', 'marker-mid', 'marker-start', 'markerHeight', 'markerUnits', 'markerWidth', 'mask', 'maskContentUnits',
262
- 'maskUnits', 'mathematical', 'mode',
263
- 'numOctaves',
264
- 'offset', 'opacity', 'operator', 'order', 'orient', 'orientation', 'origin', 'overflow', 'overline-position',
265
- 'overline-thickness',
266
- 'panose-1', 'paint-order', 'path', 'pathLength', 'patternContentUnits', 'patternTransform', 'patternUnits', 'pointer-events',
267
- 'points', 'pointsAtX', 'pointsAtY', 'pointsAtZ', 'preserveAlpha', 'preserveAspectRatio', 'primitiveUnits',
268
- 'r', 'radius', 'referrerPolicy', 'refX', 'refY', 'rendering-intent', 'repeatCount', 'repeatDur', 'requiredExtensions',
269
- 'requiredFeatures', 'restart', 'result', 'rotate', 'rx', 'ry',
270
- 'scale', 'seed', 'shape-rendering', 'slope', 'spacing', 'specularConstant', 'specularExponent', 'speed', 'spreadMethod',
271
- 'startOffset', 'stdDeviation', 'stemh', 'stemv', 'stitchTiles', 'stop-color', 'stop-opacity', 'strikethrough-position',
272
- 'strikethrough-thickness', 'string', 'stroke', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin',
273
- 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'surfaceScale', 'systemLanguage',
274
- 'tableValues', 'targetX', 'targetY', 'text-anchor', 'text-decoration', 'text-rendering', 'textLength', 'to', 'transform',
275
- 'transform-origin',
276
- 'u1', 'u2', 'underline-position', 'underline-thickness', 'unicode', 'unicode-bidi', 'unicode-range', 'units-per-em',
277
- 'v-alphabetic', 'v-hanging', 'v-ideographic', 'v-mathematical', 'values', 'vector-effect', 'version', 'vert-adv-y',
278
- 'vert-origin-x', 'vert-origin-y', 'viewBox', 'viewTarget', 'visibility',
279
- 'widths', 'word-spacing', 'writing-mode',
280
- 'x', 'x-height', 'x1', 'x2', 'xChannelSelector',
281
- 'xlink:actuate', 'xlink:arcrole', 'xlink:href', 'xlink:role', 'xlink:show',
282
- 'xlink:title', 'xlink:type', 'xml:base', 'xml:lang', 'xml:space',
283
- 'y', 'y1', 'y2', 'yChannelSelector',
284
- 'z', 'zoomAndPan'
285
- ],
286
- htmlAllowedEmptyTags: [
287
- 'textarea', 'a', 'iframe', 'object', 'video', 'style', 'script',
288
- 'hr', 'div',
289
- 'animate', 'animateMotion', 'animateTransform', 'circle', 'clipPath', 'defs', 'desc', 'discard', 'ellipse',
290
- 'feBlend', 'feColorMatrix', 'feComponentTransfer', 'feComposite', 'feConvolveMatrix', 'feDiffuseLighting',
291
- 'feDisplacementMap', 'feDistantLight', 'feDropShadow', 'feFlood', 'feFuncA', 'feFuncB', 'feFuncG',
292
- 'feFuncR', 'feGaussianBlur', 'feImage', 'feMerge', 'feMergeNode', 'feMorphology', 'feOffset',
293
- 'fePointLight', 'feSpecularLighting', 'feSpotLight', 'feTile', 'feTurbulence',
294
- 'filter', 'foreignObject', 'g', 'image', 'line', 'linearGradient', 'marker', 'mask', 'metadata', 'mpath',
295
- 'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'set', 'stop', 'svg', 'switch',
296
- 'symbol', 'text', 'textPath', 'tspan', 'unknown', 'use', 'view',
297
- 'ng-app', 'ng-bind', 'ng-bind-html', 'ng-bind-template', 'ng-blur', 'ng-change', 'ng-checked', 'ng-class', 'ng-class-even',
298
- 'ng-class-odd', 'ng-click', 'ng-cloak', 'ng-controller', 'ng-copy', 'ng-csp', 'ng-cut', 'ng-dblclick', 'ng-disabled',
299
- 'ng-focus', 'ng-form', 'ng-hide', 'ng-href', 'ng-if', 'ng-include', 'ng-init', 'ng-jq', 'ng-keydown', 'ng-keypress', 'ng-keyup',
300
- 'ng-list', 'ng-maxlength', 'ng-minlength', 'ng-model', 'ng-model-options', 'ng-mousedown', 'ng-mouseenter', 'ng-mouseleave',
301
- 'ng-mousemove', 'ng-mouseover', 'ng-mouseup', 'ng-non-bindable', 'ng-on', 'ng-open', 'ng-options', 'ng-paste', 'ng-pattern',
302
- 'ng-pluralize', 'ng-prop', 'ng-readonly', 'ng-ref', 'ng-repeat', 'ng-required', 'ng-selected', 'ng-show', 'ng-src', 'ng-srcset',
303
- 'ng-style', 'ng-submit', 'ng-switch', 'ng-transclude', 'ng-value', 'ng-animate-children', 'ng-animate-swap', 'ng-outlet',
304
- 'ng-message', 'ng-message-default', 'ng-message-exp', 'ng-messages', 'ng-messages-include', 'ng-view', 'ng-swipe-left',
305
- 'ng-swipe-right',
306
- 'md-autocomplete', 'md-autofocus', 'md-button', 'md-calendar', 'md-card', 'md-checkbox', 'md-chip', 'md-chip-remove',
307
- 'md-chips', 'md-colors', 'md-contact-chips', 'md-content', 'md-datepicker', 'md-dialog', 'md-divider', 'md-fab-actions',
308
- 'md-fab-speed-dial', 'md-fab-toolbar', 'md-force-height', 'md-grid-list', 'md-grid-tile', 'md-highlight-text', 'md-icon',
309
- 'md-ink-ripple', 'md-input', 'md-input-container', 'md-list', 'md-list-item', 'md-menu', 'md-menu-bar', 'md-nav-bar',
310
- 'md-nav-item', 'md-optgroup', 'md-option', 'md-progress-circular', 'md-progress-linear', 'md-radio-button', 'md-radio-group',
311
- 'md-select', 'md-select-on-focus', 'md-sidenav', 'md-slider', 'md-slider-container', 'md-subheader', 'md-swipe-down',
312
- 'md-swipe-left', 'md-swipe-right', 'md-swipe-up', 'md-switch', 'md-tab', 'md-tabs', 'md-toolbar', 'md-tooltip', 'md-truncate',
313
- 'md-virtual-repeat', 'md-virtual-repeat-container', 'md-whiteframe',
314
- 'md-svg-src',
315
- 'stratus-citation-notitle',
316
- 'sa-boot',
317
- 'sa-editor',
318
- 'sa-map',
319
- 'sa-media-selector',
320
- 'sa-selector',
321
- 'sa-stripe-payment-method-list',
322
- 'sa-stripe-payment-method-selector',
323
- 'sa-tree',
324
- ],
325
- htmlAllowedStyleProps: [
326
- '.*'
327
- ],
328
- htmlAllowedTags: [
329
- 'a', 'abbr', 'address', 'area', 'article', 'aside', 'audio',
330
- 'b', 'base', 'bdi', 'bdo', 'blockquote', 'br', 'button',
331
- 'canvas', 'caption', 'cite', 'code', 'col', 'colgroup',
332
- 'datalist', 'dd', 'del', 'details', 'dfn', 'dialog', 'div', 'dl', 'dt',
333
- 'em', 'embed',
334
- 'fieldset', 'figcaption', 'figure', 'footer', 'form',
335
- 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'header', 'hgroup', 'hr',
336
- 'i', 'iframe', 'img', 'input', 'ins',
337
- 'kbd', 'keygen',
338
- 'label', 'legend', 'li', 'link',
339
- 'main', 'map', 'mark', 'menu', 'menuitem', 'meter',
340
- 'nav', 'noscript',
341
- 'object', 'ol', 'optgroup', 'option', 'output',
342
- 'p', 'param', 'pre', 'progress',
343
- 'queue',
344
- 'rp', 'rt', 'ruby',
345
- 's', 'samp', 'script', 'style', 'section', 'select', 'small',
346
- 'source', 'span', 'strike', 'strong', 'sub', 'summary', 'sup',
347
- 'table', 'tbody', 'td', 'textarea', 'tfoot', 'th', 'thead', 'time', 'title', 'tr', 'track',
348
- 'u', 'ul',
349
- 'var', 'video',
350
- 'wbr',
351
- 'animate', 'animateMotion', 'animateTransform', 'circle', 'clipPath', 'defs', 'desc', 'discard', 'ellipse',
352
- 'feBlend', 'feColorMatrix', 'feComponentTransfer', 'feComposite', 'feConvolveMatrix', 'feDiffuseLighting',
353
- 'feDisplacementMap', 'feDistantLight', 'feDropShadow', 'feFlood', 'feFuncA', 'feFuncB', 'feFuncG',
354
- 'feFuncR', 'feGaussianBlur', 'feImage', 'feMerge', 'feMergeNode', 'feMorphology', 'feOffset',
355
- 'fePointLight', 'feSpecularLighting', 'feSpotLight', 'feTile', 'feTurbulence',
356
- 'filter', 'foreignObject', 'g', 'image', 'line', 'linearGradient', 'marker', 'mask', 'metadata', 'mpath',
357
- 'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'set', 'stop', 'svg', 'switch',
358
- 'symbol', 'text', 'textPath', 'tspan', 'unknown', 'use', 'view',
359
- 'ng-app', 'ng-bind', 'ng-bind-html', 'ng-bind-template', 'ng-blur', 'ng-change', 'ng-checked', 'ng-class', 'ng-class-even',
360
- 'ng-class-odd', 'ng-click', 'ng-cloak', 'ng-controller', 'ng-copy', 'ng-csp', 'ng-cut', 'ng-dblclick', 'ng-disabled',
361
- 'ng-focus', 'ng-form', 'ng-hide', 'ng-href', 'ng-if', 'ng-include', 'ng-init', 'ng-jq', 'ng-keydown', 'ng-keypress', 'ng-keyup',
362
- 'ng-list', 'ng-maxlength', 'ng-minlength', 'ng-model', 'ng-model-options', 'ng-mousedown', 'ng-mouseenter', 'ng-mouseleave',
363
- 'ng-mousemove', 'ng-mouseover', 'ng-mouseup', 'ng-non-bindable', 'ng-on', 'ng-open', 'ng-options', 'ng-paste', 'ng-pattern',
364
- 'ng-pluralize', 'ng-prop', 'ng-readonly', 'ng-ref', 'ng-repeat', 'ng-required', 'ng-selected', 'ng-show', 'ng-src', 'ng-srcset',
365
- 'ng-style', 'ng-submit', 'ng-switch', 'ng-transclude', 'ng-value', 'ng-animate-children', 'ng-animate-swap', 'ng-outlet',
366
- 'ng-message', 'ng-message-default', 'ng-message-exp', 'ng-messages', 'ng-messages-include', 'ng-view', 'ng-swipe-left',
367
- 'ng-swipe-right',
368
- 'md-autocomplete', 'md-autofocus', 'md-button', 'md-calendar', 'md-card', 'md-checkbox', 'md-chip', 'md-chip-remove',
369
- 'md-chips', 'md-colors', 'md-contact-chips', 'md-content', 'md-datepicker', 'md-dialog', 'md-divider', 'md-fab-actions',
370
- 'md-fab-speed-dial', 'md-fab-toolbar', 'md-force-height', 'md-grid-list', 'md-grid-tile', 'md-highlight-text', 'md-icon',
371
- 'md-ink-ripple', 'md-input', 'md-input-container', 'md-list', 'md-list-item', 'md-menu', 'md-menu-bar', 'md-nav-bar',
372
- 'md-nav-item', 'md-optgroup', 'md-option', 'md-progress-circular', 'md-progress-linear', 'md-radio-button', 'md-radio-group',
373
- 'md-select', 'md-select-on-focus', 'md-sidenav', 'md-slider', 'md-slider-container', 'md-subheader', 'md-swipe-down',
374
- 'md-swipe-left', 'md-swipe-right', 'md-swipe-up', 'md-switch', 'md-tab', 'md-tabs', 'md-toolbar', 'md-tooltip', 'md-truncate',
375
- 'md-virtual-repeat', 'md-virtual-repeat-container', 'md-whiteframe',
376
- 'md-svg-src',
377
- 'sa-boot',
378
- 'sa-editor',
379
- 'sa-map',
380
- 'sa-media-selector',
381
- 'sa-selector',
382
- 'sa-stripe-payment-method-list',
383
- 'sa-stripe-payment-method-selector',
384
- 'sa-tree',
385
- 'stratus-.+',
386
- ],
387
- htmlRemoveTags: [],
388
- htmlSimpleAmpersand: false,
389
- imageInsertButtons: [
390
- 'imageBack',
391
- '|',
392
- 'imageUpload',
393
- 'imageByURL',
394
- ],
395
- imageUpload: true,
396
- imageUploadRemoteUrls: true,
397
- imageUploadURL: 'https://app.sitetheory.io/?session=' + environment_1.cookie('SITETHEORY'),
398
- imageManagerPageSize: 20,
399
- imageManagerScrollOffset: 10,
400
- imageManagerLoadMethod: 'GET',
401
- imageManagerLoadURL: '/Api/Media?payload-only=true',
402
- linkEditButtons: [
403
- 'linkOpen',
404
- 'linkManagerEdit',
405
- 'linkRemove',
406
- ],
407
- linkInsertButtons: [
408
- 'linkBack',
409
- ],
410
- multiLine: true,
411
- paragraphStyles: {
412
- btn: 'Button',
413
- header: 'Header',
414
- title: 'Title',
415
- 'alt-title': 'Alt Title (over)',
416
- subtitle: 'Subtitle',
417
- pullout: 'Pullout Quote',
418
- },
419
- pasteDeniedAttrs: [
420
- 'id',
421
- 'class',
422
- 'style',
423
- 'dir',
424
- 'data-.+',
425
- 'aria-.+',
426
- 'ng-.+',
427
- 'stratus-.+',
428
- 'sa-.+'
429
- ],
430
- pasteDeniedTags: [
431
- 'form', 'input', 'label',
432
- 'style'
433
- ],
434
- pastePlain: false,
435
- pluginsEnabled: [
436
- 'align',
437
- 'charCounter',
438
- 'codeBeautifier',
439
- 'codeView',
440
- 'colors',
441
- 'draggable',
442
- 'embedly',
443
- 'entities',
444
- 'file',
445
- 'fontAwesome',
446
- 'fontFamily',
447
- 'fontSize',
448
- 'fullscreen',
449
- 'help',
450
- 'image',
451
- 'imageTUI',
452
- 'inlineStyle',
453
- 'inlineClass',
454
- 'lineBreaker',
455
- 'link',
456
- 'linkManager',
457
- 'citationManager',
458
- 'lists',
459
- 'mediaManager',
460
- 'paragraphFormat',
461
- 'paragraphStyle',
462
- 'print',
463
- 'quickInsert',
464
- 'quote',
465
- 'save',
466
- 'specialCharacters',
467
- 'table',
468
- 'url',
469
- 'video',
470
- 'wordPaste',
471
- ],
472
- quickInsertButtons: [
473
- 'media',
474
- 'link',
475
- 'video',
476
- 'embedly',
477
- 'table',
478
- 'ul',
479
- 'ol',
480
- 'hr'
481
- ],
482
- scrollableContainer: stratus_1.Stratus.Environment.get('viewPort') || 'body',
483
- spellcheck: true,
484
- toolbarSticky: true,
485
- toolbarButtons: {
486
- moreText: {
487
- buttons: this.froalaStandardButtons.moreText,
488
- buttonsVisible: 3
489
- },
490
- moreParagraph: {
491
- buttons: this.froalaStandardButtons.moreParagraph,
492
- buttonsVisible: 8
493
- },
494
- moreRich: {
495
- buttons: this.froalaStandardButtons.moreRich,
496
- buttonsVisible: 1
497
- },
498
- moreMisc: {
499
- buttons: this.froalaStandardButtons.moreMisc,
500
- align: 'right',
501
- buttonsVisible: 1
502
- }
503
- },
504
- toolbarButtonsSM: {
505
- moreText: {
506
- buttons: this.froalaStandardButtons.moreText,
507
- buttonsVisible: 3
508
- },
509
- moreParagraph: {
510
- buttons: this.froalaStandardButtons.moreParagraph,
511
- buttonsVisible: 0
512
- },
513
- moreRich: {
514
- buttons: this.froalaStandardButtons.moreRich,
515
- buttonsVisible: 3
516
- },
517
- moreMisc: {
518
- buttons: this.froalaStandardButtons.moreMisc,
519
- align: 'right',
520
- buttonsVisible: 0
521
- }
522
- },
523
- toolbarButtonsXS: {
524
- moreText: {
525
- buttons: this.froalaStandardButtons.moreText,
526
- buttonsVisible: 0
527
- },
528
- moreParagraph: {
529
- buttons: this.froalaStandardButtons.moreParagraph,
530
- buttonsVisible: 0
531
- },
532
- moreRich: {
533
- buttons: this.froalaStandardButtons.moreRich,
534
- buttonsVisible: 0
535
- },
536
- moreMisc: {
537
- buttons: this.froalaStandardButtons.moreMisc,
538
- align: 'right',
539
- buttonsVisible: 0
540
- }
541
- },
542
- useClasses: true,
543
- videoInsertButtons: [
544
- 'videoBack',
545
- '|',
546
- 'videoByURL',
547
- 'videoEmbed',
548
- 'videoUpload',
549
- ],
550
- videoUpload: true,
551
- videoUploadURL: 'https://app.sitetheory.io/?session=' + environment_1.cookie('SITETHEORY')
552
- };
553
- this.uid = lodash_1.default.uniqueId(`sa_${lodash_1.default.snakeCase(moduleName)}_component_`);
554
- stratus_1.Stratus.Instances[this.uid] = this;
555
- stratus_1.Stratus.Internals.LoadCss([
556
- `${localDir}${moduleName}/${moduleName}.component${min}.css`,
557
- `${froalaDir}css/froala_editor.pkgd${min}.css`,
558
- `${froalaDir}css/third_party/embedly${min}.css`,
559
- `${froalaDir}css/third_party/font_awesome${min}.css`,
560
- `${froalaDir}css/third_party/image_tui${min}.css`,
561
- ]).then(() => {
562
- this.styled = true;
563
- this.refresh();
564
- }).catch((e) => {
565
- console.error(e);
566
- console.warn('Issue detected in CSS Loader for Component:', this.uid);
567
- this.styled = true;
568
- this.refresh();
569
- });
570
- this.hydrate(elementRef, sanitizer, ["title", "uid", "dev", "debug", "editor", "target", "targetSuffix", "id", "manifest", "decouple", "direct", "api", "urlRoot", "property", "_", "has", "log", "Stratus", "registry", "fetched", "data", "collection", "model", "dataSub", "onChange", "subscriber", "svgIcons", "initialized", "styled", "blurred", "focused", "codeViewIsOpen", "form", "dataChangeLog", "dataString", "debounceSave", "debounceTime", "forceSave", "froalaEditorDirective", "froalaButtons", "froalaStandardButtons", "froalaConfig", "sanitizer", "ref", "elementRef", "fb", "dialog", "ngOnInit", "modelSave", "listDuplicates", "normalizeIn", "normalizeOut", "changeImgSize", "handleError", "fetchData", "dataDefer", "dataRef", "onDataChange", "created", "changedEditor", "onChangeEvent", "onFocus", "onBlur", "bypassHTML", "trigger", "openCitationDialog", "openLinkDialog", "openMediaDialog", "openCodeViewDialog", "hydrate", "disableRefresh", "stagger", "reloading", "refresh", "ngOnDestroy"]);
571
- this.fetchData()
572
- .then(data => {
573
- if (!data || !(data instanceof eventManager_1.EventManager)) {
574
- console.warn('Unable to bind data from Registry!');
575
- return;
576
- }
577
- const onDataChange = () => {
578
- if (!data.completed) {
579
- return;
580
- }
581
- this.dataDefer(this.subscriber);
582
- if (this.codeViewIsOpen) {
583
- return;
584
- }
585
- };
586
- data.on('change', onDataChange);
587
- onDataChange();
588
- });
589
- this.dataSub = new rxjs_1.Observable(subscriber => {
590
- if (this.dev) {
591
- console.warn(`[observable] creating subscriber on ${this.uid}`, subscriber);
592
- }
593
- return this.dataDefer(subscriber);
594
- });
595
- this.dataSub.pipe(operators_1.debounce(() => rxjs_1.timer(250)), operators_1.catchError(this.handleError)).subscribe(evt => {
596
- if (this.focused) {
597
- if (this.dev) {
598
- console.warn(`[subscriber] waiting on updates due to focus on ${this.uid}`);
599
- }
600
- return;
601
- }
602
- const dataControl = this.form.get('dataString');
603
- if (dataControl.value === evt) {
604
- if (this.initialized) {
605
- this.refresh();
606
- }
607
- return;
608
- }
609
- dataControl.patchValue(evt);
610
- this.refresh();
611
- });
612
- }
613
- ngOnInit() {
614
- this.initialized = true;
615
- const dataControl = this.form.get('dataString');
616
- if (this.debounceSave) {
617
- dataControl.valueChanges.pipe(operators_1.debounce(() => rxjs_1.timer(this.debounceTime)), operators_1.catchError(this.handleError)).subscribe((evt) => this.modelSave(evt));
618
- }
619
- else {
620
- dataControl.valueChanges.forEach((value) => this.modelSave(value));
621
- }
622
- if (this.dev) {
623
- this.listDuplicates(this.froalaConfig);
624
- }
625
- }
626
- modelSave(value) {
627
- if (!this.model.completed) {
628
- return;
629
- }
630
- let innerHTML = null;
631
- if (!this.froalaConfig.useClasses
632
- && this.froalaEditorDirective
633
- && this.froalaEditorDirective.getEditor()
634
- && this.froalaEditorDirective.getEditor().el
635
- && this.froalaEditorDirective.getEditor().el.innerHTML) {
636
- innerHTML = this.froalaEditorDirective.getEditor().el.innerHTML;
637
- }
638
- this.model.set(this.property, this.normalizeOut(innerHTML || value));
639
- if (this.forceSave) {
640
- this.model.save();
641
- }
550
+ const onDataChange = () => {
551
+ if (!data.completed) {
552
+ return;
642
553
  }
643
- listDuplicates(data) {
644
- lodash_1.default.forEach(data, (value, key) => {
645
- if (!lodash_1.default.isArray(value)) {
646
- return;
647
- }
648
- const catalog = {};
649
- value.forEach((e) => catalog[e] = (catalog[e] || 0) + 1);
650
- const duplicates = lodash_1.default.filter(lodash_1.default.map(catalog, ((v, k) => v > 1 ? k : null)));
651
- if (!duplicates.length) {
652
- return;
653
- }
654
- console.warn('Froala Config:', key, 'has duplicates:', duplicates);
655
- });
656
- return data;
554
+ this.dataDefer(this.subscriber);
555
+ if (this.codeViewIsOpen) {
556
+ return;
657
557
  }
658
- normalizeIn(data) {
659
- if (!data || !lodash_1.default.isString(data)) {
660
- return '';
661
- }
662
- return this.changeImgSize(data, 'hq');
663
- }
664
- normalizeOut(data) {
665
- if (data === null) {
666
- return '';
667
- }
668
- if (!lodash_1.default.isString(data)) {
669
- return data;
670
- }
671
- return this.changeImgSize(data, 'xs');
672
- }
673
- changeImgSize(data, size) {
674
- if (!data || !lodash_1.default.isString(data)) {
675
- return data;
676
- }
677
- if (!size || !lodash_1.default.isString(size)) {
678
- return data;
679
- }
680
- const imgRegex = /<img([\w\W]+?)>/gi;
681
- let imgMatch;
682
- while (imgMatch = imgRegex.exec(data)) {
683
- const el = imgMatch[0];
684
- if (el.includes('data:image')) {
685
- continue;
686
- }
687
- const srcRegex = /^<img\s(.+?)(-[A-Z]{2})?\.(?=[^.]*$)(.+)>/gi;
688
- const srcMatch = srcRegex.exec(el);
689
- if (srcMatch === null) {
690
- console.warn('Unable to find file name for image src:', el);
691
- continue;
692
- }
693
- if (!el.includes('data-stratus-src')) {
694
- if (!el.includes('cdn.sitetheory.io')) {
695
- continue;
696
- }
697
- if (lodash_1.default.isEmpty(srcMatch[2])) {
698
- continue;
699
- }
700
- data = data.replace(el, `<img data-stratus-src ${srcMatch[1]}-${size}.${srcMatch[3]}>`);
701
- continue;
702
- }
703
- data = data.replace(el, `<img ${srcMatch[1]}-${size}.${srcMatch[3]}>`);
704
- }
705
- return data;
706
- }
707
- handleError(err) {
708
- console.error(err);
709
- return err;
710
- }
711
- fetchData() {
712
- if (this.fetched) {
713
- return this.fetched;
714
- }
715
- return this.fetched = this.registry.fetch(stratus_1.Stratus.Select(this.elementRef.nativeElement), this);
716
- }
717
- dataDefer(subscriber) {
718
- this.subscriber = this.subscriber || subscriber;
719
- if (!this.subscriber) {
720
- if (this.dev) {
721
- console.warn(`[defer] debouncing due to empty subscriber on ${this.uid}`);
722
- }
723
- setTimeout(() => {
724
- if (this.dev) {
725
- console.warn(`[defer] debounced subscriber returned on ${this.uid}`);
726
- }
727
- this.dataDefer(subscriber);
728
- }, 250);
729
- return;
730
- }
731
- const prevString = lodash_1.default.clone(this.dataString);
732
- const dataString = this.dataRef();
733
- if (prevString === dataString) {
734
- return;
735
- }
736
- if (!dataString && (!this.data || !this.data.completed)) {
737
- if (this.dev) {
738
- console.warn(`[defer] debouncing subscriber due to unavailable data on ${this.uid}`, this.data);
739
- }
740
- setTimeout(() => {
741
- if (this.dev) {
742
- console.warn(`[defer] debounced subscriber returned on ${this.uid}`);
743
- }
744
- this.dataDefer(subscriber);
745
- }, 250);
746
- return;
747
- }
748
- if (!this.froalaConfig.useClasses) {
749
- if (prevString === dataString) {
750
- return;
751
- }
752
- }
753
- if (this.dev) {
754
- console.warn(`[subscriber] new value submitted on ${this.uid}:`, dataString);
755
- }
756
- this.subscriber.next(dataString);
757
- }
758
- dataRef() {
759
- if (!this.model) {
760
- return '';
761
- }
762
- return this.dataString = this.normalizeIn(this.model.get(this.property));
558
+ };
559
+ data.on('change', onDataChange);
560
+ onDataChange();
561
+ });
562
+ this.dataSub = new Observable(subscriber => {
563
+ if (this.dev) {
564
+ console.warn(`[observable] creating subscriber on ${this.uid}`, subscriber);
565
+ }
566
+ return this.dataDefer(subscriber);
567
+ });
568
+ this.dataSub.pipe(debounce(() => timer(250)), catchError(this.handleError)).subscribe(evt => {
569
+ if (this.focused) {
570
+ if (this.dev) {
571
+ console.warn(`[subscriber] waiting on updates due to focus on ${this.uid}`);
763
572
  }
764
- onDataChange() {
765
- this.dataDefer(this.subscriber);
573
+ return;
574
+ }
575
+ const dataControl = this.form.get('dataString');
576
+ if (dataControl.value === evt) {
577
+ if (this.initialized) {
766
578
  this.refresh();
767
579
  }
768
- created() {
769
- }
770
- changedEditor(event) {
771
- console.log('editor-change:', event);
772
- }
773
- onChangeEvent($event) {
774
- console.log('change:', $event);
775
- }
776
- onFocus($event) {
777
- this.focused = true;
778
- this.blurred = false;
779
- }
780
- onBlur($event) {
781
- this.focused = false;
782
- this.blurred = true;
783
- }
784
- bypassHTML(html) {
785
- return this.sanitizer.bypassSecurityTrustHtml(html);
786
- }
787
- trigger(name, data, callee) {
788
- if (this.dev && this.debug) {
789
- console.log('editor.trigger:', name, callee);
790
- }
791
- if (name === 'media-library') {
792
- this.openMediaDialog(callee);
793
- }
794
- else if (name === 'citation-input') {
795
- this.openCitationDialog(callee);
796
- }
797
- else if (name === 'link-library') {
798
- this.openLinkDialog(callee, data);
799
- }
800
- else if (name === 'code-view') {
801
- this.openCodeViewDialog();
802
- }
580
+ return;
581
+ }
582
+ dataControl.patchValue(evt);
583
+ this.refresh();
584
+ });
585
+ }
586
+ ngOnInit() {
587
+ this.initialized = true;
588
+ const dataControl = this.form.get('dataString');
589
+ if (this.debounceSave) {
590
+ dataControl.valueChanges.pipe(debounce(() => timer(this.debounceTime)), catchError(this.handleError)).subscribe((evt) => this.modelSave(evt));
591
+ dataControl.valueChanges.pipe(debounce(() => timer(250)), catchError(this.handleError)).subscribe((evt) => {
592
+ if (this.model.changedExternal) {
593
+ return;
803
594
  }
804
- openCitationDialog(callee) {
805
- const dialogRef = this.dialog.open(citation_dialog_component_1.CitationDialogComponent, {
806
- width: '1000px',
807
- data: {
808
- editor: this,
809
- eventManager: callee,
810
- form: this.form,
811
- model: this.model,
812
- property: this.property,
813
- }
814
- });
815
- const that = this;
816
- dialogRef.afterClosed().subscribe((result) => {
817
- if (!result || lodash_1.default.isEmpty(result)) {
818
- return;
819
- }
820
- that.refresh();
821
- if (this.dev && result) {
822
- console.log('citation dialog result:', result);
823
- }
824
- });
595
+ this.model.changedExternal = true;
596
+ this.model.trigger('change');
597
+ });
598
+ }
599
+ else {
600
+ dataControl.valueChanges.forEach((value) => this.modelSave(value));
601
+ }
602
+ if (this.dev) {
603
+ this.listDuplicates(this.froalaConfig);
604
+ }
605
+ }
606
+ modelSave(value) {
607
+ if (!this.model.completed) {
608
+ return;
609
+ }
610
+ let innerHTML = null;
611
+ if (!this.froalaConfig.useClasses
612
+ && this.froalaEditorDirective
613
+ && this.froalaEditorDirective.getEditor()
614
+ && this.froalaEditorDirective.getEditor().el
615
+ && this.froalaEditorDirective.getEditor().el.innerHTML) {
616
+ innerHTML = this.froalaEditorDirective.getEditor().el.innerHTML;
617
+ }
618
+ this.model.set(this.property, this.normalizeOut(innerHTML || value));
619
+ this.model.changedExternal = false;
620
+ if (this.forceSave && !_.isEmpty(this.model.getIdentifier())) {
621
+ this.model.save();
622
+ }
623
+ }
624
+ listDuplicates(data) {
625
+ _.forEach(data, (value, key) => {
626
+ if (!_.isArray(value)) {
627
+ return;
628
+ }
629
+ const catalog = {};
630
+ value.forEach((e) => catalog[e] = (catalog[e] || 0) + 1);
631
+ const duplicates = _.filter(_.map(catalog, ((v, k) => v > 1 ? k : null)));
632
+ if (!duplicates.length) {
633
+ return;
634
+ }
635
+ console.warn('Froala Config:', key, 'has duplicates:', duplicates);
636
+ });
637
+ return data;
638
+ }
639
+ normalizeIn(data) {
640
+ if (!data || !_.isString(data)) {
641
+ return '';
642
+ }
643
+ return this.changeImgSize(data, 'hq');
644
+ }
645
+ normalizeOut(data) {
646
+ if (data === null) {
647
+ return '';
648
+ }
649
+ if (!_.isString(data)) {
650
+ return data;
651
+ }
652
+ return this.changeImgSize(data, 'xs');
653
+ }
654
+ changeImgSize(data, size) {
655
+ if (!data || !_.isString(data)) {
656
+ return data;
657
+ }
658
+ if (!size || !_.isString(size)) {
659
+ return data;
660
+ }
661
+ const imgRegex = /<img([\w\W]+?)>/gi;
662
+ let imgMatch;
663
+ while (imgMatch = imgRegex.exec(data)) {
664
+ const el = imgMatch[0];
665
+ if (el.includes('data:image')) {
666
+ continue;
667
+ }
668
+ const srcRegex = /^<img\s(.+?)(-[A-Z]{2})?\.(?=[^.]*$)(.+)>/gi;
669
+ const srcMatch = srcRegex.exec(el);
670
+ if (srcMatch === null) {
671
+ console.warn('Unable to find file name for image src:', el);
672
+ continue;
673
+ }
674
+ if (!el.includes('data-stratus-src')) {
675
+ if (!el.includes('cdn.sitetheory.io')) {
676
+ continue;
825
677
  }
826
- openLinkDialog(callee, data) {
827
- const dialogRef = this.dialog.open(link_dialog_component_1.LinkDialogComponent, {
828
- width: '500px',
829
- data: {
830
- editor: this,
831
- eventManager: callee,
832
- element: data,
833
- form: this.form,
834
- model: this.model,
835
- property: this.property
836
- }
837
- });
838
- this.refresh();
839
- const that = this;
840
- dialogRef.afterClosed().subscribe((result) => {
841
- if (!result || lodash_1.default.isEmpty(result)) {
842
- return;
843
- }
844
- that.refresh();
845
- if (this.dev && result) {
846
- console.log('link dialog result:', result);
847
- }
848
- });
678
+ if (_.isEmpty(srcMatch[2])) {
679
+ continue;
849
680
  }
850
- openMediaDialog(callee) {
851
- const dialogRef = this.dialog.open(media_dialog_component_1.MediaDialogComponent, {
852
- width: '1000px',
853
- data: {
854
- editor: this,
855
- eventManager: callee,
856
- form: this.form,
857
- model: this.model,
858
- property: this.property
859
- }
860
- });
861
- this.refresh();
862
- const that = this;
863
- dialogRef.afterClosed().subscribe((result) => {
864
- if (!result || lodash_1.default.isEmpty(result)) {
865
- return;
866
- }
867
- that.refresh();
868
- if (this.dev && result) {
869
- console.log('media dialog result:', result);
870
- }
871
- });
681
+ data = data.replace(el, `<img data-stratus-src ${srcMatch[1]}-${size}.${srcMatch[3]}>`);
682
+ continue;
683
+ }
684
+ data = data.replace(el, `<img ${srcMatch[1]}-${size}.${srcMatch[3]}>`);
685
+ }
686
+ return data;
687
+ }
688
+ handleError(err) {
689
+ console.error(err);
690
+ return err;
691
+ }
692
+ fetchData() {
693
+ if (this.fetched) {
694
+ return this.fetched;
695
+ }
696
+ return this.fetched = this.registry.fetch(Stratus.Select(this.elementRef.nativeElement), this);
697
+ }
698
+ dataDefer(subscriber) {
699
+ this.subscriber = this.subscriber || subscriber;
700
+ if (!this.subscriber) {
701
+ if (this.dev) {
702
+ console.warn(`[defer] debouncing due to empty subscriber on ${this.uid}`);
703
+ }
704
+ setTimeout(() => {
705
+ if (this.dev) {
706
+ console.warn(`[defer] debounced subscriber returned on ${this.uid}`);
872
707
  }
873
- openCodeViewDialog() {
874
- this.codeViewIsOpen = true;
875
- const dialogRef = this.dialog.open(code_view_dialog_component_1.CodeViewDialogComponent, {
876
- width: '1000px',
877
- data: {
878
- form: this.form,
879
- model: this.model,
880
- property: this.property
881
- }
882
- });
883
- this.refresh();
884
- dialogRef.afterClosed().subscribe((result) => {
885
- this.codeViewIsOpen = false;
886
- if (!result || lodash_1.default.isEmpty(result)) {
887
- return;
888
- }
889
- this.refresh();
890
- if (this.dev && result) {
891
- console.log('code view dialog result:', result);
892
- }
893
- });
708
+ this.dataDefer(subscriber);
709
+ }, 250);
710
+ return;
711
+ }
712
+ const prevString = _.clone(this.dataString);
713
+ const dataString = this.dataRef();
714
+ if (prevString === dataString) {
715
+ return;
716
+ }
717
+ if (!dataString && (!this.data || !this.data.completed)) {
718
+ if (this.dev) {
719
+ console.warn(`[defer] debouncing subscriber due to unavailable data on ${this.uid}`, this.data);
720
+ }
721
+ setTimeout(() => {
722
+ if (this.dev) {
723
+ console.warn(`[defer] debounced subscriber returned on ${this.uid}`);
894
724
  }
895
- };
896
- __decorate([
897
- core_1.Input(),
898
- __metadata("design:type", String)
899
- ], EditorComponent.prototype, "target", void 0);
900
- __decorate([
901
- core_1.Input(),
902
- __metadata("design:type", String)
903
- ], EditorComponent.prototype, "targetSuffix", void 0);
904
- __decorate([
905
- core_1.Input(),
906
- __metadata("design:type", Number)
907
- ], EditorComponent.prototype, "id", void 0);
908
- __decorate([
909
- core_1.Input(),
910
- __metadata("design:type", Boolean)
911
- ], EditorComponent.prototype, "manifest", void 0);
912
- __decorate([
913
- core_1.Input(),
914
- __metadata("design:type", Boolean)
915
- ], EditorComponent.prototype, "decouple", void 0);
916
- __decorate([
917
- core_1.Input(),
918
- __metadata("design:type", Boolean)
919
- ], EditorComponent.prototype, "direct", void 0);
920
- __decorate([
921
- core_1.Input(),
922
- __metadata("design:type", Object)
923
- ], EditorComponent.prototype, "api", void 0);
924
- __decorate([
925
- core_1.Input(),
926
- __metadata("design:type", String)
927
- ], EditorComponent.prototype, "urlRoot", void 0);
928
- __decorate([
929
- core_1.Input(),
930
- __metadata("design:type", String)
931
- ], EditorComponent.prototype, "property", void 0);
932
- EditorComponent = __decorate([
933
- core_1.Component({
934
- selector: `sa-${moduleName}`,
935
- templateUrl: `${localDir}/${moduleName}/${moduleName}.component${min}.html`,
936
- }),
937
- __metadata("design:paramtypes", [platform_browser_1.DomSanitizer,
938
- core_1.ChangeDetectorRef,
939
- core_1.ElementRef,
940
- forms_1.FormBuilder,
941
- dialog_1.MatDialog])
942
- ], EditorComponent);
943
- exports_1("EditorComponent", EditorComponent);
725
+ this.dataDefer(subscriber);
726
+ }, 250);
727
+ return;
944
728
  }
945
- };
946
- });
729
+ if (!this.froalaConfig.useClasses) {
730
+ if (prevString === dataString) {
731
+ return;
732
+ }
733
+ }
734
+ if (this.dev) {
735
+ console.warn(`[subscriber] new value submitted on ${this.uid}:`, dataString);
736
+ }
737
+ this.subscriber.next(dataString);
738
+ }
739
+ dataRef() {
740
+ if (!this.model) {
741
+ return '';
742
+ }
743
+ return this.dataString = this.normalizeIn(this.model.get(this.property));
744
+ }
745
+ onDataChange() {
746
+ this.dataDefer(this.subscriber);
747
+ this.refresh();
748
+ }
749
+ created() {
750
+ }
751
+ changedEditor(event) {
752
+ console.log('editor-change:', event);
753
+ }
754
+ onChangeEvent($event) {
755
+ console.log('change:', $event);
756
+ }
757
+ onFocus($event) {
758
+ this.focused = true;
759
+ this.blurred = false;
760
+ }
761
+ onBlur($event) {
762
+ this.focused = false;
763
+ this.blurred = true;
764
+ }
765
+ bypassHTML(html) {
766
+ return this.sanitizer.bypassSecurityTrustHtml(html);
767
+ }
768
+ trigger(name, data, callee) {
769
+ if (this.dev && this.debug) {
770
+ console.log('editor.trigger:', name, callee);
771
+ }
772
+ if (name === 'media-library') {
773
+ this.openMediaDialog(callee);
774
+ }
775
+ else if (name === 'citation-input') {
776
+ this.openCitationDialog(callee);
777
+ }
778
+ else if (name === 'link-library') {
779
+ this.openLinkDialog(callee, data);
780
+ }
781
+ else if (name === 'code-view') {
782
+ this.openCodeViewDialog();
783
+ }
784
+ }
785
+ openCitationDialog(callee) {
786
+ const dialogRef = this.dialog.open(CitationDialogComponent, {
787
+ width: '1000px',
788
+ data: {
789
+ editor: this,
790
+ eventManager: callee,
791
+ form: this.form,
792
+ model: this.model,
793
+ property: this.property,
794
+ }
795
+ });
796
+ const that = this;
797
+ dialogRef.afterClosed().subscribe((result) => {
798
+ if (!result || _.isEmpty(result)) {
799
+ return;
800
+ }
801
+ that.refresh();
802
+ if (this.dev && result) {
803
+ console.log('citation dialog result:', result);
804
+ }
805
+ });
806
+ }
807
+ openLinkDialog(callee, data) {
808
+ const dialogRef = this.dialog.open(LinkDialogComponent, {
809
+ width: '500px',
810
+ data: {
811
+ editor: this,
812
+ eventManager: callee,
813
+ element: data,
814
+ form: this.form,
815
+ model: this.model,
816
+ property: this.property
817
+ }
818
+ });
819
+ this.refresh();
820
+ const that = this;
821
+ dialogRef.afterClosed().subscribe((result) => {
822
+ if (!result || _.isEmpty(result)) {
823
+ return;
824
+ }
825
+ that.refresh();
826
+ if (this.dev && result) {
827
+ console.log('link dialog result:', result);
828
+ }
829
+ });
830
+ }
831
+ openMediaDialog(callee) {
832
+ const dialogRef = this.dialog.open(MediaDialogComponent, {
833
+ width: '1000px',
834
+ data: {
835
+ editor: this,
836
+ eventManager: callee,
837
+ form: this.form,
838
+ model: this.model,
839
+ property: this.property
840
+ }
841
+ });
842
+ this.refresh();
843
+ const that = this;
844
+ dialogRef.afterClosed().subscribe((result) => {
845
+ if (!result || _.isEmpty(result)) {
846
+ return;
847
+ }
848
+ that.refresh();
849
+ if (this.dev && result) {
850
+ console.log('media dialog result:', result);
851
+ }
852
+ });
853
+ }
854
+ openCodeViewDialog() {
855
+ this.codeViewIsOpen = true;
856
+ const dialogRef = this.dialog.open(CodeViewDialogComponent, {
857
+ width: '1000px',
858
+ data: {
859
+ form: this.form,
860
+ model: this.model,
861
+ property: this.property
862
+ }
863
+ });
864
+ this.refresh();
865
+ dialogRef.afterClosed().subscribe((result) => {
866
+ this.codeViewIsOpen = false;
867
+ if (!result || _.isEmpty(result)) {
868
+ return;
869
+ }
870
+ this.refresh();
871
+ if (this.dev && result) {
872
+ console.log('code view dialog result:', result);
873
+ }
874
+ });
875
+ }
876
+ };
877
+ __decorate([
878
+ Input(),
879
+ __metadata("design:type", String)
880
+ ], EditorComponent.prototype, "target", void 0);
881
+ __decorate([
882
+ Input(),
883
+ __metadata("design:type", String)
884
+ ], EditorComponent.prototype, "targetSuffix", void 0);
885
+ __decorate([
886
+ Input(),
887
+ __metadata("design:type", Number)
888
+ ], EditorComponent.prototype, "id", void 0);
889
+ __decorate([
890
+ Input(),
891
+ __metadata("design:type", Boolean)
892
+ ], EditorComponent.prototype, "manifest", void 0);
893
+ __decorate([
894
+ Input(),
895
+ __metadata("design:type", Boolean)
896
+ ], EditorComponent.prototype, "decouple", void 0);
897
+ __decorate([
898
+ Input(),
899
+ __metadata("design:type", Boolean)
900
+ ], EditorComponent.prototype, "direct", void 0);
901
+ __decorate([
902
+ Input(),
903
+ __metadata("design:type", Object)
904
+ ], EditorComponent.prototype, "api", void 0);
905
+ __decorate([
906
+ Input(),
907
+ __metadata("design:type", String)
908
+ ], EditorComponent.prototype, "urlRoot", void 0);
909
+ __decorate([
910
+ Input(),
911
+ __metadata("design:type", String)
912
+ ], EditorComponent.prototype, "property", void 0);
913
+ EditorComponent = __decorate([
914
+ Component({
915
+ selector: `sa-${moduleName}`,
916
+ templateUrl: `${localDir}/${moduleName}/${moduleName}.component${min}.html`,
917
+ }),
918
+ __metadata("design:paramtypes", [DomSanitizer,
919
+ ChangeDetectorRef,
920
+ ElementRef,
921
+ FormBuilder,
922
+ MatDialog])
923
+ ], EditorComponent);
924
+ export { EditorComponent };
947
925
 
948
926
  //# sourceMappingURL=editor.component.js.map