File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -693,7 +693,7 @@ class xeditor {
693693 * 写入编辑器
694694 * @param value 传入text
695695 */
696- push ( value : string ) {
696+ push ( value : string , unwrite = false ) {
697697 this . text . value = value ;
698698 lineNum ( ) ;
699699 setTextAreaHeight ( ) ;
@@ -702,10 +702,8 @@ class xeditor {
702702 exitFind ( ) ;
703703 }
704704
705- if ( editingOnOther ) {
706- editingOnOther = false ;
705+ if ( ! unwrite ) {
707706 writeEditOnOther ( ) ;
708- editingOnOther = true ;
709707 }
710708
711709 if ( isCheck ) runSpellcheck ( ) ;
@@ -1969,7 +1967,7 @@ function editOnOther() {
19691967 fileWatcher = fs . watch ( tmpTextPath , ( ) => {
19701968 fs . readFile ( tmpTextPath , "utf8" , ( e , data ) => {
19711969 if ( e ) console . log ( e ) ;
1972- editor . push ( data ) ;
1970+ editor . push ( data , true ) ;
19731971 } ) ;
19741972 } ) ;
19751973 textOut . attr ( { title : "正在外部编辑中,双击退出" } ) ;
@@ -1992,6 +1990,7 @@ function editOnOther() {
19921990}
19931991
19941992function writeEditOnOther ( ) {
1993+ if ( ! editingOnOther ) return ;
19951994 const data = Buffer . from ( editor . get ( ) ) ;
19961995 fs . writeFile ( tmpTextPath , data , ( ) => { } ) ;
19971996}
You can’t perform that action at this time.
0 commit comments