mirror of
				https://github.com/flynx/ImageGrid.git
				synced 2025-10-31 11:20:09 +00:00 
			
		
		
		
	now comments are edited from the info dialog + idetified and fixed a couple of bugs with button-less dialogs...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									d020318fe7
								
							
						
					
					
						commit
						a23acab9ec
					
				| @ -78,19 +78,28 @@ var KEYBOARD_CONFIG = { | ||||
| 
 | ||||
| 		ignore: '*', | ||||
| 
 | ||||
| 		Enter: doc('Accept dialog', | ||||
| 			function(){ | ||||
| 				var f = $(':focus') | ||||
| 				// trigger the default button action...
 | ||||
| 				if(/button/i.test(f[0].tagName) || f.attr('type') == 'button'){ | ||||
| 					return true | ||||
| 		'insert-return': doc('Insert return'), | ||||
| 
 | ||||
| 				// accept the dialog...
 | ||||
| 				} else { | ||||
| 					getOverlay($('.viewer')).trigger('accept') | ||||
| 					hideOverlay($('.viewer'))  | ||||
| 				} | ||||
| 			}), | ||||
| 		Enter: { | ||||
| 				default: doc('Accept dialog', | ||||
| 					function(){ | ||||
| 						var f = $(':focus') | ||||
| 						 | ||||
| 						// trigger the default button action...
 | ||||
| 						if(f.length > 0  | ||||
| 								&& (/button/i.test(f[0].tagName)  | ||||
| 									|| f.attr('type') == 'button')){ | ||||
| 							return true | ||||
| 
 | ||||
| 						// accept the dialog...
 | ||||
| 						} else { | ||||
| 							getOverlay($('.viewer')).trigger('accept') | ||||
| 							hideOverlay($('.viewer'))  | ||||
| 						} | ||||
| 					}), | ||||
| 				shift: 'insert-return', | ||||
| 				//ctrl: 'insert-return',
 | ||||
| 			}, | ||||
| 		Esc: doc('Close dialog',  | ||||
| 			function(){  | ||||
| 				//getOverlay($('.viewer')).trigger('close')
 | ||||
| @ -616,8 +625,6 @@ var KEYBOARD_CONFIG = { | ||||
| 				// marking...
 | ||||
| 				ctrl: 'invert-marks', | ||||
| 			}, | ||||
| 		// XXX this is not permanent...
 | ||||
| 		C: doc('Edit image comment', imageCommentDialog), | ||||
| 		P: { | ||||
| 				default: doc('Show options', | ||||
| 					function(){ toggleOptionsUI() }), | ||||
|  | ||||
							
								
								
									
										53
									
								
								ui/ui.js
									
									
									
									
									
								
							
							
						
						
									
										53
									
								
								ui/ui.js
									
									
									
									
									
								
							| @ -726,6 +726,8 @@ function formDialog(root, message, config, btn, cls){ | ||||
| 	if(btn !== false){ | ||||
| 		var button = $('<button class="accept">'+btn+'</button>') | ||||
| 		form.append(button) | ||||
| 	} else { | ||||
| 		var button = null | ||||
| 	} | ||||
| 
 | ||||
| 	var overlay = showInOverlay(root, form) | ||||
| @ -745,9 +747,11 @@ function formDialog(root, message, config, btn, cls){ | ||||
| 
 | ||||
| 		}) | ||||
| 
 | ||||
| 	button.click(function(){ | ||||
| 		overlay.trigger('accept') | ||||
| 	}) | ||||
| 	if(button != null){ | ||||
| 		button.click(function(){ | ||||
| 			overlay.trigger('accept') | ||||
| 		}) | ||||
| 	} | ||||
| 
 | ||||
| 	setTimeout(function(){  | ||||
| 		form.find('.field input').first() | ||||
| @ -976,22 +980,39 @@ function showImageInfo(){ | ||||
| 	var name = data.path.split('/').pop() | ||||
| 	var comment = data.comment | ||||
| 	comment = comment == null ? '' : comment | ||||
| 	comment = comment.replace(/\n/g, '<br>') | ||||
| 
 | ||||
| 	// make this something other than alert...
 | ||||
| 	alert('<div>'+ | ||||
| 			'<h2>"'+ name +'"</h2>'+ | ||||
| 				'<h2>"'+ name +'"</h2>'+ | ||||
| 
 | ||||
| 			'<table>'+ | ||||
| 				'<tr><td>GID: </td><td>'+ gid +'</td></tr>'+ | ||||
| 				'<tr><td>Path: </td><td>"'+ data.path +'"</td></tr>'+ | ||||
| 				'<tr><td>Orientation: </td><td>'+ orientation +'°'+flipped+'</td></tr>'+ | ||||
| 				'<tr><td>Order: </td><td>'+ order +'</td></tr>'+ | ||||
| 				'<tr><td>Position (ribbon): </td><td>'+ (DATA.ribbons[r].indexOf(gid)+1) + | ||||
| 					'/'+ DATA.ribbons[r].length +'</td></tr>'+ | ||||
| 				'<tr><td>Position (global): </td><td>'+ (order+1) +'/'+ DATA.order.length +'</td></tr>'+ | ||||
| 				'<tr><td colspan="2"><hr></td></tr>'+ | ||||
| 				'<tr><td>Comment: </td><td class="comment">'+ comment +'</td></tr>'+ | ||||
| 			'</table>'+ | ||||
| 		'</div>') | ||||
| 				'<table>'+ | ||||
| 					'<tr><td>GID: </td><td>'+ gid +'</td></tr>'+ | ||||
| 					'<tr><td>Path: </td><td>"'+ data.path +'"</td></tr>'+ | ||||
| 					'<tr><td>Orientation: </td><td>'+ orientation +'°'+flipped+'</td></tr>'+ | ||||
| 					'<tr><td>Order: </td><td>'+ order +'</td></tr>'+ | ||||
| 					'<tr><td>Position (ribbon): </td><td>'+ (DATA.ribbons[r].indexOf(gid)+1) + | ||||
| 						'/'+ DATA.ribbons[r].length +'</td></tr>'+ | ||||
| 					'<tr><td>Position (global): </td><td>'+ (order+1) +'/'+ DATA.order.length +'</td></tr>'+ | ||||
| 
 | ||||
| 					// editable fields...
 | ||||
| 					'<tr><td colspan="2"><hr></td></tr>'+ | ||||
| 					// XXX this expanding to a too big size will not scroll...
 | ||||
| 					// 		add per editable and global dialog max-height and overflow
 | ||||
| 					'<tr><td>Comment: </td><td class="comment" contenteditable>'+ comment +'</td></tr>'+ | ||||
| 				'</table>'+ | ||||
| 			'</div>') | ||||
| 		// XXX hanck???
 | ||||
| 		.done(function(){ | ||||
| 			var comment = $('.dialog .comment').html().replace(/<br>/ig, '\n') | ||||
| 
 | ||||
| 			if(comment.trim() == ''){ | ||||
| 				delete data.comment | ||||
| 			} else { | ||||
| 				data.comment = comment | ||||
| 			} | ||||
| 			IMAGES_UPDATED.push(gid) | ||||
| 		}) | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user