Skip to content
This repository was archived by the owner on Sep 8, 2020. It is now read-only.

Commit 7554a1d

Browse files
committed
Add support for disabled attribute on directive element
1 parent 915e977 commit 7554a1d

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/tinymce.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,26 @@ angular.module('ui.tinymce', [])
101101
}
102102
};
103103

104+
attrs.$observe('disabled', function(disabled) {
105+
if (disabled) {
106+
if (!tinyInstance) {
107+
tinyInstance = tinymce.get(attrs.id);
108+
}
109+
110+
if (tinyInstance) {
111+
tinyInstance.getBody().setAttribute('contenteditable', false);
112+
}
113+
} else {
114+
if (!tinyInstance) {
115+
tinyInstance = tinymce.get(attrs.id);
116+
}
117+
118+
if (tinyInstance) {
119+
tinyInstance.getBody().setAttribute('contenteditable', true);
120+
}
121+
}
122+
});
123+
104124
scope.$on('$destroy', function() {
105125
if (!tinyInstance) { tinyInstance = tinymce.get(attrs.id); }
106126
if (tinyInstance) {

0 commit comments

Comments
 (0)