From 4a33c79eb2f38d54add63a609c02d6c2d09b06ff Mon Sep 17 00:00:00 2001 From: Simon Lydell Date: Tue, 21 Feb 2017 16:57:30 +0100 Subject: [PATCH] Fix the `yy` command in Reader View Fixes #865. --- extension/lib/commands.coffee | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/extension/lib/commands.coffee b/extension/lib/commands.coffee index 5b2a7a8..626ce7d 100644 --- a/extension/lib/commands.coffee +++ b/extension/lib/commands.coffee @@ -40,6 +40,7 @@ viewportUtils = require('./viewport') {ContentClick} = Cu.import('resource:///modules/ContentClick.jsm', {}) {FORWARD, BACKWARD} = SelectionManager +READER_VIEW_PREFIX = 'about:reader?url=' SPRING_CONSTANT_PREF = 'layout.css.scroll-behavior.spring-constant' commands = {} @@ -67,7 +68,13 @@ commands.paste_and_go = helper_paste_and_go.bind(null, null) commands.paste_and_go_in_tab = helper_paste_and_go.bind(null, {altKey: true}) commands.copy_current_url = ({vim}) -> - utils.writeToClipboard(vim.window.gBrowser.currentURI.spec) + url = vim.window.gBrowser.currentURI.spec + adjustedUrl = + if url.startsWith(READER_VIEW_PREFIX) + decodeURIComponent(url[READER_VIEW_PREFIX.length..]) + else + url + utils.writeToClipboard(adjustedUrl) vim.notify(translate('notification.copy_current_url.success')) commands.go_up_path = ({vim, count}) -> -- 2.39.3