これで角膜のcliに成功しました。tutorial、 私は今、問題をどのようにバインドするか、コンポーネントの値をtinymce textareaに渡します。どのようにコンポーネントからデータを2角形で結合するのか
たとえば、私は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は、テンプレートをコード化されています。 '' ??完全な例を教えてくれますか? –