aboutsummaryrefslogtreecommitdiff
path: root/src/client
diff options
context:
space:
mode:
Diffstat (limited to 'src/client')
-rw-r--r--src/client/documents/Documents.ts2
-rw-r--r--src/client/util/Scripting.ts10
-rw-r--r--src/client/views/nodes/formattedText/DailyJournal.tsx12
3 files changed, 14 insertions, 10 deletions
diff --git a/src/client/documents/Documents.ts b/src/client/documents/Documents.ts
index d21fa04d4..e1aa9aca2 100644
--- a/src/client/documents/Documents.ts
+++ b/src/client/documents/Documents.ts
@@ -927,7 +927,7 @@ export namespace Docs {
return InstanceFromProto(
Prototypes.get(DocumentType.JOURNAL),
- typeof text === 'string' ? RichTextField.textToRtfFormatting(text, undefined, undefined, styles) : text,
+ typeof text === 'string' ? RichTextField.textToRtf(text, undefined, styles, undefined) : text,
{
title: new Date().toLocaleDateString(undefined, {
weekday: 'long',
diff --git a/src/client/util/Scripting.ts b/src/client/util/Scripting.ts
index 5d78c2fab..c6d98496a 100644
--- a/src/client/util/Scripting.ts
+++ b/src/client/util/Scripting.ts
@@ -48,7 +48,11 @@ export function isCompileError(toBeDetermined: CompileResult): toBeDetermined is
// eslint-disable-next-line no-use-before-define
function Run(script: string | undefined, customParams: string[], diagnostics: ts.Diagnostic[], originalScript: string, options: ScriptOptions): CompileResult {
- const errors = diagnostics.filter(diag => diag.category === ts.DiagnosticCategory.Error).filter(diag => diag.code !== 2304 && diag.code !== 2339);
+ const errors = diagnostics.filter(diag => diag.category === ts.DiagnosticCategory.Error).filter(diag => //
+ diag.code !== 2304 &&
+ diag.code !== 2339 &&
+ (diag.code !== 2552 ||!Object.keys(scriptingGlobals).includes(diagnostics[0].messageText.toString().match(/Cannot find name '([A-Za-z0-9$-_]+)'/)?.[1]??"-------"))
+ ); // prettier-ignore
if ((options.typecheck !== false && errors.length) || !script) {
return { compiled: false, errors };
}
@@ -222,10 +226,10 @@ export function CompileScript(script: string, options: ScriptOptions = {}): Comp
if ('this' in params || 'this' in capturedVariables) {
paramNames.push('this');
}
- paramNames.push(...Object.keys(params).filter(p => p!== 'this' && !Object.keys(capturedVariables).includes(p)));
+ paramNames.push(...Object.keys(params).filter(p => p !== 'this' && !Object.keys(capturedVariables).includes(p)));
const paramList = paramNames.map(key => {
- const val = typeof params[key] === "string" && params[key].length && !"\"'`".includes(params[key][0]) ? `"${params[key]}"` : params[key];
+ const val = typeof params[key] === 'string' && params[key].length && !'"\'`'.includes(params[key][0]) ? `"${params[key]}"` : params[key];
return `${key}: ${val}`;
});
for (const key in capturedVariables) {
diff --git a/src/client/views/nodes/formattedText/DailyJournal.tsx b/src/client/views/nodes/formattedText/DailyJournal.tsx
index 42c559da4..25bb44924 100644
--- a/src/client/views/nodes/formattedText/DailyJournal.tsx
+++ b/src/client/views/nodes/formattedText/DailyJournal.tsx
@@ -56,18 +56,18 @@ export class DailyJournal extends ViewBoxAnnotatableComponent<FieldViewProps>()
console.log('Checking if dataDoc has text field...');
- const styles = {
- bold: true, // Make the journal date bold
+ const styles = {
+ bold: true, // Make the journal date bold
color: 'blue', // Set the journal date color to blue
- fontSize: 18 // Set the font size to 18px for the whole text
+ fontSize: 18, // Set the font size to 18px for the whole text
};
console.log('Setting new text field with:', initialText);
- this.dataDoc[this.fieldKey] = RichTextField.textToRtfFormatting(
+ this.dataDoc[this.fieldKey] = RichTextField.textToRtf(
initialText,
undefined, // No image DocId
- placeholderText.length, // The position for text selection
- styles // Pass the styles object here
+ styles, // Pass the styles object here
+ placeholderText.length // The position for text selection
);
console.log('Current text field:', this.dataDoc[this.fieldKey]);