|
|
|
@ -105,6 +105,9 @@ export class ImageEditorComponent implements AfterViewInit, OnChanges { |
|
|
|
private isChanged = false; |
|
|
|
private isChangedBefore = false; |
|
|
|
|
|
|
|
@Input() |
|
|
|
public accessToken: string; |
|
|
|
|
|
|
|
@Input() |
|
|
|
public imageUrl: string; |
|
|
|
|
|
|
|
@ -159,15 +162,18 @@ export class ImageEditorComponent implements AfterViewInit, OnChanges { |
|
|
|
'https://uicdn.toast.com/tui-image-editor/latest/tui-image-editor.js' |
|
|
|
]; |
|
|
|
|
|
|
|
styles.forEach(style => this.resourceLoader.loadStyle(style)); |
|
|
|
let path = this.imageUrl; |
|
|
|
|
|
|
|
const s = scripts.map(script => this.resourceLoader.loadScript(script)); |
|
|
|
if (this.accessToken) { |
|
|
|
path += `&access_token=${this.accessToken}`; |
|
|
|
} |
|
|
|
|
|
|
|
Promise.all(s).then(() => { |
|
|
|
styles.forEach(style => this.resourceLoader.loadStyle(style)); |
|
|
|
Promise.all(scripts.map(script => this.resourceLoader.loadScript(script))).then(() => { |
|
|
|
this.imageEditor = new tui.ImageEditor(this.editor.nativeElement, { |
|
|
|
includeUI: { |
|
|
|
loadImage: { |
|
|
|
path: this.imageUrl, name: 'image' |
|
|
|
path, name: 'image' |
|
|
|
}, |
|
|
|
menu: [ |
|
|
|
'crop', |
|
|
|
|