jodit-vue
Version:
Vue wrapper for Jodit Editor
2 lines (1 loc) • 2.66 kB
JavaScript
;function _interopDefault(t){return t&&"object"==typeof t&&"default"in t?t.default:t}Object.defineProperty(exports,"__esModule",{value:!0});var Jodit=_interopDefault(require("jodit")),script={name:"JoditVue",props:{value:{type:String,required:!0},buttons:{type:Array,default:null},extraButtons:{type:Array,default:null},config:{type:Object,default:function(){return{}}}},data:function(){return{editor:null}},computed:{editorConfig:function(){var t=Object.assign({},this.config);return this.buttons&&(t.buttons=this.buttons,t.buttonsMD=this.buttons,t.buttonsSM=this.buttons,t.buttonsXS=this.buttons),this.extraButtons&&(t.extraButtons=this.extraButtons),t}},watch:{value:function(t){this.editor.value!==t&&(this.editor.value=t)}},mounted:function(){var t=this;this.editor=new Jodit(this.$el,this.editorConfig),this.editor.value=this.value,this.editor.events.on("change",(function(e){return t.$emit("input",e)}))},beforeDestroy:function(){this.editor.destruct()}};function normalizeComponent(t,e,n,i,o,r,_,s,u,l){"boolean"!=typeof _&&(u=s,s=_,_=!1);var a,d="function"==typeof n?n.options:n;if(t&&t.render&&(d.render=t.render,d.staticRenderFns=t.staticRenderFns,d._compiled=!0,o&&(d.functional=!0)),i&&(d._scopeId=i),r?(a=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),e&&e.call(this,u(t)),t&&t._registeredComponents&&t._registeredComponents.add(r)},d._ssrRegister=a):e&&(a=_?function(){e.call(this,l(this.$root.$options.shadowRoot))}:function(t){e.call(this,s(t))}),a)if(d.functional){var c=d.render;d.render=function(t,e){return a.call(e),c(t,e)}}else{var f=d.beforeCreate;d.beforeCreate=f?[].concat(f,a):[a]}return n}var normalizeComponent_1=normalizeComponent,__vue_script__=script,__vue_render__=function(){var t=this.$createElement;return(this._self._c||t)("div")},__vue_staticRenderFns__=[];__vue_render__._withStripped=!0;var __vue_inject_styles__=void 0,__vue_scope_id__=void 0,__vue_module_identifier__=void 0,__vue_is_functional_template__=!1,JoditVue=normalizeComponent_1({render:__vue_render__,staticRenderFns:__vue_staticRenderFns__},__vue_inject_styles__,__vue_script__,__vue_scope_id__,__vue_is_functional_template__,__vue_module_identifier__,void 0,void 0);function install(t){install.installed||(install.installed=!0,t.component("JoditVue",JoditVue))}var plugin={install:install},GlobalVue=null;"undefined"!=typeof window?GlobalVue=window.Vue:"undefined"!=typeof global&&(GlobalVue=global.Vue),GlobalVue&&GlobalVue.use(plugin),exports.Jodit=Jodit,exports.default=JoditVue,exports.install=install;