Skip to content

Commit 7fe0ac3

Browse files
committed
Update
1 parent d9908c5 commit 7fe0ac3

File tree

3 files changed

+71
-42
lines changed

3 files changed

+71
-42
lines changed

dist/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/App.vue

Lines changed: 61 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,67 @@
11
<template>
2-
<div id="app">
3-
<div class="container grid-960">
4-
<h1>Vue2Editor 2.0 (In Development)</h1>
5-
<!-- <vue-editor
2+
<div id="app">
3+
<div class="container grid-960">
4+
<h1>Vue2Editor 2.0 (In Development)</h1>
5+
<!-- <vue-editor
66
v-model="content"
77
:editor-toolbar="customToolbar">
88
</vue-editor> -->
9-
<!-- <button class="btn btn-primary" @click="saveContent(content)">Save</button> -->
10-
<button class="btn btn-primary" @click="setEditor">Set Editor</button>
11-
<div class="containers">
12-
<div class="editorWrapper column col-6 col-sm-12">
13-
<vue-editor v-model="editorContent"></vue-editor>
14-
<button class="btn btn-primary" @click="saveContent(editorContent)">Save</button>
15-
</div>
16-
<div class="column col-6 col-sm-12 preview" v-if="showPreview" v-html="editorContent"></div>
9+
<!-- <button class="btn btn-primary" @click="saveContent(content)">Save</button> -->
10+
<button class="btn btn-primary" @click="setEditor">Set Editor</button>
11+
<button class="btn btn-primary" @click="toggleDisabled">Toggle Disabled</button>
12+
<div class="columns">
13+
<div class="editorWrapper column col-6 col-sm-12">
14+
<vue-editor :disabled="editorIsDisabled" v-model="editorContent"></vue-editor>
15+
<button class="btn btn-primary" @click="saveContent(editorContent)">Save</button>
1716
</div>
17+
<div id="preview" class="column col-6 col-sm-12" v-if="showPreview" v-html="editorContent"></div>
1818
</div>
1919
</div>
20+
</div>
2021
</template>
2122

2223
<script>
24+
import {
25+
VueEditor
26+
} from '../src/index.js'
2327
24-
import {VueEditor} from '../src/index.js'
28+
export default {
29+
components: {
30+
VueEditor,
31+
},
32+
data() {
33+
return {
34+
editorContent: '<h1>Starting Content</h1>',
35+
showPreview: true,
36+
content: '<h1>Html For Editor</h1>',
37+
editorIsDisabled: false,
38+
customToolbar: [
39+
['bold', 'italic', 'underline'],
40+
[{
41+
'list': 'ordered'
42+
}, {
43+
'list': 'bullet'
44+
}],
45+
['image', 'code-block']
46+
]
47+
}
48+
},
2549
26-
export default {
27-
components: {
28-
VueEditor,
29-
},
30-
data() {
31-
return {
32-
editorContent: '<h1>Starting Content</h1>',
33-
showPreview: true,
34-
content: '<h1>Html For Editor</h1>',
35-
customToolbar: [
36-
['bold', 'italic', 'underline'],
37-
[{ 'list': 'ordered'}, { 'list': 'bullet' }],
38-
['image', 'code-block']
39-
]
40-
}
50+
methods: {
51+
setEditor() {
52+
this.editorContent = 'Set programatically!'
4153
},
4254
43-
methods: {
44-
setEditor() {
45-
this.editorContent = 'Set programatically!'
46-
},
55+
saveContent(content) {
56+
console.log(content);
57+
// console.log(this.editorContent);
58+
},
4759
48-
saveContent(content) {
49-
console.log(content);
50-
// console.log(this.editorContent);
51-
}
60+
toggleDisabled() {
61+
this.editorIsDisabled = !this.editorIsDisabled
5262
}
5363
}
64+
}
5465
</script>
5566

5667
<style>
@@ -64,9 +75,18 @@
6475
position: relative;
6576
z-index: 99999;
6677
}
67-
.preview {
68-
flex-basis: 50%;
69-
background: #f9f9f9;
70-
padding: .5em 3em;
71-
}*/
78+
*/
79+
80+
#preview {
81+
background: #f6f6f6;
82+
border-left: 3px solid gray;
83+
padding: 2em;
84+
margin-left: 1em;
85+
}
86+
@media (min-width: 601px) {
87+
#preview {
88+
width: 47%;
89+
}
90+
}
91+
7292
</style>

src/VueEditor.vue

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ export default {
3030
props: {
3131
value: String,
3232
placeholder: String,
33+
disabled: {
34+
type: Boolean,
35+
default () {
36+
return false
37+
}
38+
},
3339
editorToolbar: Array,
3440
},
3541
@@ -51,6 +57,9 @@ export default {
5157
if (val != this.editor.innerHTML && !this.quill.hasFocus()) {
5258
this.editor.innerHTML = val
5359
}
60+
},
61+
disabled(status) {
62+
this.quill.enable(status);
5463
}
5564
},
5665

0 commit comments

Comments
 (0)