From 0b9dab6403ed3e073f499cd38d3cb4aa434d7c95 Mon Sep 17 00:00:00 2001 From: Bob Zeleznik Date: Sun, 10 Mar 2019 20:30:44 -0400 Subject: fixed issue with typing into an existing note in an embedded collection --- src/client/views/nodes/FormattedTextBox.tsx | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/client/views/nodes/FormattedTextBox.tsx') diff --git a/src/client/views/nodes/FormattedTextBox.tsx b/src/client/views/nodes/FormattedTextBox.tsx index a6cee9957..f5063f9b1 100644 --- a/src/client/views/nodes/FormattedTextBox.tsx +++ b/src/client/views/nodes/FormattedTextBox.tsx @@ -151,8 +151,12 @@ export class FormattedTextBox extends React.Component { }) } + onKeyPress(e: React.KeyboardEvent) { + e.stopPropagation(); + } render() { return (
Date: Sun, 10 Mar 2019 22:20:31 -0400 Subject: fixed type of FormattedTextBox to RichTextField --- src/client/documents/Documents.ts | 11 ++++++----- src/client/views/nodes/FormattedTextBox.tsx | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) (limited to 'src/client/views/nodes/FormattedTextBox.tsx') diff --git a/src/client/documents/Documents.ts b/src/client/documents/Documents.ts index a91834cca..b78762018 100644 --- a/src/client/documents/Documents.ts +++ b/src/client/documents/Documents.ts @@ -22,6 +22,7 @@ import { AudioBox } from "../views/nodes/AudioBox"; import { PDFField } from "../../fields/PDFField"; import { PDFBox } from "../views/nodes/PDFBox"; import { CollectionPDFView } from "../views/collections/CollectionPDFView"; +import { RichTextField } from "../../fields/RichTextField"; export interface DocumentOptions { x?: number; @@ -45,8 +46,8 @@ export namespace Documents { let webProto: Document; let collProto: Document; let kvpProto: Document; - let videoProto: Document; - let audioProto: Document; + let videoProto: Document; + let audioProto: Document; let pdfProto: Document; const textProtoId = "textProto"; const pdfProtoId = "pdfProto"; @@ -150,7 +151,7 @@ export namespace Documents { doc.SetText(KeyStore.OverlayLayout, FixedCaption()); return doc; } - export function VideoDocument(url: string, options: DocumentOptions = {}){ + export function VideoDocument(url: string, options: DocumentOptions = {}) { let doc = SetInstanceOptions(GetVideoPrototype(), { ...options, layoutKeys: [KeyStore.Data, KeyStore.Annotations, KeyStore.Caption] }, new URL(url), VideoField); doc.SetText(KeyStore.Caption, "my caption..."); @@ -158,7 +159,7 @@ export namespace Documents { doc.SetText(KeyStore.OverlayLayout, FixedCaption()); return doc; } - export function AudioDocument(url: string, options: DocumentOptions = {}){ + export function AudioDocument(url: string, options: DocumentOptions = {}) { let doc = SetInstanceOptions(GetAudioPrototype(), { ...options, layoutKeys: [KeyStore.Data, KeyStore.Annotations, KeyStore.Caption] }, new URL(url), AudioField); doc.SetText(KeyStore.Caption, "my caption..."); @@ -167,7 +168,7 @@ export namespace Documents { return doc; } export function TextDocument(options: DocumentOptions = {}) { - return SetInstanceOptions(GetTextPrototype(), options, "", TextField); + return SetInstanceOptions(GetTextPrototype(), options, "", RichTextField); } export function PdfDocument(url: string, options: DocumentOptions = {}) { return SetInstanceOptions(GetPdfPrototype(), options, new URL(url), PDFField); diff --git a/src/client/views/nodes/FormattedTextBox.tsx b/src/client/views/nodes/FormattedTextBox.tsx index f5063f9b1..ad7ddf37a 100644 --- a/src/client/views/nodes/FormattedTextBox.tsx +++ b/src/client/views/nodes/FormattedTextBox.tsx @@ -69,7 +69,7 @@ export class FormattedTextBox extends React.Component { }; let field = this.props.doc.GetT(this.props.fieldKey, RichTextField); - if (field && field != FieldWaiting) { + if (field && field != FieldWaiting && field.Data) { state = EditorState.fromJSON(config, JSON.parse(field.Data)); } else { state = EditorState.create(config); -- cgit v1.2.3-70-g09d2