Skip to content

Commit 63c1830

Browse files
committed
Fix Lint
1 parent 86c885a commit 63c1830

File tree

7 files changed

+120
-126
lines changed

7 files changed

+120
-126
lines changed

src/components/InputArea.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ export default {
5858
5959
this.$emit('finish')
6060
},
61-
height: function (newHeight) {
62-
this.editor.setSize('100%', newHeight)
63-
}
61+
height: function (newHeight) {
62+
this.editor.setSize('100%', newHeight)
63+
}
6464
},
6565
data: function () {
6666
return {

src/components/LuoguMarkdownEditor.vue

Lines changed: 76 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -71,88 +71,84 @@
7171
</style>
7272

7373
<script>
74-
import InputArea from './InputArea.vue'
75-
import PreviewArea from './PreviewArea.vue'
76-
import Toolbar from './Toolbar.vue'
77-
import EditorDialog from './Dialog.vue'
74+
import InputArea from './InputArea.vue'
75+
import PreviewArea from './PreviewArea.vue'
76+
import Toolbar from './Toolbar.vue'
77+
import EditorDialog from './Dialog.vue'
7878
79-
import {defaultConfig, getConfig} from './DefaultConfig'
79+
import {defaultConfig, getConfig} from './DefaultConfig'
8080
81-
export default {
82-
name: 'luogu-markdown-editor',
83-
props: {
84-
value: {
85-
type: String
86-
},
87-
config: {
88-
type: Object,
89-
default: function () {
90-
return defaultConfig
91-
}
92-
}
93-
},
94-
data() {
95-
let config = getConfig(this.config)
96-
return {
97-
code: '',
98-
showDialog: false,
99-
dialogRequest: {},
100-
insertCode: null,
101-
editorConfig: config,
102-
editorHeight: config.height
103-
}
104-
},
105-
mounted() {
106-
this.code = this.value
107-
},
108-
components: {
109-
InputArea,
110-
PreviewArea,
111-
Toolbar,
112-
EditorDialog
113-
},
114-
methods: {
115-
updateCode(code) {
116-
this.$emit('input', code)
117-
},
118-
insert(code) {
119-
if (code !== null) {
120-
this.insertCode = code
121-
}
122-
},
123-
closeDialog() {
124-
this.showDialog = false
125-
},
126-
dialogFinish(request) {
127-
this.insert(request.callback(request.data))
128-
this.closeDialog()
129-
},
130-
clickToolbar(request) {
131-
if (this.showDialog) {
132-
return
133-
}
134-
this.dialogRequest = request
135-
this.showDialog = true
136-
},
137-
handleToolbarOperation(operation) {
138-
if (operation === 'hide') {
139-
if (this.config.previewDisplay === 'normal')
140-
this.config.previewDisplay = 'hide'
141-
else
142-
this.config.previewDisplay = 'normal'
143-
}
144-
if (operation === 'fullscreen') {
145-
if(!this.config.fullscreen) {
146-
this.config.fullscreen = true
147-
this.editorHeight = (screen.height - this.$refs.toolbar.$el.clientHeight).toString() + 'px'
148-
console.log(this.editorHeight)
149-
150-
} else {
151-
this.config.fullscreen = false
152-
this.editorHeight = this.editorConfig.height
153-
}
154-
}
155-
}
81+
export default {
82+
name: 'luogu-markdown-editor',
83+
props: {
84+
value: {
85+
type: String
86+
},
87+
config: {
88+
type: Object,
89+
default: function () {
90+
return defaultConfig
91+
}
92+
}
93+
},
94+
data () {
95+
let config = getConfig(this.config)
96+
return {
97+
code: '',
98+
showDialog: false,
99+
dialogRequest: {},
100+
insertCode: null,
101+
editorConfig: config,
102+
editorHeight: config.height
103+
}
104+
},
105+
mounted () {
106+
this.code = this.value
107+
},
108+
components: {
109+
InputArea,
110+
PreviewArea,
111+
Toolbar,
112+
EditorDialog
113+
},
114+
methods: {
115+
updateCode (code) {
116+
this.$emit('input', code)
117+
},
118+
insert (code) {
119+
if (code !== null) {
120+
this.insertCode = code
121+
}
122+
},
123+
closeDialog () {
124+
this.showDialog = false
125+
},
126+
dialogFinish (request) {
127+
this.insert(request.callback(request.data))
128+
this.closeDialog()
129+
},
130+
clickToolbar (request) {
131+
if (this.showDialog) {
132+
return
133+
}
134+
this.dialogRequest = request
135+
this.showDialog = true
136+
},
137+
handleToolbarOperation (operation) {
138+
if (operation === 'hide') {
139+
if (this.config.previewDisplay === 'normal') { this.config.previewDisplay = 'hide' } else { this.config.previewDisplay = 'normal' }
140+
}
141+
if (operation === 'fullscreen') {
142+
if (!this.config.fullscreen) {
143+
this.config.fullscreen = true
144+
this.editorHeight = (screen.height - this.$refs.toolbar.$el.clientHeight).toString() + 'px'
145+
console.log(this.editorHeight)
146+
} else {
147+
this.config.fullscreen = false
148+
this.editorHeight = this.editorConfig.height
156149
}
150+
}
157151
}
152+
}
153+
}
158154
</script>

src/components/Toolbar.vue

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,11 @@ export default {
109109
this.$emit('click', request)
110110
},
111111
handleAction (action) {
112-
if(action.event) {
112+
if (action.event) {
113113
this.$emit('input', action.event)
114-
}
115-
else if (action.insert) {
114+
} else if (action.insert) {
116115
this.insertCode(action.insert)
117-
}
118-
else if (action.request) {
116+
} else if (action.request) {
119117
this.requestData(action.request)
120118
}
121119
}
Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
11
export default {
2-
name: 'img',
3-
icon: 'fa-code',
4-
title: '插入代码',
5-
action: {
6-
request: {
7-
title: '插入代码',
8-
body: [
9-
{
10-
name: 'lang',
11-
title: '语言类型',
12-
type: 'input',
13-
default: ''
14-
},
15-
{
16-
name: 'code',
17-
title: '代码',
18-
type: 'textarea',
19-
default: ''
20-
}
21-
],
22-
callback (data) {
23-
return '```' + data.lang + '\n'
24-
+ data.code + '\n'
25-
+ '```'
26-
}
2+
name: 'img',
3+
icon: 'fa-code',
4+
title: '插入代码',
5+
action: {
6+
request: {
7+
title: '插入代码',
8+
body: [
9+
{
10+
name: 'lang',
11+
title: '语言类型',
12+
type: 'input',
13+
default: ''
14+
},
15+
{
16+
name: 'code',
17+
title: '代码',
18+
type: 'textarea',
19+
default: ''
2720
}
21+
],
22+
callback (data) {
23+
return '```' + data.lang + '\n' +
24+
data.code + '\n' +
25+
'```'
26+
}
2827
}
28+
}
2929
}
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
export default {
2-
name: 'fullscreen',
3-
icon: 'fa-arrows-alt',
4-
title: '全屏',
5-
action: {
6-
event: 'fullscreen'
7-
}
2+
name: 'fullscreen',
3+
icon: 'fa-arrows-alt',
4+
title: '全屏',
5+
action: {
6+
event: 'fullscreen'
7+
}
88
}
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
export default {
2-
name: 'hide',
3-
icon: 'fa-eye',
4-
title: '隐藏',
5-
action: {
6-
event: 'hide'
7-
}
2+
name: 'hide',
3+
icon: 'fa-eye',
4+
title: '隐藏',
5+
action: {
6+
event: 'hide'
7+
}
88
}

src/components/toolbar-button/toolbarBtn.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export let defaultBtns = [
3535
BtnTable,
3636
Divider,
3737
BtnHide,
38-
BtnFullscreen
38+
BtnFullscreen
3939
]
4040

4141
function getDefaultBtnsMap () {

0 commit comments

Comments
 (0)