mirror of
https://github.com/Relintai/pandemonium_cms.git
synced 2024-11-14 09:37:19 +01:00
Initial setup for the blog editor.
This commit is contained in:
parent
59d2549d2a
commit
92d8f9c195
@ -1,3 +1,4 @@
|
|||||||
extends Resource
|
extends Resource
|
||||||
class_name WebBlogEntry, "res://addons/web_blog/icons/icon_web_blog_post_entry.svg"
|
class_name WebBlogEntry, "res://addons/web_blog/icons/icon_web_blog_post_entry.svg"
|
||||||
|
|
||||||
|
|
||||||
|
42
game/addons/web_blog/editor/WebBlogEditor.gd
Normal file
42
game/addons/web_blog/editor/WebBlogEditor.gd
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
tool
|
||||||
|
extends Control
|
||||||
|
|
||||||
|
var _wne_tool_bar_button : Button = null
|
||||||
|
|
||||||
|
func _enter_tree():
|
||||||
|
var wne : Control = Engine.get_global("WebNodeEditor")
|
||||||
|
if wne:
|
||||||
|
_wne_tool_bar_button = Button.new()
|
||||||
|
_wne_tool_bar_button.set_text("Blog Editor")
|
||||||
|
_wne_tool_bar_button.set_tooltip("HTML preview")
|
||||||
|
_wne_tool_bar_button.set_toggle_mode(true)
|
||||||
|
_wne_tool_bar_button.set_pressed(false)
|
||||||
|
_wne_tool_bar_button.set_button_group(wne.get_main_button_group())
|
||||||
|
_wne_tool_bar_button.set_keep_pressed_outside(true)
|
||||||
|
wne.add_control_to_tool_bar(_wne_tool_bar_button)
|
||||||
|
_wne_tool_bar_button.connect("toggled", self, "_on_blog_editor_button_toggled")
|
||||||
|
wne.connect("edited_node_changed", self, "_edited_node_changed")
|
||||||
|
|
||||||
|
func _exit_tree():
|
||||||
|
if _wne_tool_bar_button:
|
||||||
|
_wne_tool_bar_button.queue_free()
|
||||||
|
|
||||||
|
func _on_blog_editor_button_toggled(on):
|
||||||
|
if on:
|
||||||
|
var wne : Control = Engine.get_global("WebNodeEditor")
|
||||||
|
if wne:
|
||||||
|
wne.switch_to_main_screen_tab(self)
|
||||||
|
_wne_tool_bar_button.set_pressed_no_signal(true)
|
||||||
|
|
||||||
|
func _edited_node_changed(web_node : WebNode):
|
||||||
|
var wne : Control = Engine.get_global("WebNodeEditor")
|
||||||
|
if wne:
|
||||||
|
if web_node is WebBlog:
|
||||||
|
_wne_tool_bar_button.show()
|
||||||
|
_wne_tool_bar_button.pressed = true
|
||||||
|
#wne.switch_to_main_screen_tab(self)
|
||||||
|
else:
|
||||||
|
_wne_tool_bar_button.hide()
|
||||||
|
#add method to switch off to the prev screen
|
||||||
|
#wne.switch_to_main_screen_tab(self)
|
||||||
|
|
@ -1,5 +1,8 @@
|
|||||||
[gd_scene format=2]
|
[gd_scene load_steps=2 format=2]
|
||||||
|
|
||||||
[node name="Control" type="Control"]
|
[ext_resource path="res://addons/web_blog/editor/WebBlogEditor.gd" type="Script" id=1]
|
||||||
|
|
||||||
|
[node name="WebBlogEditor" type="Control"]
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
anchor_bottom = 1.0
|
anchor_bottom = 1.0
|
||||||
|
script = ExtResource( 1 )
|
||||||
|
@ -1,11 +1,20 @@
|
|||||||
tool
|
tool
|
||||||
extends EditorPlugin
|
extends EditorPlugin
|
||||||
|
|
||||||
|
var web_blog_editor : Control = null
|
||||||
|
|
||||||
func _enter_tree():
|
func _enter_tree():
|
||||||
pass
|
var wbes : PackedScene = ResourceLoader.load("res://addons/web_blog/editor/WebBlogEditor.tscn")
|
||||||
|
web_blog_editor = wbes.instance()
|
||||||
|
|
||||||
|
var wne : Control = Engine.get_global("WebNodeEditor")
|
||||||
|
if wne:
|
||||||
|
wne.add_main_screen_tab(web_blog_editor)
|
||||||
|
|
||||||
func _exit_tree():
|
func _exit_tree():
|
||||||
pass
|
var wne : Control = Engine.get_global("WebNodeEditor")
|
||||||
|
if wne:
|
||||||
|
wne.remove_main_screen_tab(web_blog_editor)
|
||||||
|
|
||||||
func get_plugin_name() -> String:
|
func get_plugin_name() -> String:
|
||||||
return "WebBlogEditorPlugin"
|
return "WebBlogEditorPlugin"
|
||||||
|
Loading…
Reference in New Issue
Block a user