mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-30 02:40:08 +00:00
more work on feature docs...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
9af9dcdc5f
commit
9ea7f416de
@ -741,6 +741,19 @@ module.Dialogs = core.ImageGridFeatures.Feature({
|
|||||||
|
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
|
|
||||||
|
// XXX do not use the global ig for link click handling...
|
||||||
|
var action2lnk =
|
||||||
|
module.action2lnk =
|
||||||
|
function(action){
|
||||||
|
return `<a href="#" onclick="ig.showDoc('${action}')">${action}</a>` }
|
||||||
|
|
||||||
|
// XXX do not use the global ig for link click handling...
|
||||||
|
var feature2lnk =
|
||||||
|
module.feature2lnk =
|
||||||
|
function(tag){
|
||||||
|
return `<a href="#" onclick="ig.showFeatureDoc('${tag}')">${tag}</a>` }
|
||||||
|
|
||||||
|
// XXX do not use the global ig for link click handling...
|
||||||
var doc2html =
|
var doc2html =
|
||||||
module.doc2html =
|
module.doc2html =
|
||||||
function(doc, skip_linking){
|
function(doc, skip_linking){
|
||||||
@ -807,8 +820,9 @@ var UIIntrospectionActions = actions.Actions({
|
|||||||
.append($('<i>')
|
.append($('<i>')
|
||||||
.text(doc[action][0]))
|
.text(doc[action][0]))
|
||||||
.append($('<div>')
|
.append($('<div>')
|
||||||
.text('Features: '
|
.html('Features: '
|
||||||
+ that.getHandlerSourceTags(action)
|
+ that.getHandlerSourceTags(action)
|
||||||
|
.map(feature2lnk)
|
||||||
.join(', ')))
|
.join(', ')))
|
||||||
.append($('<hr>'))
|
.append($('<hr>'))
|
||||||
// parse the action doc...
|
// parse the action doc...
|
||||||
@ -830,9 +844,6 @@ var UIIntrospectionActions = actions.Actions({
|
|||||||
.append($('<pre>')
|
.append($('<pre>')
|
||||||
.text(this.getHandlerDocStr(action))) )
|
.text(this.getHandlerDocStr(action))) )
|
||||||
})],
|
})],
|
||||||
|
|
||||||
// XXX not final...
|
|
||||||
// XXX should we list feature actions???
|
|
||||||
showFeatureDoc: ['Help/Feature help...',
|
showFeatureDoc: ['Help/Feature help...',
|
||||||
makeUIDialog(function(features){
|
makeUIDialog(function(features){
|
||||||
features = features || this.features.features
|
features = features || this.features.features
|
||||||
@ -846,10 +857,7 @@ var UIIntrospectionActions = actions.Actions({
|
|||||||
.addClass('help-dialog')
|
.addClass('help-dialog')
|
||||||
|
|
||||||
var tag2lnk = function(tag){
|
var tag2lnk = function(tag){
|
||||||
return tag != '-'?
|
return tag != '-'? feature2lnk(tag) : '-' }
|
||||||
`<a href="#" onclick="ig.showFeatureDoc('${tag}')">${tag}</a>`
|
|
||||||
: '-'
|
|
||||||
}
|
|
||||||
|
|
||||||
features.forEach(function(tag){
|
features.forEach(function(tag){
|
||||||
var feature = featureset[tag.startsWith('-') ? tag.slice(1) : tag]
|
var feature = featureset[tag.startsWith('-') ? tag.slice(1) : tag]
|
||||||
@ -869,6 +877,7 @@ var UIIntrospectionActions = actions.Actions({
|
|||||||
: 'loaded'))
|
: 'loaded'))
|
||||||
.append($('<div>')
|
.append($('<div>')
|
||||||
.html('Tag: '+ tag2lnk(tag) ))
|
.html('Tag: '+ tag2lnk(tag) ))
|
||||||
|
|
||||||
.append($('<div>')
|
.append($('<div>')
|
||||||
.html('Priority: '+ (feature.getPriority ?
|
.html('Priority: '+ (feature.getPriority ?
|
||||||
feature.getPriority(true)
|
feature.getPriority(true)
|
||||||
@ -895,6 +904,30 @@ var UIIntrospectionActions = actions.Actions({
|
|||||||
+ (feature.suggested || ['-'])
|
+ (feature.suggested || ['-'])
|
||||||
.map(tag2lnk)
|
.map(tag2lnk)
|
||||||
.join(', ')))
|
.join(', ')))
|
||||||
|
|
||||||
|
// list actions, props and handlers...
|
||||||
|
.append($('<hr>'))
|
||||||
|
.append($('<div>')
|
||||||
|
.html('Props: <i>not implemented</i>'))
|
||||||
|
.append($('<div>')
|
||||||
|
.html('Actions: '
|
||||||
|
+ Object.keys(feature.actions || {'-': null})
|
||||||
|
.filter(function(n){
|
||||||
|
return n == '-'
|
||||||
|
|| (Object.getOwnPropertyDescriptor(feature.actions, n) || {}).value instanceof actions.Action })
|
||||||
|
.map(function(n){
|
||||||
|
return n == '-' ? n : action2lnk(n) })
|
||||||
|
.join(', ')))
|
||||||
|
.append($('<div>')
|
||||||
|
.html('Handlers: '
|
||||||
|
+ (feature.handlers || [['-']])
|
||||||
|
.map(function(h){ return h[0] instanceof Array ? h[0] : [h[0]] })
|
||||||
|
.reduce(function(a, b){ return a.concat(b) }, [])
|
||||||
|
.unique()
|
||||||
|
.map(function(n){
|
||||||
|
return n == '-' ? n : action2lnk(n) })
|
||||||
|
.join(', ')))
|
||||||
|
|
||||||
// doc...
|
// doc...
|
||||||
.append($('<hr>'))
|
.append($('<hr>'))
|
||||||
.append($('<pre>')
|
.append($('<pre>')
|
||||||
@ -925,7 +958,8 @@ var UIIntrospectionActions = actions.Actions({
|
|||||||
makeUIDialog(function(){
|
makeUIDialog(function(){
|
||||||
var that = this
|
var that = this
|
||||||
|
|
||||||
var dialog = browse.makeLister(null, function(path, make){
|
return browse
|
||||||
|
.makeLister(null, function(path, make){
|
||||||
var features = that.features || {}
|
var features = that.features || {}
|
||||||
|
|
||||||
// XXX get feature doc...
|
// XXX get feature doc...
|
||||||
@ -953,16 +987,15 @@ var UIIntrospectionActions = actions.Actions({
|
|||||||
// XXX conflicts...
|
// XXX conflicts...
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
.run(function(){
|
||||||
// handle '?' button to browse path...
|
// handle '?' button to browse path...
|
||||||
dialog.showDoc = function(){
|
this.showDoc = function(){
|
||||||
var feature = dialog.select('!').attr('feature')
|
var feature = this.select('!').attr('feature')
|
||||||
feature
|
feature
|
||||||
&& that.showFeatureDoc(feature)
|
&& that.showFeatureDoc(feature)
|
||||||
}
|
}
|
||||||
dialog.keyboard.handler('General', '?', 'showDoc')
|
this.keyboard.handler('General', '?', 'showDoc')
|
||||||
|
})
|
||||||
return dialog
|
|
||||||
})],
|
})],
|
||||||
|
|
||||||
// XXX is this the right way to go???
|
// XXX is this the right way to go???
|
||||||
@ -1509,17 +1542,18 @@ var BrowseActionsActions = actions.Actions({
|
|||||||
config.showDisabled = dialog.options.showDisabled
|
config.showDisabled = dialog.options.showDisabled
|
||||||
config.showHidden = dialog.options.showHidden
|
config.showHidden = dialog.options.showHidden
|
||||||
})
|
})
|
||||||
|
.run(function(){
|
||||||
this.config['browse-actions-keys']
|
actions.config['browse-actions-keys']
|
||||||
&& dialog.dom.addClass('show-keys')
|
&& this.dom.addClass('show-keys')
|
||||||
|
|
||||||
// handle '?' button to browse path...
|
// handle '?' button to browse path...
|
||||||
dialog.showDoc = function(){
|
this.showDoc = function(){
|
||||||
var action = dialog.select('!').attr('action')
|
var action = this.select('!').attr('action')
|
||||||
action
|
action
|
||||||
&& actions.showDoc(action)
|
&& this.showDoc(action)
|
||||||
}
|
}
|
||||||
dialog.keyboard.handler('General', '?', 'showDoc')
|
this.keyboard.handler('General', '?', 'showDoc')
|
||||||
|
})
|
||||||
|
|
||||||
return dialog
|
return dialog
|
||||||
})],
|
})],
|
||||||
@ -1532,7 +1566,6 @@ var BrowseActionsActions = actions.Actions({
|
|||||||
this.modal.client.dom.hasClass('browse-actions')
|
this.modal.client.dom.hasClass('browse-actions')
|
||||||
&& this.modal.client.dom[state == 'on' ? 'addClass' : 'removeClass']('show-keys')
|
&& this.modal.client.dom[state == 'on' ? 'addClass' : 'removeClass']('show-keys')
|
||||||
})],
|
})],
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
var BrowseActions =
|
var BrowseActions =
|
||||||
|
|||||||
@ -3678,6 +3678,13 @@ var BrowserPrototype = {
|
|||||||
return m ? m.apply(this, arguments) : []
|
return m ? m.apply(this, arguments) : []
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// Run a function in the context of the object...
|
||||||
|
//
|
||||||
|
run: function(func){
|
||||||
|
var res = func ? func.call(this) : undefined
|
||||||
|
return res === undefined ? this : res
|
||||||
|
},
|
||||||
|
|
||||||
// XXX need to get a container -- UI widget API....
|
// XXX need to get a container -- UI widget API....
|
||||||
// XXX paste does not work on IE yet...
|
// XXX paste does not work on IE yet...
|
||||||
// XXX handle copy...
|
// XXX handle copy...
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user