aboutsummaryrefslogtreecommitdiff
path: root/src/debug
diff options
context:
space:
mode:
Diffstat (limited to 'src/debug')
-rw-r--r--src/debug/Repl.tsx11
-rw-r--r--src/debug/Test.tsx1
-rw-r--r--src/debug/Viewer.tsx24
3 files changed, 27 insertions, 9 deletions
diff --git a/src/debug/Repl.tsx b/src/debug/Repl.tsx
index c2db3bdcb..4f4db13d2 100644
--- a/src/debug/Repl.tsx
+++ b/src/debug/Repl.tsx
@@ -4,6 +4,9 @@ import { observer } from 'mobx-react';
import { observable, computed } from 'mobx';
import { CompileScript } from '../client/util/Scripting';
import { makeInterface } from '../new_fields/Schema';
+import { ObjectField } from '../new_fields/ObjectField';
+import { RefField } from '../new_fields/RefField';
+import { DocServer } from '../client/DocServer';
@observer
class Repl extends React.Component {
@@ -42,7 +45,8 @@ class Repl extends React.Component {
return (
<div style={{ marginTop: "5px" }}>
<p>{command.command}</p>
- <pre>{JSON.stringify(command.result, null, 2)}</pre>
+ {/* <pre>{JSON.stringify(command.result, null, 2)}</pre> */}
+ <pre>{command.result instanceof RefField || command.result instanceof ObjectField ? "object" : String(command.result)}</pre>
</div>
);
});
@@ -60,4 +64,7 @@ class Repl extends React.Component {
}
}
-ReactDOM.render(<Repl />, document.getElementById("root")); \ No newline at end of file
+(async function () {
+ DocServer.init(window.location.protocol, window.location.hostname, 4321, "repl");
+ ReactDOM.render(<Repl />, document.getElementById("root"));
+})(); \ No newline at end of file
diff --git a/src/debug/Test.tsx b/src/debug/Test.tsx
index 57221aa39..0dca4b4b1 100644
--- a/src/debug/Test.tsx
+++ b/src/debug/Test.tsx
@@ -6,7 +6,6 @@ import { ImageField } from '../new_fields/URLField';
import { Doc } from '../new_fields/Doc';
import { List } from '../new_fields/List';
-
const schema1 = createSchema({
hello: "number",
test: "string",
diff --git a/src/debug/Viewer.tsx b/src/debug/Viewer.tsx
index b22300d0b..2b3eed154 100644
--- a/src/debug/Viewer.tsx
+++ b/src/debug/Viewer.tsx
@@ -10,6 +10,15 @@ import { List } from '../new_fields/List';
import { URLField } from '../new_fields/URLField';
import { EditableView } from '../client/views/EditableView';
import { CompileScript } from '../client/util/Scripting';
+import { DateField } from '../new_fields/DateField';
+import { ScriptField } from '../new_fields/ScriptField';
+import CursorField from '../new_fields/CursorField';
+
+DateField;
+URLField;
+ScriptField;
+CursorField;
+
function applyToDoc(doc: { [index: string]: FieldResult }, key: string, scriptString: string): boolean;
function applyToDoc(doc: { [index: number]: FieldResult }, key: number, scriptString: string): boolean;
@@ -169,9 +178,12 @@ class Viewer extends React.Component {
}
}
-ReactDOM.render((
- <div style={{ position: "absolute", width: "100%", height: "100%" }}>
- <Viewer />
- </div>),
- document.getElementById('root')
-); \ No newline at end of file
+(async function () {
+ await DocServer.init(window.location.protocol, window.location.hostname, 4321, "viewer");
+ ReactDOM.render((
+ <div style={{ position: "absolute", width: "100%", height: "100%" }}>
+ <Viewer />
+ </div>),
+ document.getElementById('root')
+ );
+})(); \ No newline at end of file