Skip to content
This repository has been archived by the owner on Dec 19, 2023. It is now read-only.

Commit

Permalink
#43, add the theme switch for edit page
Browse files Browse the repository at this point in the history
  • Loading branch information
pandada8 committed Jul 24, 2015
1 parent 1571bb4 commit b345c7d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
if (confirm("Detected unsaved document cache, do you want to load the cache?")) {
session.setValue(value);
}
store.clear(filename);
store.clear(filename);
}


Expand Down Expand Up @@ -55,6 +55,8 @@
})

var renderedContainer = document.getElementsByClassName('render-target')[0];
var store_of_theme = new Persist.Store('strapdown', { swf_path: '/persist.swf' });
var theme = store_of_theme.get("theme") || "chaitin";

var preview_toggle = document.getElementById('preview-toggle');
addEvent(preview_toggle, 'click', function() {
Expand All @@ -66,7 +68,7 @@
renderTarget.id = 'content';
renderedContainer.innerHTML = ""
renderedContainer.appendChild(renderTarget);
render(renderTarget, markdown, 'cerulean', null, false);
render(renderTarget, markdown, theme, null, false);
renderedContainer.style.display = 'block';
setInnerText(preview_toggle, "Continue Editing");
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/strapdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ var store = new Persist.Store('strapdown', { swf_path: '/persist.swf' });
var dropdown = document.getElementsByClassName("dropdown")[0],
toggleBtn = document.getElementsByClassName('navbar-toggle')[0],
menus = document.getElementsByClassName('navbar-collapse')[0];
if (themeEl && dropdown) {
if (themeEl && dropdown) {
addEvent(dropdown, 'click', function () {
if (dropdown.className.match(/(?:^|\s)open(?!\S)/)) {
dropdown.className = dropdown.className.replace(/(?:^|\s)open(?!\S)/g, '');
Expand Down

0 comments on commit b345c7d

Please sign in to comment.