diff options
author | Bob Zeleznik <zzzman@gmail.com> | 2020-04-22 00:20:10 -0400 |
---|---|---|
committer | Bob Zeleznik <zzzman@gmail.com> | 2020-04-22 00:20:10 -0400 |
commit | f8019f3894cfcff29318a95d8c71a033de7a2ac6 (patch) | |
tree | 32fc563bd4c83425051ca8e8f67bfe1f01e75280 | |
parent | 682782a1337003de1694d1625d262a1efddcb02d (diff) |
fixed div content scripts
-rw-r--r-- | src/client/views/nodes/DocumentContentsView.tsx | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/client/views/nodes/DocumentContentsView.tsx b/src/client/views/nodes/DocumentContentsView.tsx index b5af68ba1..bc8bf3ba2 100644 --- a/src/client/views/nodes/DocumentContentsView.tsx +++ b/src/client/views/nodes/DocumentContentsView.tsx @@ -144,10 +144,10 @@ export class DocumentContentsView extends React.Component<DocumentViewProps & { let layoutFrame = this.layout; // replace code content with a script >{content}< as in <HTMLdiv>{this.title}</HTMLdiv> - const replacer = (match: any, expr: string, offset: any, string: any) => { - return ">" + (ScriptField.MakeFunction(expr, { self: Doc.name, this: Doc.name })?.script.run({ this: this.props.Document }).result as string || "") + "<"; + const replacer = (match: any, prefix: string, expr: string, postfix: string, offset: any, string: any) => { + return prefix + (ScriptField.MakeFunction(expr, { self: Doc.name, this: Doc.name })?.script.run({ this: this.props.Document }).result as string || "") + postfix; }; - layoutFrame = layoutFrame.replace(/>\{([^.'][^<}]+)\}</g, replacer); + 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: any, p1: string, offset: any, string: any) => { |