1
0
Natan Keddem 1 жил өмнө
parent
commit
3f4ed99414

+ 6 - 0
nicegui/elements/json_editor.js

@@ -31,6 +31,12 @@ export default {
         this.editor.destroy();
       }
     },
+    call_editor_method(name, arg) {
+      if (this.editor) {
+        this.arg = new Function("return " + arg)();
+        this.editor[name](this.arg);
+      }
+    },
   },
   props: {
     properties: Object,

+ 3 - 0
nicegui/elements/json_editor.py

@@ -42,3 +42,6 @@ class JsonEditor(Element, component='json_editor.js', exposed_libraries=['lib/va
     def update(self) -> None:
         super().update()
         self.run_method('update_editor')
+
+    def call_editor_method(self, name: str, arg) -> None:
+        self.run_method('call_editor_method', name, arg)