aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/WebBox.tsx
diff options
context:
space:
mode:
authormonikahedman <monika_hedman@brown.edu>2019-08-19 23:14:00 -0400
committermonikahedman <monika_hedman@brown.edu>2019-08-19 23:14:00 -0400
commitb987fe6e18c4b37a1ec40abcb4d8360d57dc7d54 (patch)
tree49beee7795ae13169a92a298f2469e621dac49bf /src/client/views/nodes/WebBox.tsx
parent9741ecc4bdfd822d8bcbe9d6505c5c2dce06cbbb (diff)
switch to text needs help lol
Diffstat (limited to 'src/client/views/nodes/WebBox.tsx')
-rw-r--r--src/client/views/nodes/WebBox.tsx37
1 files changed, 35 insertions, 2 deletions
diff --git a/src/client/views/nodes/WebBox.tsx b/src/client/views/nodes/WebBox.tsx
index 91170e99a..6e23d6fb7 100644
--- a/src/client/views/nodes/WebBox.tsx
+++ b/src/client/views/nodes/WebBox.tsx
@@ -10,6 +10,7 @@ import { InkTool } from "../../../new_fields/InkField";
import { Cast, FieldValue, NumCast, StrCast } from "../../../new_fields/Types";
import { Utils } from "../../../Utils";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+import { faStickyNote } from '@fortawesome/free-solid-svg-icons';
import { observable, action, computed } from "mobx";
import { listSpec } from "../../../new_fields/Schema";
import { Field, FieldResult } from "../../../new_fields/Doc";
@@ -18,6 +19,11 @@ import { ObjectField } from "../../../new_fields/ObjectField";
import { updateSourceFile } from "typescript";
import { KeyValueBox } from "./KeyValueBox";
import { setReactionScheduler } from "mobx/lib/internal";
+import { library } from "@fortawesome/fontawesome-svg-core";
+import { Docs } from "../../documents/Documents";
+import { PreviewCursor } from "../PreviewCursor";
+
+library.add(faStickyNote)
@observer
export class WebBox extends React.Component<FieldViewProps> {
@@ -69,6 +75,24 @@ export class WebBox extends React.Component<FieldViewProps> {
}
}
+ switchToText() {
+ console.log("switchng to text")
+ if (this.props.removeDocument) this.props.removeDocument(this.props.Document);
+ // let newPoint = PreviewCursor._getTransform().transformPoint(PreviewCursor._clickPoint[0], PreviewCursor._clickPoint[1]);
+ let newBox = Docs.Create.TextDocument({
+ width: 200, height: 100,
+ // x: newPoint[0],
+ // y: newPoint[1],
+ x: NumCast(this.props.Document.x),
+ y: NumCast(this.props.Document.y),
+ title: "-pasted text-"
+ });
+
+ newBox.proto!.autoHeight = true;
+ PreviewCursor._addLiveTextDoc(newBox);
+ return;
+ }
+
urlEditor() {
return (
<div className="webView-urlEditor" style={{ top: this.collapsed ? -70 : 0 }}>
@@ -91,9 +115,18 @@ export class WebBox extends React.Component<FieldViewProps> {
onChange={this.onURLChange}
onKeyDown={this.onValueKeyDown}
/>
- <button className="submitUrl" onClick={this.submitURL}>
- SUBMIT URL
+ <div style={{
+ display: "flex",
+ flexDirection: "row",
+
+ }}>
+ <button className="submitUrl" onClick={this.submitURL}>
+ SUBMIT URL
</button>
+ <button className="switchToText" onClick={this.switchToText} style={{ paddingLeft: 10 }} >
+ <FontAwesomeIcon icon={faStickyNote} size={"2x"} />
+ </button>
+ </div>
</div>
</div>
</div>