Skip to content
This repository has been archived by the owner on Jul 5, 2023. It is now read-only.

Commit

Permalink
Remove errant collapsed document rep in edit mode.
Browse files Browse the repository at this point in the history
Fixes #33
  • Loading branch information
bobthecow committed Sep 27, 2012
1 parent 42cab1d commit 235b0dd
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.markdown
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## v2.1

* Fix #28 — Handle BSON BinData properly in documents and ids.
* Fix #33 — Remove unexpected collapsed document representation in edit mode.
* Fix — Handle connection auth errors more gracefully.
* Fix — Query bug when running under PHP 5.4 SAPI CLI server.
* Add ObjectId timestamps to document headers.
Expand Down
6 changes: 3 additions & 3 deletions genghis.php

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions genghis.rb

Large diffs are not rendered by default.

10 changes: 6 additions & 4 deletions src/js/genghis/json.js
Original file line number Diff line number Diff line change
Expand Up @@ -298,14 +298,16 @@ Genghis.JSON = {
},

stringify: function(value, pretty) {
return jQuery('<div>' + this.prettyPrint(value, pretty) + '</div>').text();
return jQuery('<div>' + this.prettyPrint(value, pretty, false) + '</div>').text();
},

prettyPrint: function (value, pretty) {
prettyPrint: function (value, pretty, autoCollapse) {
// This function borrows heavily from json2.js, a project in the public domain.
//
// See See http://www.JSON.org/js.html

autoCollapse = (autoCollapse !== false);

function JsonView(value) {

var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;
Expand Down Expand Up @@ -501,7 +503,7 @@ Genghis.JSON = {

el = span('v a');

if (gap) {
if (autoCollapse && gap) {
el.collapsible = true;

if (value.length > 10) {
Expand Down Expand Up @@ -583,7 +585,7 @@ Genghis.JSON = {
}

el = span(spanClass);
el.collapsible = true;
el.collapsible = !!autoCollapse;
el.appendChild(t(gap ? ('{\n' + gap) : '{'));

glue = t(gap ? (',\n' + gap) : ',');
Expand Down

0 comments on commit 235b0dd

Please sign in to comment.