From 1935439ff82af6d1eca903476870f3d4935b5d17 Mon Sep 17 00:00:00 2001 From: Benito Palacios Sanchez Date: Tue, 13 Sep 2016 15:17:22 +0200 Subject: [PATCH] Improve XPath copy to clipboard --- CHANGELOG.md | 1 + keymaps/autocomplete-xml.cson | 2 ++ lib/keymaps/autocomplete-xml.cson | 11 ----------- lib/main.coffee | 8 ++++---- 4 files changed, 7 insertions(+), 15 deletions(-) create mode 100644 keymaps/autocomplete-xml.cson delete mode 100644 lib/keymaps/autocomplete-xml.cson diff --git a/CHANGELOG.md b/CHANGELOG.md index f82a58a..79e2a7b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,5 @@ ## 0.8.4 +* Add keymap to copy the current XPath into the clipboard. * Fix #26 - Error trying to dispose the status bar. * Fix tag value completion for fields with dots. diff --git a/keymaps/autocomplete-xml.cson b/keymaps/autocomplete-xml.cson new file mode 100644 index 0000000..1511b73 --- /dev/null +++ b/keymaps/autocomplete-xml.cson @@ -0,0 +1,2 @@ +'atom-workspace': + 'ctrl-alt-c': 'autocomplete-xml:copy-XPath-to-clipboard' diff --git a/lib/keymaps/autocomplete-xml.cson b/lib/keymaps/autocomplete-xml.cson deleted file mode 100644 index 26e8020..0000000 --- a/lib/keymaps/autocomplete-xml.cson +++ /dev/null @@ -1,11 +0,0 @@ -# Keybindings require three things to be fully defined: A selector that is -# matched against the focused element, the keystroke and the command to -# execute. -# -# Below is a basic keybinding which registers on all platforms by applying to -# the root workspace element. - -# For more detailed documentation see -# https://atom.io/docs/latest/behind-atom-keymaps-in-depth -'atom-workspace': - 'ctrl-alt-c': 'main:copyXpathToClipboard' diff --git a/lib/main.coffee b/lib/main.coffee index 3ceb550..38d4073 100644 --- a/lib/main.coffee +++ b/lib/main.coffee @@ -21,15 +21,15 @@ module.exports = getProvider: -> provider activate: (state) -> - # Events subscribed to in atom's system can be easily cleaned up with a CompositeDisposable @subscriptions = new CompositeDisposable - # Register command that toggles this view - @subscriptions.add atom.commands.add 'atom-workspace', 'main:copyXpathToClipboard': => @copyXpathToClipboard() - @subscriptions.dispose() + @subscriptions.add atom.commands.add 'atom-workspace', + 'autocomplete-xml:copy-XPath-to-clipboard': => @copyXpathToClipboard() deactivate: -> @xpathView?.destroy() @xpathView = null + @subscriptions?.dispose() + @subscription = null consumeStatusBar: (statusBar) -> XPathStatusBarView = require './xpath-statusbar-view'