diff --git a/bower.json b/bower.json index 28b32f8c..78ed1bfe 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "stackedit", - "version": "2.1.7", + "version": "2.2.0", "description": "StackEdit is a free, open-source Markdown editor based on PageDown, the Markdown library used by Stack Overflow and the other Stack Exchange sites.", "dependencies": { "bootstrap": "3.0.0", diff --git a/package.json b/package.json index f73b46dd..9a7cb185 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "stackedit", - "version": "2.1.7", + "version": "2.2.0", "description": "StackEdit is a free, open-source Markdown editor based on PageDown, the Markdown library used by Stack Overflow and the other Stack Exchange sites.", "main": "res/main.js", "directories": { diff --git a/public/cache.manifest b/public/cache.manifest index ade6218c..e5476104 100644 --- a/public/cache.manifest +++ b/public/cache.manifest @@ -1,5 +1,5 @@ CACHE MANIFEST -#Date Fri Oct 11 2013 22:46:08 +#Date Sun Oct 13 2013 00:36:02 CACHE: index.html diff --git a/public/res-min/main.js b/public/res-min/main.js index a10b77e2..4bf7682b 100644 --- a/public/res-min/main.js +++ b/public/res-min/main.js @@ -13419,7 +13419,7 @@ printStackTrace.implementation = function() {}, printStackTrace.implementation.p }, utils; }); -var VERSION = "2.1.7", MAIN_URL = "https://stackedit.io/", GOOGLE_ANALYTICS_ACCOUNT_ID = "UA-39556145-1", GOOGLE_API_KEY = "AIzaSyAeCU8CGcSkn0z9js6iocHuPBX4f_mMWkw", GOOGLE_DRIVE_APP_ID = "241271498917", DROPBOX_APP_KEY = "lq6mwopab8wskas", DROPBOX_APP_SECRET = "851fgnucpezy84t", BITLY_ACCESS_TOKEN = "317e033bfd48cf31155a68a536b1860013b09c4c", DEFAULT_FILE_TITLE = "Title", DEFAULT_FOLDER_NAME = "New folder", GDRIVE_DEFAULT_FILE_TITLE = "New Markdown document", EDITOR_DEFAULT_PADDING = 15, CHECK_ONLINE_PERIOD = 12e4, AJAX_TIMEOUT = 3e4, ASYNC_TASK_DEFAULT_TIMEOUT = 6e4, ASYNC_TASK_LONG_TIMEOUT = 18e4, SYNC_PERIOD = 18e4, USER_IDLE_THRESHOLD = 3e5, IMPORT_FILE_MAX_CONTENT_SIZE = 1e5, IMPORT_IMG_MAX_CONTENT_SIZE = 1e7, TEMPORARY_FILE_INDEX = "file.tempIndex", WELCOME_DOCUMENT_TITLE = "Welcome document", DOWNLOAD_PROXY_URL = "https://stackedit-download-proxy.herokuapp.com/", PICASA_PROXY_URL = "https://stackedit-picasa-proxy.herokuapp.com/", SSH_PROXY_URL = "https://stackedit-ssh-proxy.herokuapp.com/", HTMLTOPDF_URL = "http://benweet.insomnia247.nl/stackedit-htmltopdf/", delayedFunction = void 0, BASE_URL = "http://localhost/", GOOGLE_CLIENT_ID = "241271498917-lev37kef013q85avc91am1gccg5g8lrb.apps.googleusercontent.com", GITHUB_CLIENT_ID = "e47fef6055344579799d", GATEKEEPER_URL = "https://stackedit-gatekeeper-localhost.herokuapp.com/", TUMBLR_PROXY_URL = "https://stackedit-tumblr-proxy-local.herokuapp.com/", WORDPRESS_CLIENT_ID = "23361", WORDPRESS_PROXY_URL = "https://stackedit-io-wordpress-proxy.herokuapp.com/"; +var VERSION = "2.2.0", MAIN_URL = "https://stackedit.io/", GOOGLE_ANALYTICS_ACCOUNT_ID = "UA-39556145-1", GOOGLE_API_KEY = "AIzaSyAeCU8CGcSkn0z9js6iocHuPBX4f_mMWkw", GOOGLE_DRIVE_APP_ID = "241271498917", DROPBOX_APP_KEY = "lq6mwopab8wskas", DROPBOX_APP_SECRET = "851fgnucpezy84t", BITLY_ACCESS_TOKEN = "317e033bfd48cf31155a68a536b1860013b09c4c", DEFAULT_FILE_TITLE = "Title", DEFAULT_FOLDER_NAME = "New folder", GDRIVE_DEFAULT_FILE_TITLE = "New Markdown document", EDITOR_DEFAULT_PADDING = 15, CHECK_ONLINE_PERIOD = 12e4, AJAX_TIMEOUT = 3e4, ASYNC_TASK_DEFAULT_TIMEOUT = 6e4, ASYNC_TASK_LONG_TIMEOUT = 18e4, SYNC_PERIOD = 18e4, USER_IDLE_THRESHOLD = 3e5, IMPORT_FILE_MAX_CONTENT_SIZE = 1e5, IMPORT_IMG_MAX_CONTENT_SIZE = 1e7, TEMPORARY_FILE_INDEX = "file.tempIndex", WELCOME_DOCUMENT_TITLE = "Welcome document", DOWNLOAD_PROXY_URL = "https://stackedit-download-proxy.herokuapp.com/", PICASA_PROXY_URL = "https://stackedit-picasa-proxy.herokuapp.com/", SSH_PROXY_URL = "https://stackedit-ssh-proxy.herokuapp.com/", HTMLTOPDF_URL = "https://stackedit-htmltopdf.herokuapp.com/", delayedFunction = void 0, BASE_URL = "http://localhost/", GOOGLE_CLIENT_ID = "241271498917-lev37kef013q85avc91am1gccg5g8lrb.apps.googleusercontent.com", GITHUB_CLIENT_ID = "e47fef6055344579799d", GATEKEEPER_URL = "https://stackedit-gatekeeper-localhost.herokuapp.com/", TUMBLR_PROXY_URL = "https://stackedit-tumblr-proxy-local.herokuapp.com/", WORDPRESS_CLIENT_ID = "23361", WORDPRESS_PROXY_URL = "https://stackedit-io-wordpress-proxy.herokuapp.com/"; 0 === location.hostname.indexOf("stackedit.io") && (BASE_URL = MAIN_URL, GOOGLE_CLIENT_ID = "241271498917-t4t7d07qis7oc0ahaskbif3ft6tk63cd.apps.googleusercontent.com", GITHUB_CLIENT_ID = "710fc67886ab1ae8fee6", GATEKEEPER_URL = "https://stackedit-io-gatekeeper.herokuapp.com/", @@ -16223,10 +16223,7 @@ function() { var t = e.pop(); b.commands.addCommand({ name: a(t), - bindKey: { - win: "Ctrl-" + m[t], - mac: "Command-" + m[t] - }, + bindKey: m[t], exec: function() { d(y[t]); } @@ -16365,27 +16362,62 @@ function() { redo: "Redo -", help: "Markdown Editing Help" }, m = { - bold: "B", - italic: "I", - link: "L", - quote: "Q", - code: "K", - image: "G", - olist: "O", - ulist: "U", - heading: "H", - hr: "R", - undo: "Z", - redo: "Y" + bold: { + win: "Ctrl-B", + mac: "Command-B|Ctrl-B" + }, + italic: { + win: "Ctrl-I", + mac: "Command-I|Ctrl-I" + }, + link: { + win: "Ctrl-L", + mac: "Command-L|Ctrl-L" + }, + quote: { + win: "Ctrl-Q", + mac: "Command-Q|Ctrl-Q" + }, + code: { + win: "Ctrl-K", + mac: "Command-K|Ctrl-K" + }, + image: { + win: "Ctrl-G", + mac: "Command-G|Ctrl-G" + }, + olist: { + win: "Ctrl-O", + mac: "Command-O|Ctrl-O" + }, + ulist: { + win: "Ctrl-U", + mac: "Command-U|Ctrl-U" + }, + heading: { + win: "Ctrl-H", + mac: "Command-H|Ctrl-H" + }, + hr: { + win: "Ctrl-R", + mac: "Command-R|Ctrl-R" + }, + undo: { + win: "Ctrl-Z", + mac: "Command-Z" + }, + redo: { + win: "Ctrl-Y|Ctrl-Shift-Z", + mac: "Command-Y|Command-Shift-Z" + } }, v = "http://", b = "http://"; Markdown.Editor = function(e, n, s) { - s = s || {}, "function" == typeof s.handler && (s = { + if (s = s || {}, "function" == typeof s.handler && (s = { helpButton: s - }), s.strings = s.strings || {}, s.helpButton && (s.strings.help = s.strings.help || s.helpButton.title); - var a = function(e) { + }), s.strings = s.strings || {}, s.helpButton && (s.strings.help = s.strings.help || s.helpButton.title), + s.keyStrokes) for (var a in s.keyStrokes) m[a] = s.keyStrokes[a]; + var l = function(e) { return s.strings[e] || g[e]; - }, l = function(e) { - return (/win/.test(h.platform.toLowerCase()) ? "Ctrl+" : "Command+") + m[e]; }; n = n || ""; var c = this.hooks = new Markdown.HookCollection(); @@ -16393,18 +16425,21 @@ function() { c.addFalse("insertLinkDialog"), this.getConverter = function() { return e; }; - var u, d, p = this; - this.run = function(h, f) { + var u, d, h = this; + this.run = function(a, p) { if (!u) { - u = new t(n, h); - var g, m = new r(c, a), v = new i(e, u, function() { + u = new t(n, a); + var f, g = new r(c, l), v = new i(e, u, function() { c.onPreviewRefresh(); - }, f); - g = new o(n, u, d, v, m, s.helpButton, a, l), g.setUndoRedoButtonStates(); - var b = p.refreshPreview = function() { + }, p), b = "undefined" != typeof require ? require("ace/lib/useragent") : a.require("ace/lib/useragent"), y = function(e) { + var t = m[e][b.isMac ? "mac" : "win"], n = t.indexOf("|"); + return t.substring(0, n > 0 ? n : t.length); + }; + f = new o(n, u, d, v, g, s.helpButton, l, y), f.setUndoRedoButtonStates(); + var w = h.refreshPreview = function() { v.refresh(!0); }; - b(), p.uiManager = g; + w(), h.uiManager = f; } }; }, e.prototype.findTags = function(e, t) { @@ -16613,10 +16648,7 @@ function() { } /(^|\n)>/.test(n) || (i += n, n = ""); } - e.startTag = n, e.before = i, e.after && (e.after = e.after.replace(/^\n?/, "\n")), - e.after = e.after.replace(/^(((\n|^)(\n[ \t]*)*>(.+\n)*.*)+(\n[ \t]*)*)/, function(t) { - return e.endTag = t, ""; - }); + e.startTag = n, e.before = i; var l = function(t) { var n = t ? "> " : ""; e.startTag && (e.startTag = e.startTag.replace(/\n((>|\s)*)\n$/, function(e, t) { @@ -20632,41 +20664,46 @@ if (hljs.LANGUAGES.glsl = function(e) { }), c[0]; }, r; }), define("text!html/buttonSyncSettingsBlock.html", [], function() { - return '

Adds a "Synchronize documents" button in the navigation bar.

\n
\n
\n \n
\n ms\n
\n
\n
'; -}), define("extensions/buttonSync", [ "jquery", "underscore", "crel", "utils", "classes/Extension", "text!html/buttonSyncSettingsBlock.html" ], function(e, t, n, i, o, r) { - var s = new o("buttonSync", 'Button "Synchronize"'); - s.settingsBlock = r, s.defaultConfig = { - syncPeriod: 18e4 - }, s.onLoadSettings = function() { - i.setInputValue("#input-sync-period", s.config.syncPeriod); - }, s.onSaveSettings = function(e, t) { - e.syncPeriod = i.getInputIntValue("#input-sync-period", t, 0); + return '

Adds a "Synchronize documents" button in the navigation bar.

\n
\n
\n \n
\n ms\n
\n
\n
\n \n
\n \n
\n
\n
'; +}), define("extensions/buttonSync", [ "jquery", "underscore", "crel", "utils", "classes/Extension", "mousetrap", "text!html/buttonSyncSettingsBlock.html" ], function(e, t, n, i, o, r, s) { + var a = new o("buttonSync", 'Button "Synchronize"', !1, !0); + a.settingsBlock = s, a.defaultConfig = { + syncPeriod: 18e4, + syncShortcut: "mod+s" + }, a.onLoadSettings = function() { + i.setInputValue("#input-sync-period", a.config.syncPeriod), i.setInputValue("#input-sync-shortcut", a.config.syncShortcut); + }, a.onSaveSettings = function(e, t) { + e.syncPeriod = i.getInputIntValue("#input-sync-period", t, 0), e.syncShortcut = i.getInputTextValue("#input-sync-shortcut", t); }; - var a = void 0; - s.onSynchronizerCreated = function(e) { - a = e; + var l = void 0; + a.onSynchronizerCreated = function(e) { + l = e; }; - var l = void 0, c = !1, u = !1, d = function() { - void 0 !== l && (c === !0 || a.hasSync() === !1 || u ? l.addClass("disabled") : l.removeClass("disabled")); - }, h = 0; - return s.onPeriodicRun = function() { - viewerMode === !0 || !s.config.syncPeriod || h + s.config.syncPeriod > i.currentTime || a.sync() === !0 && (h = i.currentTime); - }, s.onCreateButton = function() { + var c = void 0, u = !1, d = !1, h = function() { + void 0 !== c && (u === !0 || l.hasSync() === !1 || d ? c.addClass("disabled") : c.removeClass("disabled")); + }, p = 0; + return a.onPeriodicRun = function() { + !a.config.syncPeriod || p + a.config.syncPeriod > i.currentTime || l.sync() && (p = i.currentTime); + }, a.onCreateButton = function() { var t = n("button", { "class": "btn btn-success button-synchronize", title: "Synchronize all" }, n("i", { "class": "icon-refresh" })); - return l = e(t).click(function() { - e(this).hasClass("disabled") || a.sync(); + return c = e(t), c.click(function() { + c.hasClass("disabled") || l.sync() && (p = i.currentTime); }), t; - }, s.onReady = d, s.onFileCreated = d, s.onFileDeleted = d, s.onSyncImportSuccess = d, - s.onSyncExportSuccess = d, s.onSyncRemoved = d, s.onSyncRunning = function(e) { - c = e, d(); - }, s.onOfflineChanged = function(e) { - u = e, d(); - }, s; + }, a.onReady = h, a.onFileCreated = h, a.onFileDeleted = h, a.onSyncImportSuccess = h, + a.onSyncExportSuccess = h, a.onSyncRemoved = h, a.onSyncRunning = function(e) { + u = e, h(); + }, a.onOfflineChanged = function(e) { + d = e, h(); + }, a.onReady = function() { + r.bind(a.config.syncShortcut, function(e) { + l.sync() && (p = i.currentTime), e.preventDefault(); + }); + }, a; }), define("extensions/buttonPublish", [ "jquery", "underscore", "crel", "classes/Extension" ], function(e, t, n, i) { function o() { void 0 !== s && (l === !0 || c === !1 || u === !0 ? s.addClass("disabled") : s.removeClass("disabled")); @@ -22300,6 +22337,12 @@ if (hljs.LANGUAGES.glsl = function(e) { e.each(s, function(n) { n.exec && t.commands.addCommand(e.pick(n, "name", "bindKey", "exec", "readOnly", "multiSelectAction")); }); + }, r.getPagedownKeyStrokes = function() { + return e.chain(s).where({ + isPageDown: !0 + }).map(function(e) { + return [ e.name, e.bindKey ]; + }).object().value(); }, r.addSettingEntries = function() { var t = e.reduce(s, function(t, n) { return t + e.template(o, { @@ -22319,7 +22362,7 @@ if (hljs.LANGUAGES.glsl = function(e) { }); }, r; }), define("text!html/bodyIndex.html", [], function() { - return '\n
\n
\n
\n
\n\n\n\n\n
\n \n \n
\n
\n
\n
\n
\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
\n
'; + return '\n
\n
\n
\n
\n\n\n\n\n
\n \n \n
\n
\n
\n
\n
\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
\n
'; }), define("text!html/bodyViewer.html", [], function() { return '\n\n
\n
\n
\n\n\n\n
\n \n \n
\n
\n
\n
\n
\n\n\n'; }), define("text!html/settingsTemplateTooltip.html", [], function() { @@ -26186,79 +26229,81 @@ if (hljs.LANGUAGES.glsl = function(e) { void 0 !== N && (e = N.getValue()), void 0 !== W && W != e && (H.content = e, s.onContentChanged(H)), W = e; } - function a() { + function l() { var e = j.val(); - e = h.makeHtml(e), p.html(e), f.onPreviewRefresh(); + e = p.makeHtml(e), f.html(e), g.onPreviewRefresh(); } void 0 !== H && s.onFileClosed(H), H = n, W = void 0; - var l = H.content; - if (void 0 !== N ? (N.setValue(l, -1), N.getSession().setUndoManager(new q())) : j.val(l), + var c = H.content; + if (void 0 !== N ? (N.setValue(c, -1), N.getSession().setUndoManager(new q())) : j.val(c), void 0 !== z) return N && N.selection.setSelectionRange(H.editorSelectRange), N && N.focus() || j.focus(), z.refreshPreview(), void 0; - var c = e(".preview-container"); + var u = e(".preview-container"); if (!lightMode) { - var u = t.debounce(function() { + var d = t.debounce(function() { void 0 !== W && (H.editorScrollTop = N.renderer.getScrollTop()); }, 100); - N.session.on("changeScrollTop", u); - var d = t.debounce(function() { + N.session.on("changeScrollTop", d); + var h = t.debounce(function() { void 0 !== W && (H.editorSelectRange = N.getSelectionRange()); }, 100); - N.session.selection.on("changeSelection", d), N.session.selection.on("changeCursor", d), - c.scroll(function() { - void 0 !== W && (H.previewScrollTop = c.scrollTop()); + N.session.selection.on("changeSelection", h), N.session.selection.on("changeCursor", h), + u.scroll(function() { + void 0 !== W && (H.previewScrollTop = u.scrollTop()); }); } - var h = new Markdown.Converter(); + var p = new Markdown.Converter(); if (lightMode) { - var p = e("#wmd-preview"), f = new Markdown.HookCollection(); - f.addNoop("onPreviewRefresh"); - var g = t.debounce(a, 1e3), m = function() { - void 0 === W ? (a(), s.onFileOpen(H)) : g(), i(); + var f = e("#wmd-preview"), g = new Markdown.HookCollection(); + g.addNoop("onPreviewRefresh"); + var m = t.debounce(l, 1e3), v = function() { + void 0 === W ? (l(), s.onFileOpen(H)) : m(), i(); }; - j.on("input propertychange", m), z = { - hooks: f, + j.on("input propertychange", v), z = { + hooks: g, getConverter: function() { - return h; + return p; }, - run: m, - refreshPreview: m + run: v, + refreshPreview: v }; - } else z = new Markdown.Editor(h), z.hooks.set("insertLinkDialog", function(t) { + } else z = new Markdown.Editor(p, void 0, { + keyStrokes: a.getPagedownKeyStrokes() + }), z.hooks.set("insertLinkDialog", function(t) { return E.insertLinkCallback = t, o.resetModalInputs(), e(".modal-insert-link").modal(), !0; }), z.hooks.set("insertImageDialog", function(t) { return E.insertLinkCallback = t, E.catchModal ? !0 : (o.resetModalInputs(), e(".modal-insert-image").modal(), !0); }); - var m; - m = r.lazyRendering === !0 ? function(e) { + var v; + v = r.lazyRendering === !0 ? function(e) { var n = t.debounce(e, 500); return function() { - void 0 === W ? (e(), s.onFileOpen(H), c.scrollTop(H.previewScrollTop), t.defer(function() { + void 0 === W ? (e(), s.onFileOpen(H), u.scrollTop(H.previewScrollTop), t.defer(function() { N.renderer.scrollToY(H.editorScrollTop); })) : n(), i(); }; } : function(e) { return function() { - e(), void 0 === W && (s.onFileOpen(H), c.scrollTop(H.previewScrollTop), t.defer(function() { + e(), void 0 === W && (s.onFileOpen(H), u.scrollTop(H.previewScrollTop), t.defer(function() { N.renderer.scrollToY(H.editorScrollTop); })), i(); }; }, s.onPagedownConfigure(z), z.hooks.chain("onPreviewRefresh", s.onAsyncPreview), - z.run(N, m), N && N.selection.setSelectionRange(H.editorSelectRange), N && N.focus() || j.focus(), + z.run(N, v), N && N.selection.setSelectionRange(H.editorSelectRange), N && N.focus() || j.focus(), e(".wmd-button-row li").addClass("btn btn-success").css("left", 0).find("span").hide(); - var v = e(".wmd-button-group1"); - e("#wmd-bold-button").append(e('')).appendTo(v), e("#wmd-italic-button").append(e('')).appendTo(v); - var v = e(".wmd-button-group2"); - e("#wmd-link-button").append(e('')).appendTo(v), e("#wmd-quote-button").append(e('')).appendTo(v), - e("#wmd-code-button").append(e('')).appendTo(v), e("#wmd-image-button").append(e('')).appendTo(v); - var v = e(".wmd-button-group3"); - e("#wmd-olist-button").append(e('')).appendTo(v), - e("#wmd-ulist-button").append(e('')).appendTo(v), e("#wmd-heading-button").append(e('')).appendTo(v), - e("#wmd-hr-button").append(e('')).appendTo(v); - var v = e(".wmd-button-group4"); - e("#wmd-undo-button").append(e('')).appendTo(v), e("#wmd-redo-button").append(e('')).appendTo(v); + var b = e(".wmd-button-group1"); + e("#wmd-bold-button").append(e('')).appendTo(b), e("#wmd-italic-button").append(e('')).appendTo(b); + var b = e(".wmd-button-group2"); + e("#wmd-link-button").append(e('')).appendTo(b), e("#wmd-quote-button").append(e('')).appendTo(b), + e("#wmd-code-button").append(e('')).appendTo(b), e("#wmd-image-button").append(e('')).appendTo(b); + var b = e(".wmd-button-group3"); + e("#wmd-olist-button").append(e('')).appendTo(b), + e("#wmd-ulist-button").append(e('')).appendTo(b), e("#wmd-heading-button").append(e('')).appendTo(b), + e("#wmd-hr-button").append(e('')).appendTo(b); + var b = e(".wmd-button-group4"); + e("#wmd-undo-button").append(e('')).appendTo(b), e("#wmd-redo-button").append(e('')).appendTo(b); }; var U = void 0; E.oauthRedirect = function(t, n) { @@ -26344,28 +26389,34 @@ if (hljs.LANGUAGES.glsl = function(e) { var a = theme; B = e("#input-settings-theme"), B.on("change", function() { n(this.value); - }), e(".action-import-settings").click(function() { - e("#input-file-import-settings").click(); - }), e("#input-file-import-settings").change(function(n) { + }), e(".action-import-docs-settings").click(function() { + e("#input-file-import-docs-settings").click(); + }); + var c = void 0; + e("#input-file-import-docs-settings").change(function(n) { var i = (n.dataTransfer || n.target).files; - e(".modal-settings").modal("hide"), t.each(i, function(e) { - var t = new FileReader(); - t.onload = function(e) { - return function(t) { - var n = t.target.result; + e(".modal-settings").modal("hide"), t.each(i, function(t) { + var n = new FileReader(); + n.onload = function(t) { + return function(n) { try { - JSON.parse(n); - } catch (t) { - return s.onError(e.name + " is not a valid JSON file."), void 0; + if (c = JSON.parse(n.target.result), /^v/.test(c.version) === !1) throw 1; + e(".modal-import-docs-settings").modal("show"); + } catch (n) { + s.onError("Wrong format: " + t.name); } - localStorage.settings = n, window.location.reload(); + e("#input-file-import-docs-settings").val(""); }; - }(e); - var n = e.slice(0, IMPORT_FILE_MAX_CONTENT_SIZE); - t.readAsText(n); + }(t), n.readAsText(t); }); - }), e(".action-export-settings").click(function() { - o.saveAs(JSON.stringify(r), "StackEdit Settings.json"); + }), e(".action-import-docs-settings-confirm").click(function() { + localStorage.clear(); + var e = /^file\.|^focusMode$|^folder\.|^publish\.|^settings$|^sync\.|^theme$|^version$|^welcomeTour$/; + t.each(c, function(t, n) { + e.test(n) && (localStorage[n] = t); + }), window.location.reload(); + }), e(".action-export-docs-settings").click(function() { + o.saveAs(JSON.stringify(localStorage), "StackEdit local storage.json"); }), e(".action-default-settings").click(function() { localStorage.removeItem("settings"), localStorage.removeItem("theme"), window.location.reload(); }), e(".action-app-reset").click(function() { @@ -26384,7 +26435,7 @@ if (hljs.LANGUAGES.glsl = function(e) { trigger: "hover", title: "Thanks for supporting StackEdit by adding a backlink in your documents!" }); - var c = !1; + var u = !1; if (e(".tooltip-usercustom-extension").tooltip({ html: !0, container: ".modal-settings .modal-dialog", @@ -26393,8 +26444,8 @@ if (hljs.LANGUAGES.glsl = function(e) { title: h }).click(function(t) { e(this).tooltip("show"), e(document).on("click.tooltip-usercustom-extension", function() { - c = !1, e(".tooltip-usercustom-extension").tooltip("hide"), e(document).off("click.tooltip-usercustom-extension"); - }), !c && t.stopPropagation(), c = !0; + u = !1, e(".tooltip-usercustom-extension").tooltip("hide"), e(document).off("click.tooltip-usercustom-extension"); + }), !u && t.stopPropagation(), u = !0; }), t.each(document.querySelectorAll(".tooltip-template"), function(t) { var n = e(t); n.tooltip({ @@ -26405,8 +26456,8 @@ if (hljs.LANGUAGES.glsl = function(e) { title: d }).click(function(t) { n.tooltip("show"), e(document).on("click.tooltip-template", function() { - c = !1, e(".tooltip-template").tooltip("hide"), e(document).off("click.tooltip-template"); - }), !c && t.stopPropagation(), c = !0; + u = !1, e(".tooltip-template").tooltip("hide"), e(document).off("click.tooltip-template"); + }), !u && t.stopPropagation(), u = !0; }); }), e("div.dropdown-menu").click(function(e) { e.stopPropagation(); @@ -26424,10 +26475,10 @@ if (hljs.LANGUAGES.glsl = function(e) { var n = e(t), i = n.data("stackeditSrc"); i && n.attr("src", baseDir + "/img/" + i); }), viewerMode === !1) { - var u = t.reduce(THEME_LIST, function(e, t, n) { + var p = t.reduce(THEME_LIST, function(e, t, n) { return e + '"; }, ""); - document.getElementById("input-settings-theme").innerHTML = u; + document.getElementById("input-settings-theme").innerHTML = p; } }), E; }), define("text!../WELCOME.md", [], function() { diff --git a/public/res-min/themes/blue-gray.css b/public/res-min/themes/blue-gray.css index 11a1912c..5010ea71 100644 --- a/public/res-min/themes/blue-gray.css +++ b/public/res-min/themes/blue-gray.css @@ -1440,9 +1440,9 @@ a{-webkit-transition:background-color ease-in-out .15s,color ease-in-out .15s,bo .list-group-item.active:hover{background-color:#888888} .move-to-front{z-index:1050 !important} .btn{padding:8px 11px;-webkit-transition:background-color ease-in-out .15s,color ease-in-out .15s,z-index ease-in-out .15s;transition:background-color ease-in-out .15s,color ease-in-out .15s,z-index ease-in-out .15s} -.btn-default:hover{background-color:rgba(0,0,0,0.05)} -.btn-primary:hover{color:#ffffff;background-color:#747474} -.btn-success:hover,.open .dropdown-toggle.btn-success{color:#545454;background-color:#f0f3f4 !important} +.btn-default:hover,.btn-default:focus,.btn-default:active{background-color:rgba(0,0,0,0.05)} +.btn-primary:hover,.btn-primary:focus,.btn-primary:active{color:#ffffff;background-color:#747474} +.btn-success:hover,.btn-success:focus,.btn-success:active,.open .dropdown-toggle.btn-success{color:#545454;background-color:#f0f3f4 !important} .btn-group>.btn+.dropdown-toggle{padding-right:11px;padding-left:11px} .form-inline .col-lg-1{width:8.333333333333332%} .form-inline .col-lg-2{width:16.666666666666664%} diff --git a/public/res-min/themes/default.css b/public/res-min/themes/default.css index 48b70f18..6791f60d 100644 --- a/public/res-min/themes/default.css +++ b/public/res-min/themes/default.css @@ -1440,9 +1440,9 @@ a{-webkit-transition:background-color ease-in-out .15s,color ease-in-out .15s,bo .list-group-item.active:hover{background-color:#888888} .move-to-front{z-index:1050 !important} .btn{padding:8px 11px;-webkit-transition:background-color ease-in-out .15s,color ease-in-out .15s,z-index ease-in-out .15s;transition:background-color ease-in-out .15s,color ease-in-out .15s,z-index ease-in-out .15s} -.btn-default:hover{background-color:rgba(0,0,0,0.05)} -.btn-primary:hover{color:#ffffff;background-color:#747474} -.btn-success:hover,.open .dropdown-toggle.btn-success{color:#545454;background-color:#f1f1f1 !important} +.btn-default:hover,.btn-default:focus,.btn-default:active{background-color:rgba(0,0,0,0.05)} +.btn-primary:hover,.btn-primary:focus,.btn-primary:active{color:#ffffff;background-color:#747474} +.btn-success:hover,.btn-success:focus,.btn-success:active,.open .dropdown-toggle.btn-success{color:#545454;background-color:#f1f1f1 !important} .btn-group>.btn+.dropdown-toggle{padding-right:11px;padding-left:11px} .form-inline .col-lg-1{width:8.333333333333332%} .form-inline .col-lg-2{width:16.666666666666664%} diff --git a/public/res-min/themes/night.css b/public/res-min/themes/night.css index 9a4d1d74..ae6b9808 100644 --- a/public/res-min/themes/night.css +++ b/public/res-min/themes/night.css @@ -1440,9 +1440,9 @@ a{-webkit-transition:background-color ease-in-out .15s,color ease-in-out .15s,bo .list-group-item.active:hover{background-color:#444444} .move-to-front{z-index:1050 !important} .btn{padding:8px 11px;-webkit-transition:background-color ease-in-out .15s,color ease-in-out .15s,z-index ease-in-out .15s;transition:background-color ease-in-out .15s,color ease-in-out .15s,z-index ease-in-out .15s} -.btn-default:hover{background-color:rgba(255,255,255,0.08)} -.btn-primary:hover{color:#ffffff;background-color:#585858} -.btn-success:hover,.open .dropdown-toggle.btn-success{color:#dedede;background-color:#565656 !important} +.btn-default:hover,.btn-default:focus,.btn-default:active{background-color:rgba(255,255,255,0.08)} +.btn-primary:hover,.btn-primary:focus,.btn-primary:active{color:#ffffff;background-color:#585858} +.btn-success:hover,.btn-success:focus,.btn-success:active,.open .dropdown-toggle.btn-success{color:#dedede;background-color:#565656 !important} .btn-group>.btn+.dropdown-toggle{padding-right:11px;padding-left:11px} .form-inline .col-lg-1{width:8.333333333333332%} .form-inline .col-lg-2{width:16.666666666666664%} diff --git a/public/res-min/themes/school.css b/public/res-min/themes/school.css index c216d751..e921c9e4 100644 --- a/public/res-min/themes/school.css +++ b/public/res-min/themes/school.css @@ -1440,9 +1440,9 @@ a{-webkit-transition:background-color ease-in-out .15s,color ease-in-out .15s,bo .list-group-item.active:hover{background-color:#888888} .move-to-front{z-index:1050 !important} .btn{padding:8px 11px;-webkit-transition:background-color ease-in-out .15s,color ease-in-out .15s,z-index ease-in-out .15s;transition:background-color ease-in-out .15s,color ease-in-out .15s,z-index ease-in-out .15s} -.btn-default:hover{background-color:rgba(0,0,0,0.05)} -.btn-primary:hover{color:#ffffff;background-color:#747474} -.btn-success:hover,.open .dropdown-toggle.btn-success{color:#eeeeee;background-color:#406b5b !important} +.btn-default:hover,.btn-default:focus,.btn-default:active{background-color:rgba(0,0,0,0.05)} +.btn-primary:hover,.btn-primary:focus,.btn-primary:active{color:#ffffff;background-color:#747474} +.btn-success:hover,.btn-success:focus,.btn-success:active,.open .dropdown-toggle.btn-success{color:#eeeeee;background-color:#406b5b !important} .btn-group>.btn+.dropdown-toggle{padding-right:11px;padding-left:11px} .form-inline .col-lg-1{width:8.333333333333332%} .form-inline .col-lg-2{width:16.666666666666664%} diff --git a/public/res/config.js b/public/res/config.js index 8e3dcdea..a74ca3fa 100644 --- a/public/res/config.js +++ b/public/res/config.js @@ -1,4 +1,4 @@ -var VERSION = "2.1.7"; +var VERSION = "2.2.0"; var MAIN_URL = "https://stackedit.io/"; var GOOGLE_ANALYTICS_ACCOUNT_ID = "UA-39556145-1"; diff --git a/public/res/core.js b/public/res/core.js index 601d6e39..020c0a81 100644 --- a/public/res/core.js +++ b/public/res/core.js @@ -826,18 +826,17 @@ define([ var reader = new FileReader(); reader.onload = (function(importedFile) { return function(e) { - var content = e.target.result; try { - newLocalStorage = JSON.parse(content); - if(!newLocalStorage.version) { + newLocalStorage = JSON.parse(e.target.result); + if(/^v/.test(newLocalStorage.version) === false) { throw 1; } $('.modal-import-docs-settings').modal('show'); } catch(e) { eventMgr.onError("Wrong format: " + importedFile.name); - return; } + $("#input-file-import-docs-settings").val(''); }; })(file); reader.readAsText(file);