Merge pull request #203 from LucasYuNju/master

FIx issue #198
This commit is contained in:
life
2016-12-28 10:15:19 +08:00
committed by GitHub
6 changed files with 17 additions and 17 deletions

View File

@@ -18,9 +18,9 @@
<link href="public/css-libs/ztree/zTreeStyle.css" rel="stylesheet" />
<!-- mdeditor -->
<link href="public/md/themes/mdeditor.css" rel="stylesheet" />
<link href="public/themes/markdown/meditor.css" rel="stylesheet" />
<!-- markdown theme -->
<link rel="stylesheet" href="public/md/themes/themes/default/theme.css" type="text/css" id="md-theme"/>
<link rel="stylesheet" href="public/themes/markdown/default/index.css" type="text/css" id="md-theme"/>
<!-- theme -->
<link rel="stylesheet" href="public/themes/default.css" type="text/css"/>

View File

@@ -1,6 +1,7 @@
var Config = {
"plugins": [
"theme",
"md_theme",
"import_leanote",
"import_evernote",
"export_pdf",

View File

@@ -27,20 +27,19 @@ define(function() {
_themes: [],
getThemes: function() {
var me = this;
// 遍历主题目录, 得到主题
var themeBasePath = __dirname + "/public/md/themes/themes";
var dirs = Api.nodeFs.readdirSync(themeBasePath);
for(var i = 0; i < dirs.length; ++i) {
var dir = dirs[i]; // 名称
me._themeMap[dir] = {
name: dir, // 主题名称
dir: dir
};
me._themes.push(me._themeMap[dir]);
}
// 遍历主题目录, 得到主题列表
var themeFolder = __dirname + "/public/themes/markdown";
Api.nodeFs.readdirSync(themeFolder)
.filter(function(theme) {
return Api.nodeFs.statSync(themeFolder + "/" + theme).isDirectory();
})
.forEach(function(theme) {
me._themeMap[theme] = {
name: theme, // 主题名称
dir: theme
};
me._themes.push(me._themeMap[theme]);
});
},
// 改变主题
@@ -48,7 +47,7 @@ define(function() {
var me = this;
themeDir || (themeDir = 'default');
themeDir = themeDir.toLowerCase();
$('#md-theme').attr('href', 'public/md/themes/themes/' + themeDir + '/theme.css');
$('#md-theme').attr('href', 'public/themes/markdown/' + themeDir + '/index.css');
Config.mdTheme = themeDir;
var ok = Api.writeConfig(Config);