mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 18:30:09 +00:00
experimenting with editor...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
45538694a7
commit
f4b47c3555
@ -2880,6 +2880,7 @@ module.FileSystemWriterUI = core.ImageGridFeatures.Feature({
|
||||
|
||||
tag: 'ui-fs-writer',
|
||||
depends: [
|
||||
'ui-editor',
|
||||
'ui-fs-loader',
|
||||
'fs-writer',
|
||||
],
|
||||
|
||||
@ -176,6 +176,7 @@ core.ImageGridFeatures.Feature('imagegrid-testing', [
|
||||
|
||||
|
||||
//----------------------------------------------------- testing ---
|
||||
'ui-editor',
|
||||
'experiments',
|
||||
'-tests',
|
||||
|
||||
|
||||
@ -958,9 +958,100 @@ module.Dialogs = core.ImageGridFeatures.Feature({
|
||||
|
||||
var EditorActions = actions.Actions({
|
||||
|
||||
__editor_item_constructors__: {
|
||||
// format:
|
||||
// {
|
||||
// <type>: function(id, make, options){},
|
||||
// ...
|
||||
// }
|
||||
//
|
||||
__editor_fields__: {
|
||||
// generic field...
|
||||
//
|
||||
// options format:
|
||||
// {
|
||||
// // NOTE: if this is not set then the id is used...
|
||||
// title: <str>,
|
||||
//
|
||||
// value: <value> | <func>,
|
||||
// editable: <bool>,
|
||||
//
|
||||
// list: <array> | <func(value)>,
|
||||
// list_button: <str>,
|
||||
//
|
||||
// doc: <str> | <func>,
|
||||
//
|
||||
// // callback called when value is changed...
|
||||
// // XXX should this check/normalize/...
|
||||
// set: <func>,
|
||||
//
|
||||
// ...
|
||||
// }
|
||||
//
|
||||
// XXX we need:
|
||||
// - id
|
||||
// - dialog ref (make.dialog)
|
||||
// - actions ref (this)
|
||||
// - make
|
||||
// - options
|
||||
// - initial value
|
||||
// - history
|
||||
// - callback
|
||||
// XXX Q: when do we get the data???
|
||||
field: function(actions, make, options){
|
||||
console.log('>>>>', options.type, make, options)
|
||||
},
|
||||
|
||||
text: function(actions, make, options){
|
||||
this.field(actions, make,
|
||||
Object.assign(
|
||||
{
|
||||
type: 'text',
|
||||
},
|
||||
options))
|
||||
},
|
||||
select: function(actions, make, options){
|
||||
this.field(actions, make,
|
||||
Object.assign(
|
||||
{
|
||||
type: 'select',
|
||||
},
|
||||
options))
|
||||
},
|
||||
|
||||
// XXX todo:
|
||||
// - date
|
||||
// - ...
|
||||
},
|
||||
|
||||
//
|
||||
// spec format:
|
||||
// [
|
||||
// <text>,
|
||||
//
|
||||
// {
|
||||
// type: <type>
|
||||
// ...
|
||||
// },
|
||||
//
|
||||
// ...
|
||||
// ]
|
||||
//
|
||||
// XXX does this need a callback???
|
||||
makeEditorBlock: ['- Interface/',
|
||||
function(spec, make){
|
||||
var that = this
|
||||
// XXX revise...
|
||||
var fields = this.__editor_fields__
|
||||
|| EditorActions.__editor_fields__
|
||||
|| {}
|
||||
;(spec || [])
|
||||
.map(function(field){
|
||||
field instanceof Object ?
|
||||
fields[field.type](that, make, field)
|
||||
: make(field) })
|
||||
return make }],
|
||||
|
||||
// XXX the callback is called to get initial data and to update/save it...
|
||||
makeEditor: ['- Interface/',
|
||||
makeUIDialog(function(spec, callback){
|
||||
// XXX
|
||||
@ -979,9 +1070,6 @@ module.Editor = core.ImageGridFeatures.Feature({
|
||||
],
|
||||
|
||||
actions: EditorActions,
|
||||
|
||||
handlers: [
|
||||
],
|
||||
})
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user