bugfix + notes + help links...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2017-01-24 06:14:38 +03:00
parent 63bc65b3e5
commit fa198967d7
4 changed files with 64 additions and 24 deletions

View File

@ -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;
}

View File

@ -113,9 +113,12 @@ var StatusBarActions = actions.Actions({
: $('<span>')
.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($('<span>')
.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(){

View File

@ -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($('<div class="action">')
.prop('tabindex', true)
.append($('<h2>').text(doc[action][2]))
.append($('<i>').text(doc[action][0]))
.append($('<h2>')
.text(doc[action][2]))
.append($('<i>')
.text(doc[action][0]))
.append($('<hr>'))
.append($('<pre>').html((doc[action][1] || '')
.replace(/&/g, '&amp;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
// normalize tabs...
.replace(/ {0,3}\t/g, ' ')
// comments...
.replace(/(\/\/.*)\n/g, '<span class="comment">$1</span>\n')
.replace(/NOTE:/g, '<b>NOTE:</b>')
.append($('<pre>')
.html((doc[action][1] || '')
// html stuff...
.replace(/&/g, '&amp;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
// 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, '<span class="comment">$1</span>\n')
// notes...
.replace(/NOTE:/g, '<b>NOTE:</b>')
.replace(/XXX/g, '<span class="warning">XXX</span>')
// action links...
.replace(/(\s)(\.([\w_]+[\w\d_]*)\([^)]*\))/g,
'$1<a href="#" onclick="ig.showDoc(\'$3\')">$2</a>')
)))
})
return res
})],
listDialogs: ['Interface/Dialog/Dialog list...',
makeUIDialog(function(){

View File

@ -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)