나는이 두 가지 cli에 tinymce를 통합하는 데 성공했습니다. , 내 문제는 이제 어떻게 구성 요소에서 바인딩하여 값을 구성하는 것입니까?각 2 cli로 tinymce로 데이터를 바인딩하는 방법
예를 들어 나는 product.component.ts 및 product.component.html을 가지고 있습니다.
<simple-tiny
[elementId]="'my-editor-id'"
(onEditorKeyup)="keyupHandlerFunction($event)"
>
</simple-tiny>
product.component.ts
import { Component,Input,OnInit } from '@angular/core';
@Component({
selector: 'app-product',
templateUrl: './product.component.html'
})
export class ProductComponent {
my-editor-id:any -->error
ngOnInit(): void {
this.my-editor-id="abcdefg"; --> error, i want bind abcdefg into tinymce are? how?
}
}
간단 tiny.component.ts :
import {
Component,
OnDestroy,
AfterViewInit,
EventEmitter,
Input,
Output
} from '@angular/core';
@Component({
selector: 'simple-tiny',
template: `<textarea id="{{elementId}}"></textarea>`
})
export class SimpleTinyComponent implements AfterViewInit, OnDestroy {
@Input() elementId: String;
@Output() onEditorKeyup = new EventEmitter<any>();
editor;
ngAfterViewInit() {
tinymce.init({
selector: '#' + this.elementId,
plugins: ['link', 'paste', 'table'],
skin_url: 'assets/skins/lightgray',
setup: editor => {
this.editor = editor;
editor.on('keyup',() => {
const content = editor.getContent();
this.onEditorKeyup.emit(content);
});
},
});
}
ngOnDestroy() {
tinymce.remove(this.editor);
}
}
TinyMCE에 지시어는 product.component.html에
product.component.html입니다
감사 product.component.ts하기 위해 다음과 같은 기능을 추가 할 수 있지만 난 여전히 confuse..what 템플릿 코딩되어있다 : ''?? 완전한 예를 들어 줄 수 있니? –