diff options
author | pekepeke | 2008-11-01 04:24:26 +0000 |
---|---|---|
committer | pekepeke | 2008-11-01 04:24:26 +0000 |
commit | 40f13ee987f551cb5bccfa8330e4738f1191c2a9 (patch) | |
tree | bc7e78689711875e384b207bc99eba104bf7cad9 /copy.js | |
parent | adda95c12d27f64b046a9af4c36c9e40944d4c91 (diff) | |
download | vimperator-plugins-40f13ee987f551cb5bccfa8330e4738f1191c2a9.tar.bz2 |
handling for 2.0pre
git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@22491 d0d07461-0603-4401-acd4-de1884942a52
Diffstat (limited to 'copy.js')
-rw-r--r-- | copy.js | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -79,8 +79,8 @@ liberator.globalVariables.copy_templates.forEach(function(template){ // used when argument is none //const defaultValue = templates[0].label; commands.addUserCommand(['copy'],'Copy to clipboard', - function(arg, special){ - liberator.plugins.exCopy.copy(arg, special); + function(args, special){ + liberator.plugins.exCopy.copy(args, special); },{ completer: function(filter, special){ if (special){ @@ -120,7 +120,7 @@ function replaceVariable(str){ var win = new XPCNativeWrapper(window.content.window); var sel = '',htmlsel = ''; if (str.indexOf('%SEL%') >= 0 || str.indexOf('%HTMLSEL%') >= 0){ - sel = win.getSelection().getRangeAt(0); + sel = win.getSelection().rangeCount()>0? win.getSelection().getRangeAt(0): ''; } if (str.indexOf('%HTMLSEL%') >= 0){ var serializer = new XMLSerializer(); @@ -143,7 +143,8 @@ var exCopyManager = { get: function(label){ return getCopyTemplate(label); }, - copy: function(arg, special){ + copy: function(args, special){ + var arg = args.string == undefined ? args: args.string; var copyString = ''; var isError = false; if (special && arg){ |