some cleanup and notes...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2017-01-30 20:01:24 +03:00
parent 848577f339
commit dc4eaa2973
3 changed files with 48 additions and 52 deletions

View File

@ -1277,6 +1277,7 @@ var KeyboardUIActions = actions.Actions({
reset_on_commit: false,
buttons: [
['&ctdot;', function(evt, elem){
code = code || ''
// highlight the current action...
var a = keyboard.parseActionCall(code)
var p = a.action in that ?

View File

@ -1550,7 +1550,7 @@ var WidgetTestActions = actions.Actions({
return browse.makeLister(null, function(path, make){
var that = this
make.Heading('Letters:', {
make.Heading('Numbers:', {
doc: 'List editor with all the buttons enabled...',
})
make.EditableList(numbers, {
@ -1560,7 +1560,7 @@ var WidgetTestActions = actions.Actions({
to_bottom_button: true,
})
make.Heading('Numbers:', {
make.Heading('Letters:', {
doc: 'Sortable list, use sort handle to the right to sort...'
})
make.EditableList(letters, {

View File

@ -20,12 +20,6 @@ var widget = require('./widget')
/*********************************************************************/
// Helpers...
// XXX why do we need this???
var quoteWS = function(str){
return str.replace(/(\s)/g, '\\$1')
}
// Quote a string and convert to RegExp to match self literally.
// XXX this depends on jli.quoteRegExp(..)
function toRegExp(str){
@ -92,6 +86,7 @@ function makeSimpleAction(direction){
// make protocol, i.e. make(content[, options]) or their own...
var Items = module.items = function(){}
// NOTE: this is the same as make('---'[, options])
Items.Separator =
function(options){
@ -510,6 +505,7 @@ function(data, options){
// // false - disable
// //
// // NOTE: this will force .groupList to true.
// // NOTE: this depends on jquery-ui's Sortable...
// sortable: false,
//
// // This is called when a new value is added via new_item but
@ -873,10 +869,12 @@ function(list, options){
var Buttons =
Items.buttons =
module.buttons = {
// Mark an item for removal and add it to a list of marked items...
//
markForRemoval: function(list, html){
module.buttons = {}
// Mark an item for removal and add it to a list of marked items...
//
Buttons.markForRemoval = function(list, html){
return [html || '&times;',
function(p, e){
e.toggleClass('strike-out')
@ -895,7 +893,6 @@ module.buttons = {
&& list.splice(i, 1)
}
}]
},
}
@ -1023,6 +1020,14 @@ var BrowserClassPrototype = {
// XXX might be a good idea to add a ctrl-c/copy handler...
// ...copy path by default but overloadable with something like
// .getCopyValue() which would return .strPath by default...
// XXX feels a bit over-complicated...
// ...might be a good idea to split this into:
// - base
// - structure
// - path/traversable
// - navigation (mouse/keyboard)
// - search/filtering
// - buttons
var BrowserPrototype = {
dom: null,
@ -1406,6 +1411,16 @@ var BrowserPrototype = {
}
this.options.flat = value
},
get traversable(){
return !this.dom.hasClass('not-traversable') && this.options.traversable },
set traversable(value){
if(value){
this.dom.removeClass('not-traversable')
} else {
this.dom.addClass('not-traversable')
}
this.options.traversable = value
},
get cloud(){
return this.dom.hasClass('cloud-view') || this.options.cloudView },
@ -1418,18 +1433,6 @@ var BrowserPrototype = {
this.options.cloudView = value
},
// XXX should these set both the options and dom???
get traversable(){
return !this.dom.hasClass('not-traversable') && this.options.traversable },
set traversable(value){
if(value){
this.dom.removeClass('not-traversable')
} else {
this.dom.addClass('not-traversable')
}
this.options.traversable = value
},
// Get/set the listed path...
//
// On more info on setting the path see .update(..)
@ -1535,8 +1538,7 @@ var BrowserPrototype = {
},
/*
// Copy/Paste actions...
/*/ Copy/Paste actions...
//
// XXX use 'Text' for IE...
copy: function(){
@ -1572,7 +1574,7 @@ var BrowserPrototype = {
return this
},
*/
//*/
// update (load) path...
// - build the path
@ -1851,13 +1853,6 @@ var BrowserPrototype = {
.on('blur', function(){
that.toggleFilter('off')
})
/* XXX does the right thing (replaces the later .focus(..)
* and .keyup(..)) but does not work in IE...
.on('input', function(){
//that.filterList(quoteWS($(this).text()))
that.filterList($(this).text())
})
*/
// only update if text changed...
.focus(function(){
txt = $(this).text()
@ -1882,6 +1877,7 @@ var BrowserPrototype = {
p.scrollLeft(0)
}
//---------------------------------------------------- make ---
var sort_traversable = this.options.sortTraversable
var section_tail
@ -2172,6 +2168,7 @@ var BrowserPrototype = {
}
make.dialog = this
//------------------------------------------ build the list ---
var res = list.call(this, path, make)
@ -3128,8 +3125,6 @@ var BrowserPrototype = {
var path = this.path
//path.push(quoteWS(elem.find('.text').text()))
//path.push('"'+ elem.find('.text').text() +'"')
path.push(elem.find('.text').text())
var res = this.open(path)