Skip to content

Commit 64ad427

Browse files
committed
W on CMS edit page
1 parent 52eeee9 commit 64ad427

26 files changed

+1597
-493
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,4 @@
2525
* Cookies : [Vue-cookie](https://github.com/alfhen/vue-cookie)
2626
* HighCharts : [Vue-HighCharts](https://github.com/weizhenye/vue-highcharts)
2727
* Vue Analytics : [Vue-ua](https://github.com/ScreamZ/vue-analytics)
28+
* Date picker : [Vue-Flatpickr](https://github.com/jrainlau/vue-flatpickr)

package.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,17 @@
2323
"axios": "^0.15.3",
2424
"babel-core": "^6.24.0",
2525
"babel-loader": "^6.0.0",
26+
"babel-plugin-transform-runtime": "^6.23.0",
2627
"babel-polyfill": "^6.23.0",
2728
"babel-preset-es2015": "^6.0.0",
29+
"babel-preset-stage-2": "^6.22.0",
2830
"cross-env": "^3.2.3",
2931
"css-loader": "^0.25.0",
32+
"exports-loader": "^0.6.4",
33+
"expose-loader": "^0.7.3",
3034
"file-loader": "^0.9.0",
3135
"highcharts": "^5",
36+
"imports-loader": "^0.7.1",
3237
"jasmine-core": "^2.5.2",
3338
"json-loader": "^0.5.4",
3439
"karma": "^1.5.0",
@@ -45,14 +50,17 @@
4550
"phantomjs-prebuilt": "^2.1.14",
4651
"postcss-loader": "^1.3.3",
4752
"style-loader": "^0.13.1",
53+
"tinymce-vue-2": "0.0.2",
4854
"vue-axios": "^1.2.2",
4955
"vue-cookie": "^1.1.3",
56+
"vue-flatpickr": "^2.3.0",
5057
"vue-head": "^2.0.10",
5158
"vue-highcharts": "0.0.9",
5259
"vue-loader": "^10.0.0",
5360
"vue-router": "^2.2.1",
5461
"vue-template-compiler": "^2.2",
5562
"vue-ua": "^1.3.0",
63+
"vue2-dropzone": "^2.2.4",
5664
"vuelidate": "^0.4"
5765
}
5866
}

src/js/components/editor.vue

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<template>
2+
<div>
3+
<textarea rows="30" :id="tinyId">{{editorValue}}</textarea>
4+
</div>
5+
</template>
6+
7+
<script>
8+
import Vue from 'vue'
9+
import tinymce from 'tinymce'
10+
import theme from 'tinymce/themes/modern/index.js'
11+
12+
13+
export default {
14+
name: 'tinymce',
15+
data() {
16+
return {
17+
18+
}
19+
},
20+
props: {
21+
editorValue: {
22+
required : true
23+
},
24+
tinyId: {
25+
required : true,
26+
validator: function (value) {
27+
return !_.isEmpty(value)
28+
}
29+
}
30+
},
31+
watch: {
32+
editorValue(){
33+
this.$emit('editorValueUpdate', this.editorValue)
34+
}
35+
},
36+
created () {
37+
38+
var vm = this
39+
40+
tinymce.init({
41+
selector: '#' + this.tinyId,
42+
themes:"modern",
43+
44+
setup: function(editor) {
45+
46+
editor.on('blur', function() {
47+
var newContent = editor.getContent()
48+
49+
vm.$emit('editorValueUpdate', newContent)
50+
})
51+
52+
}
53+
})
54+
55+
}
56+
}
57+
58+
</script>

src/js/components/filters.vue

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,13 @@
6464
Vue.filter('upper', (str) => {
6565
return _.upperCase(str)
6666
})
67+
68+
/*
69+
Use case : {{ "hElLO" | upper }} => "hello"
70+
*/
71+
Vue.filter('lower', (str) => {
72+
return _.lowerCase(str)
73+
})
6774
/*
6875
Use case : {{ "hello" | capitalize }} => "Hello"
6976
*/
@@ -76,9 +83,21 @@
7683
Vue.filter('truncate', (str, length = 30) => {
7784
return _.truncate(str, {'length':length})
7885
})
79-
86+
/*
87+
Use case : {{ "hello world !" | sanitaize }} => "hello-world"
88+
*/
8089
Vue.filter('sanitize',(str) => {
81-
return str.toLowerCase().replace(/[^\w ]+/g,'').replace(/ +/g,'-')
90+
91+
var cleanStr = str.toLowerCase().replace(/[^\w ]+/g,'').replace(/ +/g,'-')
92+
93+
if(_.endsWith(cleanStr, '-'))
94+
cleanStr = cleanStr.slice(0,-1)
95+
96+
if (_.startsWith(cleanStr, '-'))
97+
cleanStr = cleanStr.slice(1)
98+
99+
return cleanStr
100+
82101
})
83102
84103

0 commit comments

Comments
 (0)