├── postcss.config.js ├── .eslintignore ├── .gitignore ├── interfaces ├── mocha.js ├── images.js ├── CSSModule.js ├── draftjs-to-html.js └── draftjs-utils.js ├── docs ├── images │ ├── github.png │ └── demo │ │ ├── bold.gif │ │ ├── erase.gif │ │ ├── image.gif │ │ ├── link.gif │ │ ├── redo.gif │ │ ├── undo.gif │ │ ├── indent.gif │ │ ├── italic.gif │ │ ├── justify.gif │ │ ├── ordered.gif │ │ ├── outdent.gif │ │ ├── unlink.gif │ │ ├── left-align.gif │ │ ├── subscript.gif │ │ ├── underline.gif │ │ ├── unordered.gif │ │ ├── center-align.gif │ │ ├── right-align.gif │ │ ├── superscript.gif │ │ └── strikethrough.gif ├── static │ ├── main.css.map │ └── index.html ├── .babelrc ├── src │ ├── components │ │ ├── Author │ │ │ ├── styles.css │ │ │ └── index.js │ │ ├── index.js │ │ ├── Docs │ │ │ ├── Props │ │ │ │ ├── ReadOnlyProp │ │ │ │ │ └── index.js │ │ │ │ ├── WrapperIdProp │ │ │ │ │ └── index.js │ │ │ │ ├── DecoratorProp │ │ │ │ │ └── index.js │ │ │ │ ├── BlockRenderingProp │ │ │ │ │ └── index.js │ │ │ │ ├── DraftjsProp │ │ │ │ │ └── index.js │ │ │ │ ├── TextAlignmentProp │ │ │ │ │ └── index.js │ │ │ │ ├── HashtagProp │ │ │ │ │ └── index.js │ │ │ │ ├── EventCallbackProp │ │ │ │ │ └── index.js │ │ │ │ ├── index.js │ │ │ │ ├── CustomizingToolbarProp │ │ │ │ │ └── I18N │ │ │ │ │ │ └── index.js │ │ │ │ ├── EditorStyleProp │ │ │ │ │ └── index.js │ │ │ │ └── MentionProp │ │ │ │ │ └── index.js │ │ │ ├── index.js │ │ │ ├── ARIASupport │ │ │ │ └── index.js │ │ │ ├── styles.css │ │ │ ├── Usage │ │ │ │ └── index.js │ │ │ └── Installation │ │ │ │ └── index.js │ │ ├── Demo │ │ │ ├── EditorCustomizedToolbarOption │ │ │ │ └── ColorPic │ │ │ │ │ ├── styles.css │ │ │ │ │ └── index.js │ │ │ ├── EditorI18n │ │ │ │ └── index.js │ │ │ ├── EditorEmbedded │ │ │ │ └── index.js │ │ │ └── index.js │ │ ├── Menu │ │ │ ├── styles.css │ │ │ └── index.js │ │ ├── App │ │ │ ├── styles.css │ │ │ └── index.js │ │ └── Home │ │ │ └── styles.css │ ├── util │ │ ├── uploadImageCallBack.js │ │ └── sampleEditorContent.js │ ├── index.js │ └── icons │ │ └── palette.svg ├── index.html ├── template │ └── index.html ├── config │ ├── server.dev.js │ ├── webpack.dev.config.js │ └── webpack.prod.config.js └── package.json ├── .babelrc ├── src ├── index.js ├── controls │ ├── Remove │ │ └── Component │ │ │ ├── styles.css │ │ │ └── index.js │ ├── BlockType │ │ ├── Component │ │ │ └── styles.css │ │ └── __test__ │ │ │ └── blockControlTest.js │ ├── FontSize │ │ ├── Component │ │ │ └── styles.css │ │ └── __test__ │ │ │ └── fontSizeControlTest.js │ ├── Inline │ │ └── Component │ │ │ └── styles.css │ ├── History │ │ ├── Component │ │ │ └── styles.css │ │ └── __test__ │ │ │ └── historyControlTest.js │ ├── List │ │ ├── Component │ │ │ └── styles.css │ │ └── __test__ │ │ │ └── listControlsTest.js │ ├── FontFamily │ │ ├── Component │ │ │ └── styles.css │ │ └── __test__ │ │ │ └── fontFamilyControlTest.js │ ├── index.js │ ├── Emoji │ │ ├── Component │ │ │ ├── styles.css │ │ │ └── index.js │ │ └── index.js │ ├── TextAlign │ │ └── Component │ │ │ └── styles.css │ ├── ColorPicker │ │ ├── Component │ │ │ └── styles.css │ │ └── __test__ │ │ │ └── colorPickerTest.js │ ├── Link │ │ ├── Component │ │ │ └── styles.css │ │ └── __test__ │ │ │ └── linkControlTest.js │ ├── Image │ │ ├── __test__ │ │ │ └── imageControlTest.js │ │ └── index.js │ └── Embedded │ │ ├── index.js │ │ └── Component │ │ └── styles.css ├── decorators │ ├── HashTag │ │ ├── styles.css │ │ └── index.js │ ├── Mention │ │ ├── Mention │ │ │ ├── styles.css │ │ │ └── index.js │ │ ├── index.js │ │ ├── Suggestion │ │ │ └── styles.css │ │ └── addMention.js │ └── Link │ │ ├── styles.css │ │ ├── __test__ │ │ └── linkDecoratorTest.js │ │ └── index.js ├── components │ ├── Dropdown │ │ ├── index.js │ │ ├── DropdownOption │ │ │ ├── styles.css │ │ │ ├── __test__ │ │ │ │ └── dropdownOptionTest.js │ │ │ └── index.js │ │ └── Dropdown │ │ │ ├── __test__ │ │ │ └── dropdownTest.js │ │ │ └── styles.css │ ├── Spinner │ │ ├── index.js │ │ ├── __test__ │ │ │ └── spinnerTest.js │ │ └── styles.css │ └── Option │ │ ├── styles.css │ │ ├── index.js │ │ └── __test__ │ │ └── optionTest.js ├── event-handler │ ├── suggestions.js │ ├── keyDown.js │ ├── focus.js │ └── modals.js ├── utils │ ├── BlockStyle.js │ ├── toolbar.js │ ├── handlePaste.js │ └── common.js ├── i18n │ └── index.js ├── renderer │ ├── Embedded │ │ └── index.js │ ├── Image │ │ ├── styles.css │ │ └── __test__ │ │ │ └── imageRendererTest.js │ └── index.js └── Editor │ ├── __test__ │ └── editorTest.js │ └── styles.css ├── .travis.yml ├── scripts └── publish.sh ├── stories ├── CustomToolbar │ ├── styles.css │ └── index.js ├── I18n │ ├── styles.css │ └── index.js ├── I18nEditor │ └── styles.css ├── ToolbarHidden │ ├── styles.css │ └── index.js ├── FocusBlurCallbacks │ ├── styles.css │ └── index.js ├── FloatingToolbar │ ├── styles.css │ └── index.js ├── Basic │ └── index.js ├── ReadOnly │ └── index.js ├── styles.css ├── SpellCheck │ └── index.js ├── SelectedOptions │ └── index.js ├── HashTag │ └── index.js ├── BasicControlled │ └── index.js ├── BasicContentState │ └── index.js ├── ConvertToRawDraftContent │ └── index.js ├── ConvertToMarkdown │ └── index.js ├── Mention │ └── index.js ├── ImageUpload │ └── index.js ├── ConvertFromHTML │ └── index.js ├── ConvertFromRawDraftContent │ └── index.js ├── ConvertToHTML │ └── index.js └── index.js ├── .storybook ├── config.js └── webpack.config.js ├── config ├── test-compiler.js ├── test-setup.js └── webpack.config.js ├── .npmignore ├── .flowconfig ├── images ├── italic.svg ├── eraser.svg ├── underline.svg ├── undo.svg ├── redo.svg ├── indent.svg ├── outdent.svg ├── emoji.svg ├── unordered.svg ├── openlink.svg ├── bold.svg ├── align-center.svg ├── align-left.svg ├── align-justify.svg ├── align-right.svg ├── link.svg ├── superscript.svg ├── color.svg ├── subscript.svg ├── monospace.svg ├── ordered.svg ├── font-size.svg └── image.svg ├── .eslintrc ├── LICENSE └── README.md /postcss.config.js: -------------------------------------------------------------------------------- 1 | module.exports = {} -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | dist 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .DS_Store 3 | npm-debug.log 4 | dist 5 | -------------------------------------------------------------------------------- /interfaces/mocha.js: -------------------------------------------------------------------------------- 1 | function describe() {}; 2 | function it() {}; 3 | function xit() {}; 4 | -------------------------------------------------------------------------------- /docs/images/github.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/polydice/react-draft-wysiwyg/master/docs/images/github.png -------------------------------------------------------------------------------- /docs/static/main.css.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":[],"names":[],"mappings":"","file":"main.css","sourceRoot":""} -------------------------------------------------------------------------------- /interfaces/images.js: -------------------------------------------------------------------------------- 1 | declare module 'images' { 2 | declare var exports: { [key: string]: string }; 3 | } 4 | -------------------------------------------------------------------------------- /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["react", "es2015", "stage-0"], 3 | "plugins": ["transform-flow-strip-types"] 4 | } 5 | -------------------------------------------------------------------------------- /docs/images/demo/bold.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/polydice/react-draft-wysiwyg/master/docs/images/demo/bold.gif -------------------------------------------------------------------------------- /docs/images/demo/erase.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/polydice/react-draft-wysiwyg/master/docs/images/demo/erase.gif -------------------------------------------------------------------------------- /docs/images/demo/image.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/polydice/react-draft-wysiwyg/master/docs/images/demo/image.gif -------------------------------------------------------------------------------- /docs/images/demo/link.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/polydice/react-draft-wysiwyg/master/docs/images/demo/link.gif -------------------------------------------------------------------------------- /docs/images/demo/redo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/polydice/react-draft-wysiwyg/master/docs/images/demo/redo.gif -------------------------------------------------------------------------------- /docs/images/demo/undo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/polydice/react-draft-wysiwyg/master/docs/images/demo/undo.gif -------------------------------------------------------------------------------- /interfaces/CSSModule.js: -------------------------------------------------------------------------------- 1 | declare module 'CSSModule' { 2 | declare var exports: { [key: string]: string }; 3 | } 4 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | import Editor from './Editor'; 4 | 5 | module.exports = { 6 | Editor, 7 | }; 8 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | os: 3 | - osx 4 | language: node_js 5 | node_js: 6 | - "7" 7 | script: 8 | - npm test 9 | -------------------------------------------------------------------------------- /docs/images/demo/indent.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/polydice/react-draft-wysiwyg/master/docs/images/demo/indent.gif -------------------------------------------------------------------------------- /docs/images/demo/italic.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/polydice/react-draft-wysiwyg/master/docs/images/demo/italic.gif -------------------------------------------------------------------------------- /docs/images/demo/justify.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/polydice/react-draft-wysiwyg/master/docs/images/demo/justify.gif -------------------------------------------------------------------------------- /docs/images/demo/ordered.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/polydice/react-draft-wysiwyg/master/docs/images/demo/ordered.gif -------------------------------------------------------------------------------- /docs/images/demo/outdent.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/polydice/react-draft-wysiwyg/master/docs/images/demo/outdent.gif -------------------------------------------------------------------------------- /docs/images/demo/unlink.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/polydice/react-draft-wysiwyg/master/docs/images/demo/unlink.gif -------------------------------------------------------------------------------- /docs/images/demo/left-align.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/polydice/react-draft-wysiwyg/master/docs/images/demo/left-align.gif -------------------------------------------------------------------------------- /docs/images/demo/subscript.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/polydice/react-draft-wysiwyg/master/docs/images/demo/subscript.gif -------------------------------------------------------------------------------- /docs/images/demo/underline.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/polydice/react-draft-wysiwyg/master/docs/images/demo/underline.gif -------------------------------------------------------------------------------- /docs/images/demo/unordered.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/polydice/react-draft-wysiwyg/master/docs/images/demo/unordered.gif -------------------------------------------------------------------------------- /docs/images/demo/center-align.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/polydice/react-draft-wysiwyg/master/docs/images/demo/center-align.gif -------------------------------------------------------------------------------- /docs/images/demo/right-align.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/polydice/react-draft-wysiwyg/master/docs/images/demo/right-align.gif -------------------------------------------------------------------------------- /docs/images/demo/superscript.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/polydice/react-draft-wysiwyg/master/docs/images/demo/superscript.gif -------------------------------------------------------------------------------- /docs/images/demo/strikethrough.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/polydice/react-draft-wysiwyg/master/docs/images/demo/strikethrough.gif -------------------------------------------------------------------------------- /interfaces/draftjs-to-html.js: -------------------------------------------------------------------------------- 1 | declare module 'draftjs-to-html' { 2 | declare var exports: { 3 | draftToHtml: () => {} 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /scripts/publish.sh: -------------------------------------------------------------------------------- 1 | git subtree split --prefix docs/static -b gh-pages 2 | git push -f origin gh-pages:gh-pages 3 | git branch -D gh-pages 4 | -------------------------------------------------------------------------------- /stories/CustomToolbar/styles.css: -------------------------------------------------------------------------------- 1 | .rdw-storybook-custom-option { 2 | border: 1px solid #f1f1f1; 3 | padding: 3px 10px; 4 | height: 22px; 5 | } 6 | -------------------------------------------------------------------------------- /docs/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | "es2015", 4 | "stage-0", 5 | "react" 6 | ], 7 | "plugins": [ 8 | "lodash" 9 | ] 10 | } -------------------------------------------------------------------------------- /stories/I18n/styles.css: -------------------------------------------------------------------------------- 1 | .rdw-storybook-locale-wrapper { 2 | margin-bottom: 20px; 3 | } 4 | .rdw-storybook-locale-lbl { 5 | margin-right: 10px; 6 | } 7 | -------------------------------------------------------------------------------- /docs/src/components/Author/styles.css: -------------------------------------------------------------------------------- 1 | .author-root { 2 | margin: 30px; 3 | width: 50%; 4 | } 5 | .photo { 6 | height: 150px; 7 | width: auto; 8 | } 9 | -------------------------------------------------------------------------------- /stories/I18nEditor/styles.css: -------------------------------------------------------------------------------- 1 | .rdw-storybook-locale-wrapper { 2 | margin-bottom: 20px; 3 | } 4 | .rdw-storybook-locale-lbl { 5 | margin-right: 10px; 6 | } 7 | -------------------------------------------------------------------------------- /stories/ToolbarHidden/styles.css: -------------------------------------------------------------------------------- 1 | .rdw-storybook-locale-wrapper { 2 | margin-bottom: 20px; 3 | } 4 | .rdw-storybook-locale-lbl { 5 | margin-right: 10px; 6 | } 7 | -------------------------------------------------------------------------------- /src/controls/Remove/Component/styles.css: -------------------------------------------------------------------------------- 1 | .rdw-remove-wrapper { 2 | display: flex; 3 | align-items: center; 4 | margin-bottom: 6px; 5 | position: relative; 6 | } 7 | -------------------------------------------------------------------------------- /stories/FocusBlurCallbacks/styles.css: -------------------------------------------------------------------------------- 1 | .rdw-storybook-locale-wrapper { 2 | margin-bottom: 20px; 3 | } 4 | .rdw-storybook-locale-lbl { 5 | margin-right: 10px; 6 | } 7 | -------------------------------------------------------------------------------- /.storybook/config.js: -------------------------------------------------------------------------------- 1 | import { configure } from '@storybook/react'; 2 | 3 | function loadStories() { 4 | require('../stories'); 5 | } 6 | 7 | configure(loadStories, module); 8 | -------------------------------------------------------------------------------- /src/decorators/HashTag/styles.css: -------------------------------------------------------------------------------- 1 | .rdw-hashtag-link { 2 | text-decoration: none; 3 | color: #1236ff; 4 | background-color: #f0fbff; 5 | padding: 1px 2px; 6 | border-radius: 2px; 7 | } 8 | -------------------------------------------------------------------------------- /src/controls/BlockType/Component/styles.css: -------------------------------------------------------------------------------- 1 | .rdw-block-wrapper { 2 | display: flex; 3 | align-items: center; 4 | margin-bottom: 6px; 5 | } 6 | .rdw-block-dropdown { 7 | width: 110px; 8 | } 9 | -------------------------------------------------------------------------------- /src/decorators/Mention/Mention/styles.css: -------------------------------------------------------------------------------- 1 | .rdw-mention-link { 2 | text-decoration: none; 3 | color: #1236ff; 4 | background-color: #f0fbff; 5 | padding: 1px 2px; 6 | border-radius: 2px; 7 | } 8 | -------------------------------------------------------------------------------- /stories/FloatingToolbar/styles.css: -------------------------------------------------------------------------------- 1 | .rdw-storybook-toolbar-absolute { 2 | position: absolute; 3 | top: -130px; 4 | } 5 | .rdw-storybook-wrapper-margined { 6 | margin-top: 100px; 7 | position: relative; 8 | } 9 | -------------------------------------------------------------------------------- /config/test-compiler.js: -------------------------------------------------------------------------------- 1 | require('babel-core/register'); 2 | function noop() { 3 | return null; 4 | } 5 | require.extensions['.css'] = noop; 6 | require.extensions['.svg'] = noop; 7 | require.extensions['.png'] = noop; 8 | -------------------------------------------------------------------------------- /src/components/Dropdown/index.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | import Dropdown from './Dropdown'; 4 | import DropdownOption from './DropdownOption'; 5 | 6 | module.exports = { 7 | Dropdown, 8 | DropdownOption, 9 | }; 10 | -------------------------------------------------------------------------------- /src/decorators/Link/styles.css: -------------------------------------------------------------------------------- 1 | .rdw-link-decorator-wrapper { 2 | position: relative; 3 | } 4 | .rdw-link-decorator-icon { 5 | position: absolute; 6 | left: 40%; 7 | top: 0; 8 | cursor: pointer; 9 | background-color: white; 10 | } 11 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | .storybook 2 | config 3 | css 4 | docs 5 | images 6 | interfaces 7 | js 8 | scripts 9 | stories 10 | node_modules 11 | .babelrc 12 | .eslintignore 13 | .eslintrc 14 | .flowconfig 15 | .travis.yml 16 | .gitignore 17 | postcss.config.js 18 | .npmignore 19 | yarn.lock 20 | -------------------------------------------------------------------------------- /interfaces/draftjs-utils.js: -------------------------------------------------------------------------------- 1 | declare module 'draftjs-utils' { 2 | declare var exports: { 3 | changeDepth: () => {}, 4 | getSelectedBlocksType: () => {}, 5 | getEntityRange: () => {}, 6 | getSelectionText: () => {}, 7 | getSelectionEntity: () => {}, 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/event-handler/suggestions.js: -------------------------------------------------------------------------------- 1 | let suggestionDropdownOpen; 2 | 3 | export default { 4 | open: () => { 5 | suggestionDropdownOpen = true; 6 | }, 7 | 8 | close: () => { 9 | suggestionDropdownOpen = false; 10 | }, 11 | 12 | isOpen: () => suggestionDropdownOpen, 13 | }; 14 | -------------------------------------------------------------------------------- /src/controls/FontSize/Component/styles.css: -------------------------------------------------------------------------------- 1 | .rdw-fontsize-wrapper { 2 | display: flex; 3 | align-items: center; 4 | margin-bottom: 6px; 5 | } 6 | .rdw-fontsize-dropdown { 7 | min-width: 40px; 8 | } 9 | .rdw-fontsize-option { 10 | display: flex; 11 | justify-content: center; 12 | } 13 | -------------------------------------------------------------------------------- /docs/index.html: -------------------------------------------------------------------------------- 1 | 2 |
3 | 4 |