vue-mce . VueJS component for TinyMCE
VueJS component for TinyMCE
<script />
include:Include VueMce after vue and tinymce. VueMce will be registered as a global component.
<script src="link/to/tinymce"></script>
<script src="link/to/vue"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/vue-mce.web.js"></script>
npm install vue-mce --save
yarn add vue-mce
import Vue from 'vue';
import VueMce from 'vue-mce';
Vue.use(VueMce);
It is possible to import only component to have possibility register it locally:
import { component } from 'vue-mce';
const MyComponent = {
components: {
'vue-mce': component,
},
};
You don't need to do this when using global script tags.
By default VueMce requires no props, you can simply do this:
<whatever>
<vue-mce />
</whatever>
html name
attribute. Useful for non-ajax form submitting
You can pass to VueMce component any valid tinymce config that you want to use:
<template>
<vue-mce :config="config" />
</template>
new Vue({
data: () => ({
config: {
theme: 'modern',
fontsize_formats: "8px 10px 12px 14px 16px 18px 20px 22px 24px 26px 39px 34px 38px 42px 48px",
plugins: 'print preview fullpage powerpaste searchreplace autolink',
toolbar1: 'formatselect fontsizeselect | bold italic strikethrough forecolor backcolor link',
},
}),
});
Make sure that you don't pass to config selector
field because it have priority over the target
field which VueMce uses to mount component
You can pass the value
prop to VueMce component:
<template>
<vue-mce :value="myValue" />
</template>
new Vue({
data: () => ({
myValue: 'Hello World!',
}),
});
You can use the v-model
directive to create two-way data-binding.
<template>
<vue-mce v-model="myValue" />
</template>
To set editor content, you can simply set ref to this component and call this.$refs['YOUR_REF'].setContent(yourContent)
<template>
<vue-mce ref="editor" />
</template>
new Vue({
methods: {
getData () {
API.get()
.then((res) => {
this.$refs['YOUR_REF'].setContent(res.content);
});
},
},
created () {
this.getData();
},
});
VueMce provides 5 types of events: init, error, input, change, destroy
<template>
<vue-mce
@init="handleInit"
@error="handleError"
@input="handleInput"
@change="handleChange"
@destroy="handleDestroy"
/>
</template>
new Vue({
methods: {
handleInit (editor) {
/* This handler fires when tinymce editor is successfully initialized.
Receives tinymce editor instance as argument
You can save the editor instance to variable and
call editor.setContent(yourContent) any time you want */
},
handleError (err) {
/* Fires when an error occurred. Receives error object */
},
handleInput (value) {
/* Fires whenever editor content changes. Receives generated HTML */
},
handleChange (value) {
/* Fires only when editor emits focusout event. Receives generated HTML */
},
handleDestroy (editor) {
/* Fires before VueMce component destroys. Receives tinymce editor instance */
},
},
});
If you have any troubles, questions or proposals you can create the issue
Author: Eazymov
Demo: https://codepen.io/Eazymov/full/MEzGYv/
Source Code: https://github.com/Eazymov/vue-mce
In this article, we are going to list out the most popular websites using Vue JS as their frontend framework. Vue JS is one of those elite progressive JavaScript frameworks that has huge demand in the web development industry. Many popular websites are developed using Vue in their frontend development because of its imperative features.
Vue Native is a framework to build cross platform native mobile apps using JavaScript. It is a wrapper around the APIs of React Native. So, with Vue Native, you can do everything that you can do with React Native. With Vue Native, you get
In this article, you’ll learn how to build a Vue custom select component that can be easily be styled using your own CSS. In fact, it’s the same component that we use in production on Qvault, and you can see it in action on the playground.
There are plenty of libraries out there that will have you up and running with a good tooltip solution in minutes. However, if you are like me, you are sick and tired of giant dependency trees that have the distinct possibility of breaking at any time.
Vue-ShortKey - The ultimate shortcut plugin to improve the UX .Vue-ShortKey - plugin for VueJS 2.x accepts shortcuts globaly and in a single listener.