diff --git a/ui (gen4)/features/base.js b/ui (gen4)/features/base.js index a3150907..24bc3464 100755 --- a/ui (gen4)/features/base.js +++ b/ui (gen4)/features/base.js @@ -1801,8 +1801,6 @@ module.CropActions = actions.Actions({ }], // crop edit actions... - // XXX undo -- .removeFromCrop(..) but only the gids that were - // actually added... (???) // XXX BUG? order does odd things... addToCrop: ['- Crop/', core.doc`Add gids to current crop... @@ -1840,13 +1838,27 @@ module.CropActions = actions.Actions({ different in that it does not require the images to be loaded in the current crop... NOTE: this can only add gids to current crop... + NOTE; passing this a gid of an unloaded ribbon is pointless, so + it is not supported. `, + // NOTE: we do not need undo here as we'll not use this directly + { + getUndoState: function(d){ + var a = d.args[0] || [] + a = a instanceof Array ? a : [a] + d.args[0] = a.filter(function(g){ + return !this.data.getImage(g, 'loaded') }.bind(this)) }, + undo: 'removeFromCrop', + }, function(gids, ribbon, reference, mode){ if(!this.cropped){ return } - gids = gids instanceof Array ? gids : [gids] + gids = (gids instanceof Array ? gids : [gids]) + // filter out gids that are already loaded... + .filter(function(g){ + return !this.data.getImage(g, 'loaded') }.bind(this)) var r = this.data.ribbons[this.current_ribbon] var o = this.data.order @@ -1933,6 +1945,7 @@ module.CropActions = actions.Actions({ data.getImage(this.direction == 'left' ? 'before' : 'after') || data.getImage(this.direction == 'left' ? 'after' : 'before')) }], + // NOTE: this is undone by .removeFromCrop(..) removeRibbonFromCrop:['Crop|Ribbon/Remove ribbon from crop', core.doc` diff --git a/ui (gen4)/features/collections.js b/ui (gen4)/features/collections.js index f6412a22..62061031 100755 --- a/ui (gen4)/features/collections.js +++ b/ui (gen4)/features/collections.js @@ -311,6 +311,8 @@ var CollectionActions = actions.Actions({ // handle collection... p = running[collection] = new Promise(function(resolve, reject){ + // NOTE: we do not need to return this as we'll resolve/reject + // manually in .then(..) / .catch(..) Promise .all(Object.keys(handlers) // filter relevant handlers... @@ -853,6 +855,7 @@ var CollectionActions = actions.Actions({ // add to collection... var data = this.data.constructor.fromArray(gids) + // XXX should we use collection.data.placeImage(..)??? return this.joinCollect(null, collection, data) }).bind(this)) }], @@ -1804,12 +1807,20 @@ var CollectionLocalConfig = actions.Actions({ }, // handle collection .config + // XXX problems: + // - config leaks -- when moving crom collection to collection + // with individual option sets some options may not get + // restored if handled incorrectly... + // ...one way to deal with this is to restore the base config + // on every load before loading the new config... collectionConfigLoader: ['- Collections/', {collectionFormat: 'config'}, function(title, state, logger){ - // XXX save old config... + // XXX save old config -- in their respective collection... - // XXX load new config... + // XXX load MAIN_COLLECTION_TITLE config... + + // XXX load new config -- from target collection... }], }) @@ -2650,6 +2661,9 @@ var UICollectionActions = actions.Actions({ }) })], + + // Collection actions with collection selection... + // // XXX need to add "ALL" -- might need to rework .browseCollections(..) for this... // XXX also do: // .saveCollection(..) @@ -2664,9 +2678,6 @@ var UICollectionActions = actions.Actions({ }, `loadCollection: "${MAIN_COLLECTION_TITLE}"`], - - // Collection actions with collection selection... - // // XXX extend .saveCollection(..) and remove this... // ...see .loadCollection(..) notes above... // XXX should we warn the user when overwriting??? diff --git a/ui (gen4)/features/core.js b/ui (gen4)/features/core.js index 40d73668..dcf8b98f 100755 --- a/ui (gen4)/features/core.js +++ b/ui (gen4)/features/core.js @@ -796,7 +796,7 @@ var JournalActions = actions.Actions({ undo.call(this, a) : typeof(undo) == typeof('str') ? // pass journal structure as-is... - this[undo].apply(this, a) + this[undo].apply(this, a.args) : null // push the undone command to the reverse journal... diff --git a/ui (gen4)/features/keyboard.js b/ui (gen4)/features/keyboard.js index 603daf7c..6909c042 100755 --- a/ui (gen4)/features/keyboard.js +++ b/ui (gen4)/features/keyboard.js @@ -135,14 +135,11 @@ module.GLOBAL_KEYBOARD = { Esc: 'uncrop', shift_Esc: 'uncropAll', - // XXX - //ctrl_S: 'saveAsCollection', - W: 'testAction2 -- XXX DEBUG: remove when done...', - // XXX not sure about this... Del: 'removeFromCrop', shift_Del: 'removeMarkedFromCrop', + ctrl_Del: 'removeRibbonFromCrop', }, 'Collection': { diff --git a/ui (gen4)/imagegrid/file.js b/ui (gen4)/imagegrid/file.js index 4bed16e6..f9474bb7 100755 --- a/ui (gen4)/imagegrid/file.js +++ b/ui (gen4)/imagegrid/file.js @@ -788,6 +788,9 @@ module.writeIndex = function(json, path, date, filename_tpl, logger){ logger = logger && logger.push('Index') + // XXX get this from args/config... + var spaces = null + path = util.normalizePath(path) filename_tpl = filename_tpl || FILENAME // XXX for some reason this gets the unpatched node.js Date, so we @@ -810,7 +813,8 @@ function(json, path, date, filename_tpl, logger){ // be too many files... return Promise .all(Object.keys(json).map(function(keyword){ - var data = JSON.stringify(json[keyword]) + //var data = JSON.stringify(json[keyword]) + var data = JSON.stringify(json[keyword], null, spaces) // get the sub-path and keyword... var sub_path = keyword.split(/[\\\/]/g) diff --git a/ui (gen4)/package-lock.json b/ui (gen4)/package-lock.json index 37222493..db57e8b0 100755 --- a/ui (gen4)/package-lock.json +++ b/ui (gen4)/package-lock.json @@ -8824,7 +8824,7 @@ "deep-extend": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.4.1.tgz", "ini": "https://registry.npmjs.org/ini/-/ini-1.3.4.tgz", "minimist": "1.2.0", - "strip-json-comments": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz" + "strip-json-comments": "2.0.1" }, "dependencies": { "minimist": { @@ -9331,7 +9331,8 @@ } }, "strip-json-comments": { - "version": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=" }, "supports-color": { diff --git a/ui (gen4)/package.json b/ui (gen4)/package.json index ec83ea19..79cf6761 100755 --- a/ui (gen4)/package.json +++ b/ui (gen4)/package.json @@ -34,6 +34,7 @@ "requirejs": "^2.3.5", "requirejs-plugins": "^1.0.2", "sharp": "^0.17.3", + "strip-json-comments": "^2.0.1", "wildglob": "^0.1.1" }, "optionalDependencies": {