diff --git a/CHANGELOG.md b/CHANGELOG.md index bd075fcc..bdebbefc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,8 @@ Changelog ========= -next ----- +v0.2.2 +------ - Added missing `modules` propType and documentation. - Children are now cloned so ReactQuill can own their refs. Fixes #20. diff --git a/README.md b/README.md index 79dc4f10..30d34496 100644 --- a/README.md +++ b/README.md @@ -181,7 +181,7 @@ More tasks are available on the [Makefile](Makefile): Changelog --------- -#### next +#### v0.2.2 - Added missing `modules` propType and documentation. - Children are now cloned so ReactQuill can own their refs. Fixes #20. @@ -195,11 +195,6 @@ Changelog - Editor props can now be changed after mounting. - Added callback for selection change event. Closes #12. -#### v0.1.1 -- The pre-compiled distributable is not shipped with the NPM package anymore. Should fix [#2](https://github.com/zenoamaro/react-quill/issues/2). -- Sourcemaps are now emitted for both distributables, as separate files. -- Avoiding parsing Quill as it ships with a pre-built main. - [Full changelog](CHANGELOG.md) diff --git a/dist/react-quill.js b/dist/react-quill.js index 64f358a3..690ecfbe 100644 --- a/dist/react-quill.js +++ b/dist/react-quill.js @@ -58,7 +58,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ function(module, exports, __webpack_require__) { /* - React-Quill v0.2.1 + React-Quill v0.2.2 https://github.com/zenoamaro/react-quill */ module.exports = __webpack_require__(/*! ./component */ 1); @@ -86,6 +86,16 @@ return /******/ (function(modules) { // webpackBootstrap QuillToolbar = React.createFactory(QuillToolbar); } + // Support React 0.12 and 0.13+ + // FIXME: Remove with React 0.13 + if (React.cloneElement) { + var cloneElement = React.cloneElement; + } else if (React.addons && React.addons.cloneWithProps) { + var cloneElement = React.addons.cloneWithProps; + } else { + throw new Error('React addons are required when using React 0.12 or less.'); + } + var QuillComponent = React.createClass({ displayName: 'Quill', @@ -99,6 +109,7 @@ return /******/ (function(modules) { // webpackBootstrap value: T.string, defaultValue: T.string, readOnly: T.bool, + modules: T.object, toolbar: T.array, formats: T.array, styles: T.object, @@ -114,6 +125,7 @@ return /******/ (function(modules) { // webpackBootstrap dirtyProps: [ 'id', 'className', + 'modules', 'toolbar', 'formats', 'styles', @@ -247,7 +259,11 @@ return /******/ (function(modules) { // webpackBootstrap */ renderContents: function() { if (React.Children.count(this.props.children)) { - return this.props.children; + // Clone children to own their refs. + return React.Children.map( + this.props.children, + function(c) { return cloneElement(c, { ref: c.ref }) } + ); } else { return [ // Quill modifies these elements in-place, diff --git a/dist/react-quill.js.map b/dist/react-quill.js.map index 8ef658e3..77306c60 100644 --- a/dist/react-quill.js.map +++ b/dist/react-quill.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap 148947bffc3bb9179155","webpack:///./src/index.js","webpack:///./src/component.js","webpack:///external {\"commonjs\":\"react\",\"commonjs2\":\"react\",\"amd\":\"react\",\"root\":\"React\"}","webpack:///./src/toolbar.js","webpack:///./src/mixin.js","webpack:///external {\"commonjs\":\"quill\",\"commonjs2\":\"quill\",\"amd\":\"quill\",\"root\":\"Quill\"}"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;ACVA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,uBAAe;AACf;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;;;;;;;;;ACtCA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;ACNA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAE;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAE;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA,GAAE;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA,GAAE;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAE;;AAEF;AACA;AACA;AACA;AACA,kBAAiB,gBAAgB;AACjC,GAAE;;AAEF;AACA;AACA;AACA;AACA,GAAE;;AAEF;AACA;AACA,gBAAe,0BAA0B;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAE;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAE;;AAEF;AACA;AACA,GAAE;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAE;;AAEF;AACA;AACA,GAAE;;AAEF;AACA;AACA,GAAE;;AAEF;AACA;AACA,GAAE;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA;AACA,gCAA+B;AAC/B,MAAK;AACL;AACA;AACA,GAAE;;AAEF;AACA;AACA;AACA;AACA;AACA,mCAAkC;AAClC;AACA;AACA,GAAE;;AAEF;AACA;AACA,mBAAkB,eAAe;AACjC;AACA;AACA;AACA;AACA,GAAE;;AAEF;AACA;AACA;AACA;AACA,mBAAkB,mBAAmB;AACrC;AACA;AACA;AACA;AACA,GAAE;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,EAAC;;AAED;;;;;;;;;;AC3OA,gD;;;;;;;;;ACAA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAsB,SAAS,eAAe,EAAE;;AAEhD;;AAEA,GAAE;AACF,IAAG;AACH,KAAI,0CAA0C;AAC9C,KAAI,qCAAqC;AACzC,KAAI;AACJ,KAAI;AACJ,IAAG,mBAAmB;AACtB,IAAG;AACH,KAAI,gCAAgC;AACpC,KAAI,gCAAgC;AACpC,KAAI,gCAAgC;AACpC,KAAI;AACJ,KAAI;AACJ,IAAG,mBAAmB;AACtB,IAAG;AACH,KAAI,2BAA2B;AAC/B,KAAI,yBAAyB;AAC7B,KAAI,0BAA0B;AAC9B,KAAI;AACJ;AACA,IAAG;;AAEH,GAAE;AACF,IAAG,4BAA4B;AAC/B,IAAG,gCAAgC;AACnC,IAAG,gCAAgC;AACnC,IAAG,sCAAsC;AACzC,IAAG,mBAAmB;AACtB,IAAG,mDAAmD;AACtD,IAAG,mEAAmE;AACtE,IAAG,mBAAmB;AACtB,IAAG;AACH,IAAG;;AAEH,GAAE;AACF,IAAG,gCAAgC;AACnC,IAAG,mBAAmB;AACtB,IAAG;AACH;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,GAAE;;AAEF;AACA;AACA;AACA;AACA,GAAE;;AAEF;AACA;AACA;AACA;AACA,IAAG;AACH,GAAE;;AAEF;AACA;AACA;AACA,iCAAgC;AAChC;AACA;AACA,GAAE;;AAEF;AACA;AACA;AACA,sBAAqB;AACrB;AACA;AACA,GAAE;;AAEF;AACA;AACA;AACA,gCAA+B;AAC/B;AACA;AACA,GAAE;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA,GAAE;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAE;;AAEF;AACA;AACA,GAAE;;AAEF;AACA;AACA,oCAAmC;AACnC;AACA;AACA;;AAEA,EAAC;;AAED;AACA;AACA,4C;;;;;;;;;ACvJA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAE;;AAEF;AACA;AACA;AACA;AACA;AACA,IAAG;;AAEH;AACA;AACA;AACA;AACA,IAAG;AACH,GAAE;;AAEF;AACA;AACA,GAAE;;AAEF;AACA;AACA;AACA,GAAE;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAE;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,6B;;;;;;;;;AC9DA,gD","file":"./dist/react-quill.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"react\"), require(\"quill\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"react\", \"quill\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"ReactQuill\"] = factory(require(\"react\"), require(\"quill\"));\n\telse\n\t\troot[\"ReactQuill\"] = factory(root[\"React\"], root[\"Quill\"]);\n})(this, function(__WEBPACK_EXTERNAL_MODULE_2__, __WEBPACK_EXTERNAL_MODULE_5__) {\nreturn \n\n\n/** WEBPACK FOOTER **\n ** webpack/universalModuleDefinition\n **/"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n/** WEBPACK FOOTER **\n ** webpack/bootstrap 148947bffc3bb9179155\n **/","/*\nReact-Quill v0.2.1\nhttps://github.com/zenoamaro/react-quill\n*/\nmodule.exports = require('./component');\nmodule.exports.Mixin = require('./mixin');\nmodule.exports.Toolbar = require('./toolbar');\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/index.js\n ** module id = 0\n ** module chunks = 0\n **/","'use strict';\n\nvar React = require('react'),\n\tQuillToolbar = require('./toolbar'),\n\tQuillMixin = require('./mixin'),\n\tT = React.PropTypes;\n\n// Support React 0.11 and 0.12\n// FIXME: Remove with React 0.13\nif (React.createFactory) {\n\tQuillToolbar = React.createFactory(QuillToolbar);\n}\n\nvar QuillComponent = React.createClass({\n\n\tdisplayName: 'Quill',\n\n\tmixins: [ QuillMixin ],\n\n\tpropTypes: {\n\t\tid: T.string,\n\t\tclassName: T.string,\n\t\tstyle: T.object,\n\t\tvalue: T.string,\n\t\tdefaultValue: T.string,\n\t\treadOnly: T.bool,\n\t\ttoolbar: T.array,\n\t\tformats: T.array,\n\t\tstyles: T.object,\n\t\ttheme: T.string,\n\t\tpollInterval: T.number,\n\t\tonChange: T.func,\n\t\tonChangeSelection: T.func\n\t},\n\n\t/*\n\tChanging one of these props should cause a re-render.\n\t*/\n\tdirtyProps: [\n\t\t'id',\n\t\t'className',\n\t\t'toolbar',\n\t\t'formats',\n\t\t'styles',\n\t\t'theme',\n\t\t'pollInterval'\n\t],\n\n\tgetDefaultProps: function() {\n\t\treturn {\n\t\t\tclassName: '',\n\t\t\ttheme: 'base',\n\t\t\tmodules: {\n\t\t\t\t'link-tooltip': true\n\t\t\t}\n\t\t};\n\t},\n\n\t/*\n\tWe consider the component to be controlled if\n\twhenever `value` is bein sent in props.\n\t*/\n\tisControlled: function() {\n\t\treturn 'value' in this.props;\n\t},\n\n\tgetInitialState: function() {\n\t\treturn {\n\t\t\tvalue: this.isControlled()\n\t\t\t\t? this.props.value\n\t\t\t\t: this.props.defaultValue\n\t\t};\n\t},\n\n\tcomponentWillReceiveProps: function(nextProps) {\n\t\tvar editor = this.state.editor;\n\t\t// Update only if we've been passed a new `value`.\n\t\t// This leaves components using `defaultValue` alone.\n\t\tif ('value' in nextProps) {\n\t\t\t// NOTE: Seeing that Quill is missing a way to prevent\n\t\t\t// edits, we have to settle for a hybrid between\n\t\t\t// controlled and uncontrolled mode. We can't prevent\n\t\t\t// the change, but we'll still override content\n\t\t\t// whenever `value` differs from current state.\n\t\t\tif (nextProps.value !== this.getEditorContents()) {\n\t\t\t\tthis.setEditorContents(editor, nextProps.value);\n\t\t\t}\n\t\t}\n\t\t// We can update readOnly state in-place.\n\t\tif ('readOnly' in nextProps) {\n\t\t\tif (nextProps.readOnly !== this.props.readOnly) {\n\t\t\t\tthis.setEditorReadOnly(editor, nextProps.readOnly);\n\t\t\t}\n\t\t}\n\t},\n\n\tcomponentDidMount: function() {\n\t\tvar editor = this.createEditor(\n\t\t\tthis.getEditorElement(),\n\t\t\tthis.getEditorConfig());\n\t\tthis.setState({ editor:editor });\n\t},\n\n\tcomponentWillUnmount: function() {\n\t\tthis.destroyEditor(this.state.editor);\n\t\t// NOTE: Don't set the state to null here\n\t\t// as it would generate a loop.\n\t},\n\n\tshouldComponentUpdate: function(nextProps, nextState) {\n\t\t// Check if one of the changes should trigger a re-render.\n\t\tfor (var i=0; i", "homepage": "https://github.com/zenoamaro/react-quill", diff --git a/src/index.js b/src/index.js index 69c7c257..58c66bba 100644 --- a/src/index.js +++ b/src/index.js @@ -1,5 +1,5 @@ /* -React-Quill v0.2.1 +React-Quill v0.2.2 https://github.com/zenoamaro/react-quill */ module.exports = require('./component');