aboutsummaryrefslogtreecommitdiff
path: root/editor/example.html
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2021-08-29 13:53:00 +0700
committerShulhan <ms@kilabit.info>2021-08-29 13:53:00 +0700
commit7940feda7d50c404fb245b645c8261d6cb4dd768 (patch)
tree1d688fde2e998e8c2fb1cfd9b0ccf53022743177 /editor/example.html
parent51e7db8b61ec21628fc0ed2f5f48bfff47962684 (diff)
downloadpakakeh.ts-7940feda7d50c404fb245b645c8261d6cb4dd768.tar.xz
editor: simplify the Open method
Previously, the Open method call the predefined options OpenFile, which in turn may send request to remote server. This changes simplify it by accepting node interface that has been filled with content and metadata.
Diffstat (limited to 'editor/example.html')
-rw-r--r--editor/example.html33
1 files changed, 12 insertions, 21 deletions
diff --git a/editor/example.html b/editor/example.html
index 1c22f3f..c4eef27 100644
--- a/editor/example.html
+++ b/editor/example.html
@@ -13,25 +13,10 @@
</script>
<script src="editor.js"></script>
<script>
- function main() {
- let opts = {
- id: "editor",
- is_editable: true,
- OpenFile: doOpenFile,
- }
-
- wuiEditor = new WuiEditor(opts)
-
- wuiEditor.OpenFile("/test.aww")
- }
-
- function doOpenFile(path) {
- let res = {
- code: 200,
- data: {
- name: "Test",
- path: path,
- content: `mkdir -p \${HOME}/aur/stackdriver-collectd
+ let nodeFile = {
+ name: "Test",
+ path: "/test",
+ content: `mkdir -p \${HOME}/aur/stackdriver-collectd
git -C \${HOME}/aur/stackdriver-collectd clone \\
ssh://aur@aur.archlinux.org/stackdriver-collectd.git .
@@ -62,9 +47,15 @@ sudo systemctl status stackdriver-collectd
sudo systemctl restart telegraf
sudo systemctl status telegraf
`,
- },
+ }
+
+ function main() {
+ let opts = {
+ id: "editor",
+ is_editable: true,
}
- return res
+ wuiEditor = new WuiEditor(opts)
+ wuiEditor.Open(nodeFile)
}
</script>
</body>