aboutsummaryrefslogtreecommitdiff
path: root/src/views/nodes
diff options
context:
space:
mode:
Diffstat (limited to 'src/views/nodes')
-rw-r--r--src/views/nodes/DocumentView.tsx14
-rw-r--r--src/views/nodes/FieldView.tsx7
-rw-r--r--src/views/nodes/FormattedTextBox.scss (renamed from src/views/nodes/FieldTextBox.scss)2
-rw-r--r--src/views/nodes/FormattedTextBox.tsx (renamed from src/views/nodes/FieldTextBox.tsx)18
-rw-r--r--src/views/nodes/ImageBox.tsx4
5 files changed, 22 insertions, 23 deletions
diff --git a/src/views/nodes/DocumentView.tsx b/src/views/nodes/DocumentView.tsx
index fd5ffeb61..7ff1ef5cc 100644
--- a/src/views/nodes/DocumentView.tsx
+++ b/src/views/nodes/DocumentView.tsx
@@ -11,7 +11,7 @@ import { CollectionDockingView } from "../collections/CollectionDockingView";
import { CollectionFreeFormView } from "../collections/CollectionFreeFormView";
import { CollectionSchemaView } from "../collections/CollectionSchemaView";
import { CollectionViewBase, COLLECTION_BORDER_WIDTH } from "../collections/CollectionViewBase";
-import { FieldTextBox } from "../nodes/FieldTextBox";
+import { FormattedTextBox } from "../nodes/FormattedTextBox";
import { ImageBox } from "../nodes/ImageBox";
import "./NodeView.scss";
import React = require("react");
@@ -49,9 +49,9 @@ export class DocumentView extends React.Component<DocumentViewProps> {
//
@computed
public get ScalingToScreenSpace(): number {
- if (this.props.ContainingCollectionView != undefined && this.props.ContainingCollectionView.props.DocumentContentsOfCollection != undefined) {
+ if (this.props.ContainingCollectionView != undefined && this.props.ContainingCollectionView.props.DocumentViewForCollection != undefined) {
let ss = this.props.ContainingCollectionView.props.DocumentForCollection.GetFieldValue(KeyStore.Scale, NumberField, Number(1));
- return this.props.ContainingCollectionView.props.DocumentContentsOfCollection.ScalingToScreenSpace * ss;
+ return this.props.ContainingCollectionView.props.DocumentViewForCollection.ScalingToScreenSpace * ss;
}
return 1;
}
@@ -62,8 +62,8 @@ export class DocumentView extends React.Component<DocumentViewProps> {
public TransformToLocalPoint(screenX: number, screenY: number) {
// if this collection view is nested within another collection view, then
// first transform the screen point into the parent collection's coordinate space.
- let { LocalX: parentX, LocalY: parentY } = this.props.ContainingCollectionView != undefined && this.props.ContainingCollectionView.props.DocumentContentsOfCollection != undefined ?
- this.props.ContainingCollectionView.props.DocumentContentsOfCollection.TransformToLocalPoint(screenX, screenY) :
+ let { LocalX: parentX, LocalY: parentY } = this.props.ContainingCollectionView != undefined && this.props.ContainingCollectionView.props.DocumentViewForCollection != undefined ?
+ this.props.ContainingCollectionView.props.DocumentViewForCollection.TransformToLocalPoint(screenX, screenY) :
{ LocalX: screenX, LocalY: screenY };
let ContainerX: number = parentX - COLLECTION_BORDER_WIDTH;
let ContainerY: number = parentY - COLLECTION_BORDER_WIDTH;
@@ -111,7 +111,7 @@ export class DocumentView extends React.Component<DocumentViewProps> {
// if this collection view is nested within another collection view, then
// first transform the local point into the parent collection's coordinate space.
- let containingDocView = this.props.ContainingCollectionView != undefined ? this.props.ContainingCollectionView.props.DocumentContentsOfCollection : undefined;//.ContainingDocumentContentsView;
+ let containingDocView = this.props.ContainingCollectionView != undefined ? this.props.ContainingCollectionView.props.DocumentViewForCollection : undefined;//.ContainingDocumentContentsView;
if (containingDocView != undefined) {
let ss = containingDocView.props.Document.GetFieldValue(KeyStore.Scale, NumberField, Number(1));
let panxx = containingDocView.props.Document.GetFieldValue(KeyStore.PanX, NumberField, Number(0)) + COLLECTION_BORDER_WIDTH * ss;
@@ -144,7 +144,7 @@ export class DocumentView extends React.Component<DocumentViewProps> {
height: "100%",
}}>
<JsxParser
- components={{ FieldTextBox, ImageBox, CollectionFreeFormView, CollectionDockingView, CollectionSchemaView }}
+ components={{ FormattedTextBox: FormattedTextBox, ImageBox, CollectionFreeFormView, CollectionDockingView, CollectionSchemaView }}
bindings={bindings}
jsx={this.layout}
showWarnings={true}
diff --git a/src/views/nodes/FieldView.tsx b/src/views/nodes/FieldView.tsx
index 9f0404dbf..370f6d324 100644
--- a/src/views/nodes/FieldView.tsx
+++ b/src/views/nodes/FieldView.tsx
@@ -6,7 +6,7 @@ import { Field, Opt } from "../../fields/Field";
import { TextField } from "../../fields/TextField";
import { NumberField } from "../../fields/NumberField";
import { RichTextField } from "../../fields/RichTextField";
-import { FieldTextBox } from "./FieldTextBox";
+import { FormattedTextBox } from "./FormattedTextBox";
import { ImageField } from "../../fields/ImageField";
import { ImageBox } from "./ImageBox";
import { Key } from "../../fields/Key";
@@ -15,7 +15,7 @@ import { DocumentView } from "./DocumentView";
//
// these properties get assigned through the render() method of the DocumentView when it creates this node.
// However, that only happens because the properties are "defined" in the markup for the field view.
-// See the LayoutString method on each field view : ImageBox, FieldTextBox, etc.
+// See the LayoutString method on each field view : ImageBox, FormattedTextBox, etc.
//
export interface FieldViewProps {
fieldKey: Key;
@@ -25,6 +25,7 @@ export interface FieldViewProps {
@observer
export class FieldView extends React.Component<FieldViewProps> {
+ public static LayoutString(fieldType: string) { return `<${fieldType} doc={Document} documentViewContainer={DocumentContentsView} fieldKey={DataKey} />`; }
@computed
get field(): Opt<Field> {
const { doc, fieldKey } = this.props;
@@ -39,7 +40,7 @@ export class FieldView extends React.Component<FieldViewProps> {
return <p>{field.Data}</p>
}
else if (field instanceof RichTextField) {
- return <FieldTextBox {...this.props} />
+ return <FormattedTextBox {...this.props} />
}
else if (field instanceof ImageField) {
return <ImageBox {...this.props} />
diff --git a/src/views/nodes/FieldTextBox.scss b/src/views/nodes/FormattedTextBox.scss
index b6ce2fabc..492367fce 100644
--- a/src/views/nodes/FieldTextBox.scss
+++ b/src/views/nodes/FormattedTextBox.scss
@@ -8,7 +8,7 @@
outline: none !important
}
-.fieldTextBox-cont {
+.formattedTextBox-cont {
background: white;
padding: 1vw;
} \ No newline at end of file
diff --git a/src/views/nodes/FieldTextBox.tsx b/src/views/nodes/FormattedTextBox.tsx
index 0e884a031..d51e91315 100644
--- a/src/views/nodes/FieldTextBox.tsx
+++ b/src/views/nodes/FormattedTextBox.tsx
@@ -5,23 +5,21 @@ import { keymap } from "prosemirror-keymap";
import { schema } from "prosemirror-schema-basic";
import { EditorState, Transaction } from "prosemirror-state";
import { EditorView } from "prosemirror-view";
-import { Document } from "../../fields/Document";
import { Opt } from "../../fields/Field";
-import { Key } from "../../fields/Key";
import { SelectionManager } from "../../util/SelectionManager";
-import "./FieldTextBox.scss";
+import "./FormattedTextBox.scss";
import React = require("react")
import { RichTextField } from "../../fields/RichTextField";
-import { FieldViewProps } from "./FieldView";
+import { FieldViewProps, FieldView } from "./FieldView";
import { CollectionFreeFormDocumentView } from "./CollectionFreeFormDocumentView";
-// FieldTextBox: Displays an editable plain text node that maps to a specified Key of a Document
+// FormattedTextBox: Displays an editable plain text node that maps to a specified Key of a Document
//
-// HTML Markup: <FieldTextBox Doc={Document's ID} FieldKey={Key's name + "Key"}
+// HTML Markup: <FormattedTextBox Doc={Document's ID} FieldKey={Key's name + "Key"}
//
// In Code, the node's HTML is specified in the document's parameterized structure as:
-// document.SetField(KeyStore.Layout, "<FieldTextBox doc={doc} fieldKey={<KEYNAME>Key} />");
+// document.SetField(KeyStore.Layout, "<FormattedTextBox doc={doc} fieldKey={<KEYNAME>Key} />");
// and the node's binding to the specified document KEYNAME as:
// document.SetField(KeyStore.LayoutKeys, new ListField([KeyStore.<KEYNAME>]));
// The Jsx parser at run time will bind:
@@ -32,9 +30,9 @@ import { CollectionFreeFormDocumentView } from "./CollectionFreeFormDocumentView
// specified Key and assigns it to an HTML input node. When changes are made tot his node,
// this will edit the document and assign the new value to that field.
//
-export class FieldTextBox extends React.Component<FieldViewProps> {
+export class FormattedTextBox extends React.Component<FieldViewProps> {
- public static LayoutString() { return "<FieldTextBox doc={Document} documentViewContainer={DocumentContentsView} fieldKey={DataKey} />"; }
+ public static LayoutString() { return FieldView.LayoutString("FormattedTextBox"); }
private _ref: React.RefObject<HTMLDivElement>;
private _editorView: Opt<EditorView>;
private _reactionDisposer: Opt<IReactionDisposer>;
@@ -116,7 +114,7 @@ export class FieldTextBox extends React.Component<FieldViewProps> {
}
}
render() {
- return (<div className="fieldTextBox-cont"
+ return (<div className="formattedTextBox-cont"
style={{
color: "initial",
whiteSpace: "initial"
diff --git a/src/views/nodes/ImageBox.tsx b/src/views/nodes/ImageBox.tsx
index a4254ce39..cced95c89 100644
--- a/src/views/nodes/ImageBox.tsx
+++ b/src/views/nodes/ImageBox.tsx
@@ -5,7 +5,7 @@ import { SelectionManager } from "../../util/SelectionManager";
import "./ImageBox.scss";
import React = require("react")
import { ImageField } from '../../fields/ImageField';
-import { FieldViewProps } from './FieldView';
+import { FieldViewProps, FieldView } from './FieldView';
import { CollectionFreeFormDocumentView } from './CollectionFreeFormDocumentView';
interface ImageBoxState {
@@ -15,7 +15,7 @@ interface ImageBoxState {
export class ImageBox extends React.Component<FieldViewProps, ImageBoxState> {
- public static LayoutString() { return "<ImageBox doc={Document} documentViewContainer={DocumentContentsView} fieldKey={DataKey} />"; }
+ public static LayoutString() { return FieldView.LayoutString("ImageBox"); }
private _ref: React.RefObject<HTMLDivElement>;
private _downX: number = 0;
private _downY: number = 0;