diff options
author | bobzel <zzzman@gmail.com> | 2022-10-03 15:12:14 -0400 |
---|---|---|
committer | bobzel <zzzman@gmail.com> | 2022-10-03 15:12:14 -0400 |
commit | aaef5f4693b5eb6aae429f5c8caaf82838e9c65e (patch) | |
tree | a822b08de929860df8e810d7d986ac20947a20b4 /src/fields/Doc.ts | |
parent | 31ac3ec644547bd4a3450820f9a69ebcfd17661e (diff) |
added a reset menu item for docking views in their context menu. fixed being able to edit dockingConfig in keyValue by quoting with ' instead of ". If there's no dockingConfig, make one.
Diffstat (limited to 'src/fields/Doc.ts')
-rw-r--r-- | src/fields/Doc.ts | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/fields/Doc.ts b/src/fields/Doc.ts index a3c742f28..ea3c122a4 100644 --- a/src/fields/Doc.ts +++ b/src/fields/Doc.ts @@ -33,7 +33,10 @@ export namespace Field { return !Field.IsField(field) ? '' : (onDelegate ? '=' : '') + (field instanceof ComputedField ? `:=${field.script.originalScript}` : Field.toScriptString(field)); } export function toScriptString(field: Field): string { - if (typeof field === 'string') return `"${field}"`; + if (typeof field === 'string') { + if (field.startsWith('{"')) return `'${field}'`; // bcz: hack ... want to quote the string the right way. if there are nested "'s, then use ' instead of ". In this case, test for the start of a JSON string of the format {"property": ... } and use outer 's instead of "s + return `"${field}"`; + } if (typeof field === 'number' || typeof field === 'boolean') return String(field); if (field === undefined || field === null) return 'null'; return field[ToScriptString](); |