aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/WebBox.tsx
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2021-04-09 13:27:15 -0400
committerbobzel <zzzman@gmail.com>2021-04-09 13:27:15 -0400
commitebf301a8382e01fa3463f7295bfba175b905e59e (patch)
tree8872860bce26dee8fe2b1e79995c7ef4991063f8 /src/client/views/nodes/WebBox.tsx
parentec7d80efb92cec862b62665eb6a7af98fff73765 (diff)
fixed webBox to display link icon w/ all related links properly.
Diffstat (limited to 'src/client/views/nodes/WebBox.tsx')
-rw-r--r--src/client/views/nodes/WebBox.tsx6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/client/views/nodes/WebBox.tsx b/src/client/views/nodes/WebBox.tsx
index 2a575ca9b..2f2b242f5 100644
--- a/src/client/views/nodes/WebBox.tsx
+++ b/src/client/views/nodes/WebBox.tsx
@@ -32,6 +32,7 @@ import { FieldView, FieldViewProps } from './FieldView';
import { LinkDocPreview } from "./LinkDocPreview";
import "./WebBox.scss";
import React = require("react");
+import { ComputedField } from "../../../fields/ScriptField";
const _global = (window /* browser */ || global /* node */) as any;
const htmlToText = require("html-to-text");
@@ -80,6 +81,8 @@ export class WebBox extends ViewBoxAnnotatableComponent<ViewBoxAnnotatableProps
runInAction(() => {
this._url = this.webField?.toString() || "";
this._annotationKey = "annotations-" + this.urlHash(this._url);
+ this.dataDoc["annotation-active"] = this._annotationKey;
+ this.dataDoc[this.fieldKey + "-annotations"] = ComputedField.MakeFunction(`copyField(this["${this.fieldKey}-"+this["annotation-active"]])`);
});
this._disposers.selection = reaction(() => this.props.isSelected(),
@@ -290,6 +293,7 @@ export class WebBox extends ViewBoxAnnotatableComponent<ViewBoxAnnotatableProps
history.push(this._url);
this.dataDoc[this.fieldKey] = new WebField(new URL(this._url = future.pop()!));
this._annotationKey = "annotations-" + this.urlHash(this._url);
+ this.dataDoc["annotation-active"] = this._annotationKey;
return true;
}
return false;
@@ -304,6 +308,7 @@ export class WebBox extends ViewBoxAnnotatableComponent<ViewBoxAnnotatableProps
else future.push(this._url);
this.dataDoc[this.fieldKey] = new WebField(new URL(this._url = history.pop()!));
this._annotationKey = "annotations-" + this.urlHash(this._url);
+ this.dataDoc["annotation-active"] = this._annotationKey;
return true;
}
return false;
@@ -332,6 +337,7 @@ export class WebBox extends ViewBoxAnnotatableComponent<ViewBoxAnnotatableProps
}
this._url = newUrl;
this._annotationKey = "annotations-" + this.urlHash(this._url);
+ this.dataDoc["annotation-active"] = this._annotationKey;
this.dataDoc[this.fieldKey] = new WebField(new URL(newUrl));
} catch (e) {
console.log("WebBox URL error:" + this._url);