@stratusjs/angular 0.5.12 → 0.5.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/angular.bundle.js +31 -10
- package/dist/angular.bundle.min.js +1 -1
- package/package.json +1 -1
- package/src/app.module.js +5 -45
- package/src/app.module.js.map +1 -1
- package/src/app.module.min.js +1 -1
- package/src/app.module.ts +5 -273
- package/src/editor/link-dialog.component.js.map +1 -1
- package/src/editor/link-dialog.component.ts +2 -1
- package/src/froala/plugins/inputButton.js +18 -1
- package/src/froala/plugins/inputButton.js.map +1 -1
- package/src/froala/plugins/inputButton.min.js +1 -1
- package/src/froala/plugins/inputButton.ts +28 -8
- package/src/froala/plugins/linkManager.js +26 -11
- package/src/froala/plugins/linkManager.js.map +1 -1
- package/src/froala/plugins/linkManager.min.js +1 -1
- package/src/froala/plugins/linkManager.ts +49 -9
- package/src/main.js.map +1 -1
- package/src/main.ts +3 -0
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
import _ from 'lodash'
|
|
15
15
|
|
|
16
16
|
// Universal Button
|
|
17
|
-
// TODO:
|
|
17
|
+
// TODO: Some of this can move elsewhere, since it isn't completely specific to Froala
|
|
18
18
|
export class InputButtonPlugin<EventData = string|LooseObject> implements TriggerInterface {
|
|
19
19
|
// Local
|
|
20
20
|
uid: string
|
|
@@ -79,6 +79,9 @@ export class InputButtonPlugin<EventData = string|LooseObject> implements Trigge
|
|
|
79
79
|
}
|
|
80
80
|
// Get snapshot before passing off event
|
|
81
81
|
this.updateSnapshot()
|
|
82
|
+
if (this.debug) {
|
|
83
|
+
console.log(`[${this.eventName}]:`, {instance, data})
|
|
84
|
+
}
|
|
82
85
|
instance.trigger(this.eventName, data, this)
|
|
83
86
|
}
|
|
84
87
|
|
|
@@ -97,7 +100,7 @@ export class InputButtonPlugin<EventData = string|LooseObject> implements Trigge
|
|
|
97
100
|
return
|
|
98
101
|
}
|
|
99
102
|
// Ensure we only continue for 'insert' or 'restore' events
|
|
100
|
-
if (['insert', 'restore'].includes(name)) {
|
|
103
|
+
if (!['insert', 'restore'].includes(name)) {
|
|
101
104
|
console.warn(`${this.name}.trigger():`, name, 'event is not supported.')
|
|
102
105
|
return
|
|
103
106
|
}
|
|
@@ -133,11 +136,17 @@ export class InputButtonPlugin<EventData = string|LooseObject> implements Trigge
|
|
|
133
136
|
return false
|
|
134
137
|
}
|
|
135
138
|
// Get focus back to the editor
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
+
if (this.debug) {
|
|
140
|
+
console.log('[restoreSnapshot]is focused:', this.editor.core.hasFocus())
|
|
141
|
+
}
|
|
142
|
+
// Always disable blur before changing focus
|
|
143
|
+
this.editor.events.disableBlur()
|
|
144
|
+
// Get focus back to the editor
|
|
145
|
+
this.editor.events.focus()
|
|
139
146
|
// Restore last snapshot
|
|
140
147
|
this.editor.snapshot.restore(this.snapshot)
|
|
148
|
+
// Enable Blur after snapshot
|
|
149
|
+
this.editor.events.enableBlur()
|
|
141
150
|
return true
|
|
142
151
|
}
|
|
143
152
|
|
|
@@ -154,12 +163,18 @@ export class InputButtonPlugin<EventData = string|LooseObject> implements Trigge
|
|
|
154
163
|
console.warn(`${this.name}.restoreSelection(): unable to restore editor selection.`)
|
|
155
164
|
return false
|
|
156
165
|
}
|
|
166
|
+
// Note Focus
|
|
167
|
+
if (this.debug) {
|
|
168
|
+
console.log('[restoreSelection]is focused:', this.editor.core.hasFocus())
|
|
169
|
+
}
|
|
170
|
+
// Always disable blur before changing focus
|
|
171
|
+
this.editor.events.disableBlur()
|
|
157
172
|
// Get focus back to the editor
|
|
158
|
-
|
|
159
|
-
// console.log('[restoreSelection]is focused:', this.editor.core.hasFocus())
|
|
160
|
-
// this.editor.events.focus()
|
|
173
|
+
this.editor.events.focus()
|
|
161
174
|
// Restore last selection
|
|
162
175
|
this.editor.selection.restore()
|
|
176
|
+
// Enable Blur
|
|
177
|
+
this.editor.events.enableBlur()
|
|
163
178
|
return true
|
|
164
179
|
}
|
|
165
180
|
|
|
@@ -168,7 +183,12 @@ export class InputButtonPlugin<EventData = string|LooseObject> implements Trigge
|
|
|
168
183
|
console.warn(`${this.name}.saveSelection(): unable to save editor selection.`)
|
|
169
184
|
return false
|
|
170
185
|
}
|
|
186
|
+
// Disable blur before save
|
|
187
|
+
this.editor.events.disableBlur()
|
|
188
|
+
// Save selection inside Content-Editable HTML on DOM
|
|
171
189
|
this.editor.selection.save()
|
|
190
|
+
// Enable Blur after save
|
|
191
|
+
this.editor.events.enableBlur()
|
|
172
192
|
return true
|
|
173
193
|
}
|
|
174
194
|
|
|
@@ -1,12 +1,18 @@
|
|
|
1
|
-
System.register(["./inputButton", "froala-editor"], function (exports_1, context_1) {
|
|
1
|
+
System.register(["./inputButton", "@stratusjs/runtime/stratus", "lodash", "froala-editor"], function (exports_1, context_1) {
|
|
2
2
|
"use strict";
|
|
3
|
-
var inputButton_1, froala_editor_1;
|
|
3
|
+
var inputButton_1, stratus_1, lodash_1, froala_editor_1;
|
|
4
4
|
var __moduleName = context_1 && context_1.id;
|
|
5
5
|
return {
|
|
6
6
|
setters: [
|
|
7
7
|
function (inputButton_1_1) {
|
|
8
8
|
inputButton_1 = inputButton_1_1;
|
|
9
9
|
},
|
|
10
|
+
function (stratus_1_1) {
|
|
11
|
+
stratus_1 = stratus_1_1;
|
|
12
|
+
},
|
|
13
|
+
function (lodash_1_1) {
|
|
14
|
+
lodash_1 = lodash_1_1;
|
|
15
|
+
},
|
|
10
16
|
function (froala_editor_1_1) {
|
|
11
17
|
froala_editor_1 = froala_editor_1_1;
|
|
12
18
|
}
|
|
@@ -17,9 +23,10 @@ System.register(["./inputButton", "froala-editor"], function (exports_1, context
|
|
|
17
23
|
});
|
|
18
24
|
froala_editor_1.default.PLUGINS.linkManager = function linkManager(editor) {
|
|
19
25
|
let inputButton;
|
|
20
|
-
const linkPlugin = froala_editor_1.default.PLUGINS.link(editor);
|
|
21
26
|
const debug = false;
|
|
22
27
|
function _init() {
|
|
28
|
+
this.uid = lodash_1.uniqueId(`froala_link_manager_`);
|
|
29
|
+
stratus_1.Stratus.Instances[this.uid] = this;
|
|
23
30
|
inputButton = new inputButton_1.InputButtonPlugin({
|
|
24
31
|
name: 'Link Manager',
|
|
25
32
|
eventName: 'link-library',
|
|
@@ -32,25 +39,32 @@ System.register(["./inputButton", "froala-editor"], function (exports_1, context
|
|
|
32
39
|
if (link.target) {
|
|
33
40
|
attrs.target = '_blank';
|
|
34
41
|
}
|
|
35
|
-
|
|
42
|
+
editor.link.insert(link.url, link.text, attrs);
|
|
36
43
|
},
|
|
37
44
|
autoSaveSelection: true,
|
|
38
45
|
autoRestoreSelection: true,
|
|
39
46
|
debug
|
|
40
47
|
});
|
|
48
|
+
this.inputButton = inputButton;
|
|
49
|
+
this.editor = editor;
|
|
41
50
|
if (debug) {
|
|
42
51
|
console.log('initialized:', {
|
|
43
52
|
options: editor.opts.endpoint,
|
|
44
|
-
instance: this
|
|
53
|
+
instance: this,
|
|
54
|
+
inputButton: inputButton.uid,
|
|
45
55
|
});
|
|
46
56
|
}
|
|
47
57
|
}
|
|
48
|
-
function onClick() {
|
|
58
|
+
function onClick(el, data) {
|
|
49
59
|
if (!editor.el) {
|
|
50
60
|
console.warn('linkManager.onClick(): unable to find element');
|
|
51
61
|
return;
|
|
52
62
|
}
|
|
53
|
-
|
|
63
|
+
const link = editor.link.get();
|
|
64
|
+
if (debug) {
|
|
65
|
+
console.log('[linkManager.onClick()]:', link);
|
|
66
|
+
}
|
|
67
|
+
inputButton.onClick(editor.el, link);
|
|
54
68
|
}
|
|
55
69
|
return {
|
|
56
70
|
_init,
|
|
@@ -60,10 +74,11 @@ System.register(["./inputButton", "froala-editor"], function (exports_1, context
|
|
|
60
74
|
froala_editor_1.default.RegisterCommand('linkManager', {
|
|
61
75
|
title: 'Insert from Link Library',
|
|
62
76
|
undo: false,
|
|
63
|
-
focus:
|
|
77
|
+
focus: true,
|
|
64
78
|
modal: true,
|
|
79
|
+
refreshOnCallback: false,
|
|
65
80
|
callback() {
|
|
66
|
-
this.linkManager.onClick(
|
|
81
|
+
this.linkManager.onClick();
|
|
67
82
|
},
|
|
68
83
|
plugin: 'linkManager',
|
|
69
84
|
}),
|
|
@@ -74,7 +89,7 @@ System.register(["./inputButton", "froala-editor"], function (exports_1, context
|
|
|
74
89
|
focus: false,
|
|
75
90
|
modal: true,
|
|
76
91
|
callback() {
|
|
77
|
-
this.linkManager.onClick(undefined,
|
|
92
|
+
this.linkManager.onClick(undefined, this.link.get());
|
|
78
93
|
},
|
|
79
94
|
plugin: 'linkManager',
|
|
80
95
|
}),
|
|
@@ -91,7 +106,7 @@ System.register(["./inputButton", "froala-editor"], function (exports_1, context
|
|
|
91
106
|
eventName: 'link-library',
|
|
92
107
|
editor: this,
|
|
93
108
|
insert: (link) => {
|
|
94
|
-
|
|
109
|
+
this.link.insert(link.url, '', { 'aria-label': link.title });
|
|
95
110
|
},
|
|
96
111
|
autoSaveSelection: true,
|
|
97
112
|
autoRestoreSelection: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["linkManager.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["linkManager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;YA6BA,uBAAY,CAAC,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,uBAAY,CAAC,QAAQ,EAAE;gBACzD,QAAQ,EAAE,cAAc;aAC3B,CAAC,CAAA;YAKF,uBAAY,CAAC,OAAO,CAAC,WAAW,GAAG,SAAS,WAAW,CAAE,MAAW;gBAEhE,IAAI,WAA8B,CAAA;gBAElC,MAAM,KAAK,GAAG,KAAK,CAAA;gBAGnB,SAAS,KAAK;oBAEV,IAAI,CAAC,GAAG,GAAG,iBAAQ,CAAC,sBAAsB,CAAC,CAAA;oBAC3C,iBAAO,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAA;oBAGlC,WAAW,GAAG,IA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;gBAGnB,KAAK,EAAE,0BAA0B;gBAGjC,QAAQ,EAAE,SAAS,mBAAmB;oBAClC,MAAM,KAAK,GAAG,KAAK,CAAA;oBACnB,MAAM,WAAW,GAAG,IAAI,+BAAiB,CAAO;wBAC5C,IAAI,EAAE,cAAc;wBACpB,SAAS,EAAE,cAAc;wBAEzB,MAAM,EAAE,IAAI;wBACZ,MAAM,EAAE,CAAC,IAAU,EAAE,EAAE;4BACnB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE,EAAE,EAAC,YAAY,EAAE,IAAI,CAAC,KAAK,EAAC,CAAC,CAAA;wBAC9D,CAAC;wBACD,iBAAiB,EAAE,IAAI;wBAEvB,oBAAoB,EAAE,IAAI;wBAE1B,KAAK;qBACR,CAAC,CAAA;oBACF,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE;wBACV,OAAO,CAAC,IAAI,CAAC,+CAA+C,CAAC,CAAA;wBAC7D,OAAM;qBACT;oBACD,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;gBAChC,CAAC;gBAGD,IAAI,EAAE,IAAI;aACb,CAAC,CAAA;QACF,CAAC","file":"linkManager.js"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
System.register(["./inputButton","froala-editor"],function(n,e){"use strict";var t,i;e&&e.id;return{setters:[function(n){t=n},function(n){i=n}],execute:function(){
|
|
1
|
+
System.register(["./inputButton","@stratusjs/runtime/stratus","lodash","froala-editor"],function(n,e){"use strict";var t,i,a,l;e&&e.id;return{setters:[function(n){t=n},function(n){i=n},function(n){a=n},function(n){l=n}],execute:function(){l.default.DEFAULTS=Object.assign(l.default.DEFAULTS,{endpoint:"/Api/Content"}),l.default.PLUGINS.linkManager=function(n){let e;return{_init:function(){this.uid=a.uniqueId("froala_link_manager_"),i.Stratus.Instances[this.uid]=this,e=new t.InputButtonPlugin({name:"Link Manager",eventName:"link-library",editor:n,insert:e=>{const t={};e.id&&(t["data-content-id"]=e.id),e.target&&(t.target="_blank"),n.link.insert(e.url,e.text,t)},autoSaveSelection:!0,autoRestoreSelection:!0,debug:!1}),this.inputButton=e,this.editor=n},onClick:function(t,i){if(!n.el)return void console.warn("linkManager.onClick(): unable to find element");const a=n.link.get();e.onClick(n.el,a)}}},l.default.RegisterCommand("linkManager",{title:"Insert from Link Library",undo:!1,focus:!0,modal:!0,refreshOnCallback:!1,callback(){this.linkManager.onClick()},plugin:"linkManager"}),l.default.DefineIcon("linkManager",{NAME:"folder",SVG_KEY:"insertLink"}),l.default.RegisterCommand("linkManagerEdit",{title:"Edit Link",undo:!1,focus:!1,modal:!0,callback(){this.linkManager.onClick(void 0,this.link.get())},plugin:"linkManager"}),l.default.DefineIcon("linkManagerEdit",{NAME:"edit",SVG_KEY:"edit"}),l.default.DefineIcon("linkManagerInsert",{NAME:"plus",SVG_KEY:"add"}),l.default.DefineIcon("linkManagerDelete",{NAME:"trash",SVG_KEY:"remove"}),l.default.RegisterQuickInsertButton("link",{icon:"linkManager",title:"Insert from Link Library",callback:function(){const n=new t.InputButtonPlugin({name:"Link Manager",eventName:"link-library",editor:this,insert:n=>{this.link.insert(n.url,"",{"aria-label":n.title})},autoSaveSelection:!0,autoRestoreSelection:!0,debug:!1});this.el?n.onClick(this.el):console.warn("linkManager.onClick(): unable to find element")},undo:!0})}}});
|
|
@@ -2,13 +2,27 @@
|
|
|
2
2
|
import {
|
|
3
3
|
InputButtonPlugin
|
|
4
4
|
} from './inputButton'
|
|
5
|
+
|
|
6
|
+
// Link Dialog
|
|
5
7
|
import {
|
|
6
8
|
Link
|
|
7
9
|
} from '../../editor/link-dialog.component'
|
|
10
|
+
|
|
11
|
+
// Stratus Core
|
|
8
12
|
import {
|
|
9
13
|
LooseObject
|
|
10
14
|
} from '@stratusjs/core/misc'
|
|
11
15
|
|
|
16
|
+
// Stratus Runtime
|
|
17
|
+
import {
|
|
18
|
+
Stratus
|
|
19
|
+
} from '@stratusjs/runtime/stratus'
|
|
20
|
+
|
|
21
|
+
// External Dependencies
|
|
22
|
+
import {
|
|
23
|
+
uniqueId
|
|
24
|
+
} from 'lodash'
|
|
25
|
+
|
|
12
26
|
// @ts-ignore
|
|
13
27
|
import FroalaEditor from 'froala-editor'
|
|
14
28
|
|
|
@@ -21,13 +35,18 @@ FroalaEditor.DEFAULTS = Object.assign(FroalaEditor.DEFAULTS, {
|
|
|
21
35
|
* @param editor The Froala instance
|
|
22
36
|
*/
|
|
23
37
|
FroalaEditor.PLUGINS.linkManager = function linkManager (editor: any) {
|
|
38
|
+
// Local Variables
|
|
24
39
|
let inputButton: InputButtonPlugin
|
|
25
40
|
|
|
26
|
-
const linkPlugin = FroalaEditor.PLUGINS.link(editor)
|
|
27
41
|
const debug = false
|
|
28
42
|
|
|
29
43
|
// When the plugin is initialized,this will be called.
|
|
30
44
|
function _init() {
|
|
45
|
+
// Set UID
|
|
46
|
+
this.uid = uniqueId(`froala_link_manager_`)
|
|
47
|
+
Stratus.Instances[this.uid] = this
|
|
48
|
+
|
|
49
|
+
// Create Input Button
|
|
31
50
|
inputButton = new InputButtonPlugin<Link>({
|
|
32
51
|
name: 'Link Manager',
|
|
33
52
|
eventName: 'link-library',
|
|
@@ -40,17 +59,26 @@ FroalaEditor.PLUGINS.linkManager = function linkManager (editor: any) {
|
|
|
40
59
|
if (link.target) {
|
|
41
60
|
attrs.target = '_blank'
|
|
42
61
|
}
|
|
43
|
-
|
|
62
|
+
editor.link.insert(link.url, link.text, attrs)
|
|
44
63
|
},
|
|
64
|
+
// Note: We use Custom Bindings for this via this.insert()
|
|
45
65
|
autoSaveSelection: true,
|
|
66
|
+
// maintainSnapshot: true,
|
|
46
67
|
autoRestoreSelection: true,
|
|
68
|
+
// maintainSelection: false,
|
|
47
69
|
debug
|
|
48
70
|
})
|
|
49
71
|
|
|
72
|
+
// Hoist Local Variables to Scope (Useful for Debugging)
|
|
73
|
+
this.inputButton = inputButton
|
|
74
|
+
this.editor = editor
|
|
75
|
+
|
|
50
76
|
if (debug) {
|
|
77
|
+
// Output to Console
|
|
51
78
|
console.log('initialized:', {
|
|
52
79
|
options: editor.opts.endpoint,
|
|
53
|
-
instance: this
|
|
80
|
+
instance: this,
|
|
81
|
+
inputButton: inputButton.uid,
|
|
54
82
|
})
|
|
55
83
|
}
|
|
56
84
|
|
|
@@ -61,12 +89,16 @@ FroalaEditor.PLUGINS.linkManager = function linkManager (editor: any) {
|
|
|
61
89
|
// editor.events.add('contentChanged', function (params) {});
|
|
62
90
|
}
|
|
63
91
|
|
|
64
|
-
function onClick() {
|
|
92
|
+
function onClick(el?: HTMLElement, data?: any) {
|
|
65
93
|
if (!editor.el) {
|
|
66
94
|
console.warn('linkManager.onClick(): unable to find element')
|
|
67
95
|
return
|
|
68
96
|
}
|
|
69
|
-
|
|
97
|
+
const link = editor.link.get()
|
|
98
|
+
if (debug) {
|
|
99
|
+
console.log('[linkManager.onClick()]:', link)
|
|
100
|
+
}
|
|
101
|
+
inputButton.onClick(editor.el, link)
|
|
70
102
|
}
|
|
71
103
|
|
|
72
104
|
// Expose public methods.
|
|
@@ -84,10 +116,14 @@ FroalaEditor.PLUGINS.linkManager = function linkManager (editor: any) {
|
|
|
84
116
|
FroalaEditor.RegisterCommand('linkManager', {
|
|
85
117
|
title: 'Insert from Link Library',
|
|
86
118
|
undo: false,
|
|
87
|
-
focus:
|
|
119
|
+
focus: true,
|
|
88
120
|
modal: true,
|
|
121
|
+
//refreshAfterCallback: false,
|
|
122
|
+
refreshOnCallback: false,
|
|
89
123
|
callback() {
|
|
90
|
-
|
|
124
|
+
// console.log('linkManager callback initiated!', this.link)
|
|
125
|
+
// console.log('selection:', this.selection.isCollapsed(), this.selection, this.$el)
|
|
126
|
+
this.linkManager.onClick()
|
|
91
127
|
},
|
|
92
128
|
plugin: 'linkManager',
|
|
93
129
|
}),
|
|
@@ -100,7 +136,9 @@ FroalaEditor.RegisterCommand('linkManagerEdit', {
|
|
|
100
136
|
focus: false,
|
|
101
137
|
modal: true,
|
|
102
138
|
callback() {
|
|
103
|
-
this
|
|
139
|
+
// TODO: Review the Quick Insert command to determine if this needs the same logic changes as the toolbar button
|
|
140
|
+
// console.log('linkManagerEdit callback initiated!', this.link)
|
|
141
|
+
this.linkManager.onClick(undefined, this.link.get())
|
|
104
142
|
},
|
|
105
143
|
plugin: 'linkManager',
|
|
106
144
|
}),
|
|
@@ -127,10 +165,12 @@ FroalaEditor.RegisterQuickInsertButton('link', {
|
|
|
127
165
|
// Contextual `this` is equivalent to the editor instance
|
|
128
166
|
editor: this,
|
|
129
167
|
insert: (link: Link) => {
|
|
130
|
-
|
|
168
|
+
this.link.insert(link.url, '', {'aria-label': link.title})
|
|
131
169
|
},
|
|
132
170
|
autoSaveSelection: true,
|
|
171
|
+
// maintainSnapshot: false,
|
|
133
172
|
autoRestoreSelection: true,
|
|
173
|
+
// maintainSelection: true,
|
|
134
174
|
debug
|
|
135
175
|
})
|
|
136
176
|
if (!this.el) {
|
package/src/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["main.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"sources":["main.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;YAiBA,IAAI,IAAI,KAAK,oBAAM,CAAC,KAAK,CAAC,EAAE;gBACxB,qBAAc,EAAE,CAAA;aACnB;YAGD,iDAAsB,EAAE,CAAC,eAAe,CAAC,sBAAS,CAAC;iBAC9C,IAAI,CAAC,CAAC,MAAwB,EAAE,EAAE;gBAC/B,OAAO,CAAC,GAAG,CAAC,8CAA8C,CAAC,CAAA;YAyB/D,CAAC,CAAC;iBACD,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,0CAA0C,EAAE,GAAG,CAAC,CAAC,CAAA;QACjF,CAAC","file":"main.js"}
|
package/src/main.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
// Normalizers
|
|
2
2
|
import './polyfills'
|
|
3
3
|
|
|
4
|
+
// Compiler is Required for PlatformBrowserDynamic in Angular 13+
|
|
5
|
+
// import '@angular/compiler'
|
|
6
|
+
|
|
4
7
|
// Angular Core
|
|
5
8
|
import {enableProdMode, NgModuleRef} from '@angular/core'
|
|
6
9
|
import {platformBrowserDynamic} from '@angular/platform-browser-dynamic'
|