diff --git a/app/mindmap/buffer.py b/app/mindmap/buffer.py index 3315992..00e835d 100644 --- a/app/mindmap/buffer.py +++ b/app/mindmap/buffer.py @@ -53,7 +53,7 @@ class AppBuffer(BrowserBuffer): with open(self.url, "r") as f: self.buffer_widget.execute_js("open_file('{}');".format(string_to_base64(f.read()))) else: - self.buffer_widget.eval_js("edit_root_node();") + self.buffer_widget.eval_js("init_root_node();") self.change_title(self.get_root_node_topic()) diff --git a/app/mindmap/index.html b/app/mindmap/index.html index 81355c4..50e61fd 100644 --- a/app/mindmap/index.html +++ b/app/mindmap/index.html @@ -20,13 +20,12 @@ editable:true } - _jm = jsMind.show(options); - function select_root_node() { _jm.select_node("root"); } - function edit_root_node() { + function init_root_node() { + _jm = jsMind.show(options); select_root_node(); var selected_node = _jm.get_selected_node(); // as parent of new node @@ -172,6 +171,8 @@ } function open_file(file_base64_content) { + _jm = jsMind.show(options); + var file_data = decodeURIComponent(escape(window.atob(file_base64_content))); var mind = jsMind.util.json.string2json(file_data);