From 498f915675c1a7e6a3c3b332a2ecc77222bb4785 Mon Sep 17 00:00:00 2001 From: laurawilsonri Date: Tue, 26 Feb 2019 17:46:27 -0500 Subject: removed a bunch of stuff --- src/client/views/nodes/DocumentView.tsx | 2 -- src/client/views/nodes/FormattedTextBox.tsx | 29 +++++------------------------ 2 files changed, 5 insertions(+), 26 deletions(-) (limited to 'src/client/views/nodes') diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx index 9f80c4e3a..50dc9ddc1 100644 --- a/src/client/views/nodes/DocumentView.tsx +++ b/src/client/views/nodes/DocumentView.tsx @@ -113,14 +113,12 @@ export class DocumentView extends React.Component { } } - onPointerMove = (e: PointerEvent): void => { if (e.cancelBubble) { this._contextMenuCanOpen = false; return; } if (Math.abs(this._downX - e.clientX) > 3 || Math.abs(this._downY - e.clientY) > 3) { - this._contextMenuCanOpen = false; if (this._mainCont.current != null && !this.topMost) { this._contextMenuCanOpen = false; diff --git a/src/client/views/nodes/FormattedTextBox.tsx b/src/client/views/nodes/FormattedTextBox.tsx index 63d00a310..a92821ed6 100644 --- a/src/client/views/nodes/FormattedTextBox.tsx +++ b/src/client/views/nodes/FormattedTextBox.tsx @@ -2,24 +2,22 @@ import { action, IReactionDisposer, reaction } from "mobx"; import { baseKeymap } from "prosemirror-commands"; import { history, redo, undo } from "prosemirror-history"; import { keymap } from "prosemirror-keymap"; +const { exampleSetup } = require("prosemirror-example-setup") import { schema } from "prosemirror-schema-basic"; -import { Transform } from "prosemirror-transform"; -import { EditorState, Transaction } from "prosemirror-state"; +import { EditorState, Transaction, } from "prosemirror-state"; import { EditorView } from "prosemirror-view"; -import { Node } from "prosemirror-model"; import { Opt, FieldWaiting, FieldValue } from "../../../fields/Field"; import "./FormattedTextBox.scss"; import { KeyStore } from "../../../fields/KeyStore"; import React = require("react") import { RichTextField } from "../../../fields/RichTextField"; import { FieldViewProps, FieldView } from "./FieldView"; -import { CollectionFreeFormDocumentView } from "./CollectionFreeFormDocumentView"; -import { observer } from "mobx-react"; -import { Schema, DOMParser } from "prosemirror-model" import { Plugin } from 'prosemirror-state' import { Decoration, DecorationSet } from 'prosemirror-view' + + // FormattedTextBox: Displays an editable plain text node that maps to a specified Key of a Document // // HTML Markup: { private _ref: React.RefObject; private _editorView: Opt; private _reactionDisposer: Opt; - private _lastTextState = ""; constructor(props: FieldViewProps) { super(props); @@ -58,24 +55,9 @@ export class FormattedTextBox extends React.Component { this._editorView.updateState(state); const { doc, fieldKey } = this.props; doc.SetData(fieldKey, JSON.stringify(state.toJSON()), RichTextField); - this._lastTextState = JSON.stringify(state.toJSON); } } - //enables textboxes to be created with preexisting text or placeholder text - //this method is passed in as part of the config the editor state in componentDidMount() - placeholderPlugin(text: string) { - return new Plugin({ - props: { - decorations(state) { - let doc = state.doc - if (doc.childCount == 1 && doc.firstChild && doc.firstChild.isTextblock && doc.firstChild.content.size == 0) - return DecorationSet.create(doc, [Decoration.widget(1, document.createTextNode(text))]) - } - } - }) - } - componentDidMount() { let state: EditorState; const { doc, fieldKey } = this.props; @@ -85,8 +67,8 @@ export class FormattedTextBox extends React.Component { history(), keymap({ "Mod-z": undo, "Mod-y": redo }), keymap(baseKeymap), - //sets the placeholder text to what's in KeyStore.Text! ] + }; let field = doc.GetT(fieldKey, RichTextField); @@ -134,7 +116,6 @@ export class FormattedTextBox extends React.Component { @action onChange(e: React.ChangeEvent) { const { fieldKey, doc } = this.props; - this._lastTextState = e.target.value; doc.SetData(fieldKey, e.target.value, RichTextField); } onPointerDown = (e: React.PointerEvent): void => { -- cgit v1.2.3-70-g09d2