feat: edit entries
This commit is contained in:
parent
8e215a6962
commit
3d87fd8fcb
30 changed files with 519 additions and 6 deletions
27
addons/markdown_text_edit/markdown_text_edit.gd
Normal file
27
addons/markdown_text_edit/markdown_text_edit.gd
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
class_name MarkdownTextEdit extends TextEdit
|
||||
|
||||
@export var h1 = HeaderFormat.new() : set = _set_h1_format
|
||||
|
||||
var _converted_text: String
|
||||
|
||||
func _ready() -> void:
|
||||
h1.changed.connect(_update)
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
pass
|
||||
|
||||
|
||||
func _update() -> void:
|
||||
text = _convert_markdown(markdown_text)
|
||||
queue_redraw()
|
||||
|
||||
func _set_h1_format(new_format: HeaderFormat) -> void:
|
||||
h1 = new_format
|
||||
_update()
|
||||
|
||||
func _convert_markdown(text: String = "") -> String:
|
||||
_converted_text = ""
|
||||
var lines = text.split("\n")
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue