Repository: couchdb-fauxton Updated Branches: refs/heads/master a03d69da3 -> 6565e797e
Fix for missing Edit Map Function The recent full page doc editor changes caused the Map Function section to disappear from the Edit Index page. This fixes it by only enabling the auto-adjust height code relevant for the full page doc editor for that particular instance, via the addition of an isFullPageEditor boolean. Project: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/commit/6565e797 Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/tree/6565e797 Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/diff/6565e797 Branch: refs/heads/master Commit: 6565e797e6956621a885ee9382266cc317db524f Parents: a03d69d Author: Ben Keen <[email protected]> Authored: Fri Jan 23 12:16:47 2015 -0800 Committer: Ben Keen <[email protected]> Committed: Fri Jan 23 12:16:47 2015 -0800 ---------------------------------------------------------------------- app/addons/documents/views-doceditor.js | 1 + app/addons/fauxton/components.js | 16 +++++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/6565e797/app/addons/documents/views-doceditor.js ---------------------------------------------------------------------- diff --git a/app/addons/documents/views-doceditor.js b/app/addons/documents/views-doceditor.js index 186375e..86ffbc3 100644 --- a/app/addons/documents/views-doceditor.js +++ b/app/addons/documents/views-doceditor.js @@ -386,6 +386,7 @@ function (app, FauxtonAPI, Components, Documents, Databases, prettify) { this.listenTo(this.model, 'sync', this.updateValues); this.editor = new Components.Editor({ editorId: 'editor-container', + isFullPageEditor: true, forceMissingId: true, commands: [{ name: 'save', http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/6565e797/app/addons/fauxton/components.js ---------------------------------------------------------------------- diff --git a/app/addons/fauxton/components.js b/app/addons/fauxton/components.js index 13d5a72..7ab30fc 100644 --- a/app/addons/fauxton/components.js +++ b/app/addons/fauxton/components.js @@ -777,9 +777,15 @@ function(app, FauxtonAPI, ace, spin, ZeroClipboard) { this.couchJSHINT = options.couchJSHINT; this.edited = false; + // the full-page document editor does some extra work to adjust the total height of the editor based + // on available space. This setting ensures that only takes place there, and not with other editor locations + this.isFullPageEditor = options.isFullPageEditor || false; + var that = this; this.onPageResize = _.debounce(function () { - that.setAvailableEditorHeight(); + if (that.isFullPageEditor) { + that.setAvailableEditorHeight(); + } that.setHeightToLineCount(); that.editor.resize(true); }, 300); @@ -842,9 +848,13 @@ function(app, FauxtonAPI, ace, spin, ZeroClipboard) { setHeightToLineCount: function () { var lines = this.editor.getSession().getDocument().getLength(); - var maxLines = this.getMaxAvailableLinesOnPage(); + + if (this.isFullPageEditor) { + var maxLines = this.getMaxAvailableLinesOnPage(); + lines = lines < maxLines ? lines : maxLines; + } this.editor.setOptions({ - maxLines: lines < maxLines ? lines : maxLines + maxLines: lines }); },
