Merge branch 'master' of https://github.com/b3log/wide
This commit is contained in:
commit
539c4f279d
|
@ -68,6 +68,7 @@ type Editor struct {
|
||||||
FontSize string
|
FontSize string
|
||||||
LineHeight string
|
LineHeight string
|
||||||
Theme string
|
Theme string
|
||||||
|
TabSize string
|
||||||
}
|
}
|
||||||
|
|
||||||
// Configuration.
|
// Configuration.
|
||||||
|
@ -330,6 +331,10 @@ func upgrade() {
|
||||||
if "" == user.Editor.Theme {
|
if "" == user.Editor.Theme {
|
||||||
user.Editor.Theme = "wide" // since 1.1.0
|
user.Editor.Theme = "wide" // since 1.1.0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if "" == user.Editor.TabSize {
|
||||||
|
user.Editor.TabSize = "4" // since 1.1.0
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Save()
|
Save()
|
||||||
|
|
|
@ -137,5 +137,6 @@
|
||||||
"export": "Export",
|
"export": "Export",
|
||||||
"refresh": "Refresh",
|
"refresh": "Refresh",
|
||||||
"import": "Import",
|
"import": "Import",
|
||||||
"theme": "Theme"
|
"theme": "Theme",
|
||||||
|
"tab_size": "Tab Size"
|
||||||
}
|
}
|
|
@ -137,5 +137,6 @@
|
||||||
"export": "輸出",
|
"export": "輸出",
|
||||||
"refresh": "リフレッシュ",
|
"refresh": "リフレッシュ",
|
||||||
"import": "インポート",
|
"import": "インポート",
|
||||||
"theme": "テーマ"
|
"theme": "テーマ",
|
||||||
|
"tab_size": "Tab·サイズ"
|
||||||
}
|
}
|
||||||
|
|
|
@ -137,5 +137,6 @@
|
||||||
"export": "导出",
|
"export": "导出",
|
||||||
"refresh": "刷新",
|
"refresh": "刷新",
|
||||||
"import": "导入",
|
"import": "导入",
|
||||||
"theme": "主题"
|
"theme": "主题",
|
||||||
|
"tab_size": "Tab 大小"
|
||||||
}
|
}
|
|
@ -137,5 +137,6 @@
|
||||||
"export": "導出",
|
"export": "導出",
|
||||||
"refresh": "刷新",
|
"refresh": "刷新",
|
||||||
"import": "導入",
|
"import": "導入",
|
||||||
"theme": "主題"
|
"theme": "主題",
|
||||||
|
"tab_size": "Tab 大小"
|
||||||
}
|
}
|
|
@ -95,6 +95,7 @@ func PreferenceHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
EditorFontSize string
|
EditorFontSize string
|
||||||
EditorLineHeight string
|
EditorLineHeight string
|
||||||
EditorTheme string
|
EditorTheme string
|
||||||
|
EditorTabSize string
|
||||||
}{}
|
}{}
|
||||||
|
|
||||||
if err := json.NewDecoder(r.Body).Decode(&args); err != nil {
|
if err := json.NewDecoder(r.Body).Decode(&args); err != nil {
|
||||||
|
@ -115,6 +116,7 @@ func PreferenceHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
user.Editor.FontSize = args.EditorFontSize
|
user.Editor.FontSize = args.EditorFontSize
|
||||||
user.Editor.LineHeight = args.EditorLineHeight
|
user.Editor.LineHeight = args.EditorLineHeight
|
||||||
user.Editor.Theme = args.EditorTheme
|
user.Editor.Theme = args.EditorTheme
|
||||||
|
user.Editor.TabSize = args.EditorTabSize
|
||||||
|
|
||||||
conf.UpdateCustomizedConf(username)
|
conf.UpdateCustomizedConf(username)
|
||||||
|
|
||||||
|
|
|
@ -565,7 +565,7 @@ var editors = {
|
||||||
menu.undisabled(['save-all', 'close-all', 'build', 'run', 'go-test', 'go-get', 'go-install']);
|
menu.undisabled(['save-all', 'close-all', 'build', 'run', 'go-test', 'go-get', 'go-install']);
|
||||||
|
|
||||||
var textArea = document.getElementById("editor" + id);
|
var textArea = document.getElementById("editor" + id);
|
||||||
textArea.value = data.content;
|
textArea.value = data.content;
|
||||||
|
|
||||||
var editor = CodeMirror.fromTextArea(textArea, {
|
var editor = CodeMirror.fromTextArea(textArea, {
|
||||||
lineNumbers: true,
|
lineNumbers: true,
|
||||||
|
@ -576,6 +576,7 @@ var editors = {
|
||||||
rulers: [{color: "#ccc", column: 120, lineStyle: "dashed"}],
|
rulers: [{color: "#ccc", column: 120, lineStyle: "dashed"}],
|
||||||
styleActiveLine: true,
|
styleActiveLine: true,
|
||||||
theme: config.editorTheme,
|
theme: config.editorTheme,
|
||||||
|
tabSize: config.editorTabSize,
|
||||||
indentUnit: 4,
|
indentUnit: 4,
|
||||||
foldGutter: true,
|
foldGutter: true,
|
||||||
cursorHeight: 1,
|
cursorHeight: 1,
|
||||||
|
|
|
@ -370,6 +370,7 @@ var menu = {
|
||||||
$editorFontSize = $dialogPreference.find("input[name=editorFontSize]"),
|
$editorFontSize = $dialogPreference.find("input[name=editorFontSize]"),
|
||||||
$editorLineHeight = $dialogPreference.find("input[name=editorLineHeight]"),
|
$editorLineHeight = $dialogPreference.find("input[name=editorLineHeight]"),
|
||||||
$editorTheme = $dialogPreference.find("input[name=editorTheme]");
|
$editorTheme = $dialogPreference.find("input[name=editorTheme]");
|
||||||
|
$editorTabSize = $dialogPreference.find("input[name=editorTabSize]");
|
||||||
|
|
||||||
$.extend(request, {
|
$.extend(request, {
|
||||||
"fontFamily": $fontFamily.val(),
|
"fontFamily": $fontFamily.val(),
|
||||||
|
@ -382,7 +383,8 @@ var menu = {
|
||||||
"editorFontFamily": $editorFontFamily.val(),
|
"editorFontFamily": $editorFontFamily.val(),
|
||||||
"editorFontSize": $editorFontSize.val(),
|
"editorFontSize": $editorFontSize.val(),
|
||||||
"editorLineHeight": $editorLineHeight.val(),
|
"editorLineHeight": $editorLineHeight.val(),
|
||||||
"editorTheme": $editorTheme.val()
|
"editorTheme": $editorTheme.val(),
|
||||||
|
"editorTabSize": $editorTabSize.val()
|
||||||
});
|
});
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
|
@ -405,6 +407,7 @@ var menu = {
|
||||||
$editorFontSize.data("value", $editorFontSize.val());
|
$editorFontSize.data("value", $editorFontSize.val());
|
||||||
$editorLineHeight.data("value", $editorLineHeight.val());
|
$editorLineHeight.data("value", $editorLineHeight.val());
|
||||||
$editorTheme.data("value", $editorTheme.val());
|
$editorTheme.data("value", $editorTheme.val());
|
||||||
|
$editorTabSize.data("value", $editorTabSize.val());
|
||||||
|
|
||||||
var $okBtn = $("#dialogPreference").closest(".dialog-main").find(".dialog-footer > button:eq(0)");
|
var $okBtn = $("#dialogPreference").closest(".dialog-main").find(".dialog-footer > button:eq(0)");
|
||||||
$okBtn.prop("disabled", true);
|
$okBtn.prop("disabled", true);
|
||||||
|
|
|
@ -319,6 +319,7 @@
|
||||||
"wideSessionId": '{{.session.Id}}',
|
"wideSessionId": '{{.session.Id}}',
|
||||||
"editorTheme": '{{.user.Editor.Theme}}',
|
"editorTheme": '{{.user.Editor.Theme}}',
|
||||||
"latestSessionContent": {{.latestSessionContent}}
|
"latestSessionContent": {{.latestSessionContent}}
|
||||||
|
"editorTabSize": '{{.user.Editor.TabSize}}'
|
||||||
};
|
};
|
||||||
// 发往 Wide 的所有 AJAX 请求需要使用该函数创建请求参数.
|
// 发往 Wide 的所有 AJAX 请求需要使用该函数创建请求参数.
|
||||||
function newWideRequest() {
|
function newWideRequest() {
|
||||||
|
|
|
@ -48,6 +48,10 @@
|
||||||
{{.i18n.line_height}}{{.i18n.colon}}
|
{{.i18n.line_height}}{{.i18n.colon}}
|
||||||
<input data-value="{{.user.Editor.LineHeight}}" value="{{.user.Editor.LineHeight}}" name="editorLineHeight"/>
|
<input data-value="{{.user.Editor.LineHeight}}" value="{{.user.Editor.LineHeight}}" name="editorLineHeight"/>
|
||||||
</label>
|
</label>
|
||||||
|
<label>
|
||||||
|
{{.i18n.tab_size}}{{.i18n.colon}}
|
||||||
|
<input data-value="{{.user.Editor.TabSize}}" value="{{.user.Editor.TabSize}}" name="editorTabSize"/>
|
||||||
|
</label>
|
||||||
<label>
|
<label>
|
||||||
{{.i18n.theme}}{{.i18n.colon}}
|
{{.i18n.theme}}{{.i18n.colon}}
|
||||||
<br/>
|
<br/>
|
||||||
|
|
Loading…
Reference in New Issue