aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/DocumentContentsView.tsx
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2025-03-09 17:40:08 -0400
committerbobzel <zzzman@gmail.com>2025-03-09 17:40:08 -0400
commitdf173b02ffb7e2937d20a02beec1815b3af7c34e (patch)
treed5f9f383581818d302e9d42fe6f12eb2632763e9 /src/client/views/nodes/DocumentContentsView.tsx
parent1a48ccf57ae43bc582dcd7be453e0ad217d38828 (diff)
removed simulation doc. fixed empty imageBox uploading. fixed script typechecking. fixed metadata doc. fixed setting background colors of docs that have a template.
Diffstat (limited to 'src/client/views/nodes/DocumentContentsView.tsx')
-rw-r--r--src/client/views/nodes/DocumentContentsView.tsx11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/client/views/nodes/DocumentContentsView.tsx b/src/client/views/nodes/DocumentContentsView.tsx
index aab8a183a..47c5734f7 100644
--- a/src/client/views/nodes/DocumentContentsView.tsx
+++ b/src/client/views/nodes/DocumentContentsView.tsx
@@ -23,7 +23,6 @@ interface HTMLtagProps {
htmltag: string;
onClick?: ScriptField;
onInput?: ScriptField;
- scaling: number;
children?: JSX.Element[];
}
@@ -43,7 +42,7 @@ interface HTMLtagProps {
export class HTMLtag extends React.Component<HTMLtagProps> {
click = () => {
const clickScript = this.props.onClick as Opt<ScriptField>;
- clickScript?.script.run({ this: this.props.Document, scale: this.props.scaling });
+ clickScript?.script.run({ this: this.props.Document });
};
onInput = (e: React.FormEvent<unknown>) => {
const onInputScript = this.props.onInput as Opt<ScriptField>;
@@ -56,7 +55,6 @@ export class HTMLtag extends React.Component<HTMLtagProps> {
'dragStarting',
'dragEnding',
'htmltag',
- 'scaling',
'Document',
'key',
'onInput',
@@ -65,7 +63,7 @@ export class HTMLtag extends React.Component<HTMLtagProps> {
]).omit;
const replacer = (match: string, expr: string) =>
// bcz: this executes a script to convert a property expression string: { script } into a value
- (ScriptField.MakeFunction(expr, { this: Doc.name, scale: 'number' })?.script.run({ this: this.props.Document, scale: this.props.scaling }).result as string) || '';
+ (ScriptField.MakeFunction(expr, { this: Doc.name })?.script.run({ this: this.props.Document }).result as string) || '';
Object.keys(divKeys).forEach((prop: string) => {
const p = (this.props as unknown as { [key: string]: string })[prop] as string;
style[prop] = p?.replace(/{([^.'][^}']+)}/g, replacer);
@@ -166,12 +164,11 @@ export class DocumentContentsView extends ObservableReactComponent<DocumentConte
layoutFrame = layoutFrame.replace(/(>[^{]*)[^=]\{([^.'][^<}]+)\}([^}]*<)/g, replacer);
// replace HTML<tag> with corresponding HTML tag as in: <HTMLdiv> becomes <HTMLtag Document={props.Document} htmltag='div'>
- const replacer2 = (match: string, p1: string) => `<HTMLtag Document={props.Document} scaling='${this._props.NativeDimScaling?.() || 1}' htmltag='${p1}'`;
+ const replacer2 = (match: string, p1: string) => `<HTMLtag Document={props.Document} htmltag='${p1}'`;
layoutFrame = layoutFrame.replace(/<HTML([a-zA-Z0-9_-]+)/g, replacer2);
// replace /HTML<tag> with </HTMLdiv> as in: </HTMLdiv> becomes </HTMLtag>
const replacer3 = (/* match: any, p1: string, offset: any, string: any */) => `</HTMLtag`;
-
layoutFrame = layoutFrame.replace(/<\/HTML([a-zA-Z0-9_-]+)/g, replacer3);
// add onClick function to props
@@ -181,7 +178,7 @@ export class DocumentContentsView extends ObservableReactComponent<DocumentConte
const code = XRegExp.matchRecursive(splits[1], '{', '}', '', { valueNames: ['between', 'left', 'match', 'right', 'between'] });
layoutFrame = splits[0] + ` ${func}={props.${func}} ` + splits[1].substring(code[1].end + 1);
const script = code[1].value.replace(/^‘/, '').replace(/’$/, ''); // ‘’ are not valid quotes in javascript so get rid of them -- they may be present to make it easier to write complex scripts - see headerTemplate in currentUserUtils.ts
- return ScriptField.MakeScript(script, { this: Doc.name, scale: 'number', value: 'string' });
+ return ScriptField.MakeScript(script, { this: Doc.name, value: 'string' });
}
return undefined;
// add input function to props