Mercurial > wikked
changeset 377:2bad085aeff6
web: Better height for edit/preview controls.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Thu, 24 Sep 2015 21:25:34 -0700 |
parents | af8802303e30 |
children | 436f9b54d3e1 |
files | wikked/assets/js/wikked/edit.js |
diffstat | 1 files changed, 11 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/wikked/assets/js/wikked/edit.js Thu Sep 24 21:01:38 2015 -0700 +++ b/wikked/assets/js/wikked/edit.js Thu Sep 24 21:25:34 2015 -0700 @@ -95,6 +95,9 @@ if (this.previewSection.is(':visible')) { // Hide the preview, restore the textbox. + this.inputCtrl.height(Math.max( + this.inputCtrl.height(), + this.previewSection.height() - 12)); this.inputSection.show(); this.previewSection.hide(); this.previewButtonLabel.html("Preview"); @@ -109,10 +112,18 @@ url: previewBtn.attr('data-wiki-url'), text: this.inputCtrl.val() }; + this.previewSection.html("<p>Loading...</p>"); + this.previewSection.height(this.inputSection.height()); + this.previewSection.show(); + this.inputSection.hide(); $.post('/api/preview', previewData) .success(function(data) { var el = $view.previewSection; + el.height('auto'); el.html(data.text); + el.height(Math.max( + el.height(), + $view.inputSection.height())); el.show(); $view.inputSection.hide(); $view.previewButtonLabel.html("Edit");