Skip to content

Commit c8d67d9

Browse files
author
春秋一语
authored
Merge pull request #27 from Coding/tencent
Tencent
2 parents 18e4038 + 2838c01 commit c8d67d9

File tree

8 files changed

+4362
-1891
lines changed

8 files changed

+4362
-1891
lines changed

app/commands/commandBindings/file.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -300,9 +300,7 @@ const fileCommands = {
300300
const { EditorTabState } = mobxStore
301301
const activeTab = EditorTabState.activeTab
302302
const isMonaco = !config.switchOldEditor
303-
304303
const content = !activeTab ? '' : isMonaco ? activeTab.editorInfo.monacoEditor.getValue() : activeTab.editor.cm.getValue()
305-
306304
if (!activeTab.file) {
307305
const createFile = createFileWithContent(content)
308306
const defaultPath = activeTab._title ? `/${activeTab._title}` : '/untitled'
@@ -465,7 +463,9 @@ const fileCommands = {
465463
} else {
466464
api.createFile(ignorePath, patchTxt)
467465
.then((res) => {
468-
res.msg ? throw new Error(res.msg) : ''
466+
if (res.msg) {
467+
throw new Error(res.msg);
468+
}
469469
})
470470
.then(() => api.writeFile(ignorePath, patchTxt))
471471
.then(() => {

app/components/Editor/state.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,9 @@ class Editor {
201201
if (typeDetect(this.file.name, ['md', 'markdown', 'mdown'])) {
202202
return 'markdownEditor';
203203
}
204+
if (typeDetect(this.file.name, ['html', 'htm'])) {
205+
return 'htmlEditor'
206+
}
204207
if (typeDetect(this.file.name, ['png', 'jpg', 'jpeg', 'gif', 'webp', 'ico', 'bmp'])) {
205208
return 'imageEditor';
206209
}

app/components/MonacoEditor/Editors/HtmlEditor.jsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ class HtmlEditor extends Component {
5353
rightGrow: 50,
5454
showBigSize: false,
5555
showPreview: false,
56-
collapseAuto: false,
5756
previewUniqueId: '1',
5857
isResizing: false,
5958
});

app/components/MonacoEditor/state.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,9 @@ class EditorInfo {
252252
if (typeDetect(this.file.name, ['md', 'markdown', 'mdown'])) {
253253
return 'markdownEditor'
254254
}
255+
if (typeDetect(this.file.name, ['html', 'htm'])) {
256+
return 'htmlEditor'
257+
}
255258
if (typeDetect(this.file.name, ['png', 'jpg', 'jpeg', 'gif', 'webp', 'ico', 'bmp'])) {
256259
return 'imageEditor'
257260
}

0 commit comments

Comments
 (0)