From d7770e94876540a81bae06d233b6196a91650325 Mon Sep 17 00:00:00 2001 From: bobzel Date: Fri, 11 Oct 2024 16:20:09 -0400 Subject: added some commenting and code tweaks to ComparisonBox --- src/fields/RichTextField.ts | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src/fields/RichTextField.ts') diff --git a/src/fields/RichTextField.ts b/src/fields/RichTextField.ts index 613bb0fd1..dc636031a 100644 --- a/src/fields/RichTextField.ts +++ b/src/fields/RichTextField.ts @@ -48,4 +48,27 @@ export class RichTextField extends ObjectField { '' ); } + + public static textToRtf(text: string, imgDocId?: string) { + return new RichTextField( + JSON.stringify({ + // this is a RichText json that has the question text placed above a related image + doc: { + type: 'doc', + content: [ + { + type: 'paragraph', + attrs: { align: 'center', color: null, id: null, indent: null, inset: null, lineSpacing: null, paddingBottom: null, paddingTop: null }, + content: [ + ...(text ? [{ type: 'text', text }] : []), // + ...(imgDocId ? [{ type: 'dashDoc', attrs: { width: '200px', height: '200px', title: 'dashDoc', float: 'unset', hidden: false, docId: imgDocId } }] : []), + ], + }, + ], + }, + selection: { type: 'text', anchor: 2, head: 2 }, + }), + text + ); + } } -- cgit v1.2.3-70-g09d2