From fa198967d7ead7931451c6db50bc69a59620c2b7 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Tue, 24 Jan 2017 06:14:38 +0300 Subject: [PATCH] bugfix + notes + help links... Signed-off-by: Alex A. Naanou --- ui (gen4)/css/experimenting.css | 14 +++++++--- ui (gen4)/features/ui-status.js | 14 +++++++--- ui (gen4)/features/ui-widgets.js | 48 +++++++++++++++++++++++--------- ui (gen4)/lib/util.js | 12 ++++++-- 4 files changed, 64 insertions(+), 24 deletions(-) diff --git a/ui (gen4)/css/experimenting.css b/ui (gen4)/css/experimenting.css index 01dfd256..59883843 100755 --- a/ui (gen4)/css/experimenting.css +++ b/ui (gen4)/css/experimenting.css @@ -431,10 +431,6 @@ body { background: white; } -.help-dialog .comment { - color: gray; - font-style: italic; -} /* scrollbar setup... */ .help-dialog::-webkit-scrollbar { @@ -464,6 +460,16 @@ body { } +.help-dialog .comment { + color: gray; + font-style: italic; +} +.help-dialog .warning { + color: blue; + background: yellow; +} + + diff --git a/ui (gen4)/features/ui-status.js b/ui (gen4)/features/ui-status.js index da1c190b..0655a642 100755 --- a/ui (gen4)/features/ui-status.js +++ b/ui (gen4)/features/ui-status.js @@ -113,9 +113,12 @@ var StatusBarActions = actions.Actions({ : $('') .addClass('position editable') .attr('info', 'Image number (click to edit)') - .makeEditable() + .makeEditable({ + propagate_unhandled_keys: false, + reset_on_done: false, + }) // select image when done... - .on('edit-done', function(_, text){ + .on('edit-commit', function(_, text){ var i = parseInt(text) i = i >= 1 ? i-1 : i == null ? 'current' @@ -202,8 +205,11 @@ var StatusBarActions = actions.Actions({ .append($('') .addClass('ribbon-number') .attr('info', 'Current ribbon (click to edit)') - .makeEditable() - .on('edit-done', function(_, text){ + .makeEditable({ + propagate_unhandled_keys: false, + reset_on_done: false, + }) + .on('edit-commit', function(_, text){ that.focusRibbon(text == '*' ? that.base : parseInt(text)-1) }) .focus(function(){ diff --git a/ui (gen4)/features/ui-widgets.js b/ui (gen4)/features/ui-widgets.js index 2f04b1a0..be1c895a 100755 --- a/ui (gen4)/features/ui-widgets.js +++ b/ui (gen4)/features/ui-widgets.js @@ -532,13 +532,22 @@ var DialogsActions = actions.Actions({ return browse.makeList(null, list, options) })], + // Show doc for action... + // // XXX this needs to: // - be a widget // - handle focus // - handle keyboard // - handle search... + // - format action links/references... + // - markdown??? // - ... - showDoc: ['- Interface/Action help', + // XXX use pWiki??? + // XXX should we have navigation??? + // ...i.e. opening links is done in the viewer and we have + // ability to go back and forth... + // XXX STUB... + showDoc: ['Help/Action help...', makeUIDialog(function(actions){ actions = actions || this.actions actions = actions instanceof Array ? actions : [actions] @@ -550,24 +559,37 @@ var DialogsActions = actions.Actions({ actions.forEach(function(action){ res.append($('
') .prop('tabindex', true) - .append($('

').text(doc[action][2])) - .append($('').text(doc[action][0])) + .append($('

') + .text(doc[action][2])) + .append($('') + .text(doc[action][0])) .append($('
')) - .append($('
').html((doc[action][1] || '')
-						.replace(/&/g, '&')
-						.replace(//g, '>')
-						// normalize tabs...
-						.replace(/ {0,3}\t/g, '    ')
-						// comments...
-						.replace(/(\/\/.*)\n/g, '$1\n')
-						.replace(/NOTE:/g, 'NOTE:')
+					.append($('
')
+						.html((doc[action][1] || '')
+							// html stuff...
+							.replace(/&/g, '&')
+							.replace(//g, '>')
+							// normalize tabs -- convert tabs and tabbed 
+							// spaces into 4 spaces...
+							// NOTE: the code internally uses only tabs, 
+							// 		but this will help make the view 
+							// 		consistent.
+							.replace(/ {0,3}\t/g, '    ')
+							// comments...
+							.replace(/(\/\/.*)\n/g, '$1\n')
+							// notes...
+							.replace(/NOTE:/g, 'NOTE:')
+							.replace(/XXX/g, 'XXX')
+
+							// action links...
+							.replace(/(\s)(\.([\w_]+[\w\d_]*)\([^)]*\))/g, 
+								'$1$2')
 					)))
 			})
 
 			return res
 		})],
-	
 
 	listDialogs: ['Interface/Dialog/Dialog list...',
 		makeUIDialog(function(){
diff --git a/ui (gen4)/lib/util.js b/ui (gen4)/lib/util.js
index ed4e8106..189af655 100755
--- a/ui (gen4)/lib/util.js	
+++ b/ui (gen4)/lib/util.js	
@@ -392,6 +392,10 @@ if(typeof(jQuery) != typeof(undefined)){
 	// 		clear_selection_on_abort: true,
 	// 		clear_selection_on_commit: true,
 	//
+	// 		propagate_unhandled_keys: true,
+	//
+	// 		reset_on_done: true,
+	//
 	// 		// Keys that will abort the edit...
 	// 		abort_keys: [
 	// 			'Esc',
@@ -496,7 +500,7 @@ if(typeof(jQuery) != typeof(undefined)){
 						that.trigger('edit-commit', that.text())
 
 					// continue handling...
-					} else {
+					} else if(options.propagate_unhandled_keys !== false){
 						$(this).parent().trigger(evt)
 					}
 				})
@@ -527,7 +531,8 @@ if(typeof(jQuery) != typeof(undefined)){
 					options.keep_focus_on_parent !== false
 						&& that.parents('[tabindex]').first().focus()
 
-					that.makeEditable(false)
+					options.reset_on_done !== false
+						&& that.makeEditable(false)
 				})
 				.on('edit-commit', events['edit-commit'] = function(evt, text){
 					that.trigger('edit-committing', text)
@@ -545,7 +550,8 @@ if(typeof(jQuery) != typeof(undefined)){
 					options.keep_focus_on_parent !== false
 						&& that.parents('[tabindex]').first().focus()
 
-					that.makeEditable(false)
+					options.reset_on_done !== false
+						&& that.makeEditable(false)
 				})
 
 			this.data('editable-field-events', events)