diff --git a/ServerUI.gd b/ServerUI.gd index 78f0623..fc45f48 100644 --- a/ServerUI.gd +++ b/ServerUI.gd @@ -24,6 +24,7 @@ onready var file_tree_context_menu := $"%FileTreeContextMenu" onready var document_input_textedit := $"%DocInputTextEdit" onready var content_preview_richtextlabel := $"%ContentPreviewRichTextLabel" +onready var document_input_timer := $"%EditedTimeout" onready var server_folder_dialog := $"%ServerFolderDialog" @@ -147,7 +148,7 @@ func set_server_running(running: bool) -> void: is_server_running = running # TODO: logic for disabling and enabling certain nodes -func _generate_filestxt() -> String: +func _generate_filestxt(): var files := "" for file in working_files: @@ -155,7 +156,13 @@ func _generate_filestxt() -> String: if file.include_in_filestxt: files += "%s %s %s\n" % [file.file_path, file.date, file.title] - return files + var f := File.new() + + if f.open(server_dir.plus_file("files.txt"), File.WRITE) == OK: + f.store_string(files) + f.close() + else: + push_error("File.txt open for save error!") func _is_file_in_filestxt(path: String) -> bool: diff --git a/ServerUI.tscn b/ServerUI.tscn index 31d8177..c78ba70 100644 --- a/ServerUI.tscn +++ b/ServerUI.tscn @@ -206,6 +206,11 @@ size_flags_vertical = 3 show_line_numbers = true wrap_enabled = true +[node name="EditedTimeout" type="Timer" parent="VBoxContainer/HSplitContainer/VBoxContainer/HBoxContainer/VBoxContainer/HSplitContainer/ContentEditContainer/DocInputTextEdit"] +unique_name_in_owner = true +wait_time = 3.0 +one_shot = true + [node name="ContentPreviewContainer" type="VBoxContainer" parent="VBoxContainer/HSplitContainer/VBoxContainer/HBoxContainer/VBoxContainer/HSplitContainer"] margin_left = 390.0 margin_right = 848.0