@stratusjs/angular 0.7.6 → 0.8.1

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 (50) hide show
  1. package/dist/angular.bundle.js +109 -1319
  2. package/dist/angular.bundle.min.js +1 -1
  3. package/package.json +2 -2
  4. package/src/core/dialog.interface.js.map +1 -0
  5. package/src/tree/tree-node.component.html +7 -8
  6. package/src/tree/tree-node.component.min.html +1 -1
  7. package/src/tree/tree.component.css +63 -5
  8. package/src/tree/tree.component.css.map +1 -1
  9. package/src/tree/tree.component.js +29 -16
  10. package/src/tree/tree.component.js.map +1 -1
  11. package/src/tree/tree.component.min.css +1 -1
  12. package/src/tree/tree.component.min.js +1 -1
  13. package/src/tree/tree.component.scss +131 -21
  14. package/src/tree/tree.component.ts +30 -14
  15. package/src/editor/quill-break-blot.plugin.js +0 -38
  16. package/src/editor/quill-break-blot.plugin.js.map +0 -1
  17. package/src/editor/quill-break-blot.plugin.min.js +0 -1
  18. package/src/editor/quill-html-edit.plugin.js +0 -164
  19. package/src/editor/quill-html-edit.plugin.js.map +0 -1
  20. package/src/editor/quill-html-edit.plugin.min.js +0 -1
  21. package/src/editor/quill-image-format.plugin.js +0 -50
  22. package/src/editor/quill-image-format.plugin.js.map +0 -1
  23. package/src/editor/quill-image-format.plugin.min.js +0 -1
  24. package/src/editor/quill-input-button.plugin.js +0 -98
  25. package/src/editor/quill-input-button.plugin.js.map +0 -1
  26. package/src/editor/quill-input-button.plugin.min.js +0 -1
  27. package/src/froala/editor/froala-editor.directive.js +0 -328
  28. package/src/froala/editor/froala-editor.directive.js.map +0 -1
  29. package/src/froala/editor/froala-editor.directive.min.js +0 -1
  30. package/src/froala/editor/froala-editor.module.js +0 -37
  31. package/src/froala/editor/froala-editor.module.js.map +0 -1
  32. package/src/froala/editor/froala-editor.module.min.js +0 -1
  33. package/src/froala/editor/index.js +0 -22
  34. package/src/froala/editor/index.js.map +0 -1
  35. package/src/froala/editor/index.min.js +0 -1
  36. package/src/froala/plugins/image_manager.js +0 -364
  37. package/src/froala/plugins/image_manager.js.map +0 -1
  38. package/src/froala/plugins/image_manager.min.js +0 -1
  39. package/src/froala/view/froala-view.directive.js +0 -49
  40. package/src/froala/view/froala-view.directive.js.map +0 -1
  41. package/src/froala/view/froala-view.directive.min.js +0 -1
  42. package/src/froala/view/froala-view.module.js +0 -37
  43. package/src/froala/view/froala-view.module.js.map +0 -1
  44. package/src/froala/view/froala-view.module.min.js +0 -1
  45. package/src/froala/view/index.js +0 -22
  46. package/src/froala/view/index.js.map +0 -1
  47. package/src/froala/view/index.min.js +0 -1
  48. package/src/root/root.component.js +0 -43
  49. package/src/root/root.component.js.map +0 -1
  50. package/src/root/root.component.min.js +0 -1
@@ -123781,13 +123781,14 @@ System.register(['@stratusjs/runtime/stratus', 'lodash', '@stratusjs/core/enviro
123781
123781
  this.expandDelay = 1000;
123782
123782
  this.dropData = null;
123783
123783
  this.cdkDropListSortingDisabled = true;
123784
- this.dropDebug = false;
123785
123784
  this.treeControl = new NestedTreeControl((node) => node.children || []);
123785
+ this.isBorder = false;
123786
+ this.isDebug = false;
123786
123787
  }
123787
123788
  ngOnInit() {
123788
123789
  this.uid = _.uniqueId(`sa_${_.snakeCase(moduleName$3)}_component_`);
123789
123790
  Stratus.Instances[this.uid] = this;
123790
- this.hydrate(this.elementRef, this.sanitizer, ["title", "uid", "isInitialized", "isDestroyed", "isStyled", "target", "targetSuffix", "id", "manifest", "decouple", "direct", "api", "urlRoot", "type", "property", "_", "Stratus", "registry", "fetched", "data", "collection", "model", "dataSub", "onChange", "subscriber", "unsettled", "svgIcons", "isSingleClick", "dblClickWait", "dropLists", "dropListIdMap", "dropListMap", "expandedNodeSet", "dragging", "expandTimeout", "expandDelay", "dropData", "cdkDropListSortingDisabled", "dropDebug", "tree", "treeMap", "metaMap", "dataSource", "treeControl", "iconRegistry", "sanitizer", "backend", "ref", "elementRef", "document", "ngOnInit", "ngOnDestroy", "refresh", "remove", "removeNode", "nodeIsEqual", "fetchData", "dataDefer", "dataRef", "trackDropLists", "setExpanded", "setExpandedClick", "setExpandedDblClick", "onDragDrop", "onDragMove", "showDragData", "clearDragData", "buildNodePatch", "getSvg", "addSvgIcon", "hydrate", "disableRefresh", "stagger", "reloading"]);
123791
+ this.hydrate(this.elementRef, this.sanitizer, ["title", "uid", "isInitialized", "isDestroyed", "isStyled", "target", "targetSuffix", "id", "manifest", "decouple", "direct", "api", "urlRoot", "type", "property", "_", "Stratus", "registry", "fetched", "data", "collection", "model", "dataSub", "onChange", "subscriber", "unsettled", "svgIcons", "isSingleClick", "dblClickWait", "dropLists", "dropListIdMap", "dropListMap", "expandedNodeSet", "dragging", "expandTimeout", "expandDelay", "dropData", "cdkDropListSortingDisabled", "tree", "treeMap", "metaMap", "dataSource", "treeControl", "isBorder", "isDebug", "iconRegistry", "sanitizer", "backend", "ref", "elementRef", "document", "ngOnInit", "ngOnDestroy", "refresh", "remove", "removeNode", "nodeIsEqual", "fetchData", "dataDefer", "dataRef", "trackDropLists", "setExpanded", "setExpandedClick", "setExpandedDblClick", "onDragDrop", "onDragMove", "showDragData", "clearDragData", "buildNodePatch", "getSvg", "addSvgIcon", "hydrate", "disableRefresh", "stagger", "reloading"]);
123791
123792
  Stratus.Internals.CssLoader(`${localDir$7}/${moduleName$3}/${moduleName$3}.component${min$6}.css`)
123792
123793
  .then(() => {
123793
123794
  this.isStyled = true;
@@ -123849,6 +123850,14 @@ System.register(['@stratusjs/runtime/stratus', 'lodash', '@stratusjs/core/enviro
123849
123850
  this.dataSub = new Observable((subscriber) => this.dataDefer(subscriber));
123850
123851
  this.dropListIdMap[`${this.uid}_parent_drop_list`] = true;
123851
123852
  this.trackDropLists();
123853
+ const isBorder = cookie('tree-node-border');
123854
+ if (isBorder && isJSON(isBorder)) {
123855
+ this.isBorder = JSON.parse(isBorder);
123856
+ }
123857
+ const isDebug = cookie('tree-debug');
123858
+ if (isDebug && isJSON(isDebug)) {
123859
+ this.isDebug = JSON.parse(isDebug);
123860
+ }
123852
123861
  this.isInitialized = true;
123853
123862
  this.refresh();
123854
123863
  }
@@ -124000,115 +124009,118 @@ System.register(['@stratusjs/runtime/stratus', 'lodash', '@stratusjs/core/enviro
124000
124009
  this.setExpanded(expanded);
124001
124010
  }
124002
124011
  onDragDrop(event) {
124003
- if (!event.isPointerOverContainer) {
124004
- return;
124005
- }
124006
- const targetNode = event.item.data;
124007
- if (!targetNode) {
124008
- return;
124009
- }
124010
- let parentNode = event.container.data;
124011
- const pastParentNode = event.previousContainer.data;
124012
- const tree = parentNode ? parentNode.children : this.dataRef();
124013
- if (!tree) {
124014
- return;
124015
- }
124016
- this.unsettled = true;
124017
- const targetDropNode = (this.dropData.targetId && this.dropData.targetId in this.treeMap) ?
124018
- this.treeMap[_.toNumber(this.dropData.targetId)] : null;
124019
- if (cookie('env') && this.dropDebug) {
124020
- console.group('onDragDrop()');
124021
- _.forEach([
124022
- `model drop: ${targetNode.model.get('name')}`,
124023
- `list shift: ${event.container.element.nativeElement.id} -> ${event.previousContainer.element.nativeElement.id}`,
124024
- `index change (event): ${event.previousIndex} -> ${event.currentIndex}`,
124025
- `current priority: ${targetNode.model.get('priority')}`,
124026
- `target drop action: ${this.dropData.action}`,
124027
- ], (message) => console.log(message));
124028
- }
124029
- if (targetDropNode && !this.nodeIsEqual(parentNode, targetDropNode)) {
124030
- if (cookie('env') && this.dropDebug) {
124031
- console.log(`target drop node differs: ${targetDropNode.id} -> ${targetDropNode.model.get('name')}`);
124032
- console.log('target drop node is the same as target node:', targetNode.id === targetDropNode.id);
124033
- }
124034
- if (targetNode.id !== targetDropNode.id) {
124035
- switch (this.dropData.action) {
124036
- case 'before':
124037
- case 'after':
124038
- const nestParentId = targetDropNode.model.get('nestParent.id');
124039
- const nestParent = (nestParentId && nestParentId in this.treeMap) ? this.treeMap[nestParentId] : null;
124040
- parentNode = nestParent;
124041
- break;
124042
- case 'inside':
124043
- parentNode = targetDropNode;
124044
- break;
124012
+ return __awaiter$8(this, void 0, void 0, function* () {
124013
+ if (!event.isPointerOverContainer) {
124014
+ return;
124015
+ }
124016
+ const targetNode = event.item.data;
124017
+ if (!targetNode) {
124018
+ return;
124019
+ }
124020
+ let parentNode = event.container.data;
124021
+ const pastParentNode = event.previousContainer.data;
124022
+ const tree = parentNode ? parentNode.children : this.dataRef();
124023
+ if (!tree) {
124024
+ return;
124025
+ }
124026
+ this.unsettled = true;
124027
+ const targetDropNode = (this.dropData.targetId && this.dropData.targetId in this.treeMap) ?
124028
+ this.treeMap[_.toNumber(this.dropData.targetId)] : null;
124029
+ if (cookie('env') && this.isDebug) {
124030
+ console.group('onDragDrop()');
124031
+ _.forEach([
124032
+ `model drop: ${targetNode.model.get('name')}`,
124033
+ `list shift: ${event.container.element.nativeElement.id} -> ${event.previousContainer.element.nativeElement.id}`,
124034
+ `index change (event): ${event.previousIndex} -> ${event.currentIndex}`,
124035
+ `current priority: ${targetNode.model.get('priority')}`,
124036
+ `target drop action: ${this.dropData.action}`,
124037
+ ], (message) => console.log(message));
124038
+ }
124039
+ if (targetDropNode && !this.nodeIsEqual(parentNode, targetDropNode)) {
124040
+ if (cookie('env') && this.isDebug) {
124041
+ console.log(`target drop node differs: ${targetDropNode.id} -> ${targetDropNode.model.get('name')}`);
124042
+ console.log('target drop node is the same as target node:', targetNode.id === targetDropNode.id);
124043
+ }
124044
+ if (targetNode.id !== targetDropNode.id) {
124045
+ switch (this.dropData.action) {
124046
+ case 'before':
124047
+ case 'after':
124048
+ const nestParentId = targetDropNode.model.get('nestParent.id');
124049
+ const nestParent = (nestParentId && nestParentId in this.treeMap) ? this.treeMap[nestParentId] : null;
124050
+ parentNode = nestParent;
124051
+ break;
124052
+ case 'inside':
124053
+ parentNode = targetDropNode;
124054
+ break;
124055
+ }
124056
+ }
124057
+ if (cookie('env') && this.isDebug) {
124058
+ console.log('target drop node selected:', parentNode ? `${parentNode.id} -> ${parentNode.model.get('name')}` : 'none');
124045
124059
  }
124046
124060
  }
124047
- if (cookie('env') && this.dropDebug) {
124048
- console.log('target drop node selected:', parentNode ? `${parentNode.id} -> ${parentNode.model.get('name')}` : 'none');
124061
+ if (!this.nodeIsEqual(parentNode, pastParentNode)) {
124062
+ if (parentNode) {
124063
+ switch (this.dropData.action) {
124064
+ case 'before':
124065
+ case 'after':
124066
+ let targetIndex = parentNode.children.findIndex((n) => n.id === targetNode.id);
124067
+ if (this.dropData.action === 'after') {
124068
+ targetIndex++;
124069
+ }
124070
+ parentNode.children.splice(targetIndex, 0, targetNode);
124071
+ break;
124072
+ case 'inside':
124073
+ parentNode.children.push(targetNode);
124074
+ break;
124075
+ }
124076
+ parentNode.meta.expanded = true;
124077
+ }
124078
+ if (pastParentNode) {
124079
+ this.removeNode(pastParentNode.children, targetNode);
124080
+ }
124081
+ targetNode.model.set('nestParent', this.buildNodePatch(parentNode));
124082
+ if (cookie('env') && this.isDebug) {
124083
+ console.log(`new parent: ${targetNode.model.get('nestParent.name') || null}`);
124084
+ }
124049
124085
  }
124050
- }
124051
- if (!this.nodeIsEqual(parentNode, pastParentNode)) {
124052
- if (parentNode) {
124086
+ const branch = parentNode ? parentNode.children : tree;
124087
+ let targetDropIndex = event.currentIndex;
124088
+ if (this.cdkDropListSortingDisabled) {
124089
+ targetDropIndex = null;
124053
124090
  switch (this.dropData.action) {
124054
124091
  case 'before':
124055
124092
  case 'after':
124056
- let targetIndex = parentNode.children.findIndex((n) => n.id === targetNode.id);
124093
+ targetDropIndex = branch.findIndex((n) => n.id === targetDropNode.id);
124057
124094
  if (this.dropData.action === 'after') {
124058
- targetIndex++;
124095
+ targetDropIndex++;
124096
+ }
124097
+ if (cookie('env') && this.isDebug) {
124098
+ console.log('index change (drop node):', `${event.previousIndex} -> ${targetDropIndex}`);
124059
124099
  }
124060
- parentNode.children.splice(targetIndex, 0, targetNode);
124061
- break;
124062
- case 'inside':
124063
- parentNode.children.push(targetNode);
124064
124100
  break;
124065
124101
  }
124066
- parentNode.meta.expanded = true;
124067
- }
124068
- if (pastParentNode) {
124069
- this.removeNode(pastParentNode.children, targetNode);
124070
124102
  }
124071
- targetNode.model.set('nestParent', this.buildNodePatch(parentNode));
124072
- if (cookie('env') && this.dropDebug) {
124073
- console.log(`new parent: ${targetNode.model.get('nestParent.name') || null}`);
124074
- }
124075
- }
124076
- const branch = parentNode ? parentNode.children : tree;
124077
- let targetDropIndex = event.currentIndex;
124078
- if (this.cdkDropListSortingDisabled) {
124079
- targetDropIndex = null;
124080
- switch (this.dropData.action) {
124081
- case 'before':
124082
- case 'after':
124083
- targetDropIndex = branch.findIndex((n) => n.id === targetDropNode.id);
124084
- if (this.dropData.action === 'after') {
124085
- targetDropIndex++;
124086
- }
124087
- if (cookie('env') && this.dropDebug) {
124088
- console.log('index change (drop node):', `${event.previousIndex} -> ${targetDropIndex}`);
124103
+ if (_.isNumber(targetDropIndex)) {
124104
+ moveItemInArray(branch, event.previousIndex, targetDropIndex);
124105
+ let priority = 0;
124106
+ _.forEach(branch, (node) => {
124107
+ if (!node.model || !node.model.set) {
124108
+ return;
124089
124109
  }
124090
- break;
124091
- }
124092
- }
124093
- if (_.isNumber(targetDropIndex)) {
124094
- moveItemInArray(branch, event.previousIndex, targetDropIndex);
124095
- let priority = 0;
124096
- _.forEach(branch, (node) => {
124097
- if (!node.model || !node.model.set) {
124098
- return;
124110
+ node.model.set('priority', priority++);
124111
+ });
124112
+ if (cookie('env') && this.isDebug) {
124113
+ console.log('new priority:', targetNode.model.get('priority'));
124099
124114
  }
124100
- node.model.set('priority', priority++);
124101
- });
124102
- if (cookie('env') && this.dropDebug) {
124103
- console.log('new priority:', targetNode.model.get('priority'));
124104
124115
  }
124105
- }
124106
- if (cookie('env') && this.dropDebug) {
124107
- console.log(`new parent: ${targetNode.model.get('nestParent.name') || null}`);
124108
- console.groupEnd();
124109
- }
124110
- targetNode.model.save();
124111
- this.unsettled = false;
124116
+ if (cookie('env') && this.isDebug) {
124117
+ console.groupEnd();
124118
+ }
124119
+ yield targetNode.model.save();
124120
+ this.unsettled = false;
124121
+ this.subscriber.next(this.dataRef());
124122
+ this.ref.detectChanges();
124123
+ });
124112
124124
  }
124113
124125
  onDragMove(event) {
124114
124126
  const e = this.document.elementFromPoint(event.pointerPosition.x, event.pointerPosition.y);
@@ -161105,1228 +161117,6 @@ System.register(['@stratusjs/runtime/stratus', 'lodash', '@stratusjs/core/enviro
161105
161117
  })
161106
161118
  .catch(err => console.error('@stratusjs/angular failed to initialize!', err));
161107
161119
 
161108
- System.register(["quill", "@stratusjs/core/environment"], function (exports_1, context_1) {
161109
- var quill_1, environment_1, Break, Embed, QuillBreak;
161110
- context_1 && context_1.id;
161111
- return {
161112
- setters: [
161113
- function (quill_1_1) {
161114
- quill_1 = quill_1_1;
161115
- },
161116
- function (environment_1_1) {
161117
- environment_1 = environment_1_1;
161118
- }
161119
- ],
161120
- execute: function () {
161121
- Break = quill_1.default.import('blots/break');
161122
- Embed = quill_1.default.import('blots/embed');
161123
- QuillBreak = class QuillBreak extends Break {
161124
- length() {
161125
- return 1;
161126
- }
161127
- value() {
161128
- return '\n';
161129
- }
161130
- insertInto(parent, ref) {
161131
- if (environment_1.cookie('env')) {
161132
- console.log('insertInto:', parent, ref);
161133
- }
161134
- Embed.prototype.insertInto.call(this, parent, ref);
161135
- }
161136
- };
161137
- exports_1("QuillBreak", QuillBreak);
161138
- QuillBreak.blotName = 'break';
161139
- QuillBreak.tagName = 'BR';
161140
- }
161141
- };
161142
- });
161143
-
161144
- System.register(["quill"], function (exports_1, context_1) {
161145
- var quill_1, debug, Logger, QuillHtmlEditPlugin;
161146
- context_1 && context_1.id;
161147
- function $create(elName) {
161148
- return document.createElement(elName);
161149
- }
161150
- function $setAttr(el, key, value) {
161151
- return el.setAttribute(key, value);
161152
- }
161153
- function launchPopupEditor(quill, options) {
161154
- const htmlFromEditor = quill.container.querySelector('.ql-editor').innerHTML;
161155
- const popupContainer = $create('div');
161156
- const overlayContainer = $create('div');
161157
- const msg = options.msg || 'Edit HTML here, when you click "OK" the quill editor\'s contents will be replaced';
161158
- const cancelText = options.cancelText || 'Cancel';
161159
- const okText = options.okText || 'Ok';
161160
- $setAttr(overlayContainer, 'class', 'ql-html-overlayContainer');
161161
- $setAttr(popupContainer, 'class', 'ql-html-popupContainer');
161162
- const popupTitle = $create('i');
161163
- $setAttr(popupTitle, 'class', 'ql-html-popupTitle');
161164
- popupTitle.innerText = msg;
161165
- const textContainer = $create('div');
161166
- textContainer.appendChild(popupTitle);
161167
- $setAttr(textContainer, 'class', 'ql-html-textContainer');
161168
- const textArea = $create('textarea');
161169
- $setAttr(textArea, 'class', 'ql-html-textArea');
161170
- textArea.value = formatHTML(htmlFromEditor);
161171
- const buttonCancel = $create('button');
161172
- buttonCancel.innerHTML = cancelText;
161173
- $setAttr(buttonCancel, 'class', 'ql-html-buttonCancel');
161174
- const buttonOk = $create('button');
161175
- buttonOk.innerHTML = okText;
161176
- const buttonGroup = $create('div');
161177
- $setAttr(buttonGroup, 'class', 'ql-html-buttonGroup');
161178
- buttonGroup.appendChild(buttonCancel);
161179
- buttonGroup.appendChild(buttonOk);
161180
- textContainer.appendChild(textArea);
161181
- textContainer.appendChild(buttonGroup);
161182
- popupContainer.appendChild(textContainer);
161183
- overlayContainer.appendChild(popupContainer);
161184
- document.body.appendChild(overlayContainer);
161185
- buttonCancel.onclick = () => {
161186
- document.body.removeChild(overlayContainer);
161187
- };
161188
- overlayContainer.onclick = buttonCancel.onclick;
161189
- popupContainer.onclick = (e) => {
161190
- e.preventDefault();
161191
- e.stopPropagation();
161192
- };
161193
- buttonOk.onclick = () => {
161194
- const output = textArea.value.split(/\r?\n/g).map((el) => el.trim());
161195
- const noNewlines = output.join('');
161196
- quill.container.querySelector('.ql-editor').innerHTML = noNewlines;
161197
- document.body.removeChild(overlayContainer);
161198
- };
161199
- }
161200
- function formatHTML(code) {
161201
- const whitespace = ' '.repeat(2);
161202
- let currentIndent = 0;
161203
- const newlineChar = '\n';
161204
- let char = null;
161205
- let nextChar = null;
161206
- let result = '';
161207
- for (let pos = 0; pos <= code.length; pos++) {
161208
- char = code.substr(pos, 1);
161209
- nextChar = code.substr(pos + 1, 1);
161210
- const isBrTag = code.substr(pos, 4) === '<br>';
161211
- const isOpeningTag = char === '<' && nextChar !== '/' && !isBrTag;
161212
- const isClosingTag = char === '<' && nextChar === '/' && !isBrTag;
161213
- if (isBrTag) {
161214
- result += newlineChar;
161215
- currentIndent--;
161216
- pos += 4;
161217
- }
161218
- if (isOpeningTag) {
161219
- result += newlineChar + whitespace.repeat(currentIndent);
161220
- currentIndent++;
161221
- }
161222
- else if (isClosingTag) {
161223
- if (--currentIndent < 0) {
161224
- currentIndent = 0;
161225
- }
161226
- result += newlineChar + whitespace.repeat(currentIndent);
161227
- }
161228
- else if (char === ' ' && nextChar === ' ') {
161229
- char = '';
161230
- }
161231
- else if (char === newlineChar) {
161232
- if (code.substr(pos, code.substr(pos).indexOf('<')).trim() === '') {
161233
- char = '';
161234
- }
161235
- }
161236
- result += char;
161237
- }
161238
- Logger.log('formatHTML', {
161239
- before: code,
161240
- after: result
161241
- });
161242
- return result;
161243
- }
161244
- return {
161245
- setters: [
161246
- function (quill_1_1) {
161247
- quill_1 = quill_1_1;
161248
- }
161249
- ],
161250
- execute: function () {
161251
- debug = false;
161252
- Logger = {
161253
- prefixString() {
161254
- return `</> quill-html-edit-button: `;
161255
- },
161256
- get log() {
161257
- if (!debug) {
161258
- return () => { };
161259
- }
161260
- const boundLogFn = console.log.bind(console, this.prefixString());
161261
- return boundLogFn;
161262
- }
161263
- };
161264
- QuillHtmlEditPlugin = class QuillHtmlEditPlugin {
161265
- constructor(quill, options) {
161266
- debug = options && options.debug;
161267
- Logger.log('logging enabled');
161268
- const toolbarModule = quill.getModule('toolbar');
161269
- if (!toolbarModule) {
161270
- throw new Error('quill.htmlEditButton requires the "toolbar" module to be included too');
161271
- }
161272
- this.registerDivModule();
161273
- const toolbarEl = toolbarModule.container;
161274
- const buttonContainer = $create('span');
161275
- $setAttr(buttonContainer, 'class', 'ql-formats');
161276
- const button = $create('button');
161277
- button.innerHTML = options.buttonHTML || '&lt;&gt;';
161278
- button.title = options.buttonTitle || 'Show HTML source';
161279
- button.onclick = (e) => {
161280
- e.preventDefault();
161281
- launchPopupEditor(quill, options);
161282
- };
161283
- buttonContainer.appendChild(button);
161284
- toolbarEl.appendChild(buttonContainer);
161285
- }
161286
- registerDivModule() {
161287
- const Block = quill_1.default.import('blots/block');
161288
- class Div extends Block {
161289
- }
161290
- Div.tagName = 'div';
161291
- Div.blotName = 'div';
161292
- Div.allowedChildren = Block.allowedChildren;
161293
- Div.allowedChildren.push(Block);
161294
- quill_1.default.register(Div);
161295
- }
161296
- };
161297
- exports_1("QuillHtmlEditPlugin", QuillHtmlEditPlugin);
161298
- exports_1("default", QuillHtmlEditPlugin);
161299
- }
161300
- };
161301
- });
161302
-
161303
- System.register(["quill"], function (exports_1, context_1) {
161304
- var quill_1, BaseImage, ATTRIBUTES, QuillImageFormatPlugin;
161305
- context_1 && context_1.id;
161306
- return {
161307
- setters: [
161308
- function (quill_1_1) {
161309
- quill_1 = quill_1_1;
161310
- }
161311
- ],
161312
- execute: function () {
161313
- BaseImage = quill_1.default.import('formats/image');
161314
- ATTRIBUTES = [
161315
- 'alt',
161316
- 'height',
161317
- 'width',
161318
- 'stratus-src',
161319
- 'stratusSrc'
161320
- ];
161321
- QuillImageFormatPlugin = class QuillImageFormatPlugin extends BaseImage {
161322
- constructor() {
161323
- super(...arguments);
161324
- this.blotName = 'imageCustom';
161325
- this.tagName = 'IMG';
161326
- }
161327
- format(name, value) {
161328
- console.log('format:', name, value, this.domNode.getAttribute('src'));
161329
- if (ATTRIBUTES.indexOf(name) === -1) {
161330
- super.format(name, value);
161331
- return;
161332
- }
161333
- if (!value) {
161334
- this.domNode.removeAttribute(name);
161335
- return;
161336
- }
161337
- if (name === 'stratus-src') {
161338
- console.log('stratus-src:', value);
161339
- }
161340
- if (name === 'stratusSrc') {
161341
- console.log('stratusSrc:', value);
161342
- }
161343
- this.domNode.setAttribute(name, value);
161344
- }
161345
- };
161346
- exports_1("QuillImageFormatPlugin", QuillImageFormatPlugin);
161347
- }
161348
- };
161349
- });
161350
-
161351
- System.register(["@stratusjs/runtime/stratus", "lodash", "quill"], function (exports_1, context_1) {
161352
- var stratus_1, lodash_1, quill_1, QuillInputButtonPlugin;
161353
- context_1 && context_1.id;
161354
- return {
161355
- setters: [
161356
- function (stratus_1_1) {
161357
- stratus_1 = stratus_1_1;
161358
- },
161359
- function (lodash_1_1) {
161360
- lodash_1 = lodash_1_1;
161361
- },
161362
- function (quill_1_1) {
161363
- quill_1 = quill_1_1;
161364
- }
161365
- ],
161366
- execute: function () {
161367
- QuillInputButtonPlugin = class QuillInputButtonPlugin {
161368
- constructor(quill, options) {
161369
- this.debug = false;
161370
- this.buttonHTML = '<i class="fas fa-carrot"></i>';
161371
- this.buttonTitle = 'Input Button';
161372
- this.name = 'inputButton';
161373
- this.eventName = 'input-button';
161374
- this.uid = lodash_1.default.uniqueId(`quill_input_button_`);
161375
- stratus_1.Stratus.Instances[this.uid] = this;
161376
- this.debug = options && options.debug;
161377
- if (!options || typeof options !== 'object') {
161378
- options = {};
161379
- }
161380
- this.buttonHTML = options.buttonHTML || this.buttonHTML;
161381
- this.buttonTitle = options.buttonTitle || this.buttonTitle;
161382
- this.name = options.name || this.name;
161383
- this.eventName = options.eventName || this.eventName;
161384
- this.createToolbarModule(quill);
161385
- }
161386
- createToolbarModule(quill) {
161387
- const toolbarModule = quill.getModule('toolbar');
161388
- if (!toolbarModule) {
161389
- throw new Error(`quill.${this.name} requires the "toolbar" module`);
161390
- }
161391
- this.registerDivModule();
161392
- const toolbarEl = toolbarModule.container;
161393
- const buttonContainer = document.createElement('span');
161394
- buttonContainer.setAttribute('class', 'ql-formats');
161395
- const button = document.createElement('button');
161396
- button.innerHTML = this.buttonHTML;
161397
- button.title = this.buttonTitle;
161398
- button.onclick = (e) => {
161399
- e.preventDefault();
161400
- this.onClick(quill);
161401
- };
161402
- buttonContainer.appendChild(button);
161403
- toolbarEl.appendChild(buttonContainer);
161404
- }
161405
- registerDivModule() {
161406
- const Block = quill_1.default.import('blots/block');
161407
- class Div extends Block {
161408
- }
161409
- Div.tagName = 'div';
161410
- Div.blotName = 'div';
161411
- Div.allowedChildren = Block.allowedChildren;
161412
- Div.allowedChildren.push(Block);
161413
- quill_1.default.register(Div);
161414
- }
161415
- findUID(el) {
161416
- if ('uid' in el.dataset) {
161417
- return el.dataset.uid;
161418
- }
161419
- return this.findUID(el.parentElement);
161420
- }
161421
- getInstance(uid) {
161422
- if (!(uid in stratus_1.Stratus.Instances)) {
161423
- return undefined;
161424
- }
161425
- return stratus_1.Stratus.Instances[uid];
161426
- }
161427
- onClick(quill) {
161428
- const container = quill.container;
161429
- const uid = this.findUID(container);
161430
- const instance = this.getInstance(uid);
161431
- if (!instance) {
161432
- return;
161433
- }
161434
- instance.trigger(this.eventName, null, this);
161435
- }
161436
- trigger(name, data, callee) {
161437
- if (this.debug) {
161438
- console.log(`quill.${this.name}.trigger:`, name, data, callee);
161439
- }
161440
- }
161441
- };
161442
- exports_1("QuillInputButtonPlugin", QuillInputButtonPlugin);
161443
- }
161444
- };
161445
- });
161446
-
161447
- System.register(["reflect-metadata", "lodash", "@angular/core"], function (exports_1, context_1) {
161448
- var lodash_1, core_1, RootComponent;
161449
- context_1 && context_1.id;
161450
- return {
161451
- setters: [
161452
- function (_1) {
161453
- },
161454
- function (lodash_1_1) {
161455
- lodash_1 = lodash_1_1;
161456
- },
161457
- function (core_1_1) {
161458
- core_1 = core_1_1;
161459
- }
161460
- ],
161461
- execute: function () {
161462
- RootComponent = class RootComponent {
161463
- hydrate(elementRef, sanitizer, attrs) {
161464
- lodash_1.default.forEach(attrs, (attr) => {
161465
- const metaDataKeys = Reflect.getMetadataKeys(this, attr);
161466
- if (!lodash_1.default.includes(metaDataKeys, 'design:type')) {
161467
- return;
161468
- }
161469
- const attrKebab = lodash_1.default.kebabCase(attr);
161470
- const variants = [
161471
- attrKebab,
161472
- 'data-' + attrKebab
161473
- ];
161474
- const variant = lodash_1.default.find(variants, (v) => elementRef.nativeElement.hasAttribute(v));
161475
- if (lodash_1.default.isEmpty(variant)) {
161476
- return;
161477
- }
161478
- const value = sanitizer.sanitize(core_1.SecurityContext.HTML, elementRef.nativeElement.getAttribute(variant));
161479
- lodash_1.default.set(this, attr, value);
161480
- });
161481
- }
161482
- };
161483
- exports_1("RootComponent", RootComponent);
161484
- }
161485
- };
161486
- });
161487
-
161488
- System.register(["@angular/forms", "@angular/core", "froala-editor"], function (exports_1, context_1) {
161489
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
161490
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
161491
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
161492
- 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;
161493
- return c > 3 && r && Object.defineProperty(target, key, r), r;
161494
- };
161495
- var __metadata = (this && this.__metadata) || function (k, v) {
161496
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
161497
- };
161498
- var FroalaEditorDirective_1, forms_1, core_1, froala_editor_1, FroalaEditorDirective;
161499
- context_1 && context_1.id;
161500
- return {
161501
- setters: [
161502
- function (forms_1_1) {
161503
- forms_1 = forms_1_1;
161504
- },
161505
- function (core_1_1) {
161506
- core_1 = core_1_1;
161507
- },
161508
- function (froala_editor_1_1) {
161509
- froala_editor_1 = froala_editor_1_1;
161510
- }
161511
- ],
161512
- execute: function () {
161513
- FroalaEditorDirective = FroalaEditorDirective_1 = class FroalaEditorDirective {
161514
- constructor(el, zone) {
161515
- this.zone = zone;
161516
- this._opts = {
161517
- immediateAngularModelUpdate: false,
161518
- angularIgnoreAttrs: null
161519
- };
161520
- this.SPECIAL_TAGS = ['img', 'button', 'input', 'a'];
161521
- this.INNER_HTML_ATTR = 'innerHTML';
161522
- this._hasSpecialTag = false;
161523
- this._editorInitialized = false;
161524
- this._oldModel = null;
161525
- this.froalaModelChange = new core_1.EventEmitter();
161526
- this.froalaInit = new core_1.EventEmitter();
161527
- this.onChange = (_) => {
161528
- };
161529
- this.onTouched = () => {
161530
- };
161531
- const element = el.nativeElement;
161532
- if (this.SPECIAL_TAGS.indexOf(element.tagName.toLowerCase()) != -1) {
161533
- this._hasSpecialTag = true;
161534
- }
161535
- this._element = element;
161536
- this.zone = zone;
161537
- }
161538
- set froalaEditor(opts) {
161539
- this._opts = this.clone(opts || this._opts);
161540
- this._opts = Object.assign({}, this._opts);
161541
- }
161542
- set froalaModel(content) {
161543
- this.updateEditor(content);
161544
- }
161545
- writeValue(content) {
161546
- this.updateEditor(content);
161547
- }
161548
- registerOnChange(fn) {
161549
- this.onChange = fn;
161550
- }
161551
- registerOnTouched(fn) {
161552
- this.onTouched = fn;
161553
- }
161554
- clone(item) {
161555
- const me = this;
161556
- if (!item) {
161557
- return item;
161558
- }
161559
- const types = [Number, String, Boolean];
161560
- let result;
161561
- types.forEach((type) => {
161562
- if (item instanceof type) {
161563
- result = type(item);
161564
- }
161565
- });
161566
- if (typeof result === 'undefined') {
161567
- if (Object.prototype.toString.call(item) === '[object Array]') {
161568
- result = [];
161569
- item.forEach((child, index, array) => {
161570
- result[index] = me.clone(child);
161571
- });
161572
- }
161573
- else if (typeof item === 'object') {
161574
- if (item.nodeType && typeof item.cloneNode === 'function') {
161575
- result = item.cloneNode(true);
161576
- }
161577
- else if (!item.prototype) {
161578
- if (item instanceof Date) {
161579
- result = new Date(item);
161580
- }
161581
- else {
161582
- result = {};
161583
- for (const i in item) {
161584
- result[i] = me.clone(item[i]);
161585
- }
161586
- }
161587
- }
161588
- else {
161589
- {
161590
- result = item;
161591
- }
161592
- }
161593
- }
161594
- else {
161595
- result = item;
161596
- }
161597
- }
161598
- return result;
161599
- }
161600
- updateEditor(content) {
161601
- if (JSON.stringify(this._oldModel) === JSON.stringify(content)) {
161602
- return;
161603
- }
161604
- if (!this._hasSpecialTag) {
161605
- this._oldModel = content;
161606
- }
161607
- else {
161608
- this._model = content;
161609
- }
161610
- if (this._editorInitialized) {
161611
- if (!this._hasSpecialTag) {
161612
- this._editor.html.set(content);
161613
- }
161614
- else {
161615
- this.setContent();
161616
- }
161617
- }
161618
- else {
161619
- if (!this._hasSpecialTag) {
161620
- this._element.innerHTML = content || '';
161621
- }
161622
- else {
161623
- this.setContent();
161624
- }
161625
- }
161626
- }
161627
- updateModel() {
161628
- this.zone.run(() => {
161629
- let modelContent = null;
161630
- if (this._hasSpecialTag) {
161631
- const attributeNodes = this._element.attributes;
161632
- const attrs = {};
161633
- for (let i = 0; i < attributeNodes.length; i++) {
161634
- const attrName = attributeNodes[i].name;
161635
- if (this._opts.angularIgnoreAttrs && this._opts.angularIgnoreAttrs.indexOf(attrName) != -1) {
161636
- continue;
161637
- }
161638
- attrs[attrName] = attributeNodes[i].value;
161639
- }
161640
- if (this._element.innerHTML) {
161641
- attrs[this.INNER_HTML_ATTR] = this._element.innerHTML;
161642
- }
161643
- modelContent = attrs;
161644
- }
161645
- else {
161646
- const returnedHtml = this._editor.html.get();
161647
- if (typeof returnedHtml === 'string') {
161648
- modelContent = returnedHtml;
161649
- }
161650
- }
161651
- if (this._oldModel !== modelContent) {
161652
- this._oldModel = modelContent;
161653
- this.froalaModelChange.emit(modelContent);
161654
- this.onChange(modelContent);
161655
- }
161656
- });
161657
- }
161658
- registerEvent(eventName, callback) {
161659
- if (!eventName || !callback) {
161660
- return;
161661
- }
161662
- if (!this._opts.events) {
161663
- this._opts.events = {};
161664
- }
161665
- this._opts.events[eventName] = callback;
161666
- }
161667
- initListeners() {
161668
- const self = this;
161669
- if (this._editor.events) {
161670
- this._editor.events.on('contentChanged', function () {
161671
- self.updateModel();
161672
- });
161673
- this._editor.events.on('mousedown', function () {
161674
- setTimeout(function () {
161675
- self.onTouched();
161676
- }, 0);
161677
- });
161678
- if (this._opts.immediateAngularModelUpdate) {
161679
- this._editor.events.on('keyup', function () {
161680
- setTimeout(function () {
161681
- self.updateModel();
161682
- }, 0);
161683
- });
161684
- }
161685
- }
161686
- this._editorInitialized = true;
161687
- }
161688
- createEditor() {
161689
- if (this._editorInitialized) {
161690
- return;
161691
- }
161692
- this.setContent(true);
161693
- this.zone.runOutsideAngular(() => {
161694
- if (!this._opts.events) {
161695
- this._opts.events = {};
161696
- }
161697
- this.registerEvent('initialized', this._opts.events && this._opts.events.initialized);
161698
- const existingInitCallback = this._opts.events.initialized;
161699
- if (!this._opts.events.initialized || !this._opts.events.initialized.overridden) {
161700
- this._opts.events.initialized = () => {
161701
- this.initListeners();
161702
- existingInitCallback && existingInitCallback.call(this._editor, this);
161703
- };
161704
- this._opts.events.initialized.overridden = true;
161705
- }
161706
- this._editor = new froala_editor_1.default(this._element, this._opts);
161707
- });
161708
- }
161709
- setHtml() {
161710
- this._editor.html.set(this._model || '');
161711
- this._editor.undo.reset();
161712
- this._editor.undo.saveStep();
161713
- }
161714
- setContent(firstTime = false) {
161715
- const self = this;
161716
- if (this._model || this._model === '') {
161717
- this._oldModel = this._model;
161718
- if (this._hasSpecialTag) {
161719
- const tags = this._model;
161720
- if (tags) {
161721
- for (const attr in tags) {
161722
- if (tags.hasOwnProperty(attr) && attr != this.INNER_HTML_ATTR) {
161723
- this._element.setAttribute(attr, tags[attr]);
161724
- }
161725
- }
161726
- if (tags.hasOwnProperty(this.INNER_HTML_ATTR)) {
161727
- this._element.innerHTML = tags[this.INNER_HTML_ATTR];
161728
- }
161729
- }
161730
- }
161731
- else {
161732
- if (firstTime) {
161733
- this.registerEvent('initialized', function () {
161734
- self.setHtml();
161735
- });
161736
- }
161737
- else {
161738
- self.setHtml();
161739
- }
161740
- }
161741
- }
161742
- }
161743
- destroyEditor() {
161744
- if (this._editorInitialized) {
161745
- this._editor.destroy();
161746
- this._editorInitialized = false;
161747
- }
161748
- }
161749
- getEditor() {
161750
- if (this._element) {
161751
- return this._editor;
161752
- }
161753
- return null;
161754
- }
161755
- generateManualController() {
161756
- const controls = {
161757
- initialize: this.createEditor.bind(this),
161758
- destroy: this.destroyEditor.bind(this),
161759
- getEditor: this.getEditor.bind(this),
161760
- };
161761
- this.froalaInit.emit(controls);
161762
- }
161763
- ngAfterViewInit() {
161764
- if (!this.froalaInit.observers.length) {
161765
- this.createEditor();
161766
- }
161767
- else {
161768
- this.generateManualController();
161769
- }
161770
- }
161771
- ngOnDestroy() {
161772
- this.destroyEditor();
161773
- }
161774
- };
161775
- __decorate([
161776
- core_1.Input(),
161777
- __metadata("design:type", Object),
161778
- __metadata("design:paramtypes", [Object])
161779
- ], FroalaEditorDirective.prototype, "froalaEditor", null);
161780
- __decorate([
161781
- core_1.Input(),
161782
- __metadata("design:type", Object),
161783
- __metadata("design:paramtypes", [Object])
161784
- ], FroalaEditorDirective.prototype, "froalaModel", null);
161785
- __decorate([
161786
- core_1.Output(),
161787
- __metadata("design:type", core_1.EventEmitter)
161788
- ], FroalaEditorDirective.prototype, "froalaModelChange", void 0);
161789
- __decorate([
161790
- core_1.Output(),
161791
- __metadata("design:type", core_1.EventEmitter)
161792
- ], FroalaEditorDirective.prototype, "froalaInit", void 0);
161793
- FroalaEditorDirective = FroalaEditorDirective_1 = __decorate([
161794
- core_1.Directive({
161795
- selector: '[froalaEditor]',
161796
- exportAs: 'froalaEditor',
161797
- providers: [
161798
- {
161799
- provide: forms_1.NG_VALUE_ACCESSOR, useExisting: core_1.forwardRef(() => FroalaEditorDirective_1),
161800
- multi: true
161801
- }
161802
- ]
161803
- }),
161804
- __metadata("design:paramtypes", [core_1.ElementRef, core_1.NgZone])
161805
- ], FroalaEditorDirective);
161806
- exports_1("FroalaEditorDirective", FroalaEditorDirective);
161807
- }
161808
- };
161809
- });
161810
-
161811
- System.register(["@angular/core", "@stratusjs/angular/froala/editor/froala-editor.directive"], function (exports_1, context_1) {
161812
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
161813
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
161814
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
161815
- 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;
161816
- return c > 3 && r && Object.defineProperty(target, key, r), r;
161817
- };
161818
- var FroalaEditorModule_1, core_1, froala_editor_directive_1, FroalaEditorModule;
161819
- context_1 && context_1.id;
161820
- return {
161821
- setters: [
161822
- function (core_1_1) {
161823
- core_1 = core_1_1;
161824
- },
161825
- function (froala_editor_directive_1_1) {
161826
- froala_editor_directive_1 = froala_editor_directive_1_1;
161827
- }
161828
- ],
161829
- execute: function () {
161830
- FroalaEditorModule = FroalaEditorModule_1 = class FroalaEditorModule {
161831
- static forRoot() {
161832
- return { ngModule: FroalaEditorModule_1, providers: [] };
161833
- }
161834
- };
161835
- FroalaEditorModule = FroalaEditorModule_1 = __decorate([
161836
- core_1.NgModule({
161837
- declarations: [froala_editor_directive_1.FroalaEditorDirective],
161838
- exports: [froala_editor_directive_1.FroalaEditorDirective]
161839
- })
161840
- ], FroalaEditorModule);
161841
- exports_1("FroalaEditorModule", FroalaEditorModule);
161842
- }
161843
- };
161844
- });
161845
-
161846
- System.register(["@stratusjs/angular/froala/editor/froala-editor.directive", "@stratusjs/angular/froala/editor/froala-editor.module"], function (exports_1, context_1) {
161847
- context_1 && context_1.id;
161848
- return {
161849
- setters: [
161850
- function (froala_editor_directive_1_1) {
161851
- exports_1({
161852
- "FroalaEditorDirective": froala_editor_directive_1_1["FroalaEditorDirective"]
161853
- });
161854
- },
161855
- function (froala_editor_module_1_1) {
161856
- exports_1({
161857
- "FroalaEditorModule": froala_editor_module_1_1["FroalaEditorModule"]
161858
- });
161859
- }
161860
- ],
161861
- execute: function () {
161862
- }
161863
- };
161864
- });
161865
-
161866
- System.register(["@angular/core"], function (exports_1, context_1) {
161867
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
161868
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
161869
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
161870
- 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;
161871
- return c > 3 && r && Object.defineProperty(target, key, r), r;
161872
- };
161873
- var __metadata = (this && this.__metadata) || function (k, v) {
161874
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
161875
- };
161876
- var core_1, FroalaViewDirective;
161877
- context_1 && context_1.id;
161878
- return {
161879
- setters: [
161880
- function (core_1_1) {
161881
- core_1 = core_1_1;
161882
- }
161883
- ],
161884
- execute: function () {
161885
- FroalaViewDirective = class FroalaViewDirective {
161886
- constructor(renderer, element) {
161887
- this.renderer = renderer;
161888
- this._element = element.nativeElement;
161889
- }
161890
- set froalaView(content) {
161891
- this._element.innerHTML = content;
161892
- }
161893
- ngAfterViewInit() {
161894
- this.renderer.addClass(this._element, 'fr-view');
161895
- }
161896
- };
161897
- __decorate([
161898
- core_1.Input(),
161899
- __metadata("design:type", String),
161900
- __metadata("design:paramtypes", [String])
161901
- ], FroalaViewDirective.prototype, "froalaView", null);
161902
- FroalaViewDirective = __decorate([
161903
- core_1.Directive({
161904
- selector: '[froalaView]'
161905
- }),
161906
- __metadata("design:paramtypes", [core_1.Renderer2, core_1.ElementRef])
161907
- ], FroalaViewDirective);
161908
- exports_1("FroalaViewDirective", FroalaViewDirective);
161909
- }
161910
- };
161911
- });
161912
-
161913
- System.register(["@angular/core", "@stratusjs/angular/froala/view/froala-view.directive"], function (exports_1, context_1) {
161914
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
161915
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
161916
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
161917
- 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;
161918
- return c > 3 && r && Object.defineProperty(target, key, r), r;
161919
- };
161920
- var FroalaViewModule_1, core_1, froala_view_directive_1, FroalaViewModule;
161921
- context_1 && context_1.id;
161922
- return {
161923
- setters: [
161924
- function (core_1_1) {
161925
- core_1 = core_1_1;
161926
- },
161927
- function (froala_view_directive_1_1) {
161928
- froala_view_directive_1 = froala_view_directive_1_1;
161929
- }
161930
- ],
161931
- execute: function () {
161932
- FroalaViewModule = FroalaViewModule_1 = class FroalaViewModule {
161933
- static forRoot() {
161934
- return { ngModule: FroalaViewModule_1, providers: [] };
161935
- }
161936
- };
161937
- FroalaViewModule = FroalaViewModule_1 = __decorate([
161938
- core_1.NgModule({
161939
- declarations: [froala_view_directive_1.FroalaViewDirective],
161940
- exports: [froala_view_directive_1.FroalaViewDirective]
161941
- })
161942
- ], FroalaViewModule);
161943
- exports_1("FroalaViewModule", FroalaViewModule);
161944
- }
161945
- };
161946
- });
161947
-
161948
- System.register(["@stratusjs/angular/froala/view/froala-view.directive", "@stratusjs/angular/froala/view/froala-view.module"], function (exports_1, context_1) {
161949
- context_1 && context_1.id;
161950
- return {
161951
- setters: [
161952
- function (froala_view_directive_1_1) {
161953
- exports_1({
161954
- "FroalaViewDirective": froala_view_directive_1_1["FroalaViewDirective"]
161955
- });
161956
- },
161957
- function (froala_view_module_1_1) {
161958
- exports_1({
161959
- "FroalaViewModule": froala_view_module_1_1["FroalaViewModule"]
161960
- });
161961
- }
161962
- ],
161963
- execute: function () {
161964
- }
161965
- };
161966
- });
161967
-
161968
- /*!
161969
- * froala_editor v3.2.3 (https://www.froala.com/wysiwyg-editor)
161970
- * License https://froala.com/wysiwyg-editor/terms/
161971
- * Copyright 2014-2020 Froala Labs
161972
- */
161973
- System.register(["froala-editor"], function (exports_1, context_1) {
161974
- var froala_editor_1;
161975
- context_1 && context_1.id;
161976
- return {
161977
- setters: [
161978
- function (froala_editor_1_1) {
161979
- froala_editor_1 = froala_editor_1_1;
161980
- }
161981
- ],
161982
- execute: function () {
161983
- /*!
161984
- * froala_editor v3.2.3 (https://www.froala.com/wysiwyg-editor)
161985
- * License https://froala.com/wysiwyg-editor/terms/
161986
- * Copyright 2014-2020 Froala Labs
161987
- */
161988
- if (((froala_editor_1.default && froala_editor_1.default.hasOwnProperty('default') ? froala_editor_1.default.default : froala_editor_1.default),
161989
- Object.assign(froala_editor_1.default.DEFAULTS, {
161990
- imageManagerLoadURL: 'https://i.froala.com/load-files',
161991
- imageManagerLoadMethod: 'get',
161992
- imageManagerLoadParams: {},
161993
- imageManagerPreloader: null,
161994
- imageManagerDeleteURL: '',
161995
- imageManagerDeleteMethod: 'post',
161996
- imageManagerDeleteParams: {},
161997
- imageManagerPageSize: 12,
161998
- imageManagerScrollOffset: 20,
161999
- imageManagerToggleTags: !0,
162000
- }),
162001
- (froala_editor_1.default.PLUGINS.imageManagerCustom = (s) => {
162002
- let g, l, i, o, d, m, c, f, u, p, h, v = s.$, M = 'image_manager', e = 10, b = 11, w = 12, C = 13, L = 14, D = 15, t = 21, r = 22, n = {};
162003
- function y() {
162004
- let e = v(window).outerWidth();
162005
- return e < 768 ? 2 : e < 1200 ? 3 : 4;
162006
- }
162007
- function I() {
162008
- d.empty();
162009
- for (let e = 0; e < h; e++) {
162010
- d.append('<div class="fr-list-column"></div>');
162011
- }
162012
- }
162013
- function P() {
162014
- if (u < c.length
162015
- && (d.outerHeight() <= i.outerHeight() + s.opts.imageManagerScrollOffset
162016
- || i.scrollTop() + s.opts.imageManagerScrollOffset > d.outerHeight() - i.outerHeight())) {
162017
- f++;
162018
- for (let e = s.opts.imageManagerPageSize * (f - 1); e < Math.min(c.length, s.opts.imageManagerPageSize * f); e++) {
162019
- a(c[e]);
162020
- }
162021
- }
162022
- }
162023
- function a(n) {
162024
- let i = new Image(), o = v(document.createElement('div'))
162025
- .attr('class', 'fr-image-container fr-empty fr-image-' + p++)
162026
- .attr('data-loading', s.language.translate('Loading') + '..')
162027
- .attr('data-deleting', s.language.translate('Deleting') + '..');
162028
- R(!1),
162029
- (i.onload = function () {
162030
- o.height(Math.floor((o.width() / i.width) * i.height));
162031
- let t = v(document.createElement('img'));
162032
- if (n.thumb) {
162033
- t.attr('src', n.thumb);
162034
- }
162035
- else {
162036
- if ((O(L, n), !n.url)) {
162037
- return O(D, n), !1;
162038
- }
162039
- t.attr('src', n.url);
162040
- }
162041
- if ((n.url && t.attr('data-url', n.url), n.tag)) {
162042
- if ((l.find('.fr-modal-more.fr-not-available').removeClass('fr-not-available'), l.find('.fr-modal-tags').show(), 0 <= n.tag.indexOf(','))) {
162043
- for (let e = n.tag.split(','), a = 0; a < e.length; a++) {
162044
- (e[a] =
162045
- e[a].trim()), 0 === m.find('a[title="'.concat(e[a], '"]')).length && m.append('<a role="button" title="'.concat(e[a], '">').concat(e[a], '</a>'));
162046
- }
162047
- t.attr('data-tag', e.join());
162048
- }
162049
- else {
162050
- 0 === m.find('a[title="'.concat(n.tag.trim(), '"]')).length && m.append('<a role="button" title="'.concat(n.tag.trim(), '">').concat(n.tag.trim(), '</a>')), t.attr('data-tag', n.tag.trim());
162051
- }
162052
- }
162053
- for (let r in (n.name && t.attr('alt', n.name), n)) {
162054
- n.hasOwnProperty(r) && 'thumb' !== r && 'url' !== r && 'tag' !== r && t.attr('data-'.concat(r), n[r]);
162055
- }
162056
- o
162057
- .append(t)
162058
- .append(v(s.icon.create('imageManagerDelete')).addClass('fr-delete-img').attr('title', s.language.translate('Delete')))
162059
- .append(v(s.icon.create('imageManagerInsert')).addClass('fr-insert-img').attr('title', s.language.translate('Insert'))),
162060
- m.find('.fr-selected-tag').each(function (e, a) {
162061
- j(t, a.text) || o.hide();
162062
- }),
162063
- t.on('load', function () {
162064
- o.removeClass('fr-empty'),
162065
- o.height('auto'),
162066
- u++,
162067
- E(T(parseInt(t
162068
- .parent()
162069
- .attr('class')
162070
- .match(/fr-image-(\d+)/)[1], 10) + 1)),
162071
- R(!1),
162072
- u % s.opts.imageManagerPageSize === 0 && P();
162073
- }),
162074
- s.events.trigger('imageManager.imageLoaded', [t]);
162075
- }),
162076
- (i.onerror = () => {
162077
- u++,
162078
- o.remove(),
162079
- E(T(parseInt(o.attr('class').match(/fr-image-(\d+)/)[1], 10) + 1)),
162080
- O(e, n),
162081
- u % s.opts.imageManagerPageSize === 0 && P();
162082
- }),
162083
- (i.src = n.thumb || n.url),
162084
- S().append(o);
162085
- }
162086
- function S() {
162087
- let r, n;
162088
- return (d.find('.fr-list-column').each((e, a) => {
162089
- let t = v(a);
162090
- 0 === e ? ((n = t.outerHeight()), (r = t)) : t.outerHeight() < n && ((n = t.outerHeight()), (r = t));
162091
- }),
162092
- r);
162093
- }
162094
- function T(e) {
162095
- e === undefined && (e = 0);
162096
- for (let a = [], t = p - 1; e <= t; t--) {
162097
- let r = d.find('.fr-image-'.concat(t));
162098
- r.length && (a.push(r), v(document.createElement('div')).attr('id', 'fr-image-hidden-container').append(r), d.find('.fr-image-'.concat(t)).remove());
162099
- }
162100
- return a;
162101
- }
162102
- function E(e) {
162103
- for (let a = e.length - 1; 0 <= a; a--) {
162104
- S().append(e[a]);
162105
- }
162106
- }
162107
- function R(e) {
162108
- if ((e === undefined && (e = !0), !g.isVisible())) {
162109
- return !0;
162110
- }
162111
- let a = y();
162112
- if (a !== h) {
162113
- h = a;
162114
- let t = T();
162115
- I(), E(t);
162116
- }
162117
- s.modals.resize(M), e && P();
162118
- }
162119
- function U(e) {
162120
- for (let a, t = e[0].attributes, r = t.length, n = {}; r--;) {
162121
- t[r] && 'src' !== (a = t[r].name) && (n[a] = t[r].value);
162122
- }
162123
- return n;
162124
- }
162125
- function x(e) {
162126
- let a = v(e.currentTarget).siblings('img'), t = g.data('instance') || s, r = g.data('current-image');
162127
- if ((s.modals.hide(M), t.image.showProgressBar(), r)) {
162128
- r.data('fr-old-src', r.attr('src')), r.trigger('click');
162129
- }
162130
- else {
162131
- t.events.focus(!0), t.selection.restore();
162132
- let n = t.position.getBoundingRect(), i = n.left + n.width / 2 + v(s.doc).scrollLeft(), o = n.top + n.height + v(s.doc).scrollTop();
162133
- t.popups.setContainer('image.insert', s.$sc), t.popups.show('image.insert', i, o);
162134
- }
162135
- t.image.insert(a.data('url'), !1, U(a), r);
162136
- }
162137
- function H(e) {
162138
- let i = v(e.currentTarget).siblings('img'), a = s.language.translate('Are you sure? Image will be deleted.');
162139
- confirm(a) &&
162140
- (s.opts.imageManagerDeleteURL
162141
- ? !1 !== s.events.trigger('imageManager.beforeDeleteImage', [i]) &&
162142
- (i.parent().addClass('fr-image-deleting'),
162143
- v(this).ajax({
162144
- method: s.opts.imageManagerDeleteMethod,
162145
- url: s.opts.imageManagerDeleteURL,
162146
- data: Object.assign(Object.assign({ src: i.attr('src') }, U(i)), s.opts.imageManagerDeleteParams),
162147
- crossDomain: s.opts.requestWithCORS,
162148
- withCredentials: s.opts.requestWithCredentials,
162149
- headers: s.opts.requestHeaders,
162150
- done(e, a, t) {
162151
- s.events.trigger('imageManager.imageDeleted', [e]);
162152
- let r = T(parseInt(i
162153
- .parent()
162154
- .attr('class')
162155
- .match(/fr-image-(\d+)/)[1], 10) + 1);
162156
- i.parent().remove(),
162157
- E(r),
162158
- (function n() {
162159
- g.find('#fr-modal-tags > a').each(function () {
162160
- 0 === g.find('#fr-image-list [data-tag*="'.concat(v(this).text(), '"]')).length && v(this).removeClass('fr-selected-tag').hide();
162161
- }),
162162
- _();
162163
- })(),
162164
- R(!0);
162165
- },
162166
- fail(e) {
162167
- O(t, e.response || e.responseText);
162168
- },
162169
- }))
162170
- : O(r));
162171
- }
162172
- function O(e, a) {
162173
- 10 <= e && e < 20
162174
- ? o.hide()
162175
- : 20 <= e && e < 30 && v('.fr-image-deleting').removeClass('fr-image-deleting'), s.events.trigger('imageManager.error', [
162176
- { code: e, message: n[e] },
162177
- a
162178
- ]);
162179
- }
162180
- function q() {
162181
- let e = l.find('.fr-modal-head-line').outerHeight(), a = m.outerHeight();
162182
- l.toggleClass('fr-show-tags'), l.hasClass('fr-show-tags')
162183
- ? (l.css('height', e + a), i.css('marginTop', e + a), m.find('a').css('opacity', 1))
162184
- : (l.css('height', e), i.css('marginTop', e), m.find('a').css('opacity', 0));
162185
- }
162186
- function _() {
162187
- let e = m.find('.fr-selected-tag');
162188
- 0 < e.length
162189
- ? (d.find('img').parents().show(),
162190
- e.each((e, r) => {
162191
- d.find('img').each(function (e, a) {
162192
- let t = v(a);
162193
- j(t, r.text) || t.parent().hide();
162194
- });
162195
- }))
162196
- : d.find('img').parents().show(),
162197
- E(T()),
162198
- P();
162199
- }
162200
- function k(e) {
162201
- e.preventDefault();
162202
- let a = v(e.currentTarget);
162203
- a.toggleClass('fr-selected-tag'), s.opts.imageManagerToggleTags && a.siblings('a').removeClass('fr-selected-tag'), _();
162204
- }
162205
- function j(e, a) {
162206
- for (let t = (e.attr('data-tag') || '').split(','), r = 0; r < t.length; r++) {
162207
- if (t[r] === a) {
162208
- return !0;
162209
- }
162210
- }
162211
- return !1;
162212
- }
162213
- return ((n[e] = 'Image cannot be loaded from the passed link.'),
162214
- (n[b] = 'Error during load images request.'),
162215
- (n[w] = 'Missing imageManagerLoadURL option.'),
162216
- (n[C] = 'Parsing load response failed.'),
162217
- (n[L] = 'Missing image thumb.'),
162218
- (n[D] = 'Missing image URL.'),
162219
- (n[t] = 'Error during delete image request.'),
162220
- (n[r] = 'Missing imageManagerDeleteURL option.'),
162221
- {
162222
- require: ['image'],
162223
- _init: function z() {
162224
- if (!s.$wp && 'IMG' !== s.el.tagName) {
162225
- return !1;
162226
- }
162227
- },
162228
- show: function G() {
162229
- if (!g) {
162230
- let e, a = '<button class="fr-command fr-btn fr-modal-more fr-not-available" id="fr-modal-more-'
162231
- .concat(s.sid, '"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24""><path d="')
162232
- .concat(froala_editor_1.default.SVG.tags, '"/></svg></button><h4 data-text="true">')
162233
- .concat(s.language.translate('Manage Images'), '</h4></div>\n <div class="fr-modal-tags" id="fr-modal-tags">');
162234
- (e = s.opts.imageManagerPreloader
162235
- ? '<img class="fr-preloader" id="fr-preloader" alt="'.concat(s.language.translate('Loading'), '.." src="').concat(s.opts.imageManagerPreloader, '" style="display: none;">')
162236
- : '<span class="fr-preloader" id="fr-preloader" style="display: none;">'.concat(s.language.translate('Loading'), '</span>')),
162237
- (e += '<div class="fr-image-list" id="fr-image-list"></div>');
162238
- let t = s.modals.create(M, a, e);
162239
- (g = t.$modal), (l = t.$head), (i = t.$body);
162240
- }
162241
- g.data('current-image', s.image.get()),
162242
- s.modals.show(M),
162243
- o ||
162244
- (function r() {
162245
- (o = g.find('#fr-preloader')),
162246
- (d = g.find('#fr-image-list')),
162247
- (m = g.find('#fr-modal-tags')),
162248
- (h = y()),
162249
- I(),
162250
- l.css('height', l.find('.fr-modal-head-line').outerHeight()),
162251
- s.events.$on(v(s.o_win), 'resize', () => {
162252
- R(!!c);
162253
- }),
162254
- s.events.bindClick(d, '.fr-insert-img', x),
162255
- s.events.bindClick(d, '.fr-delete-img', H),
162256
- s.helpers.isMobile() &&
162257
- (s.events.bindClick(d, 'div.fr-image-container', (e) => {
162258
- g.find('.fr-mobile-selected').removeClass('fr-mobile-selected'),
162259
- v(e.currentTarget).addClass('fr-mobile-selected');
162260
- }),
162261
- g.on(s._mousedown, () => {
162262
- g.find('.fr-mobile-selected').removeClass('fr-mobile-selected');
162263
- })),
162264
- g.on(s._mousedown + ' ' + s._mouseup, (e) => {
162265
- e.stopPropagation();
162266
- }),
162267
- g.on(s._mousedown, '*', () => {
162268
- s.events.disableBlur();
162269
- }),
162270
- i.on('scroll', P),
162271
- s.events.bindClick(g, 'button#fr-modal-more-'.concat(s.sid), q),
162272
- s.events.bindClick(m, 'a', k);
162273
- })(),
162274
- (function n() {
162275
- o.show(),
162276
- d.find('.fr-list-column').empty(),
162277
- s.opts.imageManagerLoadURL
162278
- ? v(this).ajax({
162279
- url: s.opts.imageManagerLoadURL,
162280
- method: s.opts.imageManagerLoadMethod,
162281
- data: s.opts.imageManagerLoadParams,
162282
- crossDomain: s.opts.requestWithCORS,
162283
- withCredentials: s.opts.requestWithCredentials,
162284
- headers: s.opts.requestHeaders,
162285
- done(e, a, t) {
162286
- s.events.trigger('imageManager.imagesLoaded', [e]),
162287
- (function r(e, a) {
162288
- try {
162289
- d.find('.fr-list-column').empty(), (p = u = f = 0), (c = JSON.parse(e)), P();
162290
- }
162291
- catch (t) {
162292
- O(C, a);
162293
- }
162294
- })(e, t.response),
162295
- o.hide();
162296
- },
162297
- fail(e) {
162298
- O(b, e.response || e.responseText);
162299
- },
162300
- })
162301
- : O(w);
162302
- })();
162303
- },
162304
- hide: function N() {
162305
- s.modals.hide(M);
162306
- },
162307
- });
162308
- }),
162309
- !froala_editor_1.default.PLUGINS.image)) {
162310
- throw new Error('Image manager plugin requires image plugin.');
162311
- }
162312
- froala_editor_1.default.DEFAULTS.imageInsertButtons.push('imageManagerCustom'),
162313
- froala_editor_1.default.RegisterCommand('imageManagerCustom', {
162314
- title: 'Browse',
162315
- undo: !1,
162316
- focus: !1,
162317
- modal: !0,
162318
- callback() {
162319
- this.imageManagerCustom.show();
162320
- },
162321
- plugin: 'imageManagerCustom',
162322
- }),
162323
- froala_editor_1.default.DefineIcon('imageManagerCustom', { NAME: 'folder', SVG_KEY: 'imageManager' }),
162324
- froala_editor_1.default.DefineIcon('imageManagerCustomInsert', { NAME: 'plus', SVG_KEY: 'add' }),
162325
- froala_editor_1.default.DefineIcon('imageManagerCustomDelete', { NAME: 'trash', SVG_KEY: 'remove' });
162326
- }
162327
- };
162328
- });
162329
-
162330
161120
  FroalaEditor.DEFAULTS = Object.assign(FroalaEditor.DEFAULTS, {});
162331
161121
  FroalaEditor.PLUGINS.menuButton = function menuButton(editor) {
162332
161122
  let inputButton;