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

Commit fddb6b1

Browse files
ChangJoo-Parksohee-lee7
authored andcommitted
refactor: modulize editor and viewer option.
For remove duplicated editorEvents
1 parent c6552e8 commit fddb6b1

File tree

5 files changed

+48
-53
lines changed

5 files changed

+48
-53
lines changed

src/Editor.vue

Lines changed: 3 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -4,52 +4,9 @@
44
<script>
55
import Editor from 'tui-editor';
66
7-
const editorEvents = [
8-
'load',
9-
'change',
10-
'stateChange',
11-
'focus',
12-
'blur'
13-
];
14-
15-
const editorDefaultOptions = {
16-
minHeight: '200px',
17-
language: 'en_US',
18-
useCommandShortcut: true,
19-
useDefaultHTMLSanitizer: true,
20-
usageStatistics: true,
21-
hideModeSwitch: false,
22-
toolbarItems: [
23-
'heading',
24-
'bold',
25-
'italic',
26-
'strike',
27-
'divider',
28-
'hr',
29-
'quote',
30-
'divider',
31-
'ul',
32-
'ol',
33-
'task',
34-
'indent',
35-
'outdent',
36-
'divider',
37-
'table',
38-
'image',
39-
'link',
40-
'divider',
41-
'code',
42-
'codeblock'
43-
]
44-
};
45-
46-
const valueUpdateMethod = [
47-
'insertText',
48-
'setValue',
49-
'setMarkdown',
50-
'setHtml',
51-
'reset'
52-
];
7+
import editorEvents from './editorEvents';
8+
import editorDefaultOptions from './editorDefaultOptions';
9+
import valueUpdateMethod from './valueUpdateMethod';
5310
5411
export default {
5512
name: 'TuiEditor',

src/Viewer.vue

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,7 @@
44
<script>
55
import Viewer from 'tui-editor/dist/tui-editor-Viewer';
66
7-
const editorEvents = [
8-
'load',
9-
'change',
10-
'stateChange',
11-
'focus',
12-
'blur'
13-
];
7+
import editorEvents from './editorEvents';
148
159
export default {
1610
name: 'TuiEditorViewer',

src/editorDefaultOptions.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
export default {
2+
minHeight: '200px',
3+
language: 'en_US',
4+
useCommandShortcut: true,
5+
useDefaultHTMLSanitizer: true,
6+
usageStatistics: true,
7+
hideModeSwitch: false,
8+
toolbarItems: [
9+
'heading',
10+
'bold',
11+
'italic',
12+
'strike',
13+
'divider',
14+
'hr',
15+
'quote',
16+
'divider',
17+
'ul',
18+
'ol',
19+
'task',
20+
'indent',
21+
'outdent',
22+
'divider',
23+
'table',
24+
'image',
25+
'link',
26+
'divider',
27+
'code',
28+
'codeblock'
29+
]
30+
};

src/editorEvents.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export default [
2+
'load',
3+
'change',
4+
'stateChange',
5+
'focus',
6+
'blur'
7+
];

src/valueUpdatedMethod.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export default [
2+
'insertText',
3+
'setValue',
4+
'setMarkdown',
5+
'setHtml',
6+
'reset'
7+
];

0 commit comments

Comments
 (0)