├── VERSION ├── .gitignore ├── src └── index.js ├── public ├── css │ ├── website.css │ └── editor.css ├── demo.html └── js │ └── ProseArea-dev.js ├── rollup.config.js ├── package.json ├── CHANGELOG.md ├── LICENSE └── README.md /VERSION: -------------------------------------------------------------------------------- 1 | 0.3.5 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.swp 2 | /node_modules 3 | /package-lock.json 4 | /yarn.lock 5 | /public/ProseArea.js 6 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | export {EditorView} from "prosemirror-view" 2 | export {EditorState} from "prosemirror-state" 3 | export {schema, defaultMarkdownParser, defaultMarkdownSerializer} from "prosemirror-markdown" 4 | export {exampleSetup} from "prosemirror-example-setup" 5 | -------------------------------------------------------------------------------- /public/css/website.css: -------------------------------------------------------------------------------- 1 | body { font-family: sans-serif; font-size: 12px; } 2 | 3 | #editor {} 4 | 5 | #area-editor { margin: 16px; } 6 | 7 | #area-testing { border: 1px solid black; width: 600px; text-align: center; } 8 | #area-testing textarea { width: 560px; margin: 8px; } 9 | -------------------------------------------------------------------------------- /rollup.config.js: -------------------------------------------------------------------------------- 1 | import babel from 'rollup-plugin-babel'; 2 | import builtins from 'rollup-plugin-node-builtins'; 3 | import json from '@rollup/plugin-json'; 4 | import resolve from 'rollup-plugin-node-resolve'; 5 | import commonJS from 'rollup-plugin-commonjs' 6 | 7 | 8 | export default { 9 | input: './src/index.js', 10 | output: { 11 | format: 'iife', 12 | file: 'public/js/ProseArea.js', 13 | name: 'ProseArea' 14 | }, 15 | plugins: [ 16 | builtins(), 17 | babel(), 18 | json(), 19 | resolve(), 20 | commonJS({ 21 | include: 'node_modules/**' 22 | }) 23 | ], 24 | }; 25 | 26 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "prosearea", 3 | "dependencies": { 4 | "@rollup/plugin-json": "^4.0.0", 5 | "prosemirror-example-setup": "^1.0.1", 6 | "prosemirror-markdown": "^1.4.2", 7 | "prosemirror-model": "^1.6.4", 8 | "prosemirror-schema-basic": "^1.0.0", 9 | "prosemirror-state": "^1.2.2", 10 | "prosemirror-view": "^1.6.8", 11 | "punycode": "^2.1.1", 12 | "rollup-plugin-node-builtins": "^2.1.2" 13 | }, 14 | "devDependencies": { 15 | "@babel/core": "^7.2.2", 16 | "@babel/preset-env": "^7.2.3", 17 | "babel-loader": "^8.0.5", 18 | "rollup": "^1.1.0", 19 | "rollup-plugin-babel": "^4.3.1", 20 | "rollup-plugin-commonjs": "^9.2.0", 21 | "rollup-plugin-node-resolve": "^4.0.0" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | 0.1: 2 | * Initial working version. 3 | 4 | 0.2: 5 | * Files moved around and renamed. 6 | * CHANGELOG.md added. 7 | 8 | 0.3: 9 | * WYSIWYG/markdown buttons optionally hidden. 10 | * Support for disabling WYSIWYG/markdown editor via disabled-attribute. 11 | * Event "changed" emitted when content changes. 12 | * Event "save" periodically emitted if necessary, with 1-second hard-coded interval. 13 | * View object accessible through target textarea node. 14 | 15 | 0.3.1: 16 | * LICENSE updated (MIT). 17 | * README updated. 18 | 19 | 0.3.2: 20 | * README updated some more. 21 | 22 | 0.3.3: 23 | * Fixed bug resulting in newlines being omitted from POST content. 24 | 25 | 0.3.4: 26 | * Transparent support for focus-function on textarea -> WYSIWYG. 27 | 28 | 0.3.5: 29 | * CSS class "prosearea-instance" added automatically to ProseArea's container for custom styling. 30 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Helgi Hrafn Gunnarsson 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /public/demo.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 14 |
15 |
16 |
17 |

Editor 1

18 |

19 |
20 |
21 |

Editor 2

22 |

23 |
24 |
25 | 26 |
27 |

Testing area (editor 1)

28 |

29 |

30 | 31 | 32 | 33 | | 34 | 35 |

36 | 37 |
38 |
39 | 40 | 41 | 42 | 43 | 69 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ProseArea 2 | 3 | ## About 4 | 5 | ProseArea is a drop-in replacement for HTML textareas, providing [WYSIWYG](https://en.wikipedia.org/wiki/WYSIWYG) editing of [markdown](https://en.wikipedia.org/wiki/Markdown), based on the [ProseMirror](https://prosemirror.net/) web library. 6 | 7 | ## Design goals 8 | 9 | * WYSIWYG markdown editing. 10 | * Plaintext markdown editing. 11 | * Drop-in replacement for HTML textareas. 12 | * UI-framework agnosticism. 13 | * Simplicity of use. 14 | 15 | ## Installation 16 | 17 | If you only want to start using ProseArea to turn textareas on your webpage to fully-functional WYSIWYG editors spouting out beautiful markdown, then everything you need is in `public/js`. 18 | 19 | To see how to use it, take a look at `public/demo.html` for an example of how to convert HTML textareas into WYSIWYG/markdown editors. 20 | 21 | Once a textarea has been turned into a WYSIWYG editor, you can read and write its content through the regular `value` property of the textarea, as shown in the example (`public/demo.html`). On GET and POST submissions, the editor's content will be delivered in markdown format with the textarea's name as a variable. 22 | 23 | One of ProseArea's most important design goals is ease-of-use without in-depth knowledge of ProseMirror. If you have any kind of trouble using ProseArea, please let the authors know, since that indicates a need to make it even simpler. 24 | 25 | ### Notes on usage 26 | 27 | When ProseArea is applied to a `