Skip to content

MaxWithU/awesome-vue-tinymce

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

awesome-vue-tinymce

GitHub npm

A small editor from vue with tinyMCE

Without tinyMCE module, without css, make it easier & flexible

Install

 npm i -s tinymce awesome-vue-tinymce

Usage

quick start

<template>
    <Editor
        v-model="value"
        id="editor"
    />
<template>
<script>
    import 'tinymce/themes/modern/theme';
    import 'tinymce/skins/ligshtgray/skin.min.css';
    import 'tinymce/skins/lightgray/content.min.css';
    import AwesomeVueTinymce from 'awesome-vue-tinymce';

    export default {
        components: {
            Editor: AwesomeVueTinymce
        },
        data () {
            return {
                value: '<p>Your Text</p>'
            }
        }
    }
</script>

async value

<template>
    <awesome-vue-tinymce
      id="editor"
      v-model ="value"
      ref="editor"
      @on-ready="ready = true"
    />
</template>
<script>
    export default {
        methods: {
            setValue (value) {
                this.$refs.editor.instance.forEach((item) => { 
                    item.setContent(value)
                })
            }
        }
    }
</script>

skin

If you would like to create your own skin, Make your skin here ,then

<template>
    <Editor
        v-model="value"
        id="editor"
    />
<template>
<script>
    import 'tinymce/themes/modern/theme';
-   import 'tinymce/skins/lightgray/skin.min.css';
-   import 'tinymce/skins/lightgray/content.min.css';
    import './custom/skin.min.css';
    import './custom/content.min.css';
    import AwesomeVueTinymce from 'awesome-vue-tinymce';

    export default {
        components: {
            Editor: AwesomeVueTinymce
        },
        data () {
            return {
                value: '<p>Your Text</p>'
            }
        }
    }
</script>

i18N

Get language from TinyMCE language

then

<template>
    <Editor
        v-model="value"
        id="editor"
        :config="{
            language: 'zh_CN'
        }"
    />
<template>
<script>
    import 'tinymce/themes/modern/theme';
    import 'tinymce/skins/lightgray/skin.min.css';
    import 'tinymce/skins/lightgray/content.min.css';
    import AwesomeVueTinymce from 'awesome-vue-tinymce';
    import './langs/zh_CN';  // example

    export default {
        components: {
            Editor: AwesomeVueTinymce
        },
        data () {
            return {
                value: '<p>Your Text</p>'
            }
        }
    }
</script>

upload picture

License

MIT © maxwithu [email protected]

About

A WYSIWYG editor for vue

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published