Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

A simple and powerful package for easy usage of tinymce in Vue.js project.

License

NotificationsYou must be signed in to change notification settings

m3esma/vue-easy-tinymce

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vue-easy-tinymce

GitHub releaseNPM DownloadsGitHub licenseFile SizeGitHub issuesGitHub forksGitHub starsmade_with love

A simple and powerful package for easy usage of tinymce inVue.js project.

Features

  • v-model Support
  • Multiple instance editor support
  • Configurable options
  • Binding initial content (from v-model)

Installation

Run the command below to install this package:

npm install vue-easy-tinymce --save

Or

Download or clone this repository and copydist/vue-easy-tinymce.min.js file to your project.

Or

Use CDN provider:

<scriptsrc="https://cdn.jsdelivr.net/npm/vue-easy-tinymce/dist/vue-easy-tinymce.min.js"></script>

Usage

In the first step, putvue-easy-tinymce in your project.

Node.js Bundler (Webpack, Rollup, Browserify)

window.Vue=require('vue');// npm install vue --save//... etc data or package(s)varVueEasyTinyMCE=require('vue-easy-tinymce');

Browser loading

<scriptsrc="examples/tinymce/tinymce.min.js"></script><!-- TinyMCE core --><!-- Or CDN <script src="https://cdnjs.cloudflare.com/ajax/libs/tinymce/4.7.4/tinymce.min.js"></script> --><scriptsrc="examples/vue/vue.min.js"></script><!-- Vue.js core --><!-- Or CDN <script src="https://cdn.jsdelivr.net/npm/vue"></script> --><scriptsrc="dist/vue-easy-tinymce.min.js"></script><!-- VueEasyTinyMCE module--><!-- Or CDN <script src="https://cdn.jsdelivr.net/npm/vue-easy-tinymce/dist/vue-easy-tinymce.min.js"></script> --><scriptsrc="examples/index.js"></script><!-- Your project js code -->

In the next step, use theVueEasyTinyMCE in vue instance as a component

newVue({// ,...components:{// <tinymce> tag available in parent's template'tinymce':VueEasyTinyMCE},data:{/* Your data and models here */myModel:'<p>initial value</p>',/* Config can be declare here */myPlugins :[],myToolbar1:'',myToolbar2 :'',myOtherOptions :{}}// ,...});

Or

Vue.component('tinymce',VueEasyTinyMCE);newVue({// ...});

Config

The VueEasyTinyMCE configuration can be defined in:

  1. Inside Vue instance in data section.Example:Explained in above.
  2. Inside<script></script> tag in above of component.Example:
<script>varconfigToolbar1='undo redo | bold';</script><tinymce:toolbar1="configToolbar1"></tinymce>
  1. Inside<tinymce></tinymce> By binding value directly.Example:
<tinymce:toolbar1="'undo redo | bold'"></tinymce>
props
PropTypeDefaultRequired
:pluginsArray[ ]No
:toolbar1String' 'No
:toolbar2String' 'No
:otherObject{ }No

Config value example:

varmyPlugins=['advlist autolink lists link image charmap print preview anchor textcolor','searchreplace visualblocks code fullscreen','insertdatetime media table contextmenu paste code directionality template colorpicker textpattern'];varmyToolbar1='undo redo | bold italic strikethrough | forecolor backcolor | template link | bullist numlist | ltr rtl | removeformat';varmyToolbar2='';varmyOtherOptions={height:200,templates:[{title:'Test template 1',content:'Test 1'},{title:'Test template 2',content:'Test 2'}]//,content_css: 'css/tinymce-content.css'//,width:600,//directionality: 'rtl',//theme: 'modern',//menubar: false//, etc...};

Finally, you can easily use the<tinymce></tinymce> in your own view.

<tinymcev-model="myModel":plugins="myPlugins":toolbar1="myToolbar1":toolbar2="myToolbar2":other="myOtherOptions"></tinymce>

Example

At first read theUsage section and then follow below code:

index.js

newVue({el:'#app',data:{/* Your data and models here */myModel:'<p><span>Initial Value</span></p>',/* Config can be declare here */myPlugins :['advlist autolink lists link image charmap print preview anchor textcolor','searchreplace visualblocks code fullscreen','insertdatetime media table contextmenu paste code directionality template colorpicker textpattern'],myToolbar1:'undo redo | bold italic strikethrough | forecolor backcolor | template link | bullist numlist | ltr rtl | removeformat',myToolbar2 :'',myOtherOptions :{height:200,templates:[{title:'Test template 1',content:'Test 1'},{title:'Test template 2',content:'Test 2'}],content_css:'css/tinymce-content.css'//,width:600,//directionality: 'rtl',//theme: 'modern',//menubar: false//, etc...}},components:{'tinymce':VueEasyTinyMCE},methods:{getModelValue:function(){alert(this.myModel);},changeModelValue:function(){this.myModel='<p>Change value programmability</p>';},clearModelValue:function(){this.myModel='';}}});

index.html

<!doctype html><htmllang="en"><head><metacharset="UTF-8"><metaname="viewport"content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"><metahttp-equiv="X-UA-Compatible"content="ie=edge"><title>vue-easy-tinymce</title><linkrel="stylesheet"href="css/style.css"></head><body><divid="app"><imgsrc="logo.png"><tinymcev-model="myModel":plugins="myPlugins":toolbar1="myToolbar1":toolbar2="myToolbar2":other="myOtherOptions"></tinymce><br><button@click="getModelValue()">Get current model value</button><button@click="changeModelValue()">Change model value programmability</button><button@click="clearModelValue()">Clear model value</button><br><br><atarget="_blank"href="https://github.com/m3esma/vue-easy-tinymce">vue-easy-tinymce</a></div><scriptsrc="tinymce/tinymce.min.js"></script><!-- TinyMCE core --><!-- Or CDN <script src="https://cdnjs.cloudflare.com/ajax/libs/tinymce/4.7.4/tinymce.min.js"></script> --><scriptsrc="vue/vue.min.js"></script><!-- Vue.js core --><!-- Or CDN <script src="https://cdn.jsdelivr.net/npm/vue"></script> --><scriptsrc="../dist/vue-easy-tinymce.min.js"></script><!-- VueEasyTinyMCE module--><!-- Or CDN <script src="https://cdn.jsdelivr.net/npm/vue-easy-tinymce/dist/vue-easy-tinymce.min.js"></script> --><scriptsrc="index.js"></script><!-- Your project js code --></body></html>

In the above example, you can use node package manager (npm) instead of scripts. it explained in theUsage section.

Demo

screenshot

Download or clone this respository and openindex.html orindex2.html in examples directory.

Contribute

If you have a feature request, please add it as an issue or make a pull request.

Authors

Mehdi Esmaeili

License

Released under theMIT License.

About

A simple and powerful package for easy usage of tinymce in Vue.js project.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp