├── .babelrc ├── .eslintrc ├── .gitignore ├── .npmignore ├── LICENSE ├── README.md ├── docs └── examples.js ├── example-dist ├── index.html └── style │ └── rich-text-editor.css ├── example └── index.js ├── index.html ├── package.json ├── src ├── BasicHtmlEditor.js ├── components │ ├── BlockStyleControls.js │ ├── EntityControls.js │ ├── InlineStyleControls.js │ ├── Link.js │ └── StyleButton.js ├── config │ └── tagMaps.js └── utils │ ├── draftRawToHtml.js │ ├── findEntities.js │ ├── htmlToContent.js │ └── processInlineStylesAndEntities.js ├── style └── rich-text-editor.css ├── tests └── unit │ └── utils │ ├── draftRawToHtmlTests.js │ └── processInlineStylesTests.js ├── webpack.config.js ├── webpack.dist.config.js └── webpack.example-dist.config.js /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["es2015", "react"] 3 | } 4 | -------------------------------------------------------------------------------- /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "parser": "babel-eslint", 3 | "rules": { 4 | "indent": [ 2, 2, {"SwitchCase": 1} ], 5 | "quotes": 0, 6 | "linebreak-style": [ 2, "unix" ], 7 | "semi": [ 2, "always" ], 8 | "no-console": 0, 9 | "valid-jsdoc": 2, 10 | "react/jsx-uses-react": 2, 11 | "react/jsx-uses-vars": 2, 12 | "react/react-in-jsx-scope": 2, 13 | }, 14 | globals: { 15 | }, 16 | "env": { 17 | "es6": true, 18 | "node": true, 19 | "browser": true, 20 | "mocha": true 21 | }, 22 | "extends": "eslint:recommended", 23 | "ecmaFeatures": { 24 | "jsx": true, 25 | "modules": true, 26 | }, 27 | "plugins": [ 28 | "react" 29 | ] 30 | } 31 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .DS_Store 3 | npm-debug.log 4 | lib-compiled 5 | coverage 6 | .cache 7 | *bundle.js 8 | *bundle.js.map 9 | log.txt 10 | .idea 11 | dist -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .DS_Store 3 | npm-debug.log 4 | lib-compiled 5 | coverage 6 | .cache 7 | *bundle.js 8 | *bundle.js.map 9 | log.txt 10 | .idea 11 | example-dist 12 | src -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | Copyright (c) 2016 David Burrows 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 5 | 6 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 7 | 8 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 9 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # draft-js-BasicHtmlEditor 2 | Basic HTML editor using draft.js - html in, html out 3 | 4 | Proof of concept currently, not production ready! PR's welcome. 5 | 6 | Extends the Rich example from the Draft repo to accept html as its input format, and return html to an `onChange` handler. 7 | 8 | ### Tag Support 9 | 10 | Block tags: `