@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
@@ -38,56 +38,130 @@
38
38
  position: relative;
39
39
  float: right;
40
40
  }
41
- .drop {
42
- &-inside {
43
- border: 2px solid #00b7ff !important;
44
- //padding-top: 5px;
45
- //padding-bottom: 5px;
46
- }
47
- &-before {
48
- border-top: 2px solid #00b7ff !important;
49
- //padding-top: 5px;
50
- //padding-bottom: 5px;
51
- }
52
- &-after {
53
- border-bottom: 2px solid #00b7ff !important;
54
- //padding-top: 5px;
55
- //padding-bottom: 5px;
41
+ // Drop Location Borders (Only while Dragging)
42
+ .cdk-drop-list-dragging {
43
+ .drop {
44
+ &-inside {
45
+ border: 2px solid #00b7ff !important;
46
+ //padding-top: 5px;
47
+ //padding-bottom: 5px;
48
+ }
49
+ &-before {
50
+ border-top: 2px solid #00b7ff !important;
51
+ //padding-top: 5px;
52
+ //padding-bottom: 5px;
53
+ }
54
+ &-after {
55
+ border-bottom: 2px solid #00b7ff !important;
56
+ //padding-top: 5px;
57
+ //padding-bottom: 5px;
58
+ }
56
59
  }
57
60
  }
58
61
  .tree-node {
59
62
  // We have to use 'block' since 'flex' makes the Drag & Drop even more inaccurate
60
- display: block;
63
+ //display: block;
64
+
65
+ // Grid works better for alignment and Drag & Drop calculations
66
+ display: grid;
67
+
68
+ // Padding Options
69
+ //padding-top: .225rem;
70
+ //padding-bottom: .225rem;
61
71
  //padding: 20px 10px;
62
- //border-bottom: solid 1px #ccc;
72
+
73
+ // Height & Alignment
74
+ //min-height: 2.5rem;
75
+ vertical-align: middle;
76
+ place-content: center start;
77
+
63
78
  //color: rgba(0, 0, 0, 0.87);
79
+
80
+ // Flex Design (Doesn't work well with Drag & Drop(
64
81
  //display: flex;
65
82
  //flex-direction: row;
83
+
84
+ // Flex Alignment
66
85
  //align-items: center;
67
86
  //justify-content: space-between;
68
87
  //box-sizing: border-box;
88
+
89
+ // Cursor
69
90
  cursor: move;
91
+
92
+ // Alternate Indentation Calculations
93
+ //&:before {
94
+ // position: absolute;
95
+ // top: 15px;
96
+ // left: 0;
97
+ // width: 10px;
98
+ // height: 1px;
99
+ // margin: auto;
100
+ // content: '';
101
+ // background-color: #666;
102
+ //}
103
+
104
+ // Material Buttons
70
105
  a, mat-button, mat-icon-button {
71
106
  cursor: pointer;
72
107
  }
73
108
  // only show certain elements on hover
74
109
  .hover {
110
+ &-box {
111
+ padding-right: 0.5rem;
112
+ }
75
113
  &-box:hover ~ .hover-show {
76
114
  display: unset;
77
115
  }
78
116
  &-show {
79
117
  display: none;
118
+ padding-bottom: 1rem;
119
+ padding-right: 5rem;
80
120
  &:hover {
81
121
  display: unset;
82
122
  }
83
123
  }
84
124
  }
85
125
 
86
- .tree-node { // be explicit for child padding
87
- padding-left: 40px;
88
- //border-left: dashed 1px #222222;
126
+ .tree-node {
127
+ // be explicit for child padding
128
+ padding-left: 2.5rem;
129
+ .tree-node-content {
130
+ padding-top: 0.25rem;
131
+ padding-bottom: 0.25rem;
132
+ .node-name {
133
+ font-size: 10pt;
134
+ }
135
+ }
136
+
137
+ // Debug Child Borders
138
+ //border: dashed 1px #ccc;
89
139
  }
90
140
  .tree-node-content {
141
+ // Cell Borders
142
+ &.border {
143
+ border: dashed 1px #ccc;
144
+ }
145
+ .node-name {
146
+ font-weight: bold;
147
+ font-size: 15pt;
148
+ padding-right: 0.5rem;
149
+ }
150
+ // this maintains alignment for parents without children
151
+ .mat-button-placeholder {
152
+ display: inline-block;
153
+ width: 40px;
154
+ height: 40px;
155
+ vertical-align: baseline;
156
+ line-height: 40px;
157
+ }
158
+ padding-top: 1rem;
159
+ padding-bottom: 1rem;
160
+ padding-right: 0.5rem;
161
+ //.mat-icon-button {
162
+ // width: auto;
163
+ // height: auto;
164
+ //}
91
165
  .visibility-off {
92
166
  opacity: 0.5;
93
167
  }
@@ -122,7 +196,7 @@
122
196
  }
123
197
  &.cdk-drop-list-dragging {
124
198
  .tree-node:not(.cdk-drag-placeholder) {
125
- //transition: transform 250ms cubic-bezier(0, 0, 0.2, 1);
199
+ transition: transform 250ms cubic-bezier(0, 0, 0.2, 1);
126
200
  }
127
201
  }
128
202
  &:last-child {
@@ -130,6 +204,7 @@
130
204
  }
131
205
  }
132
206
  .cdk {
207
+ // NOTE: Much of these Drag Selectors won't work, since this element gets pulled out of the Tree Element when being dragged.
133
208
  &-drag {
134
209
  &-preview {
135
210
  //box-sizing: border-box;
@@ -164,6 +239,9 @@
164
239
  // border-style: dashed !important;
165
240
  // border-radius: 4px !important;
166
241
  //}
242
+ .hover-show {
243
+ display: none !important;
244
+ }
167
245
  }
168
246
  &-receiving {
169
247
  //min-width: 100px;
@@ -208,6 +286,38 @@
208
286
  // }
209
287
  //}
210
288
 
289
+ // NOTE: CDK Drag needs to be outside .tree, since this element gets pulled out of the Tree Element when being dragged.
290
+ .cdk {
291
+ &-drag {
292
+ &-preview {
293
+ box-sizing: border-box;
294
+ border-radius: 4px;
295
+ //box-shadow: 0 5px 5px -3px rgba(0, 0, 0, 0.2),
296
+ //0 8px 10px 1px rgba(0, 0, 0, 0.14),
297
+ //0 3px 14px 2px rgba(0, 0, 0, 0.12);
298
+ padding: 0 !important;
299
+ .hover-show {
300
+ display: none !important;
301
+ }
302
+ }
303
+ // Dragging Placeholder
304
+ &-placeholder {
305
+ opacity: 50%;
306
+ // Hide Hover Buttons
307
+ .hover-show {
308
+ display: none !important;
309
+ }
310
+ // Hide Children
311
+ .tree-node-drop-list {
312
+ display: none !important;
313
+ }
314
+ }
315
+ //&-animating {
316
+ // transition: transform 250ms cubic-bezier(0, 0, 0.2, 1);
317
+ //}
318
+ }
319
+ }
320
+
211
321
  // Tree Dialog
212
322
  .tree-dialog-content {
213
323
  .form-field {
@@ -49,11 +49,12 @@ import {RefreshInterface} from '../core/refresh.interface'
49
49
  // Services
50
50
  import {BackendService} from '../backend.service'
51
51
  import {Registry} from '@stratusjs/angularjs/services/registry'
52
- import {cookie} from '@stratusjs/core/environment'
53
52
 
54
53
  // Core Classes
55
54
  import {EventManager} from '@stratusjs/core/events/eventManager'
56
55
  import {EventBase} from '@stratusjs/core/events/eventBase'
56
+ import {cookie} from '@stratusjs/core/environment'
57
+ import {isJSON} from '@stratusjs/core/misc'
57
58
 
58
59
  // AngularJS Classes
59
60
  import {
@@ -196,7 +197,6 @@ export class TreeComponent extends RootComponent implements OnInit, OnDestroy {
196
197
  expandDelay = 1000
197
198
  dropData: DropData = null
198
199
  cdkDropListSortingDisabled = true
199
- dropDebug = false
200
200
 
201
201
  // Tree Specific
202
202
  tree: Node[]
@@ -210,6 +210,10 @@ export class TreeComponent extends RootComponent implements OnInit, OnDestroy {
210
210
  // hasChild = (index: number, node: any) => this.getChildren(node).length > 0
211
211
  // hasChild = (index: number, node: any) => node.children && node.children.length > 0
212
212
 
213
+ // User Settings
214
+ isBorder = false
215
+ isDebug = false
216
+
213
217
  constructor(
214
218
  public iconRegistry: MatIconRegistry,
215
219
  public sanitizer: DomSanitizer,
@@ -323,6 +327,16 @@ export class TreeComponent extends RootComponent implements OnInit, OnDestroy {
323
327
  this.dropListIdMap[`${this.uid}_parent_drop_list`] = true
324
328
  this.trackDropLists()
325
329
 
330
+ // Initialize User Settings
331
+ const isBorder = cookie('tree-node-border')
332
+ if (isBorder && isJSON(isBorder)) {
333
+ this.isBorder = JSON.parse(isBorder)
334
+ }
335
+ const isDebug = cookie('tree-debug')
336
+ if (isDebug && isJSON(isDebug)) {
337
+ this.isDebug = JSON.parse(isDebug)
338
+ }
339
+
326
340
  // Mark as complete
327
341
  this.isInitialized = true
328
342
 
@@ -546,7 +560,7 @@ export class TreeComponent extends RootComponent implements OnInit, OnDestroy {
546
560
  // return this.getIdsRecursive(this.parentItem).reverse()
547
561
  // }
548
562
 
549
- public onDragDrop(event: CdkDragDrop<any>) {
563
+ public async onDragDrop(event: CdkDragDrop<any>) {
550
564
  // ignore drops outside of the tree
551
565
  if (!event.isPointerOverContainer) {
552
566
  return
@@ -582,7 +596,7 @@ export class TreeComponent extends RootComponent implements OnInit, OnDestroy {
582
596
  this.treeMap[_.toNumber(this.dropData.targetId)] : null
583
597
 
584
598
  // Debug Data
585
- if (cookie('env') && this.dropDebug) {
599
+ if (cookie('env') && this.isDebug) {
586
600
  console.group('onDragDrop()')
587
601
  _.forEach(
588
602
  [
@@ -602,7 +616,7 @@ export class TreeComponent extends RootComponent implements OnInit, OnDestroy {
602
616
  // with the drop location and this attempts to correct it in these
603
617
  // specific edge cases
604
618
  if (targetDropNode && !this.nodeIsEqual(parentNode, targetDropNode)) {
605
- if (cookie('env') && this.dropDebug) {
619
+ if (cookie('env') && this.isDebug) {
606
620
  console.log(`target drop node differs: ${targetDropNode.id} -> ${targetDropNode.model.get('name')}`)
607
621
  console.log('target drop node is the same as target node:', targetNode.id === targetDropNode.id)
608
622
  }
@@ -619,7 +633,7 @@ export class TreeComponent extends RootComponent implements OnInit, OnDestroy {
619
633
  break
620
634
  }
621
635
  }
622
- if (cookie('env') && this.dropDebug) {
636
+ if (cookie('env') && this.isDebug) {
623
637
  console.log('target drop node selected:', parentNode ? `${parentNode.id} -> ${parentNode.model.get('name')}` : 'none')
624
638
  }
625
639
  }
@@ -648,7 +662,7 @@ export class TreeComponent extends RootComponent implements OnInit, OnDestroy {
648
662
  targetNode.model.set('nestParent', this.buildNodePatch(parentNode))
649
663
 
650
664
  // Display debug data
651
- if (cookie('env') && this.dropDebug) {
665
+ if (cookie('env') && this.isDebug) {
652
666
  console.log(`new parent: ${targetNode.model.get('nestParent.name') || null}`)
653
667
  }
654
668
  }
@@ -668,7 +682,7 @@ export class TreeComponent extends RootComponent implements OnInit, OnDestroy {
668
682
  if (this.dropData.action === 'after') {
669
683
  targetDropIndex++
670
684
  }
671
- if (cookie('env') && this.dropDebug) {
685
+ if (cookie('env') && this.isDebug) {
672
686
  console.log('index change (drop node):', `${event.previousIndex} -> ${targetDropIndex}`)
673
687
  }
674
688
  break
@@ -688,14 +702,13 @@ export class TreeComponent extends RootComponent implements OnInit, OnDestroy {
688
702
  node.model.set('priority', priority++)
689
703
  })
690
704
  // Display debug data
691
- if (cookie('env') && this.dropDebug) {
705
+ if (cookie('env') && this.isDebug) {
692
706
  console.log('new priority:', targetNode.model.get('priority'))
693
707
  }
694
708
  }
695
709
 
696
710
  // Close Debug Group
697
- if (cookie('env') && this.dropDebug) {
698
- console.log(`new parent: ${targetNode.model.get('nestParent.name') || null}`)
711
+ if (cookie('env') && this.isDebug) {
699
712
  console.groupEnd()
700
713
  }
701
714
 
@@ -716,14 +729,17 @@ export class TreeComponent extends RootComponent implements OnInit, OnDestroy {
716
729
  // })
717
730
 
718
731
  // Start XHR
719
- targetNode.model.save()
732
+ await targetNode.model.save()
720
733
 
721
734
  // Enable Listeners
722
735
  this.unsettled = false
723
736
 
737
+ // Refresh UI
738
+ // await this.refresh()
739
+
724
740
  // update pipe
725
- // this.subscriber.next(tree)
726
- // this.ref.detectChanges()
741
+ this.subscriber.next(this.dataRef())
742
+ this.ref.detectChanges()
727
743
 
728
744
  // propagate change
729
745
  // this.collection.throttleTrigger('change')
@@ -1,38 +0,0 @@
1
- System.register(["quill", "@stratusjs/core/environment"], function (exports_1, context_1) {
2
- "use strict";
3
- var quill_1, environment_1, Break, Embed, QuillBreak;
4
- var __moduleName = context_1 && context_1.id;
5
- return {
6
- setters: [
7
- function (quill_1_1) {
8
- quill_1 = quill_1_1;
9
- },
10
- function (environment_1_1) {
11
- environment_1 = environment_1_1;
12
- }
13
- ],
14
- execute: function () {
15
- Break = quill_1.default.import('blots/break');
16
- Embed = quill_1.default.import('blots/embed');
17
- QuillBreak = class QuillBreak extends Break {
18
- length() {
19
- return 1;
20
- }
21
- value() {
22
- return '\n';
23
- }
24
- insertInto(parent, ref) {
25
- if (environment_1.cookie('env')) {
26
- console.log('insertInto:', parent, ref);
27
- }
28
- Embed.prototype.insertInto.call(this, parent, ref);
29
- }
30
- };
31
- exports_1("QuillBreak", QuillBreak);
32
- QuillBreak.blotName = 'break';
33
- QuillBreak.tagName = 'BR';
34
- }
35
- };
36
- });
37
-
38
- //# sourceMappingURL=quill-break-blot.plugin.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["quill-break-blot.plugin.ts"],"names":[],"mappings":";;;;;;;;;;;;;;YAKM,KAAK,GAAG,eAAK,CAAC,MAAM,CAAC,aAAa,CAAC,CAAA;YACnC,KAAK,GAAG,eAAK,CAAC,MAAM,CAAC,aAAa,CAAC,CAAA;YAWzC,aAAA,MAAa,UAAW,SAAQ,KAAK;gBACjC,MAAM;oBACF,OAAO,CAAC,CAAA;gBACZ,CAAC;gBACD,KAAK;oBACD,OAAO,IAAI,CAAA;gBACf,CAAC;gBAED,UAAU,CAAC,MAAW,EAAE,GAAQ;oBAC5B,IAAI,oBAAM,CAAC,KAAK,CAAC,EAAE;wBACf,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,MAAM,EAAE,GAAG,CAAC,CAAA;qBAC1C;oBACD,KAAK,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,CAAC,CAAA;gBACtD,CAAC;aACJ,CAAA;;YAED,UAAU,CAAC,QAAQ,GAAG,OAAO,CAAA;YAC7B,UAAU,CAAC,OAAO,GAAG,IAAI,CAAA;QACzB,CAAC","file":"quill-break-blot.plugin.js"}
@@ -1 +0,0 @@
1
- System.register(["quill","@stratusjs/core/environment"],function(t,e){"use strict";var n,r,o,s,i;e&&e.id;return{setters:[function(t){n=t},function(t){r=t}],execute:function(){o=n.default.import("blots/break"),s=n.default.import("blots/embed"),t("QuillBreak",i=class extends o{length(){return 1}value(){return"\n"}insertInto(t,e){r.cookie("env")&&console.log("insertInto:",t,e),s.prototype.insertInto.call(this,t,e)}}),i.blotName="break",i.tagName="BR"}}});
@@ -1,164 +0,0 @@
1
- System.register(["quill"], function (exports_1, context_1) {
2
- "use strict";
3
- var quill_1, debug, Logger, QuillHtmlEditPlugin;
4
- var __moduleName = context_1 && context_1.id;
5
- function $create(elName) {
6
- return document.createElement(elName);
7
- }
8
- function $setAttr(el, key, value) {
9
- return el.setAttribute(key, value);
10
- }
11
- function launchPopupEditor(quill, options) {
12
- const htmlFromEditor = quill.container.querySelector('.ql-editor').innerHTML;
13
- const popupContainer = $create('div');
14
- const overlayContainer = $create('div');
15
- const msg = options.msg || 'Edit HTML here, when you click "OK" the quill editor\'s contents will be replaced';
16
- const cancelText = options.cancelText || 'Cancel';
17
- const okText = options.okText || 'Ok';
18
- $setAttr(overlayContainer, 'class', 'ql-html-overlayContainer');
19
- $setAttr(popupContainer, 'class', 'ql-html-popupContainer');
20
- const popupTitle = $create('i');
21
- $setAttr(popupTitle, 'class', 'ql-html-popupTitle');
22
- popupTitle.innerText = msg;
23
- const textContainer = $create('div');
24
- textContainer.appendChild(popupTitle);
25
- $setAttr(textContainer, 'class', 'ql-html-textContainer');
26
- const textArea = $create('textarea');
27
- $setAttr(textArea, 'class', 'ql-html-textArea');
28
- textArea.value = formatHTML(htmlFromEditor);
29
- const buttonCancel = $create('button');
30
- buttonCancel.innerHTML = cancelText;
31
- $setAttr(buttonCancel, 'class', 'ql-html-buttonCancel');
32
- const buttonOk = $create('button');
33
- buttonOk.innerHTML = okText;
34
- const buttonGroup = $create('div');
35
- $setAttr(buttonGroup, 'class', 'ql-html-buttonGroup');
36
- buttonGroup.appendChild(buttonCancel);
37
- buttonGroup.appendChild(buttonOk);
38
- textContainer.appendChild(textArea);
39
- textContainer.appendChild(buttonGroup);
40
- popupContainer.appendChild(textContainer);
41
- overlayContainer.appendChild(popupContainer);
42
- document.body.appendChild(overlayContainer);
43
- buttonCancel.onclick = () => {
44
- document.body.removeChild(overlayContainer);
45
- };
46
- overlayContainer.onclick = buttonCancel.onclick;
47
- popupContainer.onclick = (e) => {
48
- e.preventDefault();
49
- e.stopPropagation();
50
- };
51
- buttonOk.onclick = () => {
52
- const output = textArea.value.split(/\r?\n/g).map((el) => el.trim());
53
- const noNewlines = output.join('');
54
- quill.container.querySelector('.ql-editor').innerHTML = noNewlines;
55
- document.body.removeChild(overlayContainer);
56
- };
57
- }
58
- function formatHTML(code) {
59
- 'use strict';
60
- const stripWhiteSpaces = true;
61
- const stripEmptyLines = true;
62
- const whitespace = ' '.repeat(2);
63
- let currentIndent = 0;
64
- const newlineChar = '\n';
65
- let char = null;
66
- let nextChar = null;
67
- let result = '';
68
- for (let pos = 0; pos <= code.length; pos++) {
69
- char = code.substr(pos, 1);
70
- nextChar = code.substr(pos + 1, 1);
71
- const isBrTag = code.substr(pos, 4) === '<br>';
72
- const isOpeningTag = char === '<' && nextChar !== '/' && !isBrTag;
73
- const isClosingTag = char === '<' && nextChar === '/' && !isBrTag;
74
- if (isBrTag) {
75
- result += newlineChar;
76
- currentIndent--;
77
- pos += 4;
78
- }
79
- if (isOpeningTag) {
80
- result += newlineChar + whitespace.repeat(currentIndent);
81
- currentIndent++;
82
- }
83
- else if (isClosingTag) {
84
- if (--currentIndent < 0) {
85
- currentIndent = 0;
86
- }
87
- result += newlineChar + whitespace.repeat(currentIndent);
88
- }
89
- else if (stripWhiteSpaces === true && char === ' ' && nextChar === ' ') {
90
- char = '';
91
- }
92
- else if (stripEmptyLines === true && char === newlineChar) {
93
- if (code.substr(pos, code.substr(pos).indexOf('<')).trim() === '') {
94
- char = '';
95
- }
96
- }
97
- result += char;
98
- }
99
- Logger.log('formatHTML', {
100
- before: code,
101
- after: result
102
- });
103
- return result;
104
- }
105
- return {
106
- setters: [
107
- function (quill_1_1) {
108
- quill_1 = quill_1_1;
109
- }
110
- ],
111
- execute: function () {
112
- debug = false;
113
- Logger = {
114
- prefixString() {
115
- return `</> quill-html-edit-button: `;
116
- },
117
- get log() {
118
- if (!debug) {
119
- return () => { };
120
- }
121
- const boundLogFn = console.log.bind(console, this.prefixString());
122
- return boundLogFn;
123
- }
124
- };
125
- QuillHtmlEditPlugin = class QuillHtmlEditPlugin {
126
- constructor(quill, options) {
127
- debug = options && options.debug;
128
- Logger.log('logging enabled');
129
- const toolbarModule = quill.getModule('toolbar');
130
- if (!toolbarModule) {
131
- throw new Error('quill.htmlEditButton requires the "toolbar" module to be included too');
132
- }
133
- this.registerDivModule();
134
- const toolbarEl = toolbarModule.container;
135
- const buttonContainer = $create('span');
136
- $setAttr(buttonContainer, 'class', 'ql-formats');
137
- const button = $create('button');
138
- button.innerHTML = options.buttonHTML || '&lt;&gt;';
139
- button.title = options.buttonTitle || 'Show HTML source';
140
- button.onclick = (e) => {
141
- e.preventDefault();
142
- launchPopupEditor(quill, options);
143
- };
144
- buttonContainer.appendChild(button);
145
- toolbarEl.appendChild(buttonContainer);
146
- }
147
- registerDivModule() {
148
- const Block = quill_1.default.import('blots/block');
149
- class Div extends Block {
150
- }
151
- Div.tagName = 'div';
152
- Div.blotName = 'div';
153
- Div.allowedChildren = Block.allowedChildren;
154
- Div.allowedChildren.push(Block);
155
- quill_1.default.register(Div);
156
- }
157
- };
158
- exports_1("QuillHtmlEditPlugin", QuillHtmlEditPlugin);
159
- exports_1("default", QuillHtmlEditPlugin);
160
- }
161
- };
162
- });
163
-
164
- //# sourceMappingURL=quill-html-edit.plugin.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["quill-html-edit.plugin.ts"],"names":[],"mappings":";;;;IAQA,SAAS,OAAO,CAAC,MAAW;QACxB,OAAO,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,CAAA;IACzC,CAAC;IACD,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B,GAAG,CAAC,OAAO,GAAG,KAAK,CAAA;oBACnB,GAAG,CAAC,QAAQ,GAAG,KAAK,CAAA;oBACpB,GAAG,CAAC,eAAe,GAAG,KAAK,CAAC,eAAe,CAAA;oBAC3C,GAAG,CAAC,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;oBAC/B,eAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAA;gBACvB,CAAC;aACJ,CAAA;;iCA6Gc,mBAAmB;QAElC,CAAC","file":"quill-html-edit.plugin.js"}
@@ -1 +0,0 @@
1
- System.register(["quill"],function(t,e){"use strict";var n,l,o,i;e&&e.id;function r(t){return document.createElement(t)}function s(t,e,n){return t.setAttribute(e,n)}function c(t,e){const n=t.container.querySelector(".ql-editor").innerHTML,l=r("div"),i=r("div"),c=e.msg||'Edit HTML here, when you click "OK" the quill editor\'s contents will be replaced',u=e.cancelText||"Cancel",d=e.okText||"Ok";s(i,"class","ql-html-overlayContainer"),s(l,"class","ql-html-popupContainer");const a=r("i");s(a,"class","ql-html-popupTitle"),a.innerText=c;const p=r("div");p.appendChild(a),s(p,"class","ql-html-textContainer");const h=r("textarea");s(h,"class","ql-html-textArea"),h.value=function(t){const e=" ".repeat(2);let n=0;let l=null,i=null,r="";for(let o=0;o<=t.length;o++){l=t.substr(o,1),i=t.substr(o+1,1);const s="<br>"===t.substr(o,4),c="<"===l&&"/"===i&&!s;s&&(r+="\n",n--,o+=4),"<"===l&&"/"!==i&&!s?(r+="\n"+e.repeat(n),n++):c?(--n<0&&(n=0),r+="\n"+e.repeat(n)):(" "===l&&" "===i||"\n"===l&&""===t.substr(o,t.substr(o).indexOf("<")).trim())&&(l=""),r+=l}return o.log("formatHTML",{before:t,after:r}),r}(n);const b=r("button");b.innerHTML=u,s(b,"class","ql-html-buttonCancel");const m=r("button");m.innerHTML=d;const g=r("div");s(g,"class","ql-html-buttonGroup"),g.appendChild(b),g.appendChild(m),p.appendChild(h),p.appendChild(g),l.appendChild(p),i.appendChild(l),document.body.appendChild(i),b.onclick=()=>{document.body.removeChild(i)},i.onclick=b.onclick,l.onclick=t=>{t.preventDefault(),t.stopPropagation()},m.onclick=()=>{const e=h.value.split(/\r?\n/g).map(t=>t.trim()).join("");t.container.querySelector(".ql-editor").innerHTML=e,document.body.removeChild(i)}}return{setters:[function(t){n=t}],execute:function(){l=!1,o={prefixString:()=>"</> quill-html-edit-button: ",get log(){if(!l)return()=>{};return console.log.bind(console,this.prefixString())}},t("QuillHtmlEditPlugin",i=class{constructor(t,e){l=e&&e.debug,o.log("logging enabled");const n=t.getModule("toolbar");if(!n)throw new Error('quill.htmlEditButton requires the "toolbar" module to be included too');this.registerDivModule();const i=n.container,u=r("span");s(u,"class","ql-formats");const d=r("button");d.innerHTML=e.buttonHTML||"&lt;&gt;",d.title=e.buttonTitle||"Show HTML source",d.onclick=n=>{n.preventDefault(),c(t,e)},u.appendChild(d),i.appendChild(u)}registerDivModule(){const t=n.default.import("blots/block");class e extends t{}e.tagName="div",e.blotName="div",e.allowedChildren=t.allowedChildren,e.allowedChildren.push(t),n.default.register(e)}}),t("default",i)}}});
@@ -1,50 +0,0 @@
1
- System.register(["quill"], function (exports_1, context_1) {
2
- "use strict";
3
- var quill_1, BaseImage, ATTRIBUTES, QuillImageFormatPlugin;
4
- var __moduleName = context_1 && context_1.id;
5
- return {
6
- setters: [
7
- function (quill_1_1) {
8
- quill_1 = quill_1_1;
9
- }
10
- ],
11
- execute: function () {
12
- BaseImage = quill_1.default.import('formats/image');
13
- ATTRIBUTES = [
14
- 'alt',
15
- 'height',
16
- 'width',
17
- 'stratus-src',
18
- 'stratusSrc'
19
- ];
20
- QuillImageFormatPlugin = class QuillImageFormatPlugin extends BaseImage {
21
- constructor() {
22
- super(...arguments);
23
- this.blotName = 'imageCustom';
24
- this.tagName = 'IMG';
25
- }
26
- format(name, value) {
27
- console.log('format:', name, value, this.domNode.getAttribute('src'));
28
- if (ATTRIBUTES.indexOf(name) === -1) {
29
- super.format(name, value);
30
- return;
31
- }
32
- if (!value) {
33
- this.domNode.removeAttribute(name);
34
- return;
35
- }
36
- if (name === 'stratus-src') {
37
- console.log('stratus-src:', value);
38
- }
39
- if (name === 'stratusSrc') {
40
- console.log('stratusSrc:', value);
41
- }
42
- this.domNode.setAttribute(name, value);
43
- }
44
- };
45
- exports_1("QuillImageFormatPlugin", QuillImageFormatPlugin);
46
- }
47
- };
48
- });
49
-
50
- //# sourceMappingURL=quill-image-format.plugin.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["quill-image-format.plugin.ts"],"names":[],"mappings":";;;;;;;;;;;YACM,SAAS,GAAG,eAAK,CAAC,MAAM,CAAC,eAAe,CAAC,CAAA;YAEzC,UAAU,GAAG;gBACf,KAAK;gBACL,QAAQ;gBACR,OAAO;gBACP,aAAa;gBACb,YAAY;aACf,CAAA;YAED,yBAAA,MAAa,sBAAuB,SAAQ,SAAS;gBAArD;;oBAGI,aAAQ,GAAG,aAAa,CAAA;oBACxB,YAAO,GAAG,KAAK,CAAA;gBA2DnB,CAAC;gBApBG,MAAM,CAAC,IAAS,EAAE,KAAU;oBACxB,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAA;oBACrE,IAAI,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE;wBACjC,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;wBACzB,OAAM;qBACT;oBACD,IAAI,CAAC,KAAK,EAAE;wBACR,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,IAAI,CAAC,CAAA;wBAClC,OAAM;qBACT;oBACD,IAAI,IAAI,KAAK,aAAa,EAAE;wBACxB,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,KAAK,CAAC,CAAA;qBAErC;oBACD,IAAI,IAAI,KAAK,YAAY,EAAE;wBACvB,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,KAAK,CAAC,CAAA;qBAEpC;oBACD,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;gBAC1C,CAAC;aACJ,CAAA;;QACD,CAAC","file":"quill-image-format.plugin.js"}
@@ -1 +0,0 @@
1
- System.register(["quill"],function(t,s){"use strict";var e,r,o;s&&s.id;return{setters:[function(t){e=t}],execute:function(){r=e.default.import("formats/image"),o=["alt","height","width","stratus-src","stratusSrc"],t("QuillImageFormatPlugin",class extends r{constructor(){super(...arguments),this.blotName="imageCustom",this.tagName="IMG"}format(t,s){console.log("format:",t,s,this.domNode.getAttribute("src")),-1!==o.indexOf(t)?s?("stratus-src"===t&&console.log("stratus-src:",s),"stratusSrc"===t&&console.log("stratusSrc:",s),this.domNode.setAttribute(t,s)):this.domNode.removeAttribute(t):super.format(t,s)}})}}});