diff options
author | bobzel <zzzman@gmail.com> | 2024-03-01 08:23:06 -0500 |
---|---|---|
committer | bobzel <zzzman@gmail.com> | 2024-03-01 08:23:06 -0500 |
commit | 25474b83f908732b2618cb7110f1e410030f9280 (patch) | |
tree | a942453765eb876ffaa3899d623fa77e13a196b4 /src/fields/URLField.ts | |
parent | 4e837a73f5fae06368416f99c047d78f6b94565b (diff) | |
parent | 3179048be75fb7662fc472249798b2d103dc5544 (diff) |
Merge branch 'master' into info-ui-observable
Diffstat (limited to 'src/fields/URLField.ts')
-rw-r--r-- | src/fields/URLField.ts | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/fields/URLField.ts b/src/fields/URLField.ts index 817b62373..87334ad16 100644 --- a/src/fields/URLField.ts +++ b/src/fields/URLField.ts @@ -1,7 +1,7 @@ import { Deserializable } from '../client/util/SerializationHelper'; import { serializable, custom } from 'serializr'; import { ObjectField } from './ObjectField'; -import { ToScriptString, ToString, Copy } from './FieldSymbols'; +import { ToScriptString, ToString, Copy, ToJavascriptString } from './FieldSymbols'; import { scriptingGlobal } from '../client/util/ScriptingGlobals'; import { Utils } from '../Utils'; @@ -36,6 +36,12 @@ export abstract class URLField extends ObjectField { } return `new ${this.constructor.name}("${this.url?.href}")`; } + [ToJavascriptString]() { + if (Utils.prepend(this.url?.pathname) === this.url?.href) { + return `new ${this.constructor.name}("${this.url.pathname}")`; + } + return `new ${this.constructor.name}("${this.url?.href}")`; + } [ToString]() { if (Utils.prepend(this.url?.pathname) === this.url?.href) { return this.url.pathname; |