Skip to content

Commit

Permalink
fix(tinymce): set absolute path for skin url (#5491)
Browse files Browse the repository at this point in the history
  • Loading branch information
yggg authored and Maksim Karatkevich committed May 22, 2020
1 parent 251659b commit 6a9a33d
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions src/app/@theme/components/tiny-mce/tiny-mce.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { Component, OnDestroy, AfterViewInit, Output, EventEmitter, ElementRef } from '@angular/core';
import { LocationStrategy } from '@angular/common';

@Component({
selector: 'ngx-tiny-mce',
template: '',
})
export class TinyMCEComponent implements OnDestroy, AfterViewInit {

@Output() editorKeyup = new EventEmitter<any>();

editor: any;

constructor(
private host: ElementRef,
private locationStrategy: LocationStrategy,
) { }

ngAfterViewInit() {
tinymce.init({
target: this.host.nativeElement,
plugins: ['link', 'paste', 'table'],
skin_url: `${this.locationStrategy.getBaseHref()}assets/skins/lightgray`,
setup: editor => {
this.editor = editor;
editor.on('keyup', () => {
this.editorKeyup.emit(editor.getContent());
});
},
height: '320',
});
}

ngOnDestroy() {
tinymce.remove(this.editor);
}
}

0 comments on commit 6a9a33d

Please sign in to comment.