UNPKG

jodit-vue

Version:
2 lines (1 loc) 2.01 kB
import t from"jodit";export{default as Jodit}from"jodit";var e=function(t,e,n,o,i,r,s,u,d,a){"boolean"!=typeof s&&(d=u,u=s,s=!1);var l,f="function"==typeof n?n.options:n;if(t&&t.render&&(f.render=t.render,f.staticRenderFns=t.staticRenderFns,f._compiled=!0,i&&(f.functional=!0)),o&&(f._scopeId=o),r?(l=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,d(t)),t&&t._registeredComponents&&t._registeredComponents.add(r)},f._ssrRegister=l):e&&(l=s?function(){e.call(this,a(this.$root.$options.shadowRoot))}:function(t){e.call(this,u(t))}),l)if(f.functional){var c=f.render;f.render=function(t,e){return l.call(e),c(t,e)}}else{var h=f.beforeCreate;f.beforeCreate=h?[].concat(h,l):[l]}return n},n={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 e=this;this.editor=new t(this.$el,this.editorConfig),this.editor.value=this.value,this.editor.events.on("change",(function(t){return e.$emit("input",t)}))},beforeDestroy:function(){this.editor.destruct()}},o=function(){var t=this.$createElement;return(this._self._c||t)("div")};o._withStripped=!0;var i=e({render:o,staticRenderFns:[]},void 0,n,void 0,!1,void 0,void 0,void 0);function r(t){r.installed||(r.installed=!0,t.component("JoditVue",i))}var s={install:r},u=null;"undefined"!=typeof window?u=window.Vue:"undefined"!=typeof global&&(u=global.Vue),u&&u.use(s);export default i;export{r as install};