From 219726e71bde0a5b702835573d9026e1da502eee Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Sun, 28 Jun 2015 05:23:31 +0300 Subject: [PATCH] disabled clipboard events in browser, added nw.js triggering, still not sure if we actually need them... Signed-off-by: Alex A. Naanou --- ui (gen4)/experiments/browse-dialog.js | 46 +++++++++++++++++++++++--- 1 file changed, 41 insertions(+), 5 deletions(-) diff --git a/ui (gen4)/experiments/browse-dialog.js b/ui (gen4)/experiments/browse-dialog.js index 19531c8d..54daa376 100755 --- a/ui (gen4)/experiments/browse-dialog.js +++ b/ui (gen4)/experiments/browse-dialog.js @@ -148,6 +148,9 @@ var BrowserPrototype = { '/', 'A', + 'C', + 'V', + 'X', ], Enter: 'stopFullPathEdit!', @@ -168,6 +171,10 @@ var BrowserPrototype = { 'Esc', '/', 'A', + + 'C', + 'V', + 'X', ], Enter: 'action!', @@ -1239,23 +1246,33 @@ var BrowserPrototype = { }) .keyup(function(){ var e = $(this) + // clear the list on edit... if(e.attr('contenteditable') && e.text() != dom.attr('orig-path')){ dom.find('.list').empty() } }) - // handle paste... + /* XXX + // Handle copy/paste... + // + // Make the whole widget support copy/paste of current path. + // + // NOTE: on nw.js mode this will handle this via keyboard + // directly, skipping the events and their quirks... + // // XXX does not work on IE yet... // XXX do we handle other types??? - // ...try an get the path of anything... + // ...try and get the path of anything, including files, dirs, etc... // XXX seems not to work until we cycle any of the editable // controls (filter/path), and then it still is on and // off... - .on('paste', function(){ + // XXX does not work with ':not([contenteditable])' and kills + // copy/paste on editable fields without... + // XXX do we bother with these?? + .on('paste', ':not([contenteditable])', function(){ event.preventDefault() that.paste() }) - // XXX handle copy... - /* XXX + // XXX does not work... .on('cut copy', function(){ event.preventDefault() that.copy() @@ -1281,6 +1298,25 @@ var BrowserPrototype = { } +/* +// nw.js copy/paste handling... +// +// XXX not sure if we actually need these... +if(NW){ + // override copy... + BrowserPrototype.keyboard.General.C = { + ctrl: 'copy!', + } + BrowserPrototype.keyboard.General.X = 'C' + + // override paste... + BrowserPrototype.keyboard.General.V = { + ctrl: 'paste!', + } +} +*/ + + var Browser = module.Browser = object.makeConstructor('Browser',