diff options
author | Nathan-SR <144961007+Nathan-SR@users.noreply.github.com> | 2025-02-20 03:08:07 -0500 |
---|---|---|
committer | Nathan-SR <144961007+Nathan-SR@users.noreply.github.com> | 2025-02-20 03:08:07 -0500 |
commit | 370d731eaff3bad1f61f63478a529d38b49a3ccb (patch) | |
tree | d92a1aeae5b96a127e072033f4fb59e64eaa151b /src | |
parent | 6c5d7c2a4584e73e17593cb54071c91bcf153cca (diff) |
cntentupdate change in staticfield
Diffstat (limited to 'src')
-rw-r--r-- | src/client/views/nodes/DataVizBox/DocCreatorMenu/FieldTypes/StaticField.tsx | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/src/client/views/nodes/DataVizBox/DocCreatorMenu/FieldTypes/StaticField.tsx b/src/client/views/nodes/DataVizBox/DocCreatorMenu/FieldTypes/StaticField.tsx index df997c8c5..2090d94b9 100644 --- a/src/client/views/nodes/DataVizBox/DocCreatorMenu/FieldTypes/StaticField.tsx +++ b/src/client/views/nodes/DataVizBox/DocCreatorMenu/FieldTypes/StaticField.tsx @@ -3,6 +3,7 @@ import { Docs, DocumentOptions } from "../../../../../documents/Documents"; import { Col } from "../DocCreatorMenu"; import { FieldUtils } from "./FieldUtils"; import { Field, FieldContentType, FieldDimensions, FieldSettings, ViewType } from "./Field"; +import { RichTextField } from "../../../../../../fields/RichTextField"; export class StaticField extends Field { @@ -27,7 +28,28 @@ export class StaticField extends Field { }; setContent = (newContent: string, type?: FieldContentType) => { + console.log('set to: ', newContent) + const rtf = { + doc: { + type: 'doc', + content: [ + { + type: 'paragraph', + content: [ + { + type: 'text', + newContent, + }, + ], + }, + ], + }, + selection: { type: 'text', anchor: 1, head: 1 }, + storedMarks: [], + }; + const field = new RichTextField(JSON.stringify(rtf), newContent); this.content = newContent; + // this.renderedDocument['data'] = field; if (type) this.contentType = type; this.updateRenderedDoc(this.renderedDocument /*, true*/); @@ -60,7 +82,6 @@ export class StaticField extends Field { }; updateRenderedDoc = (oldDoc?: Doc): Doc => { - console.log(' static field updated'); const opts = this.settings.opts; if (!this.contentType) { this.contentType = FieldContentType.STRING }; @@ -70,6 +91,7 @@ export class StaticField extends Field { switch (this.contentType) { case FieldContentType.STRING: const text = String(this.content); + console.log('creating text doc with text: ', text) doc = Docs.Create.TextDocument(text, { title: this.title, text_fontColor: oldDoc ? String(oldDoc.color) : opts.text_fontColor, |