File tree Expand file tree Collapse file tree 5 files changed +14
-7
lines changed Expand file tree Collapse file tree 5 files changed +14
-7
lines changed Original file line number Diff line number Diff line change 3636 </div >
3737 </div >
3838 </form >
39-
4039 </div >
4140 </div >
4241 </div >
Original file line number Diff line number Diff 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}
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ export default {
55 action : {
66 request : {
77 title : '插入图片' ,
8+ type : 'form' ,
89 body : [
910 {
1011 name : 'address' ,
Original file line number Diff line number Diff 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 }
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ module.exports = {
1717 libraryExport : 'default'
1818 }
1919 } ,
20- transpileDependencies : [ ] ,
20+ transpileDependencies : [
21+ ] ,
2122 productionSourceMap : false
2223}
You can’t perform that action at this time.
0 commit comments