mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-11-03 21:00:14 +00:00
more work on copy/paste, added nw.js version, still not sure about it...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
e23d0efa45
commit
56626a3480
@ -121,6 +121,28 @@
|
||||
overflow-x: hidden;
|
||||
}
|
||||
/*
|
||||
.browse .list:before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
display: inline-block;
|
||||
width: 100%;
|
||||
height: 40px;
|
||||
top: 1px;
|
||||
left: 0px;
|
||||
background: linear-gradient(to top, rgba(128, 128, 128, 0), rgba(128, 128, 128, 1));
|
||||
}
|
||||
.browse .list:after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
display: inline-block;
|
||||
width: 100%;
|
||||
height: 40px;
|
||||
bottom: 0px;
|
||||
left: 0px;
|
||||
background: linear-gradient(to bottom, rgba(128, 128, 128, 0), rgba(128, 128, 128, 1));
|
||||
}
|
||||
*/
|
||||
/*
|
||||
.browse .list:empty {
|
||||
display: block;
|
||||
}
|
||||
|
||||
@ -6,6 +6,15 @@
|
||||
|
||||
//var DEBUG = DEBUG != null ? DEBUG : true
|
||||
|
||||
if(typeof(module) !== 'undefined' && module.exports){
|
||||
var NW = true
|
||||
var gui = require('nw.gui')
|
||||
|
||||
} else {
|
||||
var NW = false
|
||||
}
|
||||
|
||||
|
||||
define(function(require){ var module = {}
|
||||
|
||||
|
||||
@ -326,6 +335,51 @@ var BrowserPrototype = {
|
||||
set path(value){
|
||||
return this.update(value)
|
||||
},
|
||||
// String path...
|
||||
get strPath(){
|
||||
return '/' + this.path.join('/')
|
||||
},
|
||||
// NOTE: this is just a shorthand to .path for uniformity...
|
||||
set strPath(value){
|
||||
this.path = value
|
||||
},
|
||||
|
||||
// Copy/Paste...
|
||||
//
|
||||
// XXX use 'Test' for IE...
|
||||
copy: function(){
|
||||
var path = this.strPath
|
||||
|
||||
if(NW){
|
||||
gui.Clipboard.get()
|
||||
.set(path, 'text')
|
||||
|
||||
// browser...
|
||||
// XXX use 'Test' for IE...
|
||||
} else if(event != undefined){
|
||||
event.clipboardData.setData('text/plain', path)
|
||||
}
|
||||
|
||||
return path
|
||||
},
|
||||
paste: function(str){
|
||||
// generic...
|
||||
if(str != null){
|
||||
this.path = str
|
||||
|
||||
// nw.js
|
||||
} else if(NW){
|
||||
this.path = gui.Clipboard.get()
|
||||
.get('text')
|
||||
|
||||
// browser...
|
||||
// XXX use 'Test' for IE...
|
||||
} else if(event != undefined){
|
||||
this.path = event.clipboardData.getData('text/plain')
|
||||
}
|
||||
|
||||
return this
|
||||
},
|
||||
|
||||
// update path...
|
||||
// - build the path
|
||||
@ -452,7 +506,7 @@ var BrowserPrototype = {
|
||||
res.forEach(make)
|
||||
}
|
||||
|
||||
this.dom.attr('path', '/' + this.path.join('/'))
|
||||
this.dom.attr('path', this.strPath)
|
||||
this.trigger('update')
|
||||
|
||||
// maintain focus within the widget...
|
||||
@ -673,7 +727,7 @@ var BrowserPrototype = {
|
||||
startFullPathEdit: function(){
|
||||
if(this.options.fullpathedit){
|
||||
var browser = this.dom
|
||||
var path = '/' + this.path.join('/')
|
||||
var path = this.strPath
|
||||
var orig = this.select('!').text()
|
||||
browser
|
||||
.attr('orig-path', path)
|
||||
@ -1191,13 +1245,22 @@ var BrowserPrototype = {
|
||||
})
|
||||
// handle paste...
|
||||
// XXX does not work on IE yet...
|
||||
// XXX do we handle other types???
|
||||
// ...try an get the path of anything...
|
||||
// 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(){
|
||||
event.preventDefault()
|
||||
var path = event.clipboardData.getData('text/plain')
|
||||
that.path = path
|
||||
that.paste()
|
||||
})
|
||||
// XXX handle copy...
|
||||
// XXX
|
||||
/* XXX
|
||||
.on('cut copy', function(){
|
||||
event.preventDefault()
|
||||
that.copy()
|
||||
})
|
||||
*/
|
||||
|
||||
// add keyboard handler...
|
||||
dom.keydown(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user