react-tinymce-input
Advanced tools
Comparing version 1.1.0 to 1.2.0
@@ -23,6 +23,8 @@ /*global tinymce */ | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
var React = require('react'), | ||
uuid = require('uuid'); | ||
var DIRECT_PASSTHROUGH_EVENTS = ['Activate', 'Deactivate', 'Focus', 'Hide', 'Init', 'Remove', 'Reset', 'Show', 'Submit']; | ||
var DIRECT_PASSTHROUGH_EVENTS = ['Activate', 'Deactivate', 'Focus', 'Hide', 'Init', 'Remove', 'Reset', 'Show', 'Submit', 'Click']; | ||
var PSEUDO_HIDDEN = { position: 'absolute', left: -200, top: -200, height: 0 }; | ||
@@ -52,2 +54,3 @@ | ||
onActivate: React.PropTypes.func, | ||
onClick: React.PropTypes.func, | ||
onDeactivate: React.PropTypes.func, | ||
@@ -62,4 +65,7 @@ onFocus: React.PropTypes.func, | ||
onSubmit: React.PropTypes.func, | ||
onUndo: React.PropTypes.func | ||
onUndo: React.PropTypes.func, | ||
textareaProps: React.PropTypes.object.isRequired, // props passed through to the textarea | ||
otherEventHandlers: React.PropTypes.objectOf(React.PropTypes.func.isRequired).isRequired | ||
}, | ||
@@ -71,2 +77,4 @@ getDefaultProps: function getDefaultProps() { | ||
pollInterval: 1000, | ||
textareaProps: {}, | ||
otherEventHandlers: {}, | ||
onChange: function onChange() {} | ||
@@ -123,3 +131,3 @@ }; | ||
/* eslint-disable no-loop-func */ | ||
for (var i = 0, len = DIRECT_PASSTHROUGH_EVENTS.length; i < len; i++) { | ||
for (var i = 0, len = DIRECT_PASSTHROUGH_EVENTS.length; i < len; ++i) { | ||
event = DIRECT_PASSTHROUGH_EVENTS[i]; | ||
@@ -134,2 +142,9 @@ editor.on(event.toLowerCase(), function (tinyMCEEvent) { | ||
/* eslint-enable no-loop-func */ | ||
var handlers = this.props.otherEventHandlers; | ||
for (var eventName in handlers) { | ||
if (handlers.hasOwnProperty(eventName)) { | ||
editor.on(eventName, handlers[eventName]); | ||
} | ||
} | ||
}, | ||
@@ -254,3 +269,3 @@ setupEditor: function setupEditor(editor) { | ||
React.createElement('input', { type: 'hidden', name: this.props.name, value: this.state.value, readOnly: true }), | ||
React.createElement('textarea', { | ||
React.createElement('textarea', _extends({ | ||
id: this.state.id, | ||
@@ -261,3 +276,3 @@ defaultValue: this.state.value, | ||
style: PSEUDO_HIDDEN | ||
}) | ||
}, this.props.textareaProps)) | ||
); | ||
@@ -264,0 +279,0 @@ } |
{ | ||
"name": "react-tinymce-input", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "A React component to control TinyMCE.", | ||
@@ -5,0 +5,0 @@ "main": "dist/TinyMCEInput.js", |
@@ -28,2 +28,8 @@ # React TinyMCE Input | ||
- 1.2.0 passthroughs | ||
- added `onClick` prop that will bind to the 'click' event on the tinymce editor | ||
- added `textareaProps` prop that will pass through to the textarea | ||
- added `otherEventHandlers` prop that takes an `Object<string, Function>`. Each key in otherEventHandlers will be bound to the TinyMCE editor. This is direct access to the TinyMCE event binding for any future enhancements that might be required before they can be added as a direct prop on the TinyMCEInput component. | ||
- 1.0.5 mitigate textarea blink | ||
@@ -30,0 +36,0 @@ |
16923
287
41