From e860882af0d1cc8804652343b44b9b14ed0f2b5b Mon Sep 17 00:00:00 2001 From: Tyler Schicke Date: Tue, 30 Apr 2019 17:33:31 -0400 Subject: KVP is working again --- src/new_fields/Doc.ts | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/new_fields/Doc.ts') diff --git a/src/new_fields/Doc.ts b/src/new_fields/Doc.ts index 0e5105761..64cc6d270 100644 --- a/src/new_fields/Doc.ts +++ b/src/new_fields/Doc.ts @@ -36,6 +36,15 @@ export class Doc extends RefField { set: setter, get: getter, ownKeys: target => Object.keys(target.__fields), + getOwnPropertyDescriptor: (target, prop) => { + if (prop in target.__fields) { + return { + configurable: true,//TODO Should configurable be true? + enumerable: true, + }; + } + return Reflect.getOwnPropertyDescriptor(target, prop); + }, deleteProperty: deleteProperty, defineProperty: () => { throw new Error("Currently properties can't be defined on documents using Object.defineProperty"); }, }); -- cgit v1.2.3-70-g09d2 From 3ed9fbefe1428c1493027122791ccbbe1b2fe1d1 Mon Sep 17 00:00:00 2001 From: Bob Zeleznik Date: Tue, 30 Apr 2019 19:48:36 -0400 Subject: fixed link document --- src/client/views/nodes/FormattedTextBox.scss | 6 +++--- src/client/views/nodes/FormattedTextBox.tsx | 8 ++++---- src/new_fields/Doc.ts | 8 ++++---- 3 files changed, 11 insertions(+), 11 deletions(-) (limited to 'src/new_fields/Doc.ts') diff --git a/src/client/views/nodes/FormattedTextBox.scss b/src/client/views/nodes/FormattedTextBox.scss index 727d3c0b2..d43aa4e02 100644 --- a/src/client/views/nodes/FormattedTextBox.scss +++ b/src/client/views/nodes/FormattedTextBox.scss @@ -30,11 +30,11 @@ pointer-events: none; } .formattedTextBox-inner-rounded { - height: calc(100% - 40px); + height: calc(100% - 25px); width: calc(100% - 40px); position: absolute; - overflow: scroll; - top: 20; + overflow: auto; + top: 15; left: 20; } diff --git a/src/client/views/nodes/FormattedTextBox.tsx b/src/client/views/nodes/FormattedTextBox.tsx index 9c6f95fc4..fe9696062 100644 --- a/src/client/views/nodes/FormattedTextBox.tsx +++ b/src/client/views/nodes/FormattedTextBox.tsx @@ -144,8 +144,8 @@ export class FormattedTextBox extends DocComponent<(FieldViewProps & FormattedTe private setupEditor(config: any, doc?: Doc) { let field = doc ? Cast(doc[this.props.fieldKey], RichTextField) : undefined; - if (this._ref.current) { - this._editorView = new EditorView(this._ref.current, { + if (this._proseRef.current) { + this._editorView = new EditorView(this._proseRef.current, { state: field && field.Data ? EditorState.fromJSON(config, JSON.parse(field.Data)) : EditorState.create(config), dispatchTransaction: this.dispatchTransaction }); @@ -195,8 +195,8 @@ export class FormattedTextBox extends DocComponent<(FieldViewProps & FormattedTe if (!this.props.isOverlay) { MainOverlayTextBox.Instance.SetTextDoc(this.props.Document, this.props.fieldKey, this._ref.current!, this.props.ScreenToLocalTransform); } else { - if (this._ref.current) { - this._ref.current.scrollTop = MainOverlayTextBox.Instance.TextScroll; + if (this._proseRef.current) { + this._proseRef.current.scrollTop = MainOverlayTextBox.Instance.TextScroll; } } } diff --git a/src/new_fields/Doc.ts b/src/new_fields/Doc.ts index 64cc6d270..c4ad5ae95 100644 --- a/src/new_fields/Doc.ts +++ b/src/new_fields/Doc.ts @@ -1,7 +1,6 @@ import { observable, action } from "mobx"; import { serializable, primitive, map, alias, list } from "serializr"; import { autoObject, SerializationHelper, Deserializable } from "../client/util/SerializationHelper"; -import { Utils } from "../Utils"; import { DocServer } from "../client/DocServer"; import { setter, getter, getField, updateFunction, deleteProperty } from "./util"; import { Cast, ToConstructor, PromiseValue, FieldValue, NumCast } from "./Types"; @@ -10,6 +9,7 @@ import { listSpec } from "./Schema"; import { List } from "./List"; import { ObjectField, Parent, OnUpdate } from "./ObjectField"; import { RefField, FieldId, Id } from "./RefField"; +import { Docs } from "../client/documents/Documents"; export function IsField(field: any): field is Field { return (typeof field === "string") @@ -163,9 +163,9 @@ export namespace Doc { return copy; } - export function MakeLink(source: Doc, target: Doc): Doc { - return UndoManager.RunInBatch(() => { - let linkDoc = new Doc; + export function MakeLink(source: Doc, target: Doc) { + UndoManager.RunInBatch(() => { + let linkDoc = Docs.TextDocument({ width: 100, height: 30, borderRounding: -1 }); linkDoc.title = "New Link"; linkDoc.linkDescription = ""; linkDoc.linkTags = "Default"; -- cgit v1.2.3-70-g09d2