Skip to content

Commit

Permalink
update to 2.0
Browse files Browse the repository at this point in the history
new building and docs
  • Loading branch information
lpreterite committed Apr 20, 2019
1 parent bcdbd83 commit ee972fb
Show file tree
Hide file tree
Showing 7 changed files with 104 additions and 81 deletions.
74 changes: 36 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
![vue-tinymce](docs/assets/vu-tinymce-logo.png)

# vue-tinymce

[![npm version](https://img.shields.io/npm/v/@packy-tang/vue-tinymce.svg)](https://www.npmjs.com/package/@packy-tang/vue-tinymce)
Expand All @@ -23,39 +25,38 @@ npm install @packy-tang/vue-tinymce

### use

```js
import Vue from 'vue';
import { VueTinymce , TinymceSetting } from '@packy-tang/vue-tinymce';

new Vue({
el: '#app',
data: function(){
return {
content: '<p>html content</p>',
setting: {
...TinymceSetting,
height: 200,
language_url: "langs/zh_CN.js",
block_formats: "Paragraph=p;Heading 1=h1;Heading 2=h2;Heading 3=h3;Heading 4=h4;Heading 5=h5;Heading 6=h6;"
```html
<template>
<script src="//cdn.bootcss.com/tinymce/4.9.4/tinymce.min.js"></script>
<div id="app">
<vue-tinymce
ref="tinymce"
v-model="content"
:setting="setting">
</vue-tinymce>
</div>
</template>
<script>
import Vue from 'vue';
import { default as VueTinymce, TinymceSetting } from '@packy-tang/vue-tinymce';
Vue.use(VueTinymce)
new Vue({
el: '#app',
data: function(){
return {
content: '<p>html content</p>',
setting: {
...TinymceSetting,
height: 200,
language_url: "langs/zh_CN.js",
block_formats: "Paragraph=p;Heading 1=h1;Heading 2=h2;Heading 3=h3;Heading 4=h4;Heading 5=h5;Heading 6=h6;"
}
}
}
}
})

```

### template

```html
<div id="app">
<vue-tinymce
ref="tinymce"
v-model="content"
:setting="setting">
</vue-tinymce>
</div>
<!-- in last -->
<script src="node_modules/tinymce/tinymce.min.js"></script>
})
</script>
```

### Get Editor to do something
Expand All @@ -65,16 +66,13 @@ const bm = this.$refs.tinymce.editor.selection.getBookmark();
console.log(bm);
```

## Run Example

```sh
npm i
npm run dev
```

## Run build

```sh
// install
npm i

npm run build
//or
npm run watch
```
12 changes: 12 additions & 0 deletions docs/Example.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,18 @@ export default {

<vuep template="#customstyle" :style="{height: '600px'}"></vuep>

### Custom files

```sh
- docs/
- assets/
- tinymce/
- skins/
- custom/
- utils/
index.js
```

<script v-pre type="text/x-template" id="customstyle">
<template>
<div>
Expand Down
72 changes: 34 additions & 38 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,39 +25,38 @@ npm install @packy-tang/vue-tinymce

### use

```js
import Vue from 'vue';
import { VueTinymce , TinymceSetting } from '@packy-tang/vue-tinymce';

new Vue({
el: '#app',
data: function(){
return {
content: '<p>html content</p>',
setting: {
...TinymceSetting,
height: 200,
language_url: "langs/zh_CN.js",
block_formats: "Paragraph=p;Heading 1=h1;Heading 2=h2;Heading 3=h3;Heading 4=h4;Heading 5=h5;Heading 6=h6;"
```html
<template>
<script src="//cdn.bootcss.com/tinymce/4.9.4/tinymce.min.js"></script>
<div id="app">
<vue-tinymce
ref="tinymce"
v-model="content"
:setting="setting">
</vue-tinymce>
</div>
</template>
<script>
import Vue from 'vue';
import { default as VueTinymce, TinymceSetting } from '@packy-tang/vue-tinymce';
Vue.use(VueTinymce)
new Vue({
el: '#app',
data: function(){
return {
content: '<p>html content</p>',
setting: {
...TinymceSetting,
height: 200,
language_url: "langs/zh_CN.js",
block_formats: "Paragraph=p;Heading 1=h1;Heading 2=h2;Heading 3=h3;Heading 4=h4;Heading 5=h5;Heading 6=h6;"
}
}
}
}
})

```

### template

```html
<div id="app">
<vue-tinymce
ref="tinymce"
v-model="content"
:setting="setting">
</vue-tinymce>
</div>
<!-- in last -->
<script src="node_modules/tinymce/tinymce.min.js"></script>
})
</script>
```

### Get Editor to do something
Expand All @@ -67,16 +66,13 @@ const bm = this.$refs.tinymce.editor.selection.getBookmark();
console.log(bm);
```

## Run Example

```sh
npm i
npm run dev
```

## Run build

```sh
// install
npm i

npm run build
//or
npm run watch
```
2 changes: 1 addition & 1 deletion docs/main.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Vue from "vue"
import { default as VueTinymce, TinymceSetting } from ".."

Vue.component('VueTinymce', VueTinymce)
Vue.use(VueTinymce)

window.VueTinymce = { TinymceSetting }
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@packy-tang/vue-tinymce",
"version": "0.1.5",
"version": "0.2.0",
"description": "A simple vue-based tinymce component",
"main": "dist/vue-tinymce.cjs.js",
"module": "dist/vue-tinymce.esm.js",
Expand Down
22 changes: 19 additions & 3 deletions src/main.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
import TinymceSetting from './setting'
import component from './vue-tinymce.vue'
export { TinymceSetting }
export default component
import VueTinymce from './vue-tinymce.vue'
export { TinymceSetting, VueTinymce }
class VuePlugin{
constructor(){
const { prefix } = { prefix: "" }
this.prefix = prefix;
}
install(Vue, options={}){
const prefix = options.prefix || this.prefix
const components = {
VueTinymce
}
Object.keys(components).forEach(key => {
const component = components[key];
Vue.component(prefix+component.name, component);
});
}
}
export default new VuePlugin()
1 change: 1 addition & 0 deletions src/vue-tinymce.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const INPUT = 1;
const CHANGED = 2;
export default {
name: "VueTinymce",
props: {
value: {
type: String,
Expand Down

0 comments on commit ee972fb

Please sign in to comment.