aboutsummaryrefslogtreecommitdiff
path: root/src/fields/URLField.ts
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2024-01-27 04:21:08 -0500
committerbobzel <zzzman@gmail.com>2024-01-27 04:21:08 -0500
commite3709b4445732791f696cdf26274ab09294ce208 (patch)
tree2c1b0e51b3609e6284f499e3a3a851dd8b26da58 /src/fields/URLField.ts
parentcdbe62da5c62f809629f4e8b01524b223f38abd4 (diff)
made dataViz nodes linked to schema nodes update automatically as cahnges are made. fixed user created templates from disappearing from menu, and made them work. added toJavascriptString and made DashField views convert to text. added support for turning text into javascript rendering (paint) code.
Diffstat (limited to 'src/fields/URLField.ts')
-rw-r--r--src/fields/URLField.ts8
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;