Skip to content

Commit 730975e

Browse files
author
Mattias Wikstrom
committed
added disabled
1 parent 71cc059 commit 730975e

3 files changed

Lines changed: 18 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# 2.2.0
2+
3+
* Added support for disabling the editor via the `disabled` attribute.
4+
15
# 2.1.0
26

37
* Fixed bug where textarea was being added to editor content if id was set.

tinymce-angular-component/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@tinymce/tinymce-angular",
33
"description": "Official TinyMCE Angular Component",
4-
"version": "2.1.0",
4+
"version": "2.2.0",
55
"repository": "https://github.com/tinymce/tinymce-angular.git",
66
"author": "Ephox Inc",
77
"license": "Apache-2.0",

tinymce-angular-component/src/editor/editor.component.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,18 @@ export class EditorComponent extends Events implements AfterViewInit, ControlVal
3737
@Input() plugins: string | undefined;
3838
@Input() toolbar: string | string[] | null = null;
3939

40+
private _disabled: boolean | undefined;
41+
@Input()
42+
set disabled(val) {
43+
this._disabled = val;
44+
if (this.editor && this.editor.initialized) {
45+
this.editor.setMode(val ? 'readonly' : 'design');
46+
}
47+
}
48+
get disabled() {
49+
return this._disabled;
50+
}
51+
4052
private onTouchedCallback = () => {};
4153
private onChangeCallback = (x: any) => {};
4254

@@ -110,6 +122,7 @@ export class EditorComponent extends Events implements AfterViewInit, ControlVal
110122
...this.init,
111123
target: this.element,
112124
inline: this.inline,
125+
readonly: this.disabled,
113126
plugins: mergePlugins(this.init && this.init.plugins, this.plugins),
114127
toolbar: this.toolbar || (this.init && this.init.toolbar),
115128
setup: (editor: any) => {

0 commit comments

Comments
 (0)