mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-12-26 21:11:57 +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;
|
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 {
|
.browse .list:empty {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,6 +6,15 @@
|
|||||||
|
|
||||||
//var DEBUG = DEBUG != null ? DEBUG : true
|
//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 = {}
|
define(function(require){ var module = {}
|
||||||
|
|
||||||
|
|
||||||
@ -326,6 +335,51 @@ var BrowserPrototype = {
|
|||||||
set path(value){
|
set path(value){
|
||||||
return this.update(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...
|
// update path...
|
||||||
// - build the path
|
// - build the path
|
||||||
@ -452,7 +506,7 @@ var BrowserPrototype = {
|
|||||||
res.forEach(make)
|
res.forEach(make)
|
||||||
}
|
}
|
||||||
|
|
||||||
this.dom.attr('path', '/' + this.path.join('/'))
|
this.dom.attr('path', this.strPath)
|
||||||
this.trigger('update')
|
this.trigger('update')
|
||||||
|
|
||||||
// maintain focus within the widget...
|
// maintain focus within the widget...
|
||||||
@ -673,7 +727,7 @@ var BrowserPrototype = {
|
|||||||
startFullPathEdit: function(){
|
startFullPathEdit: function(){
|
||||||
if(this.options.fullpathedit){
|
if(this.options.fullpathedit){
|
||||||
var browser = this.dom
|
var browser = this.dom
|
||||||
var path = '/' + this.path.join('/')
|
var path = this.strPath
|
||||||
var orig = this.select('!').text()
|
var orig = this.select('!').text()
|
||||||
browser
|
browser
|
||||||
.attr('orig-path', path)
|
.attr('orig-path', path)
|
||||||
@ -1191,13 +1245,22 @@ var BrowserPrototype = {
|
|||||||
})
|
})
|
||||||
// handle paste...
|
// handle paste...
|
||||||
// XXX does not work on IE yet...
|
// 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(){
|
.on('paste', function(){
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
var path = event.clipboardData.getData('text/plain')
|
that.paste()
|
||||||
that.path = path
|
|
||||||
})
|
})
|
||||||
// XXX handle copy...
|
// XXX handle copy...
|
||||||
// XXX
|
/* XXX
|
||||||
|
.on('cut copy', function(){
|
||||||
|
event.preventDefault()
|
||||||
|
that.copy()
|
||||||
|
})
|
||||||
|
*/
|
||||||
|
|
||||||
// add keyboard handler...
|
// add keyboard handler...
|
||||||
dom.keydown(
|
dom.keydown(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user