Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
4c14ed2
tinymce-editor bugfixes
abhirathore2006 Aug 22, 2016
e79a9e0
tinymce-editor bugfixes -deploy
abhirathore2006 Aug 22, 2016
2e1b93e
changed location in example file
abhirathore2006 Aug 22, 2016
0193be1
0.6.1 build
abhirathore2006 Aug 22, 2016
813a44d
added npm-debug.log to git ignore
abhirathore2006 Aug 22, 2016
d815fe3
added seld as author in package.json
abhirathore2006 Aug 22, 2016
cf76fae
release v0.6.3
abhirathore2006 Aug 22, 2016
0b90a1b
release v0.6.4
abhirathore2006 Aug 22, 2016
f415cb9
release v0.6.5
abhirathore2006 Aug 22, 2016
998bce7
release v0.6.6
abhirathore2006 Aug 22, 2016
00787a8
release v0.6.7
abhirathore2006 Aug 22, 2016
42221a9
release v0.6.8
abhirathore2006 Aug 22, 2016
f6ffe7d
release v0.6.9
abhirathore2006 Aug 22, 2016
f9d54e2
release v0.7.2
abhirathore2006 Aug 22, 2016
01adfa8
[fixed] tinymce.4.2.7.min.js Uncaught TypeError: Cannot read property…
abhirathore2006 Aug 23, 2016
48beef2
[Added] extra note to README.md regarding bind methods in Handler
abhirathore2006 Aug 23, 2016
e841eb5
release v0.8.1
abhirathore2006 Aug 23, 2016
c930531
Update CHANGELOG.md
abhirathore2006 Aug 23, 2016
08f390e
Update CHANGELOG.md
abhirathore2006 Aug 23, 2016
9ff011a
release v0.8.2
abhirathore2006 Sep 16, 2016
0f24d42
Merge branch 'master' of github.com:abhirathore2006/react-tinymce-editor
abhirathore2006 Sep 16, 2016
e7536af
release v0.8.3
abhirathore2006 Sep 16, 2016
6969a7a
moved lodash to peer dependency
abhirathore2006 Mar 10, 2017
602e3ae
changed version
abhirathore2006 Mar 10, 2017
07d4285
changed version
abhirathore2006 Mar 10, 2017
771bb71
fixed version
abhirathore2006 Mar 10, 2017
aaaa378
lodash changes
abhirathore2006 Mar 10, 2017
4302cd3
moved lodash to dependency
abhirathore2006 Mar 10, 2017
c7428c5
changed entry point to build
abhirathore2006 Mar 10, 2017
95b618e
fixed rackt version
abhirathore2006 Jun 6, 2017
2e09f59
release v0.8.9
abhirathore2006 Jun 6, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[fixed] tinymce.4.2.7.min.js Uncaught TypeError: Cannot read property…
… body

[fixed] use the latest handler passed in by the props
[Added] reset props which excepts a number ( any number ) and reset editor if its different from previous prop, this is necessary evil to prevent editor from reseting everytime
  • Loading branch information
abhirathore2006 committed Aug 23, 2016
commit 01adfa8c7c0c12ed9e2918f6323026446c06c4fe
108 changes: 61 additions & 47 deletions dist/react-tinymce-editor.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/react-tinymce-editor.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/react-tinymce-editor.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/react-tinymce-editor.min.js.map

Large diffs are not rendered by default.

88 changes: 42 additions & 46 deletions lib/components/TinyMCE.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ const TinyMCE = React.createClass({
config: React.PropTypes.object,
content: React.PropTypes.string,
id: React.PropTypes.string,
className: React.PropTypes.string
className: React.PropTypes.string,
reset: React.PropTypes.number
},

getDefaultProps() {
Expand All @@ -55,8 +56,9 @@ const TinyMCE = React.createClass({
this._init(config, content, this.id);
},
_getPropData(props) {
const {content, ...partialprops} = props;
const {content, config, ...partialprops} = props;
this.content = content;
this.config1 = config;
return partialprops;
},
componentWillReceiveProps(nextProps) {
Expand All @@ -66,9 +68,12 @@ const TinyMCE = React.createClass({
},

shouldComponentUpdate(nextProps) {
if (isEqual(this._getPropData(nextProps), this._getPropData(this.props) ) &&
this.props.content !== nextProps.content && (this._isInit !== undefined && this._isInit === true)) {
this.editor.setContent(nextProps.content);
}
return (
!isEqual(this.props.content, nextProps.content) ||
!isEqual(this.props.config, nextProps.config)
!isEqual(this._getPropData(nextProps), this._getPropData(this.props))
);
},

Expand All @@ -93,53 +98,44 @@ const TinyMCE = React.createClass({
},

_init(config, content, id) {
if (this._isInit) {
this._remove(this.id);
}
this.id = id;
// hide the textarea that is me so that no one sees it
if (document.getElementById(this.id)) {
document.getElementById(this.id).style.hidden = 'hidden';
}

const setupCallback = config.setup;
const hasSetupCallback = (typeof setupCallback === 'function');

config.selector = '#' + this.id;
config.setup = (editor) => {
EVENTS.forEach((event, index) => {
const handler = this.props[HANDLER_NAMES[index]];
if (typeof handler !== 'function') return;
editor.on(event, (e) => {
// native DOM events don't have access to the editor so we pass it here
handler(e, editor);
});
});
// need to set content here because the textarea will still have the
// old `this.props.content`
if (content) {
editor.on('init', () => {
// setTimeout(()=>{
editor.setContent(content);
// }, 100);
setTimeout(()=>{
const oldId = this.id;
this.id = id;

const setupCallback = config.setup;
const hasSetupCallback = (typeof setupCallback === 'function');
config.selector = '#' + this.id;
config.setup = (editor) => {
this.editor = editor;
EVENTS.forEach((event, index) => {
const handler = this.props[HANDLER_NAMES[index]];
if (typeof handler !== 'function') return;
editor.on(event, (e) => {
// native DOM events don't have access to the editor so we pass it here
handler(e, editor);
});
});
// need to set content here because the textarea will still have the
// old `this.props.content`
if (content) {
editor.on('init', () => {
editor.setContent(content);
});
}
if (hasSetupCallback) {
setupCallback(editor);
}
};
if (this._isInit) {
this._remove(oldId);
}
if (hasSetupCallback) {
setupCallback(editor);
}
};

tinymce.init(config);

if (document.getElementById(this.id)) {
document.getElementById(this.id).style.hidden = '';
}

this._isInit = true;
tinymce.init(config);
this._isInit = true;
}, 5);
},

_remove(id) {
tinymce.EditorManager.execCommand('mceRemoveControl', true, id);
tinymce.EditorManager.execCommand('mceRemoveEditor', false, id);
this._isInit = false;
}
});
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@
"dependencies": {
"lodash": "^3.9.3"
}
}
}