diff --git a/core/fse.js b/core/fse.js index 1efc2777..ed9d3b13 100644 --- a/core/fse.js +++ b/core/fse.js @@ -169,7 +169,6 @@ exports.FullScreenEditorModule = exports.getModule = class FullScreenEditorModul } cb(newFocusViewId); }, - headerSubmit : function(formData, extraArgs, cb) { self.switchToBody(); return cb(null); diff --git a/mods/msg_area_view_fse.js b/mods/msg_area_view_fse.js index 129476ae..de4657f1 100644 --- a/mods/msg_area_view_fse.js +++ b/mods/msg_area_view_fse.js @@ -22,8 +22,9 @@ exports.getModule = class AreaViewFSEModule extends FullScreenEditorModule { this.editorMode = 'view'; if(_.isObject(options.extraArgs)) { - this.messageList = options.extraArgs.messageList; - this.messageIndex = options.extraArgs.messageIndex; + this.messageList = options.extraArgs.messageList; + this.messageIndex = options.extraArgs.messageIndex; + this.lastMessageNextExit = options.extraArgs.lastMessageNextExit; } this.messageList = this.messageList || []; @@ -41,6 +42,12 @@ exports.getModule = class AreaViewFSEModule extends FullScreenEditorModule { return self.loadMessageByUuid(self.messageList[self.messageIndex].messageUuid, cb); } + // auto-exit if no more to go? + if(self.lastMessageNextExit) { + self.lastMessageReached = true; + return self.prevMenu(cb); + } + return cb(null); }, @@ -120,6 +127,9 @@ exports.getModule = class AreaViewFSEModule extends FullScreenEditorModule { } getMenuResult() { - return this.messageIndex; + return { + messageIndex : this.messageIndex, + lastMessageReached : this.lastMessageReached, + }; } }; diff --git a/mods/msg_list.js b/mods/msg_list.js index 498d8976..bc80e27b 100644 --- a/mods/msg_list.js +++ b/mods/msg_list.js @@ -49,6 +49,8 @@ exports.getModule = class MessageListModule extends MessageAreaConfTempSwitcher( this.messageAreaTag = config.messageAreaTag; + this.lastMessageReachedExit = _.get(options, 'lastMenuResult.lastMessageReached', false); + if(options.extraArgs) { // // |extraArgs| can override |messageAreaTag| provided by config @@ -73,6 +75,7 @@ exports.getModule = class MessageListModule extends MessageAreaConfTempSwitcher( messageAreaTag : self.messageAreaTag, messageList : self.messageList, messageIndex : formData.value.message, + lastMessageNextExit : true, } }; @@ -107,6 +110,10 @@ exports.getModule = class MessageListModule extends MessageAreaConfTempSwitcher( } enter() { + if(this.lastMessageReachedExit) { + return this.prevMenu(); + } + super.enter(); //