Skip to content

Commit 94a776e

Browse files
committed
Fix bugs
1 parent 2bf8b68 commit 94a776e

File tree

5 files changed

+14
-7
lines changed

5 files changed

+14
-7
lines changed

src/components/Dialog/Dialog.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
</div>
3737
</div>
3838
</form>
39-
4039
</div>
4140
</div>
4241
</div>

src/components/ToolBarBtns/btn-code.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ export default {
22
name: 'img',
33
icon: 'fa-code',
44
title: '插入代码',
5-
action: {
6-
request: {
5+
action () {
6+
const selection = this.editor.getSelection()
7+
const request = {
78
title: '插入代码',
89
type: 'form',
910
body: [
@@ -55,12 +56,17 @@ export default {
5556
},
5657
{
5758
name: 'code',
58-
type: 'dialog-codemirror'
59+
type: 'dialog-codemirror',
60+
default: selection
5961
}
6062
],
6163
callback: (data) => {
62-
return '```' + data.lang + '\n' + data.code + '\n' + '```\n';
64+
this.editor.replaceSelection('```' + data.lang + '\n' +
65+
data.code + '\n' +
66+
'```\n')
67+
this.editor.focus()
6368
}
6469
}
70+
this.requestData(request)
6571
}
6672
}

src/components/ToolBarBtns/btn-img.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export default {
55
action: {
66
request: {
77
title: '插入图片',
8+
type: 'form',
89
body: [
910
{
1011
name: 'address',

src/mixins/ToolbarMixin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ export default {
22
methods: {
33
toolbarAction (btn) {
44
if (typeof btn.action === 'function') {
5-
btn.action.callback(this)
5+
btn.action.call(this)
66
} else {
77
this.toolbarHandleActionLegacy(btn.action)
88
}

vue.config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ module.exports = {
1717
libraryExport: 'default'
1818
}
1919
},
20-
transpileDependencies: [],
20+
transpileDependencies: [
21+
],
2122
productionSourceMap: false
2223
}

0 commit comments

Comments
 (0)