aboutsummaryrefslogtreecommitdiff
path: root/src/views
diff options
context:
space:
mode:
authorTyler Schicke <tyler_schicke@brown.edu>2019-01-28 01:55:22 -0500
committerTyler Schicke <tyler_schicke@brown.edu>2019-01-28 01:55:22 -0500
commitdb241485f4f9dff0f43cf5e8059ccb7bd8df5b15 (patch)
tree789aa71a15151ae9c180200414b8089084a497dc /src/views
parentb6ae466668086bee68014a3fb0c7df75ff7df4ca (diff)
Formatted all files
Diffstat (limited to 'src/views')
-rw-r--r--src/views/ContextMenu.tsx8
-rw-r--r--src/views/ContextMenuItem.tsx2
-rw-r--r--src/views/freeformcanvas/CollectionFreeFormView.scss4
-rw-r--r--src/views/nodes/FieldTextBox.tsx40
-rw-r--r--src/views/nodes/NodeView.scss10
-rw-r--r--src/views/nodes/RichTextView.tsx0
6 files changed, 27 insertions, 37 deletions
diff --git a/src/views/ContextMenu.tsx b/src/views/ContextMenu.tsx
index 299ce91c6..4f26a75d2 100644
--- a/src/views/ContextMenu.tsx
+++ b/src/views/ContextMenu.tsx
@@ -8,7 +8,7 @@ import "./ContextMenu.scss"
export class ContextMenu extends React.Component {
static Instance: ContextMenu
- @observable private _items: Array<ContextMenuProps> = [{description:"test", event:(e:React.MouseEvent) => e.preventDefault()}];
+ @observable private _items: Array<ContextMenuProps> = [{ description: "test", event: (e: React.MouseEvent) => e.preventDefault() }];
@observable private _pageX: number = 0;
@observable private _pageY: number = 0;
@observable private _display: string = "none";
@@ -57,10 +57,10 @@ export class ContextMenu extends React.Component {
}
render() {
- return(
- <div className="contextMenu-cont" style={{left: this._pageX, top: this._pageY, display: this._display }} ref={this.ref}>
+ return (
+ <div className="contextMenu-cont" style={{ left: this._pageX, top: this._pageY, display: this._display }} ref={this.ref}>
{this._items.map(prop => {
- return <ContextMenuItem {...prop} key={prop.description}/>
+ return <ContextMenuItem {...prop} key={prop.description} />
})}
</div>
)
diff --git a/src/views/ContextMenuItem.tsx b/src/views/ContextMenuItem.tsx
index beacb44d2..8f00f8b3d 100644
--- a/src/views/ContextMenuItem.tsx
+++ b/src/views/ContextMenuItem.tsx
@@ -8,7 +8,7 @@ export interface ContextMenuProps {
export class ContextMenuItem extends React.Component<ContextMenuProps> {
render() {
- return(
+ return (
<div className="contextMenu-item" onClick={this.props.event}>
<div className="contextMenu-description">{this.props.description}</div>
</div>
diff --git a/src/views/freeformcanvas/CollectionFreeFormView.scss b/src/views/freeformcanvas/CollectionFreeFormView.scss
index cb4805eb3..6ad6ad86c 100644
--- a/src/views/freeformcanvas/CollectionFreeFormView.scss
+++ b/src/views/freeformcanvas/CollectionFreeFormView.scss
@@ -5,11 +5,9 @@
width: 100%;
height: 100%;
overflow: hidden;
-
.collectionfreeformview {
position: absolute;
top: 0;
left: 0;
}
-}
-
+} \ No newline at end of file
diff --git a/src/views/nodes/FieldTextBox.tsx b/src/views/nodes/FieldTextBox.tsx
index 3b8743627..4539bbab0 100644
--- a/src/views/nodes/FieldTextBox.tsx
+++ b/src/views/nodes/FieldTextBox.tsx
@@ -5,19 +5,19 @@ import { TextField } from "../../fields/TextField";
import React = require("react")
import { action, observable, reaction, IReactionDisposer } from "mobx";
-import {schema} from "prosemirror-schema-basic";
-import {EditorState, Transaction} from "prosemirror-state"
-import {EditorView} from "prosemirror-view"
-import {keymap} from "prosemirror-keymap"
-import {baseKeymap} from "prosemirror-commands"
-import {undo, redo, history} from "prosemirror-history"
+import { schema } from "prosemirror-schema-basic";
+import { EditorState, Transaction } from "prosemirror-state"
+import { EditorView } from "prosemirror-view"
+import { keymap } from "prosemirror-keymap"
+import { baseKeymap } from "prosemirror-commands"
+import { undo, redo, history } from "prosemirror-history"
import { Opt } from "../../fields/Field";
import "./FieldTextBox.scss"
interface IProps {
- fieldKey:Key;
- doc:Document;
+ fieldKey: Key;
+ doc: Document;
}
// FieldTextBox: Displays an editable plain text node that maps to a specified Key of a Document
@@ -41,7 +41,7 @@ export class FieldTextBox extends React.Component<IProps> {
private _editorView: Opt<EditorView>;
private _reactionDisposer: Opt<IReactionDisposer>;
- constructor(props:IProps) {
+ constructor(props: IProps) {
super(props);
this._ref = React.createRef();
@@ -50,33 +50,33 @@ export class FieldTextBox extends React.Component<IProps> {
}
dispatchTransaction = (tx: Transaction) => {
- if(this._editorView) {
+ if (this._editorView) {
const state = this._editorView.state.apply(tx);
this._editorView.updateState(state);
- const {doc, fieldKey} = this.props;
+ const { doc, fieldKey } = this.props;
doc.SetFieldValue(fieldKey, JSON.stringify(state.toJSON()), TextField);
}
}
componentDidMount() {
- let state:EditorState;
- const {doc, fieldKey} = this.props;
+ let state: EditorState;
+ const { doc, fieldKey } = this.props;
const config = {
schema,
plugins: [
history(),
- keymap({"Mod-z": undo, "Mod-y": redo}),
+ keymap({ "Mod-z": undo, "Mod-y": redo }),
keymap(baseKeymap)
]
};
let field = doc.GetFieldT(fieldKey, TextField);
- if(field) {
+ if (field) {
state = EditorState.fromJSON(config, JSON.parse(field.Data));
} else {
state = EditorState.create(config);
}
- if(this._ref.current) {
+ if (this._ref.current) {
this._editorView = new EditorView(this._ref.current, {
state,
dispatchTransaction: this.dispatchTransaction
@@ -87,17 +87,17 @@ export class FieldTextBox extends React.Component<IProps> {
const field = this.props.doc.GetFieldT(this.props.fieldKey, TextField);
return field ? field.Data : undefined;
}, (field) => {
- if(field && this._editorView) {
+ if (field && this._editorView) {
this._editorView.updateState(EditorState.fromJSON(config, JSON.parse(field)));
}
})
}
componentWillUnmount() {
- if(this._editorView) {
+ if (this._editorView) {
this._editorView.destroy();
}
- if(this._reactionDisposer) {
+ if (this._reactionDisposer) {
this._reactionDisposer();
}
}
@@ -108,7 +108,7 @@ export class FieldTextBox extends React.Component<IProps> {
@action
onChange(e: React.ChangeEvent<HTMLInputElement>) {
- const {fieldKey, doc} = this.props;
+ const { fieldKey, doc } = this.props;
doc.SetFieldValue(fieldKey, e.target.value, TextField);
}
diff --git a/src/views/nodes/NodeView.scss b/src/views/nodes/NodeView.scss
index a68335f87..dac1c0a8e 100644
--- a/src/views/nodes/NodeView.scss
+++ b/src/views/nodes/NodeView.scss
@@ -1,31 +1,23 @@
.node {
position: absolute;
background: #cdcdcd;
-
overflow: hidden;
-
-
&.minimized {
width: 30px;
height: 30px;
}
-
.top {
background: #232323;
height: 20px;
cursor: pointer;
}
-
.content {
padding: 20px 20px;
height: auto;
box-sizing: border-box;
-
}
-
.scroll-box {
overflow-y: scroll;
height: calc(100% - 20px);
}
-}
-
+} \ No newline at end of file
diff --git a/src/views/nodes/RichTextView.tsx b/src/views/nodes/RichTextView.tsx
deleted file mode 100644
index e69de29bb..000000000
--- a/src/views/nodes/RichTextView.tsx
+++ /dev/null