Skip to content
This repository was archived by the owner on Apr 6, 2020. It is now read-only.

Commit 3bc692e

Browse files
author
Sohee Lee
committed
refactor: tabsize 4 to 2
1 parent 00bb7b3 commit 3bc692e

File tree

8 files changed

+244
-244
lines changed

8 files changed

+244
-244
lines changed

package-lock.json

Lines changed: 49 additions & 49 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"babel-eslint": "^9.0.0",
2727
"babel-loader": "^8.0.2",
2828
"eslint": "^5.5.0",
29-
"eslint-config-tui": "^1.0.3",
29+
"eslint-config-tui": "^2.1.0",
3030
"eslint-loader": "^2.1.0",
3131
"eslint-plugin-vue": "^4.7.1",
3232
"vue": "^2.5.17",

src/Editor.vue

Lines changed: 109 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -1,127 +1,127 @@
11
<template>
2-
<div ref="tuiEditor"></div>
2+
<div ref="tuiEditor"></div>
33
</template>
44
<script>
5-
import Editor from 'tui-editor';
5+
import Editor from "tui-editor";
66
7-
import editorEvents from './editorEvents';
8-
import editorDefaultOptions from './editorDefaultOptions';
9-
import valueUpdateMethod from './valueUpdateMethod';
7+
import editorEvents from "./editorEvents";
8+
import editorDefaultOptions from "./editorDefaultOptions";
9+
import valueUpdateMethod from "./valueUpdateMethod";
1010
1111
export default {
12-
name: 'TuiEditor',
13-
props: {
14-
previewStyle: {
15-
type: String,
16-
default: 'tab'
17-
},
18-
height: {
19-
type: String,
20-
default: '300px'
21-
},
22-
value: {
23-
type: String,
24-
default: ''
25-
},
26-
mode: {
27-
type: String,
28-
default: 'markdown'
29-
},
30-
options: {
31-
type: Object,
32-
default() {
33-
return editorDefaultOptions;
34-
}
35-
},
36-
html: {
37-
type: String
38-
},
39-
visible: {
40-
type: Boolean,
41-
default: true
42-
}
12+
name: "TuiEditor",
13+
props: {
14+
previewStyle: {
15+
type: String,
16+
default: "tab"
4317
},
44-
data() {
45-
return {
46-
editor: null
47-
};
18+
height: {
19+
type: String,
20+
default: "300px"
4821
},
49-
computed: {
50-
editorOptions() {
51-
const options = Object.assign({}, editorDefaultOptions, this.options);
52-
options.initialValue = this.value;
53-
options.initialEditType = this.mode;
54-
options.height = this.height;
55-
options.previewStyle = this.previewStyle;
56-
57-
return options;
58-
}
22+
value: {
23+
type: String,
24+
default: ""
5925
},
60-
watch: {
61-
previewStyle(newValue) {
62-
this.editor.changePreviewStyle(newValue);
63-
},
64-
value(newValue, preValue) {
65-
if (newValue !== preValue && newValue !== this.editor.getValue()) {
66-
this.editor.setValue(newValue);
67-
}
68-
},
69-
height(newValue) {
70-
this.editor.height(newValue);
71-
},
72-
mode(newValue) {
73-
this.editor.changeMode(newValue);
74-
},
75-
html(newValue) {
76-
this.editor.setHtml(newValue);
77-
this.$emit('input', this.editor.getValue());
78-
},
79-
visible(newValue) {
80-
if (newValue) {
81-
this.editor.show();
82-
} else {
83-
this.editor.hide();
84-
}
85-
}
26+
mode: {
27+
type: String,
28+
default: "markdown"
8629
},
87-
mounted() {
88-
const eventOption = {};
89-
editorEvents.forEach(event => {
90-
eventOption[event] = (...args) => {
91-
this.$emit(event, ...args);
92-
};
93-
});
94-
95-
const options = Object.assign(this.editorOptions, {
96-
el: this.$refs.tuiEditor,
97-
events: eventOption
98-
});
30+
options: {
31+
type: Object,
32+
default() {
33+
return editorDefaultOptions;
34+
}
35+
},
36+
html: {
37+
type: String
38+
},
39+
visible: {
40+
type: Boolean,
41+
default: true
42+
}
43+
},
44+
data() {
45+
return {
46+
editor: null
47+
};
48+
},
49+
computed: {
50+
editorOptions() {
51+
const options = Object.assign({}, editorDefaultOptions, this.options);
52+
options.initialValue = this.value;
53+
options.initialEditType = this.mode;
54+
options.height = this.height;
55+
options.previewStyle = this.previewStyle;
9956
100-
this.editor = new Editor(options);
101-
if (this.$listeners.input) {
102-
this.editor.on('change', () => {
103-
this.$emit('input', this.editor.getValue());
104-
});
105-
}
57+
return options;
58+
}
59+
},
60+
watch: {
61+
previewStyle(newValue) {
62+
this.editor.changePreviewStyle(newValue);
63+
},
64+
value(newValue, preValue) {
65+
if (newValue !== preValue && newValue !== this.editor.getValue()) {
66+
this.editor.setValue(newValue);
67+
}
68+
},
69+
height(newValue) {
70+
this.editor.height(newValue);
71+
},
72+
mode(newValue) {
73+
this.editor.changeMode(newValue);
10674
},
107-
destroyed() {
108-
editorEvents.forEach(event => {
109-
this.editor.off(event);
110-
});
111-
this.editor.remove();
75+
html(newValue) {
76+
this.editor.setHtml(newValue);
77+
this.$emit("input", this.editor.getValue());
11278
},
113-
methods: {
114-
invoke(methodName, ...args) {
115-
let result = null;
116-
if (this.editor[methodName]) {
117-
result = this.editor[methodName](...args);
118-
if (valueUpdateMethod.indexOf(methodName) > -1) {
119-
this.$emit('input', this.editor.getValue());
120-
}
121-
}
79+
visible(newValue) {
80+
if (newValue) {
81+
this.editor.show();
82+
} else {
83+
this.editor.hide();
84+
}
85+
}
86+
},
87+
mounted() {
88+
const eventOption = {};
89+
editorEvents.forEach(event => {
90+
eventOption[event] = (...args) => {
91+
this.$emit(event, ...args);
92+
};
93+
});
94+
95+
const options = Object.assign(this.editorOptions, {
96+
el: this.$refs.tuiEditor,
97+
events: eventOption
98+
});
12299
123-
return result;
100+
this.editor = new Editor(options);
101+
if (this.$listeners.input) {
102+
this.editor.on("change", () => {
103+
this.$emit("input", this.editor.getValue());
104+
});
105+
}
106+
},
107+
destroyed() {
108+
editorEvents.forEach(event => {
109+
this.editor.off(event);
110+
});
111+
this.editor.remove();
112+
},
113+
methods: {
114+
invoke(methodName, ...args) {
115+
let result = null;
116+
if (this.editor[methodName]) {
117+
result = this.editor[methodName](...args);
118+
if (valueUpdateMethod.indexOf(methodName) > -1) {
119+
this.$emit("input", this.editor.getValue());
124120
}
121+
}
122+
123+
return result;
125124
}
125+
}
126126
};
127127
</script>

src/Viewer.vue

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,55 @@
11
<template>
2-
<div ref="tuiEditorViewer"></div>
2+
<div ref="tuiEditorViewer"></div>
33
</template>
44
<script>
5-
import Viewer from 'tui-editor/dist/tui-editor-Viewer';
5+
import Viewer from "tui-editor/dist/tui-editor-Viewer";
66
7-
import editorEvents from './editorEvents';
7+
import editorEvents from "./editorEvents";
88
99
export default {
10-
name: 'TuiEditorViewer',
11-
props: {
12-
height: {
13-
type: String,
14-
default: '300px'
15-
},
16-
value: {
17-
type: String,
18-
default: ''
19-
}
10+
name: "TuiEditorViewer",
11+
props: {
12+
height: {
13+
type: String,
14+
default: "300px"
2015
},
21-
data() {
22-
return {
23-
editor: null
24-
};
25-
},
26-
watch: {
27-
value(val, preVal) {
28-
if (val !== preVal) {
29-
this.editor.setValue(val);
30-
}
31-
}
32-
},
33-
mounted() {
34-
const eventOption = {};
35-
editorEvents.forEach(event => {
36-
eventOption[event] = (...args) => {
37-
this.$emit(event, ...args);
38-
};
39-
});
40-
41-
this.editor = new Viewer({
42-
el: this.$refs.tuiEditorViewer,
43-
events: eventOption,
44-
initialValue: this.value,
45-
height: this.height
46-
});
47-
},
48-
destroyed() {
49-
editorEvents.forEach(event => {
50-
this.editor.off(event);
51-
});
52-
this.editor.remove();
16+
value: {
17+
type: String,
18+
default: ""
19+
}
20+
},
21+
data() {
22+
return {
23+
editor: null
24+
};
25+
},
26+
watch: {
27+
value(val, preVal) {
28+
if (val !== preVal) {
29+
this.editor.setValue(val);
30+
}
5331
}
32+
},
33+
mounted() {
34+
const eventOption = {};
35+
editorEvents.forEach(event => {
36+
eventOption[event] = (...args) => {
37+
this.$emit(event, ...args);
38+
};
39+
});
40+
41+
this.editor = new Viewer({
42+
el: this.$refs.tuiEditorViewer,
43+
events: eventOption,
44+
initialValue: this.value,
45+
height: this.height
46+
});
47+
},
48+
destroyed() {
49+
editorEvents.forEach(event => {
50+
this.editor.off(event);
51+
});
52+
this.editor.remove();
53+
}
5454
};
5555
</script>

0 commit comments

Comments
 (0)