Skip to content

Commit 74a9991

Browse files
committed
Allow Chaining of config.setup for Editor Init
This allows user plugin configuration without having to hook refs, etc. Still add custom event proxying and initial content, but allow definition of a setup callback that is invoked after wrapper initialization. This allows configuration similar to the official TinyMCE examples (such as http://www.tinymce.com/tryit/3_x/custom_toolbar_button.php)
1 parent 15831fd commit 74a9991

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/components/TinyMCE.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,9 @@ const TinyMCE = React.createClass({
9999
// hide the textarea that is me so that no one sees it
100100
findDOMNode(this).style.hidden = 'hidden';
101101

102+
var setupCallback = config.setup;
103+
var hasSetupCallback = (typeof setupCallback === 'function');
104+
102105
config.selector = '#' + this.id;
103106
config.setup = (editor) => {
104107
EVENTS.forEach((event, index) => {
@@ -116,6 +119,9 @@ const TinyMCE = React.createClass({
116119
editor.setContent(content);
117120
});
118121
}
122+
if(hasSetupCallback) {
123+
setupCallback(editor);
124+
}
119125
};
120126

121127
tinymce.init(config);

0 commit comments

Comments
 (0)