@stratusjs/angular 0.5.0 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/angular.bundle.js +30609 -2673
- package/dist/angular.bundle.min.js +1 -1
- package/package.json +5 -4
- package/src/angular.modules.js +18 -33
- package/src/angular.modules.js.map +1 -1
- package/src/app.module.js +181 -227
- package/src/app.module.js.map +1 -1
- package/src/app.module.min.js +1 -1
- package/src/app.module.ts +17 -17
- package/src/backend.service.js +66 -87
- package/src/backend.service.js.map +1 -1
- package/src/base/base.component.js +101 -124
- package/src/base/base.component.js.map +1 -1
- package/src/boot.js +42 -55
- package/src/boot.js.map +1 -1
- package/src/confirm-dialog/confirm-dialog.component.js +41 -60
- package/src/confirm-dialog/confirm-dialog.component.js.map +1 -1
- package/src/core/base.interface.js +1 -9
- package/src/core/base.interface.js.map +1 -1
- package/src/core/dialog.interface.js.map +1 -0
- package/src/core/refresh.interface.js +1 -9
- package/src/core/refresh.interface.js.map +1 -1
- package/src/core/responsive.component.js +40 -58
- package/src/core/responsive.component.js.map +1 -1
- package/src/core/responsive.interface.js +1 -9
- package/src/core/responsive.interface.js.map +1 -1
- package/src/core/root.component.js +24 -43
- package/src/core/root.component.js.map +1 -1
- package/src/core/trigger.interface.js +1 -9
- package/src/core/trigger.interface.js.map +1 -1
- package/src/data/contact-meta.interface.js +1 -9
- package/src/data/contact-meta.interface.js.map +1 -1
- package/src/data/content.interface.js +1 -9
- package/src/data/content.interface.js.map +1 -1
- package/src/data/convoy.interface.js +1 -9
- package/src/data/convoy.interface.js.map +1 -1
- package/src/editor/citation-dialog.component.js +174 -207
- package/src/editor/citation-dialog.component.js.map +1 -1
- package/src/editor/code-mirror-bridge.js +63 -0
- package/src/editor/code-mirror-bridge.js.map +1 -0
- package/src/editor/code-mirror-bridge.min.js +1 -0
- package/src/editor/code-mirror-bridge.ts +85 -0
- package/src/editor/code-view-dialog.component.js +87 -116
- package/src/editor/code-view-dialog.component.js.map +1 -1
- package/src/editor/editor.component.js +903 -925
- package/src/editor/editor.component.js.map +1 -1
- package/src/editor/editor.component.min.js +1 -1
- package/src/editor/editor.component.ts +60 -21
- package/src/editor/link-dialog.component.js +356 -395
- package/src/editor/link-dialog.component.js.map +1 -1
- package/src/editor/media-dialog.component.js +270 -303
- package/src/editor/media-dialog.component.js.map +1 -1
- package/src/froala/plugins/citationManager.js +170 -191
- package/src/froala/plugins/citationManager.js.map +1 -1
- package/src/froala/plugins/inputButton.js +122 -138
- package/src/froala/plugins/inputButton.js.map +1 -1
- package/src/froala/plugins/linkManager.js +89 -104
- package/src/froala/plugins/linkManager.js.map +1 -1
- package/src/froala/plugins/mediaManager.js +72 -87
- package/src/froala/plugins/mediaManager.js.map +1 -1
- package/src/froala/plugins/menuButton.js +71 -86
- package/src/froala/plugins/menuButton.js.map +1 -1
- package/src/main.js +13 -33
- package/src/main.js.map +1 -1
- package/src/material.js +99 -194
- package/src/material.js.map +1 -1
- package/src/media-selector/media-selector.component.js +406 -441
- package/src/media-selector/media-selector.component.js.map +1 -1
- package/src/polyfills.js +3 -16
- package/src/polyfills.js.map +1 -1
- package/src/quill-plugins/quill-break-blot.plugin.js +19 -35
- package/src/quill-plugins/quill-break-blot.plugin.js.map +1 -1
- package/src/quill-plugins/quill-html-edit.plugin.js +140 -153
- package/src/quill-plugins/quill-html-edit.plugin.js.map +1 -1
- package/src/quill-plugins/quill-image-format.plugin.js +33 -47
- package/src/quill-plugins/quill-image-format.plugin.js.map +1 -1
- package/src/quill-plugins/quill-input-button.plugin.js +77 -95
- package/src/quill-plugins/quill-input-button.plugin.js.map +1 -1
- package/src/selector/selector.component.js +241 -276
- package/src/selector/selector.component.js.map +1 -1
- package/src/test/test.directive.js +49 -66
- package/src/test/test.directive.js.map +1 -1
- package/src/tree/tree-dialog.component.js +202 -231
- package/src/tree/tree-dialog.component.js.map +1 -1
- package/src/tree/tree-node.component.js +253 -279
- package/src/tree/tree-node.component.js.map +1 -1
- package/src/tree/tree-node.component.min.js +1 -1
- package/src/tree/tree-node.component.ts +10 -18
- package/src/tree/tree.component.js +531 -568
- package/src/tree/tree.component.js.map +1 -1
- package/src/tree/tree.component.min.js +1 -1
- package/src/tree/tree.component.ts +7 -10
|
@@ -1,212 +1,179 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
11
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
12
|
+
};
|
|
13
|
+
import { ChangeDetectorRef, Component, Inject } from '@angular/core';
|
|
14
|
+
import { FormBuilder, FormControl, Validators } from '@angular/forms';
|
|
15
|
+
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
|
16
|
+
import { MatSnackBar } from '@angular/material/snack-bar';
|
|
17
|
+
import { Observable } from 'rxjs';
|
|
18
|
+
import { head, isEmpty, isString, isUndefined, snakeCase, uniqueId } from 'lodash';
|
|
19
|
+
import { Stratus } from '@stratusjs/runtime/stratus';
|
|
20
|
+
import { cookie } from '@stratusjs/core/environment';
|
|
21
|
+
import { ResponsiveComponent } from '../core/responsive.component';
|
|
22
|
+
import { MatIconRegistry } from '@angular/material/icon';
|
|
23
|
+
import { DomSanitizer } from '@angular/platform-browser';
|
|
24
|
+
const systemDir = '@stratusjs/angular';
|
|
25
|
+
const moduleName = 'citation-dialog';
|
|
26
|
+
const parentModuleName = 'editor';
|
|
27
|
+
const min = !cookie('env') ? '.min' : '';
|
|
28
|
+
const localDir = `${Stratus.BaseUrl}${boot.configuration.paths[`${systemDir}/*`].replace(/[^/]*$/, '').replace(/\/dist\/$/, '/src/')}`;
|
|
29
|
+
let CitationDialogComponent = class CitationDialogComponent extends ResponsiveComponent {
|
|
30
|
+
constructor(dialogRef, data, fb, snackBar, iconRegistry, sanitizer, ref) {
|
|
31
|
+
super();
|
|
32
|
+
this.dialogRef = dialogRef;
|
|
33
|
+
this.data = data;
|
|
34
|
+
this.fb = fb;
|
|
35
|
+
this.snackBar = snackBar;
|
|
36
|
+
this.iconRegistry = iconRegistry;
|
|
37
|
+
this.sanitizer = sanitizer;
|
|
38
|
+
this.ref = ref;
|
|
39
|
+
this.title = moduleName + '_component';
|
|
40
|
+
this.Stratus = Stratus;
|
|
41
|
+
this.popupTitle = 'Create New Citation';
|
|
42
|
+
this.isPopupLoading = true;
|
|
43
|
+
this.formDisabled = false;
|
|
44
|
+
this.newCitation = true;
|
|
45
|
+
this.svgIcons = {};
|
|
46
|
+
}
|
|
47
|
+
ngOnInit() {
|
|
48
|
+
this.uid = uniqueId(`sa_${snakeCase(moduleName)}_component_`);
|
|
49
|
+
Stratus.Instances[this.uid] = this;
|
|
50
|
+
Stratus.Internals.CssLoader(`${localDir}${parentModuleName}/${moduleName}.component${min}.css`);
|
|
51
|
+
this.model = this.data.model;
|
|
52
|
+
this.property = this.data.property;
|
|
53
|
+
this.editor = this.data.editor;
|
|
54
|
+
this.eventManager = this.data.eventManager;
|
|
55
|
+
this.baseEditor = this.data.eventManager.editor;
|
|
56
|
+
this.dialogCitationForm = this.fb.group({
|
|
57
|
+
citationContentInput: new FormControl('', [Validators.required]),
|
|
58
|
+
citationTitleInput: new FormControl(''),
|
|
59
|
+
});
|
|
60
|
+
this.highlightedText = this.baseEditor.selection.text();
|
|
61
|
+
const containedElement = this.baseEditor.citationManager.getSelectedCitation() ||
|
|
62
|
+
this.baseEditor.citationManager.getLastKnownCitation();
|
|
63
|
+
this.baseEditor.citationManager.hideToolbar();
|
|
64
|
+
if (containedElement) {
|
|
65
|
+
this.newCitation = false;
|
|
66
|
+
this.existingCitationElement = containedElement;
|
|
67
|
+
const copiedElement = containedElement.cloneNode(true);
|
|
68
|
+
Array.from(copiedElement.getElementsByClassName('fr-marker')).forEach((markerEl) => {
|
|
69
|
+
markerEl.remove();
|
|
70
|
+
});
|
|
71
|
+
const contentElement = head(copiedElement.getElementsByTagName('stratus-citation-content'));
|
|
72
|
+
if (contentElement) {
|
|
73
|
+
this.dialogCitationForm.get('citationContentInput').setValue(contentElement.innerHTML);
|
|
51
74
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
return;
|
|
127
|
-
}
|
|
128
|
-
const content = this.dialogCitationForm.get('citationContentInput').value;
|
|
129
|
-
if (lodash_1.isUndefined(content) || !lodash_1.isString(content)) {
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
132
|
-
const title = this.dialogCitationForm.get('citationTitleInput').value;
|
|
133
|
-
const citationElement = this.createCitationHTML(content, title);
|
|
134
|
-
if (!citationElement) {
|
|
135
|
-
console.warn(`${moduleName}: unable to build citation for: ${content}`);
|
|
136
|
-
this.snackBar.open(`Unable to build citation for: ${content}.`, 'dismiss', {
|
|
137
|
-
duration: 5000,
|
|
138
|
-
horizontalPosition: 'right',
|
|
139
|
-
verticalPosition: 'bottom'
|
|
140
|
-
});
|
|
141
|
-
return;
|
|
142
|
-
}
|
|
143
|
-
if (!this.eventManager) {
|
|
144
|
-
console.warn(`${moduleName}: event manager is not set.`);
|
|
145
|
-
return;
|
|
146
|
-
}
|
|
147
|
-
if (!this.newCitation && this.existingCitationElement) {
|
|
148
|
-
this.existingCitationElement.outerHTML = citationElement;
|
|
149
|
-
}
|
|
150
|
-
else {
|
|
151
|
-
this.eventManager.trigger('insert', citationElement, this.editor);
|
|
152
|
-
}
|
|
153
|
-
this.dialogRef.close();
|
|
154
|
-
}
|
|
155
|
-
createCitationHTML(content, title) {
|
|
156
|
-
if (!content) {
|
|
157
|
-
console.warn(`${moduleName}: unable to create citation for empty content`);
|
|
158
|
-
return null;
|
|
159
|
-
}
|
|
160
|
-
if (!lodash_1.isEmpty(title)) {
|
|
161
|
-
title = `<stratus-citation-title>${title}</stratus-citation-title>`;
|
|
162
|
-
}
|
|
163
|
-
else {
|
|
164
|
-
title = `<stratus-citation-notitle/>`;
|
|
165
|
-
}
|
|
166
|
-
return `<stratus-citation><stratus-citation-content>${content}</stratus-citation-content>${title}</stratus-citation-content>`;
|
|
167
|
-
}
|
|
168
|
-
getSvg(url, options) {
|
|
169
|
-
const uid = this.addSvgIcon(url, options);
|
|
170
|
-
return new rxjs_1.Observable((subscriber) => {
|
|
171
|
-
this.iconRegistry
|
|
172
|
-
.getNamedSvgIcon(uid)
|
|
173
|
-
.subscribe({
|
|
174
|
-
error(err) {
|
|
175
|
-
console.error(`getSvg(${url}): ${err}`);
|
|
176
|
-
},
|
|
177
|
-
complete() {
|
|
178
|
-
subscriber.next(uid);
|
|
179
|
-
}
|
|
180
|
-
});
|
|
181
|
-
});
|
|
182
|
-
}
|
|
183
|
-
addSvgIcon(url, options) {
|
|
184
|
-
if (url in this.svgIcons) {
|
|
185
|
-
return this.svgIcons[url];
|
|
186
|
-
}
|
|
187
|
-
if (!options) {
|
|
188
|
-
options = {};
|
|
189
|
-
}
|
|
190
|
-
const uid = this.svgIcons[url] = lodash_1.uniqueId('selector_svg');
|
|
191
|
-
this.iconRegistry.addSvgIcon(uid, this.sanitizer.bypassSecurityTrustResourceUrl(url), options);
|
|
192
|
-
return uid;
|
|
75
|
+
const titleElement = head(copiedElement.getElementsByTagName('stratus-citation-title'));
|
|
76
|
+
if (titleElement) {
|
|
77
|
+
this.dialogCitationForm.get('citationTitleInput').setValue(titleElement.innerHTML);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
if (this.newCitation && !isEmpty(this.highlightedText)) {
|
|
81
|
+
this.popupTitle = 'Convert Text into Citation';
|
|
82
|
+
this.dialogCitationForm.get('citationTitleInput').setValue(this.highlightedText);
|
|
83
|
+
}
|
|
84
|
+
if (!this.newCitation) {
|
|
85
|
+
this.popupTitle = 'Update Citation';
|
|
86
|
+
}
|
|
87
|
+
this.isPopupLoading = false;
|
|
88
|
+
this.refresh();
|
|
89
|
+
}
|
|
90
|
+
cancel() {
|
|
91
|
+
this.dialogRef.close();
|
|
92
|
+
this.refresh();
|
|
93
|
+
}
|
|
94
|
+
confirm() {
|
|
95
|
+
if (isUndefined(this.dialogCitationForm.get('citationContentInput'))) {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
const content = this.dialogCitationForm.get('citationContentInput').value;
|
|
99
|
+
if (isUndefined(content) || !isString(content)) {
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
const title = this.dialogCitationForm.get('citationTitleInput').value;
|
|
103
|
+
const citationElement = this.createCitationHTML(content, title);
|
|
104
|
+
if (!citationElement) {
|
|
105
|
+
console.warn(`${moduleName}: unable to build citation for: ${content}`);
|
|
106
|
+
this.snackBar.open(`Unable to build citation for: ${content}.`, 'dismiss', {
|
|
107
|
+
duration: 5000,
|
|
108
|
+
horizontalPosition: 'right',
|
|
109
|
+
verticalPosition: 'bottom'
|
|
110
|
+
});
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
if (!this.eventManager) {
|
|
114
|
+
console.warn(`${moduleName}: event manager is not set.`);
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
if (!this.newCitation && this.existingCitationElement) {
|
|
118
|
+
this.existingCitationElement.outerHTML = citationElement;
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
this.eventManager.trigger('insert', citationElement, this.editor);
|
|
122
|
+
}
|
|
123
|
+
this.dialogRef.close();
|
|
124
|
+
}
|
|
125
|
+
createCitationHTML(content, title) {
|
|
126
|
+
if (!content) {
|
|
127
|
+
console.warn(`${moduleName}: unable to create citation for empty content`);
|
|
128
|
+
return null;
|
|
129
|
+
}
|
|
130
|
+
if (!isEmpty(title)) {
|
|
131
|
+
title = `<stratus-citation-title>${title}</stratus-citation-title>`;
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
title = `<stratus-citation-notitle/>`;
|
|
135
|
+
}
|
|
136
|
+
return `<stratus-citation><stratus-citation-content>${content}</stratus-citation-content>${title}</stratus-citation-content>`;
|
|
137
|
+
}
|
|
138
|
+
getSvg(url, options) {
|
|
139
|
+
const uid = this.addSvgIcon(url, options);
|
|
140
|
+
return new Observable((subscriber) => {
|
|
141
|
+
this.iconRegistry
|
|
142
|
+
.getNamedSvgIcon(uid)
|
|
143
|
+
.subscribe({
|
|
144
|
+
error(err) {
|
|
145
|
+
console.error(`getSvg(${url}): ${err}`);
|
|
146
|
+
},
|
|
147
|
+
complete() {
|
|
148
|
+
subscriber.next(uid);
|
|
193
149
|
}
|
|
194
|
-
};
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
icon_1.MatIconRegistry,
|
|
204
|
-
platform_browser_1.DomSanitizer,
|
|
205
|
-
core_1.ChangeDetectorRef])
|
|
206
|
-
], CitationDialogComponent);
|
|
207
|
-
exports_1("CitationDialogComponent", CitationDialogComponent);
|
|
150
|
+
});
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
addSvgIcon(url, options) {
|
|
154
|
+
if (url in this.svgIcons) {
|
|
155
|
+
return this.svgIcons[url];
|
|
156
|
+
}
|
|
157
|
+
if (!options) {
|
|
158
|
+
options = {};
|
|
208
159
|
}
|
|
209
|
-
|
|
210
|
-
|
|
160
|
+
const uid = this.svgIcons[url] = uniqueId('selector_svg');
|
|
161
|
+
this.iconRegistry.addSvgIcon(uid, this.sanitizer.bypassSecurityTrustResourceUrl(url), options);
|
|
162
|
+
return uid;
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
CitationDialogComponent = __decorate([
|
|
166
|
+
Component({
|
|
167
|
+
selector: `sa-${moduleName}`,
|
|
168
|
+
templateUrl: `${localDir}/${parentModuleName}/${moduleName}.component${min}.html`,
|
|
169
|
+
}),
|
|
170
|
+
__param(1, Inject(MAT_DIALOG_DATA)),
|
|
171
|
+
__metadata("design:paramtypes", [MatDialogRef, Object, FormBuilder,
|
|
172
|
+
MatSnackBar,
|
|
173
|
+
MatIconRegistry,
|
|
174
|
+
DomSanitizer,
|
|
175
|
+
ChangeDetectorRef])
|
|
176
|
+
], CitationDialogComponent);
|
|
177
|
+
export { CitationDialogComponent };
|
|
211
178
|
|
|
212
179
|
//# sourceMappingURL=citation-dialog.component.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["citation-dialog.component.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["citation-dialog.component.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,OAAO,EACH,iBAAiB,EACjB,SAAS,EACT,MAAM,EAET,MAAM,eAAe,CAAA;AACtB,OAAO,EACH,WAAW,EACX,WAAW,EAEX,UAAU,EACb,MAAM,gBAAgB,CAAA;AAGvB,OAAO,EACH,eAAe,EACf,YAAY,EACf,MAAM,0BAA0B,CAAA;AACjC,OAAO,EACH,WAAW,EACd,MAAM,6BAA6B,CAAA;AAGpC,OAAO,EACH,UAAU,EACb,MAAM,MAAM,CAAA;AAGb,OAAO,EAAC,IAAI,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A;SAC5B;QACD,IAAI,CAAC,OAAO,EAAE;YACV,OAAO,GAAG,EAAE,CAAA;SACf;QACD,MAAM,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC,cAAc,CAAC,CAAA;QACzD,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,GAAG,EAAE,IAAI,CAAC,SAAS,CAAC,8BAA8B,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,CAAA;QAC9F,OAAO,GAAG,CAAA;IACd,CAAC;CACJ,CAAA;AApNY,uBAAuB;IALnC,SAAS,CAAC;QACP,QAAQ,EAAE,MAAM,UAAU,EAAE;QAC5B,WAAW,EAAE,GAAG,QAAQ,IAAI,gBAAgB,IAAI,UAAU,aAAa,GAAG,OAAO;KAEpF,CAAC;IA0CO,WAAA,MAAM,CAAC,eAAe,CAAC,CAAA;qCADN,YAAY,UAElB,WAAW;QACL,WAAW;QACP,eAAe;QAClB,YAAY;QAChB,iBAAiB;GA9C3B,uBAAuB,CAoNnC;SApNY,uBAAuB","file":"citation-dialog.component.js"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { EditorView } from 'codemirror';
|
|
2
|
+
export class CodeMirrorBridge {
|
|
3
|
+
constructor(opts) {
|
|
4
|
+
if (!opts || !(typeof opts === 'object')) {
|
|
5
|
+
return;
|
|
6
|
+
}
|
|
7
|
+
this.extensions = opts.extensions;
|
|
8
|
+
}
|
|
9
|
+
fromTextArea(el, opts) {
|
|
10
|
+
this.editorView = new EditorView({
|
|
11
|
+
doc: el.value,
|
|
12
|
+
extensions: this.extensions || [],
|
|
13
|
+
});
|
|
14
|
+
el.parentNode.insertBefore(this.editorView.dom, el);
|
|
15
|
+
el.style.display = 'none';
|
|
16
|
+
if (el.form)
|
|
17
|
+
el.form.addEventListener('submit', () => {
|
|
18
|
+
el.value = this.editorView.state.doc.toString();
|
|
19
|
+
});
|
|
20
|
+
return this;
|
|
21
|
+
}
|
|
22
|
+
focus() {
|
|
23
|
+
return this.editorView.focus();
|
|
24
|
+
}
|
|
25
|
+
refresh() {
|
|
26
|
+
console.warn('CodeMirror Bridge has not implemented a refresh function.');
|
|
27
|
+
}
|
|
28
|
+
clearHistory() {
|
|
29
|
+
console.warn('CodeMirror Bridge has not implemented a clearHistory function.');
|
|
30
|
+
}
|
|
31
|
+
on(event, func) {
|
|
32
|
+
console.warn('bind attempt:', { event, func });
|
|
33
|
+
console.warn('CodeMirror Bridge has not implemented an on(event) function.');
|
|
34
|
+
}
|
|
35
|
+
setSize(width, height) {
|
|
36
|
+
console.warn('CodeMirror Bridge has not implemented a setSize function.');
|
|
37
|
+
}
|
|
38
|
+
getValue() {
|
|
39
|
+
return this.editorView.state.doc.toString();
|
|
40
|
+
}
|
|
41
|
+
setValue(html) {
|
|
42
|
+
this.editorView.dispatch({
|
|
43
|
+
changes: { from: 0, to: this.editorView.state.doc.length, insert: html }
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
setSelection(start, end) {
|
|
47
|
+
const posToOffset = (pos) => {
|
|
48
|
+
const doc = this.editorView.state.doc;
|
|
49
|
+
return doc.line(pos.line + 1).from + pos.ch;
|
|
50
|
+
};
|
|
51
|
+
this.editorView.dispatch({
|
|
52
|
+
selection: {
|
|
53
|
+
anchor: posToOffset(start),
|
|
54
|
+
head: posToOffset(end)
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
toTextArea() {
|
|
59
|
+
console.warn('CodeMirror Bridge has not implemented a toTextArea function.');
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
//# sourceMappingURL=code-mirror-bridge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["code-mirror-bridge.ts"],"names":[],"mappings":"AAKA,OAAO,EAAa,UAAU,EAAC,MAAM,YAAY,CAAA;AAcjD,MAAM,OAAO,gBAAgB;IAGzB,YAAY,IAA8B;QACtC,IAAI,CAAC,IAA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C7E,CAAC;IACD,QAAQ;QACJ,OAAO,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAA;IAC/C,CAAC;IACD,QAAQ,CAAC,IAAY;QACjB,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC;YACrB,OAAO,EAAE,EAAC,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAC;SACzE,CAAC,CAAA;IACN,CAAC;IACD,YAAY,CAAC,KAAoB,EAAE,GAAkB;QACjD,MAAM,WAAW,GAAG,CAAC,GAAkB,EAAU,EAAE;YAC/C,MAAM,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,GAAG,CAAA;YACrC,OAAO,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,IAAI,GAAG,GAAG,CAAC,EAAE,CAAA;QAC/C,CAAC,CAAA;QACD,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC;YACrB,SAAS,EAAE;gBACP,MAAM,EAAE,WAAW,CAAC,KAAK,CAAC;gBAC1B,IAAI,EAAE,WAAW,CAAC,GAAG,CAAC;aACzB;SACJ,CAAC,CAAA;IACN,CAAC;IACD,UAAU;QAEN,OAAO,CAAC,IAAI,CAAC,8DAA8D,CAAC,CAAA;IAChF,CAAC;CACJ","file":"code-mirror-bridge.js"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
System.register(["codemirror"],function(e,t){"use strict";var o;t&&t.id;return{setters:[function(e){o=e}],execute:function(){e("CodeMirrorBridge",class{constructor(e){e&&"object"==typeof e&&(this.extensions=e.extensions)}fromTextArea(e,t){return this.editorView=new o.EditorView({doc:e.value,extensions:this.extensions||[]}),e.parentNode.insertBefore(this.editorView.dom,e),e.style.display="none",e.form&&e.form.addEventListener("submit",()=>{e.value=this.editorView.state.doc.toString()}),this}focus(){return this.editorView.focus()}refresh(){console.warn("CodeMirror Bridge has not implemented a refresh function.")}clearHistory(){console.warn("CodeMirror Bridge has not implemented a clearHistory function.")}on(e,t){console.log("bind attempt:",{event:e,func:t}),console.warn("CodeMirror Bridge has not implemented an on(event) function.")}setSize(e,t){console.warn("CodeMirror Bridge has not implemented a setSize function.")}getValue(){return this.editorView.state.doc.toString()}setValue(e){this.editorView.dispatch({changes:{from:0,to:this.editorView.state.doc.length,insert:e}})}setSelection(e,t){const o=e=>this.editorView.state.doc.line(e.line+1).from+e.ch;this.editorView.dispatch({selection:{anchor:o(e),head:o(t)}})}toTextArea(){console.warn("CodeMirror Bridge has not implemented a toTextArea function.")}})}}});
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
// Stratus Core
|
|
2
|
+
import {LooseFunction, LooseObject} from '@stratusjs/core/misc'
|
|
3
|
+
import {Extension} from '@codemirror/state'
|
|
4
|
+
|
|
5
|
+
// CodeMirror
|
|
6
|
+
import {basicSetup, EditorView} from 'codemirror'
|
|
7
|
+
|
|
8
|
+
// Data Type Interfaces
|
|
9
|
+
interface CodeMirrorPos {
|
|
10
|
+
line: number,
|
|
11
|
+
ch: number
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* This provides bridged functionality for CodeMirror 6 in legacy implementations.
|
|
16
|
+
*/
|
|
17
|
+
interface CodeMirrorBridgeOptions {
|
|
18
|
+
extensions?: Extension
|
|
19
|
+
}
|
|
20
|
+
export class CodeMirrorBridge {
|
|
21
|
+
editorView: EditorView
|
|
22
|
+
extensions?: Extension
|
|
23
|
+
constructor(opts?: CodeMirrorBridgeOptions) {
|
|
24
|
+
if (!opts || !(typeof opts === 'object')) {
|
|
25
|
+
return
|
|
26
|
+
}
|
|
27
|
+
this.extensions = opts.extensions
|
|
28
|
+
}
|
|
29
|
+
fromTextArea(el: HTMLTextAreaElement, opts: LooseObject) {
|
|
30
|
+
this.editorView = new EditorView({
|
|
31
|
+
doc: el.value,
|
|
32
|
+
extensions: this.extensions || [],
|
|
33
|
+
})
|
|
34
|
+
el.parentNode.insertBefore(this.editorView.dom, el)
|
|
35
|
+
el.style.display = 'none'
|
|
36
|
+
if (el.form) el.form.addEventListener('submit', () => {
|
|
37
|
+
el.value = this.editorView.state.doc.toString()
|
|
38
|
+
})
|
|
39
|
+
return this
|
|
40
|
+
}
|
|
41
|
+
focus() {
|
|
42
|
+
return this.editorView.focus()
|
|
43
|
+
}
|
|
44
|
+
refresh() {
|
|
45
|
+
// TODO: Implement this, if we find a CodeMirror 6 equivalent or necessity.
|
|
46
|
+
console.warn('CodeMirror Bridge has not implemented a refresh function.')
|
|
47
|
+
}
|
|
48
|
+
clearHistory() {
|
|
49
|
+
// TODO: Implement this, if we find a CodeMirror 6 equivalent or necessity.
|
|
50
|
+
console.warn('CodeMirror Bridge has not implemented a clearHistory function.')
|
|
51
|
+
}
|
|
52
|
+
on(event: string, func: LooseFunction) {
|
|
53
|
+
// TODO: Implement this, if we find a CodeMirror 6 equivalent or necessity.
|
|
54
|
+
console.warn('bind attempt:', {event, func})
|
|
55
|
+
console.warn('CodeMirror Bridge has not implemented an on(event) function.')
|
|
56
|
+
}
|
|
57
|
+
setSize(width?: string|number, height?: string|number) {
|
|
58
|
+
// TODO: Implement this, if we find a CodeMirror 6 equivalent or necessity.
|
|
59
|
+
console.warn('CodeMirror Bridge has not implemented a setSize function.')
|
|
60
|
+
}
|
|
61
|
+
getValue() {
|
|
62
|
+
return this.editorView.state.doc.toString()
|
|
63
|
+
}
|
|
64
|
+
setValue(html: string) {
|
|
65
|
+
this.editorView.dispatch({
|
|
66
|
+
changes: {from: 0, to: this.editorView.state.doc.length, insert: html}
|
|
67
|
+
})
|
|
68
|
+
}
|
|
69
|
+
setSelection(start: CodeMirrorPos, end: CodeMirrorPos) {
|
|
70
|
+
const posToOffset = (pos: CodeMirrorPos): number => {
|
|
71
|
+
const doc = this.editorView.state.doc
|
|
72
|
+
return doc.line(pos.line + 1).from + pos.ch
|
|
73
|
+
}
|
|
74
|
+
this.editorView.dispatch({
|
|
75
|
+
selection: {
|
|
76
|
+
anchor: posToOffset(start),
|
|
77
|
+
head: posToOffset(end)
|
|
78
|
+
}
|
|
79
|
+
})
|
|
80
|
+
}
|
|
81
|
+
toTextArea() {
|
|
82
|
+
// TODO: Implement this, if we find a CodeMirror 6 equivalent or necessity.
|
|
83
|
+
console.warn('CodeMirror Bridge has not implemented a toTextArea function.')
|
|
84
|
+
}
|
|
85
|
+
}
|