Commit dfbf06a4 authored by techird's avatar techird

merge from dev

parents 3ee012c5 70ae9c51
...@@ -8,6 +8,27 @@ function DraftManager( minder ) { ...@@ -8,6 +8,27 @@ function DraftManager( minder ) {
function init() { function init() {
drafts = localStorage.getItem( 'drafts' ); drafts = localStorage.getItem( 'drafts' );
drafts = drafts ? JSON.parse( drafts ) : []; drafts = drafts ? JSON.parse( drafts ) : [];
loadDraftForOldVersion();
}
/**
* @todo 1.2 版本中删除该方法
*
* 加载老版本的草稿
*/
function loadDraftForOldVersion() {
var path = localStorage.getItem( 'draft_filename' ),
data = localStorage.getItem( 'draft_data' );
if ( path && data ) {
drafts.push( {
path: path,
data: data,
name: JSON.parse( data ).data.text,
update: new Date()
} );
localStorage.removeItem( 'draft_filename' );
localStorage.removeItem( 'draft_data' );
}
} }
function store() { function store() {
......
...@@ -457,7 +457,8 @@ $( function () { ...@@ -457,7 +457,8 @@ $( function () {
var list = draftManager.list(), var list = draftManager.list(),
draft, $draft, index; draft, $draft, index;
if ( !list.length ) { if ( !list.length ) {
return false; draftManager.create();
list = draftManager.list();
} }
draft = list.shift(); draft = list.shift();
...@@ -488,7 +489,7 @@ $( function () { ...@@ -488,7 +489,7 @@ $( function () {
function adjustDraftMenu() { function adjustDraftMenu() {
var pos = $draft_btn.offset(); var pos = $draft_btn.offset();
pos.top -= $draft_menu.outerHeight() + 15; pos.top -= $draft_menu.outerHeight() + 5;
$draft_menu.offset( pos ); $draft_menu.offset( pos );
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment