From 7a3a288daef5206d3dbed5ec7de9e03d8e04f633 Mon Sep 17 00:00:00 2001 From: Keith L Robertson Date: Fri, 15 Mar 2019 18:21:12 -0400 Subject: [PATCH] Update 1.5.0 - Updated version for release of TOC menu and emoji - Tweaked use of Promise from storage.get() - BTW no longer works in Chrome; it doesn't follow spec --- ext/content.js | 12 +++++------- manifest.json | 2 +- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/ext/content.js b/ext/content.js index 6d73d97..fe6825e 100644 --- a/ext/content.js +++ b/ext/content.js @@ -18,14 +18,13 @@ function addExtensionStylesheet(href, media) { function addCustomStylesheet() { var p = webext.storage.sync.get('custom_css') - p.then((storage) => { + return p.then((storage) => { if ('custom_css' in storage) { var style = document.createElement('style'); style.textContent = storage.custom_css; document.head.appendChild(style); } }); - return p; } function makeAnchor(node) { @@ -319,11 +318,10 @@ if (body.childNodes.length === 1 && if (hash > 0) url = url.substr(0, hash); // Exclude fragment id from key. var scrollPosKey = encodeURIComponent(url) + ".scrollPosition"; - processMarkdown(textContent).then(() => - addMarkdownViewerMenu().then(() => - createHTMLSourceBlob() - ) - ) + processMarkdown(textContent) + .then(() => addMarkdownViewerMenu()) + .then(() => createHTMLSourceBlob()); + try { window.scrollTo.apply(window, JSON.parse(sessionStorage[scrollPosKey] || '[0,0]')); } catch(err) {} diff --git a/manifest.json b/manifest.json index a274f05..447cdc7 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 2, "name": "Markdown Viewer Webext", - "version": "1.4.0", + "version": "1.5.0", "author": "Keith L Robertson", "homepage_url": "https://github.com/KeithLRobertson/markdown-viewer", "description": "Displays markdown documents beautified in your browser.",