mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 02:10:08 +00:00
cleanup and refactoring...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
edd0fba141
commit
c49aa7857b
@ -1274,7 +1274,8 @@ stretching in width... */
|
||||
}
|
||||
.overlay-info .ribbon-number:before {
|
||||
content: "R:";
|
||||
opacity: 0.6;
|
||||
|
||||
opacity: 0.7;
|
||||
}
|
||||
/* XXX not sure if we need to expand this
|
||||
.overlay-info .ribbon-number:hover:before {
|
||||
|
||||
@ -2017,6 +2017,7 @@ var FileSystemWriterUIActions = actions.Actions({
|
||||
|
||||
var path = elem.find('.text').last()
|
||||
.makeEditable({
|
||||
activate: true,
|
||||
clear_on_edit: false,
|
||||
abort_keys: [
|
||||
'Esc',
|
||||
@ -2046,6 +2047,7 @@ var FileSystemWriterUIActions = actions.Actions({
|
||||
// XXX multiline???
|
||||
var path = elem.find('.text').last()
|
||||
.makeEditable({
|
||||
activate: true,
|
||||
multiline: true,
|
||||
clear_on_edit: false,
|
||||
abort_keys: [
|
||||
|
||||
@ -110,7 +110,7 @@ var StatusBarActions = actions.Actions({
|
||||
: $('<span>')
|
||||
.addClass('position editable')
|
||||
.attr('info', 'Image position (click to edit)')
|
||||
.makeEditable({ clear_on_edit: false })
|
||||
.makeEditable()
|
||||
// select image when done...
|
||||
.on('edit-done', function(_, text){
|
||||
var i = parseInt(text)
|
||||
@ -188,7 +188,7 @@ var StatusBarActions = actions.Actions({
|
||||
item = $('<span>')
|
||||
.addClass('ribbon-number')
|
||||
.attr('info', 'Current ribbon (click to edit)')
|
||||
.makeEditable({ clear_on_edit: false })
|
||||
.makeEditable()
|
||||
.on('edit-done', function(_, text){
|
||||
that.focusRibbon(text == '*' ? that.base : parseInt(text))
|
||||
})
|
||||
|
||||
@ -39,7 +39,6 @@ function(list, item, elem, callback, options){
|
||||
return elem
|
||||
.makeEditable({
|
||||
activate: true,
|
||||
clear_on_edit: false,
|
||||
})
|
||||
.on('edit-done', callback || function(){})
|
||||
.on('edit-aborted edit-done', function(_, text){
|
||||
@ -95,6 +94,7 @@ function(actions, list_key, options){
|
||||
return $(elem).find('.text')
|
||||
.makeEditable({
|
||||
activate: true,
|
||||
clear_on_edit: true,
|
||||
blur_on_abort: false,
|
||||
blur_on_commit: false,
|
||||
})
|
||||
|
||||
@ -373,6 +373,9 @@ if(typeof(jQuery) != typeof(undefined)){
|
||||
// // set multi line edit mode...
|
||||
// multiline: false,
|
||||
//
|
||||
// // clear element value on edit...
|
||||
// clear_on_edit: false,
|
||||
//
|
||||
// // reset value on abort...
|
||||
// reset_on_abort: true,
|
||||
//
|
||||
@ -384,9 +387,6 @@ if(typeof(jQuery) != typeof(undefined)){
|
||||
// clear_selection_on_abort: true,
|
||||
// clear_selection_on_commit: true,
|
||||
//
|
||||
// // clear element value on edit...
|
||||
// clear_on_edit: true,
|
||||
//
|
||||
// // Keys that will abort the edit...
|
||||
// abort_keys: [
|
||||
// 'Esc',
|
||||
@ -419,12 +419,12 @@ if(typeof(jQuery) != typeof(undefined)){
|
||||
|
||||
var original = this.text()
|
||||
|
||||
if(options.clear_on_edit == null || options.clear_on_edit){
|
||||
this.text('')
|
||||
}
|
||||
|
||||
this.prop('contenteditable', true)
|
||||
|
||||
options.activate
|
||||
&& options.clear_on_edit
|
||||
&& this.text('')
|
||||
|
||||
// NOTE: this will also focus the element...
|
||||
options.activate && this.selectText()
|
||||
|
||||
@ -467,9 +467,16 @@ if(typeof(jQuery) != typeof(undefined)){
|
||||
that.trigger('commit')
|
||||
}
|
||||
})
|
||||
.on('blur', function(){
|
||||
.blur(function(){
|
||||
window.getSelection().removeAllRanges()
|
||||
})
|
||||
.on('focus click', function(evt){
|
||||
evt.stopPropagation()
|
||||
options.clear_on_edit
|
||||
&& $(this)
|
||||
.text('')
|
||||
.selectText()
|
||||
})
|
||||
// user triggerable events...
|
||||
.on('abort', function(){
|
||||
that.trigger('edit-aborted', original)
|
||||
|
||||
@ -143,7 +143,9 @@ var BrowserClassPrototype = {
|
||||
.attr('tabindex', 0)
|
||||
// focus the widget if something inside is clicked...
|
||||
.click(function(){
|
||||
$(this).focus()
|
||||
if($(this).find(':focus').length == 0){
|
||||
$(this).focus()
|
||||
}
|
||||
})
|
||||
|
||||
if(options.flat){
|
||||
@ -524,7 +526,17 @@ var BrowserPrototype = {
|
||||
//trigger: widget.triggerEventWithSource,
|
||||
|
||||
// specific events...
|
||||
focus: widget.proxyToDom('focus'),
|
||||
focus: function(handler){
|
||||
if(handler != null){
|
||||
this.on('focus', handler)
|
||||
|
||||
// focus only if we do not have focus...
|
||||
} else if(!this.dom.is(':focus')
|
||||
&& this.dom.find(':focus').length == 0) {
|
||||
this.dom.focus()
|
||||
}
|
||||
return this
|
||||
},
|
||||
blur: widget.proxyToDom('blur'),
|
||||
|
||||
|
||||
@ -1118,7 +1130,6 @@ var BrowserPrototype = {
|
||||
if(focus && browser.find(':focus').length == 0){
|
||||
that.focus()
|
||||
}
|
||||
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
@ -129,11 +129,9 @@ var OverlayPrototype = {
|
||||
.addClass('blur')
|
||||
.append(this.dom)
|
||||
|
||||
// pass focus to the client...
|
||||
// pass focus to the client if it is not focused already...
|
||||
this.on('focus click', function(){
|
||||
if(client.dom && client.focus){
|
||||
client.focus()
|
||||
}
|
||||
client.focus && client.focus()
|
||||
})
|
||||
|
||||
this.focus()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user