@stratusjs/angular 0.3.8 → 0.3.10
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/package.json +1 -1
- package/src/editor/editor.component.js +1 -1
- package/src/editor/editor.component.js.map +1 -1
- package/src/editor/editor.component.min.js +1 -1
- package/src/editor/editor.component.ts +1 -1
- package/src/editor/link-dialog.component.html +68 -24
- package/src/editor/link-dialog.component.js +49 -24
- package/src/editor/link-dialog.component.js.map +1 -1
- package/src/editor/link-dialog.component.min.html +1 -1
- package/src/editor/link-dialog.component.min.js +1 -1
- package/src/editor/link-dialog.component.ts +73 -34
- package/src/froala/plugins/inputButton.js +52 -3
- package/src/froala/plugins/inputButton.js.map +1 -1
- package/src/froala/plugins/inputButton.min.js +1 -1
- package/src/froala/plugins/inputButton.ts +70 -9
- package/src/froala/plugins/linkManager.js +24 -15
- package/src/froala/plugins/linkManager.js.map +1 -1
- package/src/froala/plugins/linkManager.min.js +1 -1
- package/src/froala/plugins/linkManager.ts +37 -20
- package/src/tree/tree-dialog.component.js.map +1 -1
- package/src/tree/tree-dialog.component.ts +0 -5
|
@@ -84,22 +84,25 @@ System.register(["@angular/core", "@angular/forms", "@angular/material/dialog",
|
|
|
84
84
|
this.isContentLoading = true;
|
|
85
85
|
this.limit = 20;
|
|
86
86
|
this.eventInsert = true;
|
|
87
|
+
this.isListView = false;
|
|
87
88
|
this.selected = [];
|
|
88
89
|
this.svgIcons = {};
|
|
89
|
-
this.
|
|
90
|
+
this.isInitialized = false;
|
|
91
|
+
this.isDestroyed = false;
|
|
92
|
+
this.isStyled = false;
|
|
90
93
|
}
|
|
91
94
|
ngOnInit() {
|
|
92
95
|
this.uid = lodash_1.default.uniqueId(`sa_${lodash_1.default.snakeCase(moduleName)}_component_`);
|
|
93
96
|
stratus_1.Stratus.Instances[this.uid] = this;
|
|
94
97
|
stratus_1.Stratus.Internals.CssLoader(`${localDir}${parentModuleName}/${moduleName}.component${min}.css`)
|
|
95
98
|
.then(() => {
|
|
96
|
-
this.
|
|
99
|
+
this.isStyled = true;
|
|
97
100
|
this.refresh();
|
|
98
101
|
})
|
|
99
102
|
.catch((err) => {
|
|
100
103
|
console.warn('Issue detected in CSS Loader for Component:', this);
|
|
101
104
|
console.error(err);
|
|
102
|
-
this.
|
|
105
|
+
this.isStyled = true;
|
|
103
106
|
this.refresh();
|
|
104
107
|
});
|
|
105
108
|
lodash_1.default.forEach({
|
|
@@ -113,19 +116,34 @@ System.register(["@angular/core", "@angular/forms", "@angular/material/dialog",
|
|
|
113
116
|
if (lodash_1.default.isBoolean(this.data.eventInsert)) {
|
|
114
117
|
this.eventInsert = this.data.eventInsert;
|
|
115
118
|
}
|
|
116
|
-
this.
|
|
117
|
-
|
|
119
|
+
this.dialogContentForm = this.fb.group({
|
|
120
|
+
contentSelectorInput: ''
|
|
118
121
|
});
|
|
119
|
-
this.
|
|
120
|
-
.get('
|
|
122
|
+
this.dialogContentForm
|
|
123
|
+
.get('contentSelectorInput')
|
|
121
124
|
.valueChanges
|
|
122
|
-
.pipe(operators_1.debounceTime(300), operators_1.tap(() => {
|
|
123
|
-
|
|
125
|
+
.pipe(operators_1.debounceTime(300), operators_1.tap(() => this.isContentLoading = true), operators_1.switchMap((value) => {
|
|
126
|
+
if (!lodash_1.default.isString(value)) {
|
|
127
|
+
this.select(value);
|
|
128
|
+
return this.getQuery();
|
|
129
|
+
}
|
|
124
130
|
return this.getQuery(value);
|
|
125
131
|
}))
|
|
126
132
|
.subscribe((response) => this.processContent(response));
|
|
127
|
-
this.
|
|
128
|
-
|
|
133
|
+
this.backend
|
|
134
|
+
.get(this.getQueryUrl())
|
|
135
|
+
.pipe(operators_1.finalize(() => this.isContentLoading = false))
|
|
136
|
+
.subscribe((response) => this.processContent(response));
|
|
137
|
+
this.isInitialized = true;
|
|
138
|
+
}
|
|
139
|
+
ngOnDestroy() {
|
|
140
|
+
this.isDestroyed = true;
|
|
141
|
+
}
|
|
142
|
+
refresh() {
|
|
143
|
+
if (this.isDestroyed) {
|
|
144
|
+
return new Promise(resolve => resolve());
|
|
145
|
+
}
|
|
146
|
+
return super.refresh();
|
|
129
147
|
}
|
|
130
148
|
onCancelClick() {
|
|
131
149
|
this.dialogRef.close();
|
|
@@ -136,14 +154,8 @@ System.register(["@angular/core", "@angular/forms", "@angular/material/dialog",
|
|
|
136
154
|
this.getQuery(this.lastContentQuery).subscribe((response) => this.processContent(response));
|
|
137
155
|
}
|
|
138
156
|
getQueryUrl(query) {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
if (this.pageEvent) {
|
|
142
|
-
limit = this.pageEvent.pageSize;
|
|
143
|
-
paging = this.pageEvent.pageIndex + 1;
|
|
144
|
-
}
|
|
145
|
-
query = (lodash_1.default.isString(query) && !lodash_1.default.isEmpty(query)) ? `"${query}"` : '';
|
|
146
|
-
return `${this.apiBase}?limit=${limit}&p=${paging}&q=${query}`;
|
|
157
|
+
query = (!lodash_1.default.isString(query) || lodash_1.default.isEmpty(query)) ? '' : `"${query}"`;
|
|
158
|
+
return `${this.apiBase}?limit=${this.limit}&options[isContent]=null&options[isCollection]=null&options[showRoutable]=true&options[showRouting]=true&q=${query}`;
|
|
147
159
|
}
|
|
148
160
|
getQuery(query) {
|
|
149
161
|
this.lastContentQuery = query;
|
|
@@ -175,8 +187,8 @@ System.register(["@angular/core", "@angular/forms", "@angular/material/dialog",
|
|
|
175
187
|
if (lodash_1.default.isUndefined(content)) {
|
|
176
188
|
return;
|
|
177
189
|
}
|
|
178
|
-
const
|
|
179
|
-
if (!
|
|
190
|
+
const link = this.createLink(content);
|
|
191
|
+
if (!link) {
|
|
180
192
|
console.warn(`${moduleName}: unable to build link for Content ID: ${content.id}`);
|
|
181
193
|
this.snackBar.open(`Unable to build link for Content ID: ${content.id}.`, 'dismiss', {
|
|
182
194
|
duration: 5000,
|
|
@@ -196,14 +208,14 @@ System.register(["@angular/core", "@angular/forms", "@angular/material/dialog",
|
|
|
196
208
|
return;
|
|
197
209
|
}
|
|
198
210
|
console.warn(`${moduleName}: disabling eventInsert is not recommended.`);
|
|
199
|
-
this.model.set(this.property, this.model.get(this.property) +
|
|
211
|
+
this.model.set(this.property, this.model.get(this.property) + link);
|
|
200
212
|
return;
|
|
201
213
|
}
|
|
202
214
|
if (!this.eventManager) {
|
|
203
215
|
console.warn(`${moduleName}: event manager is not set.`);
|
|
204
216
|
return;
|
|
205
217
|
}
|
|
206
|
-
this.eventManager.trigger('insert',
|
|
218
|
+
this.eventManager.trigger('insert', link, this.editor);
|
|
207
219
|
this.onCancelClick();
|
|
208
220
|
}
|
|
209
221
|
isSelected(content) {
|
|
@@ -237,7 +249,10 @@ System.register(["@angular/core", "@angular/forms", "@angular/material/dialog",
|
|
|
237
249
|
console.warn(`${moduleName}: unable to find title for ${content.contentType.name} id: ${content.id}`);
|
|
238
250
|
return null;
|
|
239
251
|
}
|
|
240
|
-
return
|
|
252
|
+
return {
|
|
253
|
+
url: `/${content.routing[0].url}`,
|
|
254
|
+
title: content.version.title
|
|
255
|
+
};
|
|
241
256
|
}
|
|
242
257
|
getSvg(url, options) {
|
|
243
258
|
const uid = this.addSvgIcon(url, options);
|
|
@@ -265,6 +280,16 @@ System.register(["@angular/core", "@angular/forms", "@angular/material/dialog",
|
|
|
265
280
|
this.iconRegistry.addSvgIcon(uid, this.sanitizer.bypassSecurityTrustResourceUrl(url), options);
|
|
266
281
|
return uid;
|
|
267
282
|
}
|
|
283
|
+
displayContentText(content) {
|
|
284
|
+
if (!content) {
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
287
|
+
const routing = lodash_1.default.get(content, 'routing[0].url');
|
|
288
|
+
const routingText = !lodash_1.default.isUndefined(routing) ? ` (/${routing})` : ' (No route!)';
|
|
289
|
+
const contentId = lodash_1.default.get(content, 'id');
|
|
290
|
+
const contentIdText = !lodash_1.default.isUndefined(contentId) ? `Content: ${contentId}` : null;
|
|
291
|
+
return (lodash_1.default.get(content, 'version.title') || contentIdText) + routingText;
|
|
292
|
+
}
|
|
268
293
|
goToUrl(content) {
|
|
269
294
|
if (!content || !content.contentType) {
|
|
270
295
|
console.error('unable to execute goToUrl() because a valid model content was not provided.');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["link-dialog.component.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"sources":["link-dialog.component.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAkEM,SAAS,GAAG,oBAAoB,CAAA;YAChC,UAAU,GAAG,aAAa,CAAA;YAC1B,gBAAgB,GAAG,QAAQ,CAAA;YAG3B,GAAG,GAAG,CAAC,oBAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAA;YAClC,QAAQ,GAAG,GAAG,iBAAO,CAAC,OAAO,GAAG,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,GAAG,SAAS,IAAI,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,EAAE,CAAA;YAU3F,mBAAmB,GAAzB,MAAM,mBAAoB,SAAQ,0CAAmB;gBA8CxD,YACW,SAA4C,EACnB,IAAoB,EAC5C,EAAe,EACf,OAAuB,EACvB,QAAqB,EACrB,YAA6B,EAC7B,SAAuB,EACrB,GAAsB;oBAGhC,KAAK,EAAE,CAAA;oBAVA,cAAS,GAAT,SAAS,CAAmC;oBACnB,SAAI,GAAJ,IAAI,CAAgB;oBAC5C,OAAE,GAAF,EAAE,CAAa;oBACf,YAAO,GAAP,OAAO,CAAgB;oBACvB,aAAQ,GAAR,QAAQ,CAAa;oBACrB,iBAAY,GAAZ,YAAY,CAAiB;oBAC7B,cAAS,GAAT,SAAS,CAAc;oBACrB,QAAG,GAAH,GAAG,CAAmB;oBAnDpC,UAAK,GAAG,UAA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SAAS,EAAE,CAAC,CAAC,CAAC,IAAI,CAAA;oBAEhF,OAAO,CAAC,gBAAC,CAAC,GAAG,CAAC,OAAO,EAAE,eAAe,CAAC,IAAI,aAAa,CAAC,GAAG,WAAW,CAAA;gBAC3E,CAAC;gBAED,OAAO,CAAC,OAAsB;oBAC1B,IAAI,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE;wBAClC,OAAO,CAAC,KAAK,CAAC,6EAA6E,CAAC,CAAA;wBAC5F,OAAM;qBACT;oBACD,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAA;gBAC5E,CAAC;aACJ,CAAA;YA9UY,mBAAmB;gBAL/B,gBAAS,CAAC;oBACP,QAAQ,EAAE,MAAM,UAAU,EAAE;oBAC5B,WAAW,EAAE,GAAG,QAAQ,IAAI,gBAAgB,IAAI,UAAU,aAAa,GAAG,OAAO;iBAEpF,CAAC;gBAiDO,WAAA,aAAM,CAAC,wBAAe,CAAC,CAAA;iDADN,qBAAY,UAElB,mBAAW;oBACN,gCAAc;oBACb,uBAAW;oBACP,sBAAe;oBAClB,+BAAY;oBAChB,wBAAiB;eAtD3B,mBAAmB,CA8U/B;;QAeD,CAAC","file":"link-dialog.component.js"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<h1 mat-dialog-title>Link Selector</h1><div mat-dialog-content class="link-dialog-content"><form class="dialog-form" [formGroup]="
|
|
1
|
+
<h1 mat-dialog-title>Link Selector</h1><div mat-dialog-content class="link-dialog-content"><form class="dialog-form" *ngIf="isStyled" [formGroup]="dialogContentForm"><mat-form-field class="form-field"><input matInput placeholder="Search Content" aria-label="Search Content" [matAutocomplete]="auto" formControlName="contentSelectorInput"></mat-form-field><mat-autocomplete autoActiveFirstOption #auto="matAutocomplete" [displayWith]="displayContentText"><mat-option *ngIf="isContentLoading" class="is-loading"><mat-spinner diameter="50"></mat-spinner></mat-option><ng-container *ngIf="!isContentLoading"><mat-option *ngFor="let model of contentEntities" [value]="model"><mat-icon aria-hidden="true" *ngIf="_.get(model, 'contentType.iconResourcePath')" [svgIcon]="getSvg(Stratus.BaseUrl + _.get(model, 'contentType.iconResourcePath')) | async">Icon</mat-icon>{{(model && model.version) ? model.version.title : 'Untitled'}} <small *ngIf="model.routing && model.routing.length">{{'/' + model.routing[0].url}}</small></mat-option></ng-container></mat-autocomplete></form><mat-progress-bar mode="indeterminate" *ngIf="!isListView && !isStyled"></mat-progress-bar><mat-progress-bar mode="indeterminate" *ngIf="isListView && (isContentLoading || !isStyled)"></mat-progress-bar><div class="content-list" *ngIf="isListView && isStyled"><div class="content-list-row content-box" [ngClass]="{'active': _.get(model, 'status') === 1, 'inactive' : _.get(model, 'status') !== 1, 'published': _.get(model, 'version.published') === 1, 'unpublished': _.get(model, 'version.published') !== 1, 'selected': isSelected(model)}" (click)="select(model)" *ngFor="let model of contentEntities"><div class="content-list-container"><div class="column-image position-anchor"><div class="image position-all" *ngIf="_.has(model, 'version.bestImage._thumbnailUrl')" [attr.data-stratus-src]="!_.get(model, 'version.bestImage.service') ? true : false" [ngStyle]="{'background': 'url(' + _.get(model, 'version.bestImage._thumbnailUrl') + ') no-repeat center center', 'background-size': 'cover'}"></div><div class="no-image-icon position-all" *ngIf="!_.has(model, 'version.bestImage._thumbnailUrl')" [ngClass]="_.get(model, 'contentType.class') + '-background-color'"><mat-icon class="content-type-icon position-center" [svgIcon]="getSvg(Stratus.BaseUrl + (_.get(model, 'contentType.iconResourcePath') || _.get(model, 'iconResourcePath'))) | async">Icon</mat-icon></div><img class="shapeholder" [src]="Stratus.BaseUrl + 'sitetheorycore/images/shapeholder-square.png'"></div><div class="column-title"><div class="content-type" *ngIf="_.has(model, 'contentType.iconResourcePath')"><mat-icon class="content-type-icon" [svgIcon]="getSvg(Stratus.BaseUrl + _.get(model, 'contentType.iconResourcePath')) | async">ContentType Icon</mat-icon><span class="comment content-type-name font-body" [ngClass]="((_.get(model, 'contentType.name') || _.get(model, 'name')) | lowercase) + '-color'" [textContent]="(_.get(model, 'contentType.name') || _.get(model, 'name')) + ((_.get(model, 'status') !== 1) ? ' (hidden)' : '') + ((_.get(model, 'version.published') !== 1) ? ' (unpublished)' : '')"></span></div><h3 [innerHTML]="_.get(model, 'version.bestIdentifier') || _.get(model, 'name') || (_.get(model, 'contentType.controller') === 'Content\\Module' ? _.get(model, 'version.internalIdentifier') : 'Untitled ' + _.get(model, 'contentType.name') + ' (' + _.get(model, 'id') + ')')"></h3><span class="routing" [textContent]="(_.has(model, 'routing') ? '/' + _.get(model, 'routing[0].url') : null) || _.get(model, 'description') || ''"></span></div><div class="column-action"><a mat-button *ngIf="_.has(model, 'contentType.editUrl')" [matTooltip]="'Edit ' + (_.get(model, 'contentType.name') || _.get(model, 'name'))" aria-label="Edit Item in New Window" class="btn btn-edit" (click)="goToUrl(model, '_blank');"><mat-icon svgIcon="selector_edit" aria-hidden="false" aria-label="Edit Item">Edit</mat-icon></a></div></div></div></div></div>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
System.register(["@angular/core","@angular/forms","@angular/material/dialog","@angular/material/snack-bar","rxjs","rxjs/operators","lodash","@stratusjs/runtime/stratus","@stratusjs/core/environment","@stratusjs/angular/backend.service","@stratusjs/angularjs/services/model","@stratusjs/angular/core/responsive.component","@angular/material/icon","@angular/platform-browser"],function(t,e){"use strict";var n,i,s,o,r,a,l,c,d,u,h,g,f,p,m,v,
|
|
1
|
+
System.register(["@angular/core","@angular/forms","@angular/material/dialog","@angular/material/snack-bar","rxjs","rxjs/operators","lodash","@stratusjs/runtime/stratus","@stratusjs/core/environment","@stratusjs/angular/backend.service","@stratusjs/angularjs/services/model","@stratusjs/angular/core/responsive.component","@angular/material/icon","@angular/platform-browser"],function(t,e){"use strict";var n,i,s,o,r,a,l,c,d,u,h,g,f,p,m,y,v,b,k=this&&this.__decorate||function(t,e,n,i){var s,o=arguments.length,r=o<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(r=(o<3?s(r):o>3?s(e,n,r):s(e,n))||r);return o>3&&r&&Object.defineProperty(e,n,r),r},C=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},S=this&&this.__param||function(t,e){return function(n,i){e(n,i,t)}};e&&e.id;return{setters:[function(t){n=t},function(t){i=t},function(t){s=t},function(t){o=t},function(t){r=t},function(t){a=t},function(t){l=t},function(t){c=t},function(t){d=t},function(t){u=t},function(t){h=t},function(t){g=t},function(t){f=t},function(t){p=t}],execute:function(){"@stratusjs/angular",m="link-dialog","editor",y=d.cookie("env")?"":".min",v=`${c.Stratus.BaseUrl}${boot.configuration.paths["@stratusjs/angular/*"].replace(/[^/]*$/,"")}`,b=class extends g.ResponsiveComponent{constructor(t,e,n,i,s,o,r,a){super(),this.dialogRef=t,this.data=e,this.fb=n,this.backend=i,this.snackBar=s,this.iconRegistry=o,this.sanitizer=r,this.ref=a,this.title="link-dialog_component",this._=l.default,this.Stratus=c.Stratus,this.apiBase="/Api/Content",this.contentEntities=[],this.isContentLoading=!0,this.limit=20,this.eventInsert=!0,this.isListView=!1,this.selected=[],this.svgIcons={},this.isInitialized=!1,this.isDestroyed=!1,this.isStyled=!1}ngOnInit(){this.uid=l.default.uniqueId(`sa_${l.default.snakeCase(m)}_component_`),c.Stratus.Instances[this.uid]=this,c.Stratus.Internals.CssLoader(`${v}editor/link-dialog.component${y}.css`).then(()=>{this.isStyled=!0,this.refresh()}).catch(t=>{console.warn("Issue detected in CSS Loader for Component:",this),console.error(t),this.isStyled=!0,this.refresh()}),l.default.forEach({selector_delete:`${c.Stratus.BaseUrl}sitetheorycore/images/icons/actionButtons/delete.svg`,selector_edit:`${c.Stratus.BaseUrl}sitetheorycore/images/icons/actionButtons/edit.svg`},(t,e)=>this.iconRegistry.addSvgIcon(e,this.sanitizer.bypassSecurityTrustResourceUrl(t)).getNamedSvgIcon(e)),this.model=this.data.model,this.property=this.data.property,this.editor=this.data.editor,this.eventManager=this.data.eventManager,l.default.isBoolean(this.data.eventInsert)&&(this.eventInsert=this.data.eventInsert),this.dialogContentForm=this.fb.group({contentSelectorInput:""}),this.dialogContentForm.get("contentSelectorInput").valueChanges.pipe(a.debounceTime(300),a.tap(()=>this.isContentLoading=!0),a.switchMap(t=>l.default.isString(t)?this.getQuery(t):(this.select(t),this.getQuery()))).subscribe(t=>this.processContent(t)),this.backend.get(this.getQueryUrl()).pipe(a.finalize(()=>this.isContentLoading=!1)).subscribe(t=>this.processContent(t)),this.isInitialized=!0}ngOnDestroy(){this.isDestroyed=!0}refresh(){return this.isDestroyed?new Promise(t=>t()):super.refresh()}onCancelClick(){this.dialogRef.close(),this.refresh()}onPage(t){this.pageEvent=t,this.getQuery(this.lastContentQuery).subscribe(t=>this.processContent(t))}getQueryUrl(t){return t=!l.default.isString(t)||l.default.isEmpty(t)?"":`"${t}"`,`${this.apiBase}?limit=${this.limit}&options[isContent]=null&options[isCollection]=null&options[showRoutable]=true&options[showRouting]=true&q=${t}`}getQuery(t){return this.lastContentQuery=t,this.isContentLoading=!0,this.backend.get(this.getQueryUrl(t)).pipe(a.finalize(()=>this.isContentLoading=!1))}processContent(t){if(!t.ok||200!==t.status||l.default.isEmpty(t.body))return this.meta={},this.contentEntities=[],this.refresh(),this.contentEntities;this.meta=l.default.get(t.body,"meta")||{};const e=l.default.get(t.body,"payload")||t.body;return l.default.isEmpty(e)||!Array.isArray(e)?(this.contentEntities=[],this.isContentLoading=!1,this.refresh(),this.contentEntities):(this.contentEntities=e,this.isContentLoading=!1,this.refresh(),this.contentEntities)}select(t){if(l.default.isUndefined(t))return;const e=this.createLink(t);return e?(this.selected.push(t.id),this.eventInsert?void(this.eventManager?(this.eventManager.trigger("insert",e,this.editor),this.onCancelClick()):console.warn("link-dialog: event manager is not set.")):this.model instanceof h.Model&&l.default.isString(this.property)?(console.warn("link-dialog: disabling eventInsert is not recommended."),void this.model.set(this.property,this.model.get(this.property)+e)):void console.warn("link-dialog: event manager not available.")):(console.warn(`link-dialog: unable to build link for Content ID: ${t.id}`),void this.snackBar.open(`Unable to build link for Content ID: ${t.id}.`,"dismiss",{duration:5e3,horizontalPosition:"right",verticalPosition:"bottom"}))}isSelected(t){if(!l.default.isUndefined(t))return l.default.includes(this.selected,t.id)}createLink(t){return t?t.contentType&&t.contentType.name?t.routing&&t.routing.length&&t.routing[0]?t.routing[0].url?t.version?t.version.title&&t.version.title.length?{url:`/${t.routing[0].url}`,title:t.version.title}:(console.warn(`link-dialog: unable to find title for ${t.contentType.name} id: ${t.id}`),null):(console.warn(`link-dialog: unable to find content version for ${t.contentType.name} id: ${t.id}`),null):(console.warn(`link-dialog: unable to find url for ${t.contentType.name} id: ${t.id}`),null):(console.warn(`link-dialog: unable to find routing for ${t.contentType.name} id: ${t.id}`),null):(console.warn(`link-dialog: unable to find content type for content id: ${t.id}`),null):(console.warn("link-dialog: unable to create link for empty content"),null)}getSvg(t,e){const n=this.addSvgIcon(t,e);return new r.Observable(e=>{this.iconRegistry.getNamedSvgIcon(n).subscribe({error(e){console.error(`getSvg(${t}): ${e}`)},complete(){e.next(n)}})})}addSvgIcon(t,e){if(t in this.svgIcons)return this.svgIcons[t];e||(e={});const n=this.svgIcons[t]=l.default.uniqueId("selector_svg");return this.iconRegistry.addSvgIcon(n,this.sanitizer.bypassSecurityTrustResourceUrl(t),e),n}displayContentText(t){if(!t)return;const e=l.default.get(t,"routing[0].url"),n=l.default.isUndefined(e)?" (No route!)":` (/${e})`,i=l.default.get(t,"id"),s=l.default.isUndefined(i)?null:`Content: ${i}`;return(l.default.get(t,"version.title")||s)+n}goToUrl(t){t&&t.contentType?window.open(t.contentType.editUrl+"?id="+t.id,"_blank"):console.error("unable to execute goToUrl() because a valid model content was not provided.")}},b=k([n.Component({selector:"sa-link-dialog",templateUrl:`${v}/editor/link-dialog.component${y}.html`}),S(1,n.Inject(s.MAT_DIALOG_DATA)),C("design:paramtypes",[s.MatDialogRef,Object,i.FormBuilder,u.BackendService,o.MatSnackBar,f.MatIconRegistry,p.DomSanitizer,n.ChangeDetectorRef])],b),t("LinkDialogComponent",b)}}});
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
// ChangeDetectionStrategy,
|
|
4
4
|
ChangeDetectorRef,
|
|
5
5
|
Component,
|
|
6
|
-
Inject,
|
|
6
|
+
Inject, OnDestroy,
|
|
7
7
|
OnInit
|
|
8
8
|
} from '@angular/core'
|
|
9
9
|
import {
|
|
@@ -61,6 +61,7 @@ import {
|
|
|
61
61
|
import {ContentEntity} from '@stratusjs/angular/data/content.interface'
|
|
62
62
|
import {IconOptions, MatIconRegistry} from '@angular/material/icon'
|
|
63
63
|
import {DomSanitizer} from '@angular/platform-browser'
|
|
64
|
+
import {Convoy} from '@stratusjs/angular/data/convoy.interface'
|
|
64
65
|
|
|
65
66
|
// Local Setup
|
|
66
67
|
const systemDir = '@stratusjs/angular'
|
|
@@ -79,7 +80,7 @@ const localDir = `${Stratus.BaseUrl}${boot.configuration.paths[`${systemDir}/*`]
|
|
|
79
80
|
templateUrl: `${localDir}/${parentModuleName}/${moduleName}.component${min}.html`,
|
|
80
81
|
// changeDetection: ChangeDetectionStrategy.OnPush
|
|
81
82
|
})
|
|
82
|
-
export class LinkDialogComponent extends ResponsiveComponent implements OnInit {
|
|
83
|
+
export class LinkDialogComponent extends ResponsiveComponent implements OnInit, OnDestroy {
|
|
83
84
|
|
|
84
85
|
// Basic Component Settings
|
|
85
86
|
title = moduleName + '_component'
|
|
@@ -93,7 +94,7 @@ export class LinkDialogComponent extends ResponsiveComponent implements OnInit {
|
|
|
93
94
|
// AutoComplete Data
|
|
94
95
|
apiBase = '/Api/Content'
|
|
95
96
|
contentEntities: any[] = []
|
|
96
|
-
|
|
97
|
+
dialogContentForm: FormGroup
|
|
97
98
|
isContentLoading = true
|
|
98
99
|
lastContentQuery: string
|
|
99
100
|
|
|
@@ -112,6 +113,7 @@ export class LinkDialogComponent extends ResponsiveComponent implements OnInit {
|
|
|
112
113
|
eventInsert = true
|
|
113
114
|
|
|
114
115
|
// UI Settings
|
|
116
|
+
isListView = false
|
|
115
117
|
selected: Array<number> = []
|
|
116
118
|
|
|
117
119
|
// Icon Localization
|
|
@@ -119,8 +121,10 @@ export class LinkDialogComponent extends ResponsiveComponent implements OnInit {
|
|
|
119
121
|
[key: string]: string
|
|
120
122
|
} = {}
|
|
121
123
|
|
|
122
|
-
//
|
|
123
|
-
|
|
124
|
+
// Timing Flags
|
|
125
|
+
isInitialized = false
|
|
126
|
+
isDestroyed = false
|
|
127
|
+
isStyled = false
|
|
124
128
|
|
|
125
129
|
constructor(
|
|
126
130
|
public dialogRef: MatDialogRef<LinkDialogComponent>,
|
|
@@ -148,13 +152,13 @@ export class LinkDialogComponent extends ResponsiveComponent implements OnInit {
|
|
|
148
152
|
// Load Component CSS until System.js can import CSS properly.
|
|
149
153
|
Stratus.Internals.CssLoader(`${localDir}${parentModuleName}/${moduleName}.component${min}.css`)
|
|
150
154
|
.then(() => {
|
|
151
|
-
this.
|
|
155
|
+
this.isStyled = true
|
|
152
156
|
this.refresh()
|
|
153
157
|
})
|
|
154
158
|
.catch((err: any) => {
|
|
155
159
|
console.warn('Issue detected in CSS Loader for Component:', this)
|
|
156
160
|
console.error(err)
|
|
157
|
-
this.
|
|
161
|
+
this.isStyled = true
|
|
158
162
|
this.refresh()
|
|
159
163
|
})
|
|
160
164
|
|
|
@@ -175,32 +179,51 @@ export class LinkDialogComponent extends ResponsiveComponent implements OnInit {
|
|
|
175
179
|
|
|
176
180
|
// TODO: Move this to its own AutoComplete Component
|
|
177
181
|
// AutoComplete Logic
|
|
178
|
-
this.
|
|
179
|
-
|
|
182
|
+
this.dialogContentForm = this.fb.group({
|
|
183
|
+
contentSelectorInput: ''
|
|
180
184
|
})
|
|
181
|
-
this.
|
|
182
|
-
.get('
|
|
185
|
+
this.dialogContentForm
|
|
186
|
+
.get('contentSelectorInput')
|
|
183
187
|
.valueChanges
|
|
184
188
|
.pipe(
|
|
185
189
|
debounceTime(300),
|
|
186
|
-
tap(() =>
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
+
tap(() => this.isContentLoading = true),
|
|
191
|
+
switchMap((value: string|ContentEntity) => {
|
|
192
|
+
if (!_.isString(value)) {
|
|
193
|
+
this.select(value)
|
|
194
|
+
return this.getQuery()
|
|
195
|
+
}
|
|
190
196
|
return this.getQuery(value)
|
|
191
197
|
}
|
|
192
198
|
)
|
|
193
199
|
)
|
|
194
200
|
.subscribe((response: HttpResponse<any>) => this.processContent(response))
|
|
195
201
|
|
|
196
|
-
//
|
|
197
|
-
this.
|
|
198
|
-
(
|
|
199
|
-
|
|
202
|
+
// Initial Call for Content
|
|
203
|
+
this.backend
|
|
204
|
+
.get(this.getQueryUrl())
|
|
205
|
+
.pipe(
|
|
206
|
+
finalize(() => this.isContentLoading = false),
|
|
207
|
+
)
|
|
208
|
+
.subscribe((response: HttpResponse<Convoy<ContentEntity>>) => this.processContent(response))
|
|
209
|
+
|
|
210
|
+
// Mark as complete
|
|
211
|
+
this.isInitialized = true
|
|
200
212
|
|
|
201
213
|
// FIXME: We have to go in this roundabout way to force changes to be detected since the
|
|
202
214
|
// Dialog Sub-Components don't seem to have the right timing for ngOnInit
|
|
203
|
-
this.refresh()
|
|
215
|
+
// this.refresh()
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
ngOnDestroy() {
|
|
219
|
+
this.isDestroyed = true
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
public refresh() {
|
|
223
|
+
if (this.isDestroyed) {
|
|
224
|
+
return new Promise<void>(resolve => resolve())
|
|
225
|
+
}
|
|
226
|
+
return super.refresh()
|
|
204
227
|
}
|
|
205
228
|
|
|
206
229
|
onCancelClick(): void {
|
|
@@ -216,14 +239,8 @@ export class LinkDialogComponent extends ResponsiveComponent implements OnInit {
|
|
|
216
239
|
}
|
|
217
240
|
|
|
218
241
|
getQueryUrl(query?: string): string {
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
if (this.pageEvent) {
|
|
222
|
-
limit = this.pageEvent.pageSize
|
|
223
|
-
paging = this.pageEvent.pageIndex + 1
|
|
224
|
-
}
|
|
225
|
-
query = (_.isString(query) && !_.isEmpty(query)) ? `"${query}"` : ''
|
|
226
|
-
return `${this.apiBase}?limit=${limit}&p=${paging}&q=${query}`
|
|
242
|
+
query = (!_.isString(query) || _.isEmpty(query)) ? '' : `"${query}"`
|
|
243
|
+
return `${this.apiBase}?limit=${this.limit}&options[isContent]=null&options[isCollection]=null&options[showRoutable]=true&options[showRouting]=true&q=${query}`
|
|
227
244
|
}
|
|
228
245
|
|
|
229
246
|
getQuery(query?: string): Observable<HttpResponse<any>> {
|
|
@@ -260,8 +277,8 @@ export class LinkDialogComponent extends ResponsiveComponent implements OnInit {
|
|
|
260
277
|
if (_.isUndefined(content)) {
|
|
261
278
|
return
|
|
262
279
|
}
|
|
263
|
-
const
|
|
264
|
-
if (!
|
|
280
|
+
const link = this.createLink(content)
|
|
281
|
+
if (!link) {
|
|
265
282
|
console.warn(`${moduleName}: unable to build link for Content ID: ${content.id}`)
|
|
266
283
|
this.snackBar.open(`Unable to build link for Content ID: ${content.id}.`, 'dismiss', {
|
|
267
284
|
duration: 5000,
|
|
@@ -284,7 +301,7 @@ export class LinkDialogComponent extends ResponsiveComponent implements OnInit {
|
|
|
284
301
|
console.warn(`${moduleName}: disabling eventInsert is not recommended.`)
|
|
285
302
|
this.model.set(
|
|
286
303
|
this.property,
|
|
287
|
-
this.model.get(this.property) +
|
|
304
|
+
this.model.get(this.property) + link
|
|
288
305
|
)
|
|
289
306
|
return
|
|
290
307
|
}
|
|
@@ -292,7 +309,7 @@ export class LinkDialogComponent extends ResponsiveComponent implements OnInit {
|
|
|
292
309
|
console.warn(`${moduleName}: event manager is not set.`)
|
|
293
310
|
return
|
|
294
311
|
}
|
|
295
|
-
this.eventManager.trigger('insert',
|
|
312
|
+
this.eventManager.trigger('insert', link, this.editor)
|
|
296
313
|
// close dialog after inserting link
|
|
297
314
|
this.onCancelClick()
|
|
298
315
|
}
|
|
@@ -304,7 +321,7 @@ export class LinkDialogComponent extends ResponsiveComponent implements OnInit {
|
|
|
304
321
|
return _.includes(this.selected, content.id)
|
|
305
322
|
}
|
|
306
323
|
|
|
307
|
-
createLink (content: ContentEntity):
|
|
324
|
+
createLink (content: ContentEntity): Link|null {
|
|
308
325
|
if (!content) {
|
|
309
326
|
console.warn(`${moduleName}: unable to create link for empty content`)
|
|
310
327
|
return null
|
|
@@ -331,7 +348,10 @@ export class LinkDialogComponent extends ResponsiveComponent implements OnInit {
|
|
|
331
348
|
return null
|
|
332
349
|
}
|
|
333
350
|
|
|
334
|
-
return
|
|
351
|
+
return {
|
|
352
|
+
url: `/${content.routing[0].url}`,
|
|
353
|
+
title: content.version.title
|
|
354
|
+
}
|
|
335
355
|
}
|
|
336
356
|
|
|
337
357
|
getSvg(url: string, options?: IconOptions): Observable<string> {
|
|
@@ -372,6 +392,21 @@ export class LinkDialogComponent extends ResponsiveComponent implements OnInit {
|
|
|
372
392
|
return uid
|
|
373
393
|
}
|
|
374
394
|
|
|
395
|
+
displayContentText(content: ContentEntity) {
|
|
396
|
+
// Ensure Content is Selected before Display Text
|
|
397
|
+
if (!content) {
|
|
398
|
+
return
|
|
399
|
+
}
|
|
400
|
+
// Routing Display
|
|
401
|
+
const routing = _.get(content, 'routing[0].url')
|
|
402
|
+
const routingText = !_.isUndefined(routing) ? ` (/${routing})` : ' (No route!)'
|
|
403
|
+
// ContentId Fallback
|
|
404
|
+
const contentId = _.get(content, 'id')
|
|
405
|
+
const contentIdText = !_.isUndefined(contentId) ? `Content: ${contentId}` : null
|
|
406
|
+
// Return Version Title or Fallback Text
|
|
407
|
+
return (_.get(content, 'version.title') || contentIdText) + routingText
|
|
408
|
+
}
|
|
409
|
+
|
|
375
410
|
goToUrl(content: ContentEntity) {
|
|
376
411
|
if (!content || !content.contentType) {
|
|
377
412
|
console.error('unable to execute goToUrl() because a valid model content was not provided.')
|
|
@@ -390,3 +425,7 @@ export interface LinkDialogData {
|
|
|
390
425
|
model: Model,
|
|
391
426
|
property: string
|
|
392
427
|
}
|
|
428
|
+
export interface Link {
|
|
429
|
+
url: string,
|
|
430
|
+
title: string
|
|
431
|
+
}
|
|
@@ -17,6 +17,10 @@ System.register(["@stratusjs/runtime/stratus", "lodash"], function (exports_1, c
|
|
|
17
17
|
this.debug = false;
|
|
18
18
|
this.name = 'inputButton';
|
|
19
19
|
this.eventName = 'input-button';
|
|
20
|
+
this.autoRestoreSelection = false;
|
|
21
|
+
this.autoSaveSelection = false;
|
|
22
|
+
this.maintainSelection = false;
|
|
23
|
+
this.maintainSnapshot = false;
|
|
20
24
|
this.uid = lodash_1.default.uniqueId(`input_button_`);
|
|
21
25
|
stratus_1.Stratus.Instances[this.uid] = this;
|
|
22
26
|
this.debug = options && options.debug;
|
|
@@ -26,6 +30,11 @@ System.register(["@stratusjs/runtime/stratus", "lodash"], function (exports_1, c
|
|
|
26
30
|
this.name = options.name || this.name;
|
|
27
31
|
this.eventName = options.eventName || this.eventName;
|
|
28
32
|
this.editor = options.editor || null;
|
|
33
|
+
this.insert = options.insert || null;
|
|
34
|
+
this.autoRestoreSelection = options.autoRestoreSelection || null;
|
|
35
|
+
this.autoSaveSelection = options.autoSaveSelection || null;
|
|
36
|
+
this.maintainSelection = options.maintainSelection || null;
|
|
37
|
+
this.maintainSnapshot = options.maintainSnapshot || null;
|
|
29
38
|
}
|
|
30
39
|
findUID(el) {
|
|
31
40
|
if ('uid' in el.dataset) {
|
|
@@ -45,6 +54,9 @@ System.register(["@stratusjs/runtime/stratus", "lodash"], function (exports_1, c
|
|
|
45
54
|
if (!instance) {
|
|
46
55
|
return;
|
|
47
56
|
}
|
|
57
|
+
if (this.autoSaveSelection) {
|
|
58
|
+
this.saveSelection();
|
|
59
|
+
}
|
|
48
60
|
this.updateSnapshot();
|
|
49
61
|
instance.trigger(this.eventName, null, this);
|
|
50
62
|
}
|
|
@@ -52,8 +64,8 @@ System.register(["@stratusjs/runtime/stratus", "lodash"], function (exports_1, c
|
|
|
52
64
|
if (this.debug) {
|
|
53
65
|
console.log(`${this.name}.trigger():`, name, data, callee);
|
|
54
66
|
}
|
|
55
|
-
if (
|
|
56
|
-
console.warn(`${this.name}.trigger():`, data, 'is not
|
|
67
|
+
if (lodash_1.default.isEmpty(data)) {
|
|
68
|
+
console.warn(`${this.name}.trigger():`, data, 'is not valid data.');
|
|
57
69
|
return;
|
|
58
70
|
}
|
|
59
71
|
if (!this.editor) {
|
|
@@ -67,10 +79,19 @@ System.register(["@stratusjs/runtime/stratus", "lodash"], function (exports_1, c
|
|
|
67
79
|
if (!this.restoreSnapshot()) {
|
|
68
80
|
return;
|
|
69
81
|
}
|
|
70
|
-
this.
|
|
82
|
+
if (this.autoRestoreSelection) {
|
|
83
|
+
this.restoreSelection();
|
|
84
|
+
}
|
|
85
|
+
this.insert ? this.insert(data) : this.editor.html.insert(data);
|
|
71
86
|
this.updateSnapshot();
|
|
87
|
+
if (this.maintainSelection) {
|
|
88
|
+
this.saveSelection();
|
|
89
|
+
}
|
|
72
90
|
}
|
|
73
91
|
restoreSnapshot() {
|
|
92
|
+
if (!this.maintainSnapshot) {
|
|
93
|
+
return true;
|
|
94
|
+
}
|
|
74
95
|
if (!this.snapshot) {
|
|
75
96
|
console.warn(`${this.name}.restoreSnapshot(): unable to restore editor session without a snapshot.`);
|
|
76
97
|
return false;
|
|
@@ -80,8 +101,36 @@ System.register(["@stratusjs/runtime/stratus", "lodash"], function (exports_1, c
|
|
|
80
101
|
return true;
|
|
81
102
|
}
|
|
82
103
|
updateSnapshot() {
|
|
104
|
+
if (!this.maintainSnapshot) {
|
|
105
|
+
return true;
|
|
106
|
+
}
|
|
83
107
|
this.snapshot = this.editor.snapshot.get();
|
|
84
108
|
}
|
|
109
|
+
restoreSelection() {
|
|
110
|
+
if (!this.editor.selection) {
|
|
111
|
+
console.warn(`${this.name}.restoreSelection(): unable to restore editor selection.`);
|
|
112
|
+
return false;
|
|
113
|
+
}
|
|
114
|
+
this.editor.events.focus();
|
|
115
|
+
this.editor.selection.restore();
|
|
116
|
+
return true;
|
|
117
|
+
}
|
|
118
|
+
saveSelection() {
|
|
119
|
+
if (!this.editor.selection) {
|
|
120
|
+
console.warn(`${this.name}.saveSelection(): unable to save editor selection.`);
|
|
121
|
+
return false;
|
|
122
|
+
}
|
|
123
|
+
this.editor.selection.save();
|
|
124
|
+
return true;
|
|
125
|
+
}
|
|
126
|
+
clearSelection() {
|
|
127
|
+
if (!this.editor.selection) {
|
|
128
|
+
console.warn(`${this.name}.clearSelection(): unable to clear editor selection.`);
|
|
129
|
+
return false;
|
|
130
|
+
}
|
|
131
|
+
this.editor.selection.clear();
|
|
132
|
+
return true;
|
|
133
|
+
}
|
|
85
134
|
};
|
|
86
135
|
exports_1("InputButtonPlugin", InputButtonPlugin);
|
|
87
136
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["inputButton.ts"],"names":[],"mappings":";;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"sources":["inputButton.ts"],"names":[],"mappings":";;;;;;;;;;;;;;YAiBA,oBAAA,MAAa,iBAAiB;gBAiB1B,YAAY,OAAY;oBAXxB,UAAK,GAAG,KAAK,CAAA;oBACb,SAAI,GAAG,aAAa,CAAA;oBACpB,cAAS,GAAG,cAAc,CAAA;oBAG1B,yBAAoB,GAAG,KAAK,CAAA;oBAC5B,sBAAiB,GAAG,KAAK,CAAA;oBACzB,sBAAiB,GAAG,KAAK,CAAA;oBACzB,qBAAgB,GAAG,KAAK,CAAA;oBAKpB,IAAI,CAAC,GAAG,GAAG,gBAAC,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAA;oBACtC,iBAAO,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC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AC;gBAED,aAAa;oBACT,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE;wBACxB,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI,oDAAoD,CAAC,CAAA;wBAC9E,OAAO,KAAK,CAAA;qBACf;oBACD,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE,CAAA;oBAC5B,OAAO,IAAI,CAAA;gBACf,CAAC;gBAED,cAAc;oBACV,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE;wBACxB,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI,sDAAsD,CAAC,CAAA;wBAChF,OAAO,KAAK,CAAA;qBACf;oBACD,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,CAAA;oBAC7B,OAAO,IAAI,CAAA;gBACf,CAAC;aACJ,CAAA;;QACD,CAAC","file":"inputButton.js"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
System.register(["@stratusjs/runtime/stratus","lodash"],function(t,e){"use strict";var s
|
|
1
|
+
System.register(["@stratusjs/runtime/stratus","lodash"],function(t,e){"use strict";var i,s;e&&e.id;return{setters:[function(t){i=t},function(t){s=t}],execute:function(){t("InputButtonPlugin",class{constructor(t){this.debug=!1,this.name="inputButton",this.eventName="input-button",this.autoRestoreSelection=!1,this.autoSaveSelection=!1,this.maintainSelection=!1,this.maintainSnapshot=!1,this.uid=s.default.uniqueId("input_button_"),i.Stratus.Instances[this.uid]=this,this.debug=t&&t.debug,t&&"object"==typeof t||(t={}),this.name=t.name||this.name,this.eventName=t.eventName||this.eventName,this.editor=t.editor||null,this.insert=t.insert||null,this.autoRestoreSelection=t.autoRestoreSelection||null,this.autoSaveSelection=t.autoSaveSelection||null,this.maintainSelection=t.maintainSelection||null,this.maintainSnapshot=t.maintainSnapshot||null}findUID(t){return"uid"in t.dataset?t.dataset.uid:this.findUID(t.parentElement)}getInstance(t){if(t in i.Stratus.Instances)return i.Stratus.Instances[t]}onClick(t){const e=this.findUID(t),i=this.getInstance(e);i&&(this.autoSaveSelection&&this.saveSelection(),this.updateSnapshot(),i.trigger(this.eventName,null,this))}trigger(t,e,i){this.debug&&console.log(`${this.name}.trigger():`,t,e,i),s.default.isEmpty(e)?console.warn(`${this.name}.trigger():`,e,"is not valid data."):this.editor?"insert"===t?this.restoreSnapshot()&&(this.autoRestoreSelection&&this.restoreSelection(),this.insert?this.insert(e):this.editor.html.insert(e),this.updateSnapshot(),this.maintainSelection&&this.saveSelection()):console.warn(`${this.name}.trigger():`,t,"event is not supported."):console.warn(`${this.name}.trigger(): unable to inject html without a set editor.`)}restoreSnapshot(){return!this.maintainSnapshot||(this.snapshot?(this.editor.events.focus(),this.editor.snapshot.restore(this.snapshot),!0):(console.warn(`${this.name}.restoreSnapshot(): unable to restore editor session without a snapshot.`),!1))}updateSnapshot(){if(!this.maintainSnapshot)return!0;this.snapshot=this.editor.snapshot.get()}restoreSelection(){return this.editor.selection?(this.editor.events.focus(),this.editor.selection.restore(),!0):(console.warn(`${this.name}.restoreSelection(): unable to restore editor selection.`),!1)}saveSelection(){return this.editor.selection?(this.editor.selection.save(),!0):(console.warn(`${this.name}.saveSelection(): unable to save editor selection.`),!1)}clearSelection(){return this.editor.selection?(this.editor.selection.clear(),!0):(console.warn(`${this.name}.clearSelection(): unable to clear editor selection.`),!1)}})}}});
|