mirror of
https://github.com/vrana/adminer.git
synced 2026-02-08 15:47:47 +01:00
Pretty print JSON in edit
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
## Adminer dev
|
||||
- Pretty print JSON in edit
|
||||
- PostgreSQL: Mark unique partial indexes as unique (bug #1172)
|
||||
- ClickHouse: Fix offset (bug #1188)
|
||||
- ClickHouse: Fix list of tables (bug #1176)
|
||||
|
||||
@@ -254,7 +254,10 @@ function input(array $field, $value, ?string $function, ?bool $autofocus = false
|
||||
} elseif (is_blob($field) && ini_bool("file_uploads")) {
|
||||
echo "<input type='file' name='fields-$name'>";
|
||||
} elseif ($function == "json" || preg_match('~^jsonb?$~', $field["type"])) {
|
||||
echo "<textarea$attrs cols='50' rows='12' class='jush-js'>" . h($value) . '</textarea>';
|
||||
echo "<textarea$attrs cols='50' rows='12' class='jush-js'>" . h($value == '' || (JUSH == "pgsql" && $field["type"] == "json")
|
||||
? $value
|
||||
: json_encode(json_decode($value), JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE))
|
||||
. '</textarea>';
|
||||
} elseif (($text = preg_match('~text|lob|memo~i', $field["type"])) || preg_match("~\n~", $value)) {
|
||||
if ($text && JUSH != "sqlite") {
|
||||
$attrs .= " cols='50' rows='12'";
|
||||
|
||||
Reference in New Issue
Block a user