Added recovery page

This commit is contained in:
benweet 2013-10-20 15:00:08 +01:00
parent 0ef074c1a1
commit 35e18c99bc
9 changed files with 123 additions and 23 deletions

View File

@ -1,5 +1,5 @@
CACHE MANIFEST CACHE MANIFEST
#Date Sun Oct 20 2013 00:00:12 #Date Sun Oct 20 2013 14:51:35
CACHE: CACHE:
res/worker.js res/worker.js

87
public/recovery.html Normal file
View File

@ -0,0 +1,87 @@
<!DOCTYPE html>
<html>
<head>
<title>StackEdit - Recovery</title>
<link rel="canonical" href="https://stackedit.io/">
<link rel="icon" href="res-min/img/stackedit-32.ico" type="image/x-icon">
<link rel="shortcut icon" href="res-min/img/stackedit-32.ico" type="image/x-icon">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="res-min/themes/default.css">
<script>
// Use http://.../?debug to serve original JavaScript files instead of minified
var baseDir = 'res-min';
var noStart = true;
var require = {
baseUrl: baseDir,
deps: ['main']
};
setTimeout(function() {
try {
// Try to use StackEdit dependencies to save a file
var utils = require('utils');
utils.saveAs(JSON.stringify(localStorage), "StackEdit local storage.json");
$('.download-success').removeClass('hide');
}
catch (e) {
// Try something safer
document.getElementsByTagName('textarea')[0].value = JSON.stringify(localStorage);
var eltList = document.querySelectorAll('.download-failure');
for (var i = 0; i < eltList.length; ++i) {
var elt = eltList[i];
elt.className = elt.className.replace(/ hide/, '');
}
}
}, 5000);
function clearLocalStorage() {
var ok = confirm('This will remove all your documents and settings. Are you sure?');
ok && localStorage.clear();
}
</script>
<script src="res-min/require.js"></script>
</head>
<body>
<div class="container">
<br/>
<a href="https://stackedit.io/">
<img src="res-min/img/stackedit-promo.png" width="240" height="60" />
</a>
<h3>StackEdit recovery</h3>
<p>
<strong>The download of your documents and settings will start in 5 seconds...</strong>
</p>
<p>To import your documents and settings back in StackEdit:</p>
<blockquote>
<i class="icon-provider-stackedit"></i>
<code>Menu</code>
<i class="icon-angle-right"></i>
<i class="icon-cog"></i>
<code>Settings</code>
<i class="icon-angle-right"></i>
<code>Utils</code>
<i class="icon-angle-right"></i>
<i class="icon-cog-alt"></i>
<code>Import docs & settings</code>
</blockquote>
<p class="download-success hide text-primary">
<strong>
<i class="icon-ok"></i>Documents and settings have been downloaded successfully.</strong>
</p>
<p class="download-failure hide text-danger">
<strong>
<i class="icon-cancel"></i>Download failed. Please copy/paste the following content in a file:</strong>
</p>
<p>
<textarea class="download-failure hide form-control" rows="10"></textarea>
</p>
<p class="download-success download-failure hide">To clear the local storage
<a href="#" onclick="clearLocalStorage()">click here</a>.</p>
<p class="download-success download-failure hide">To reopen StackEdit
<a href="https://stackedit.io/">click here</a>.</p>
</div>
</body>
</html>

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
/** vim: et:ts=4:sw=4:sts=4 /** vim: et:ts=4:sw=4:sts=4
* @license RequireJS 2.1.8 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved. * @license RequireJS 2.1.9 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
* Available via the MIT or new BSD license. * Available via the MIT or new BSD license.
* see: http://github.com/jrburke/requirejs for details * see: http://github.com/jrburke/requirejs for details
*/ */
@ -12,7 +12,7 @@ var requirejs, require, define;
(function (global) { (function (global) {
var req, s, head, baseElement, dataMain, src, var req, s, head, baseElement, dataMain, src,
interactiveScript, currentlyAddingScript, mainScript, subPath, interactiveScript, currentlyAddingScript, mainScript, subPath,
version = '2.1.8', version = '2.1.9',
commentRegExp = /(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg, commentRegExp = /(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg,
cjsRequireRegExp = /[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g, cjsRequireRegExp = /[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,
jsSuffixRegExp = /\.js$/, jsSuffixRegExp = /\.js$/,
@ -22,7 +22,7 @@ var requirejs, require, define;
hasOwn = op.hasOwnProperty, hasOwn = op.hasOwnProperty,
ap = Array.prototype, ap = Array.prototype,
apsp = ap.splice, apsp = ap.splice,
isBrowser = !!(typeof window !== 'undefined' && navigator && window.document), isBrowser = !!(typeof window !== 'undefined' && typeof navigator !== 'undefined' && window.document),
isWebWorker = !isBrowser && typeof importScripts !== 'undefined', isWebWorker = !isBrowser && typeof importScripts !== 'undefined',
//PS3 indicates loaded and complete, but need to wait for complete //PS3 indicates loaded and complete, but need to wait for complete
//specifically. Sequence is 'loading', 'loaded', execution, //specifically. Sequence is 'loading', 'loaded', execution,
@ -373,7 +373,6 @@ var requirejs, require, define;
function hasPathFallback(id) { function hasPathFallback(id) {
var pathConfig = getOwn(config.paths, id); var pathConfig = getOwn(config.paths, id);
if (pathConfig && isArray(pathConfig) && pathConfig.length > 1) { if (pathConfig && isArray(pathConfig) && pathConfig.length > 1) {
removeScript(id);
//Pop off the first array value, since it failed, and //Pop off the first array value, since it failed, and
//retry //retry
pathConfig.shift(); pathConfig.shift();
@ -1464,6 +1463,8 @@ var requirejs, require, define;
var map = makeModuleMap(id, relMap, true), var map = makeModuleMap(id, relMap, true),
mod = getOwn(registry, id); mod = getOwn(registry, id);
removeScript(id);
delete defined[id]; delete defined[id];
delete urlFetched[map.url]; delete urlFetched[map.url];
delete undefEvents[id]; delete undefEvents[id];
@ -1609,7 +1610,7 @@ var requirejs, require, define;
//Join the path parts together, then figure out if baseUrl is needed. //Join the path parts together, then figure out if baseUrl is needed.
url = syms.join('/'); url = syms.join('/');
url += (ext || (/\?/.test(url) || skipExt ? '' : '.js')); url += (ext || (/^data\:|\?/.test(url) || skipExt ? '' : '.js'));
url = (url.charAt(0) === '/' || url.match(/^[\w\+\.\-]+:/) ? '' : config.baseUrl) + url; url = (url.charAt(0) === '/' || url.match(/^[\w\+\.\-]+:/) ? '' : config.baseUrl) + url;
} }
@ -1918,7 +1919,7 @@ var requirejs, require, define;
} }
//Look for a data-main script attribute, which could also adjust the baseUrl. //Look for a data-main script attribute, which could also adjust the baseUrl.
if (isBrowser) { if (isBrowser && !cfg.skipDataMain) {
//Figure out baseUrl. Get it from the script tag with require.js in it. //Figure out baseUrl. Get it from the script tag with require.js in it.
eachReverse(scripts(), function (script) { eachReverse(scripts(), function (script) {
//Set the 'head' where we can append children by //Set the 'head' where we can append children by

View File

@ -39,7 +39,7 @@ define([
title: 'Welcome to StackEdit!', title: 'Welcome to StackEdit!',
content: [ content: [
'<i class="icon-lock pull-left"></i>', '<i class="icon-lock pull-left"></i>',
'<p><strong>You are using the new secured platform.</strong> If you want to recover your documents from the old platform, <a target="_blank" href="http://benweet.github.io/stackedit/recovery.html">click here</a>.</p>', '<p><strong>You are using the new secured platform.</strong> If you want to recover your documents from the old platform <a target="_blank" href="http://benweet.github.io/stackedit/recovery.html">click here</a>.</p>',
'Please click <code>Next</code> to take a quick tour.' 'Please click <code>Next</code> to take a quick tour.'
].join(""), ].join(""),
placement: 'bottom', placement: 'bottom',

View File

@ -1044,7 +1044,8 @@
Load default settings</a> <a href="#" class="btn btn-block btn-primary" Load default settings</a> <a href="#" class="btn btn-block btn-primary"
data-dismiss="modal" data-toggle="modal" data-dismiss="modal" data-toggle="modal"
data-target=".modal-app-reset"><i data-target=".modal-app-reset"><i
class="icon-fire icon-white"></i> Reset application</a> class="icon-fire icon-white"></i> Reset application</a> <a target="_blank" href="recovery.html" class="btn btn-block btn-primary"><i
class="icon-medkit icon-white"></i> StackEdit recovery</a>
</div> </div>
<span class="help-block text-center"><a target="_blank" <span class="help-block text-center"><a target="_blank"
href="http://benweet.github.io/stackedit/recovery.html">Old platform recovery</a></span> href="http://benweet.github.io/stackedit/recovery.html">Old platform recovery</a></span>

View File

@ -63,11 +63,14 @@ var isIndentingList = false;
if(isIndentingList === true && (state == "listblock" || state == "listblock-start") && /^\s*(?:[-+*]|\d+\.)\s+$/.test(line)) { if(isIndentingList === true && (state == "listblock" || state == "listblock-start") && /^\s*(?:[-+*]|\d+\.)\s+$/.test(line)) {
// When hitting enter twice in a listblock, remove the previous line // When hitting enter twice in a listblock, remove the previous line
var rows = editor.$getSelectedRows(); var rows = editor.$getSelectedRows();
if (rows.last > 2) { if (rows.last > 1) {
var range = new Range( var range = new Range(
rows.last - 2, editor.session.getLine(rows.last - 2).length, rows.last - 2, editor.session.getLine(rows.last - 2).length,
rows.last - 1, editor.session.getLine(rows.last - 1).length); rows.last - 1, editor.session.getLine(rows.last - 1).length);
editor.session.remove(range); var previousLine = editor.session.getTextRange(range);
if(/^\s*(?:[-+*]|\d+\.)\s+$/.test(previousLine)) {
editor.session.remove(range);
}
} }
isIndentingList = false; isIndentingList = false;
return this.$getIndent(line); return this.$getIndent(line);

View File

@ -139,6 +139,10 @@ if (baseDir.indexOf('-min') !== -1) {
require(["jquery", "core", "eventMgr", "synchronizer", "publisher", "mediaImporter", "css", require(["jquery", "core", "eventMgr", "synchronizer", "publisher", "mediaImporter", "css",
themeModule, ], function($, core, eventMgr) { themeModule, ], function($, core, eventMgr) {
if(typeof(noStart) !== 'undefined' && noStart) {
return;
}
$(function() { $(function() {
// Here, all the modules are loaded and the DOM is ready // Here, all the modules are loaded and the DOM is ready

View File

@ -2,7 +2,7 @@
<html> <html>
<head> <head>
<title>StackEdit - Error 404</title> <title>StackEdit - 404</title>
<link rel="canonical" href="https://stackedit.io/"> <link rel="canonical" href="https://stackedit.io/">
<link rel="icon" href="res-min/img/stackedit-32.ico" type="image/x-icon"> <link rel="icon" href="res-min/img/stackedit-32.ico" type="image/x-icon">
<link rel="shortcut icon" href="res-min/img/stackedit-32.ico" type="image/x-icon"> <link rel="shortcut icon" href="res-min/img/stackedit-32.ico" type="image/x-icon">