.*?)\\]|\\((?[h\\.]\\S*?)\\)")
+ result = regex.search_all(content)
+ if result:
+ for res in result:
+ if res.get_string("link")!="":
+ links.append(res.get_string("link"))
+ if res.get_string("linkname")!="":
+ linknames.append(res.get_string("linkname"))
+
+ for bold in bolded:
+ content = content.replace("**"+bold+"**","[b]"+bold+"[/b]")
+ for italic in italics:
+ content = content.replace("*"+italic+"*","[i]"+italic+"[/i]")
+ for strik in striked:
+ content = content.replace("~~"+strik+"~~","[s]"+strik+"[/s]")
+ for code in coded:
+ content = content.replace("`"+code+"`","[code]"+code+"[/code]")
+ for image in images:
+ var substr = image.split("(")
+ var imglink = substr[1].rstrip(")")
+ content = content.replace(image,"[img]"+imglink+"[/img]")
+ for i in links.size():
+ content = content.replace("["+linknames[i]+"]("+links[i]+")","[url="+links[i]+"]"+linknames[i]+"[/url]")
+ for element in lists:
+ if content.find("- "+element):
+ content = content.replace("-"+element,"[indent]-"+element+"[/indent]")
+ if content.find("+ "+element):
+ content = content.replace("+"+element,"[indent]-"+element+"[/indent]")
+
+ TextPreview.append_bbcode(content)
+
+func print_html(content : String):
+ content = content.replace("","[i]")
+ content = content.replace("","[/i]")
+ content = content.replace("","[b]")
+ content = content.replace("","[/b]")
+ content = content.replace("","[u]")
+ content = content.replace("","[/u]")
+ content = content.replace('',"]")
+ content = content.replace("","[/url]")
+ content = content.replace('',"[/img]")
+ content = content.replace('"/>',"[/img]")
+ content = content.replace("","[code]")
+ content = content.replace("
","[/code]")
+ content = content.replace("","[center]")
+ content = content.replace("","[/center]")
TextPreview.append_bbcode(content)
diff --git a/addons/file-editor/scripts/file-editor.gd b/addons/file-editor/scripts/file-editor.gd
index 266c2a5..576a861 100644
--- a/addons/file-editor/scripts/file-editor.gd
+++ b/addons/file-editor/scripts/file-editor.gd
@@ -1,14 +1,29 @@
tool
extends EditorPlugin
-var doc
+var doc = preload("../scenes/FileEditor.tscn").instance()
var plugin_version
+var toolbar
+var fileditorbutton
+var IconLoader = preload("res://addons/file-editor/scripts/IconLoader.gd")
func _enter_tree():
- doc = preload("../scenes/FileEditor.tscn").instance()
- add_control_to_dock(EditorPlugin.DOCK_SLOT_LEFT_BR,doc)
-
+ add_autoload_singleton("IconLoader","res://addons/file-editor/scripts/IconLoader.gd")
+ get_editor_interface().get_editor_viewport().add_child(doc)
+ doc.hide()
func _exit_tree():
- remove_control_from_docks(doc)
- doc.queue_free()
\ No newline at end of file
+ get_editor_interface().get_editor_viewport().remove_child(doc)
+ remove_autoload_singleton("IconLoader")
+
+func has_main_screen():
+ return true
+
+func get_plugin_name():
+ return "File"
+
+func get_plugin_icon():
+ return IconLoader.load_icon_from_name("file")
+
+func make_visible(visible):
+ doc.visible = visible
\ No newline at end of file