X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/dd79289baf8168c654faaaa5c8e5840e3a63f94e..4334b1df511eb3a8161e9a98b1d3f00777e4e054:/src/redakcja/static/js/wiki/view_properties.js diff --git a/src/redakcja/static/js/wiki/view_properties.js b/src/redakcja/static/js/wiki/view_properties.js index fd53f041..204a4dec 100644 --- a/src/redakcja/static/js/wiki/view_properties.js +++ b/src/redakcja/static/js/wiki/view_properties.js @@ -171,10 +171,18 @@ PropertiesPerspective.prototype.edit = function(element) { let self = this; - let $node = $(element); $("#parents", self.$pane).empty(); $("#bubbles").empty(); + $f = $("#properties-form", self.$pane); + $f.empty(); + + if (element === null) { + self.$edited = null; + return; + } + + let $node = $(element); let b = $("
").text($node.attr('x-node')); b.data('node', element); $("#bubbles").append(b); @@ -193,8 +201,6 @@ node = $(element).attr('x-node'); $("h1", self.$pane).text(node); - $f = $("#properties-form", self.$pane); - $f.empty(); self.$edited = $(element); let nodeDef = elementDefs[node]; @@ -372,6 +378,16 @@ this.edit(p); } + PropertiesPerspective.prototype.onEnter = function(success, failure){ + var self = this; + $.wiki.SidebarPerspective.prototype.onEnter.call(this); + + if ($.wiki.activePerspective() != 'VisualPerspective') + $.wiki.switchToTab('#VisualPerspective'); + + self.edit($('[x-node="utwor"]')[0]); + }; + $.wiki.PropertiesPerspective = PropertiesPerspective; })(jQuery);