├── .gitignore ├── index.html ├── index.js ├── vue-redactor.min.js ├── LICENSE ├── README.md └── vue-redactor.js /.gitignore: -------------------------------------------------------------------------------- 1 | # OS generated files 2 | dist/ 3 | .DS_Store 4 | .DS_Store? 5 | ._* 6 | .Spotlight-V100 7 | .Trashes 8 | ehthumbs.db 9 | Thumbs.db -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 |Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
', 19 | configOptions: {} 20 | } 21 | } 22 | }); -------------------------------------------------------------------------------- /vue-redactor.min.js: -------------------------------------------------------------------------------- 1 | Vue.component('Redactor',{template:'',redactor:!1,props:{value:{default:'',type:String},placeholder:{type:String,default:null},name:{type:String,default:null},config:{default:{},type:Object}},watch:{value(newValue,oldValue){if(this.redactor.editor.isFocus()||this.redactor.editor.isSourceMode()){return} 2 | this.redactor.source.setCode(newValue)}},mounted(){this.init()},beforeDestroy(){this.destroy()},methods:{init(){var me=this;var callbacks={changed:function(html){me.handleInput(html);return html}};if(typeof this.config.callbacks==='undefined'){Vue.set(this.config,'callbacks',callbacks)}else{this.config.callbacks.changed=callbacks.changed} 3 | var app=Redactor(this.$refs.redactor,this.config);this.redactor=app;this.$parent.redactor=app},destroy(){Redactor(this.$refs.redactor,'destroy');this.redactor=null;this.$parent.redactor=null},handleInput(val){this.$emit('input',val)}}}) -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Imperavi 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. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Redactor Vue.js Component 2 | 3 | Vue-redactor helps [Redactor](https://imperavi.com/redactor/) to work as a Vue.js component. The Redactor Vue component is under MIT license. 4 | However, to use this component, you should purchase a Redactor license. 5 | 6 | Please see [the buying page](https://imperavi.com/redactor/buy/) and [License Agreement](https://imperavi.com/redactor/license/). 7 | 8 | ## Compatibility 9 | 10 | - Vue.js 2.x 11 | 12 | ## Intialization 13 | 14 | ### One Way Binding 15 | 16 | Import 17 | 18 | ```html 19 | import '/your-redactor-dist-path/redactor.min.js'; 20 | import './vue-redactor.js'; 21 | ``` 22 | 23 | Component 24 | 25 | ```html 26 |