aboutsummaryrefslogtreecommitdiff
path: root/editor/example.ts
diff options
context:
space:
mode:
Diffstat (limited to 'editor/example.ts')
-rw-r--r--editor/example.ts20
1 files changed, 15 insertions, 5 deletions
diff --git a/editor/example.ts b/editor/example.ts
index a967045..39efb4c 100644
--- a/editor/example.ts
+++ b/editor/example.ts
@@ -48,13 +48,23 @@ sudo systemctl status telegraf
const opts = {
id: "editor",
- is_editable: true,
- onSelection: (begin: number, end: number) => {
- console.log("OnSelection: ", begin, end);
- },
+ isEditable: true,
onSave: (content: string) => {
- console.log("OnSave: ", content);
+ const lines = content.split("\n");
+ lines.forEach((line: string, x: number) => {
+ console.log(`${x}: ${line}`);
+ });
},
};
const wuiEditor = new WuiEditor(opts);
wuiEditor.open(nodeFile);
+
+const optsro = {
+ id: "editor-readonly",
+ isEditable: false,
+ onSave: (content: string) => {
+ console.log("OnSave: ", content);
+ },
+};
+const edro = new WuiEditor(optsro);
+edro.open(nodeFile);