mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-19 14:16:01 +00:00
multiline dialog fixes
This commit is contained in:
@@ -259,6 +259,28 @@ export function safeJsonParse(json, defaultValue?, logError = false) {
|
||||
}
|
||||
}
|
||||
|
||||
export function shouldOpenMultilineDialog(value) {
|
||||
if (_isString(value)) {
|
||||
if (value.includes('\n')) {
|
||||
return true;
|
||||
}
|
||||
const parsed = safeJsonParse(value);
|
||||
if (parsed && (_isPlainObject(parsed) || _isArray(parsed))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (value?.$oid) {
|
||||
return false;
|
||||
}
|
||||
if (value?.$date) {
|
||||
return false;
|
||||
}
|
||||
if (_isPlainObject(value) || _isArray(value)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
export function isJsonLikeLongString(value) {
|
||||
return _isString(value) && value.length > 100 && value.match(/^\s*\{.*\}\s*$|^\s*\[.*\]\s*$/);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user