aboutsummaryrefslogtreecommitdiff
path: root/src/new_fields/Doc.ts
diff options
context:
space:
mode:
authorbob <bcz@cs.brown.edu>2019-08-08 10:58:04 -0400
committerbob <bcz@cs.brown.edu>2019-08-08 10:58:04 -0400
commit44a0bc3546eca5fa18f3599448ebcebf709e3f90 (patch)
tree83e44be4be892e05f8b750fcf708ef69b33c6687 /src/new_fields/Doc.ts
parentff087aca29a01a8aa254148c9ab6082c3921fb3b (diff)
fixed titling of aliases. fixed docking panel initial size.
Diffstat (limited to 'src/new_fields/Doc.ts')
-rw-r--r--src/new_fields/Doc.ts6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/new_fields/Doc.ts b/src/new_fields/Doc.ts
index c51b42e07..ba01cfd9c 100644
--- a/src/new_fields/Doc.ts
+++ b/src/new_fields/Doc.ts
@@ -393,6 +393,7 @@ export namespace Doc {
let alias = !GetT(doc, "isPrototype", "boolean", true) ? Doc.MakeCopy(doc) : Doc.MakeDelegate(doc);
let aliasNumber = Doc.GetProto(doc).aliasNumber = NumCast(Doc.GetProto(doc).aliasNumber) + 1;
let script = `return renameAlias(self, ${aliasNumber})`;
+ //let script = "StrCast(self.title).replace(/\\([0-9]*\\)/, \"\") + `(${n})`";
let compiled = CompileScript(script, { params: { this: "Doc" }, capturedVariables: { self: doc }, typecheck: false });
if (compiled.compiled) {
alias.title = new ComputedField(compiled);
@@ -588,4 +589,7 @@ export namespace Doc {
let index = manager.BrushedDoc.indexOf(doc);
if (index !== -1) runInAction(() => manager.BrushedDoc.splice(index, 1));
}
-} \ No newline at end of file
+}
+Scripting.addGlobal(function renameAlias(doc: any, n: any) {
+ return StrCast(doc.title).replace(/\([0-9]*\)/, "") + `(${n})`;
+}); \ No newline at end of file