fnp
/
redakcja.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
eadb282
)
Fixes #4405: reset metadata editor when switching views.
author
Radek Czajka
<rczajka@rczajka.pl>
Thu, 25 May 2023 09:36:46 +0000
(11:36 +0200)
committer
Radek Czajka
<rczajka@rczajka.pl>
Thu, 25 May 2023 09:36:46 +0000
(11:36 +0200)
src/redakcja/static/js/wiki/base.js
patch
|
blob
|
history
src/redakcja/static/js/wiki/view_editor_source.js
patch
|
blob
|
history
src/redakcja/static/js/wiki/view_editor_wysiwyg.js
patch
|
blob
|
history
src/redakcja/static/js/wiki/view_properties.js
patch
|
blob
|
history
diff --git
a/src/redakcja/static/js/wiki/base.js
b/src/redakcja/static/js/wiki/base.js
index
5262ab7
..
b4fee85
100644
(file)
--- a/
src/redakcja/static/js/wiki/base.js
+++ b/
src/redakcja/static/js/wiki/base.js
@@
-104,6
+104,15
@@
return this.perspectives[ $(tab).attr('id')];
}
return this.perspectives[ $(tab).attr('id')];
}
+ $.wiki.exitTab = function(tab){
+ var self = this;
+ var $tab = $(tab);
+ if (!('.active', $tab)) return;
+ $('.active', $tab).removeClass('active');
+ self.perspectives[$tab.attr('id')].onExit();
+ $('#' + $tab.attr('data-ui-related')).hide();
+ }
+
$.wiki.switchToTab = function(tab){
var self = this;
var $tab = $(tab);
$.wiki.switchToTab = function(tab){
var self = this;
var $tab = $(tab);
diff --git
a/src/redakcja/static/js/wiki/view_editor_source.js
b/src/redakcja/static/js/wiki/view_editor_source.js
index
988d23c
..
ab8eaf0
100644
(file)
--- a/
src/redakcja/static/js/wiki/view_editor_source.js
+++ b/
src/redakcja/static/js/wiki/view_editor_source.js
@@
-66,9
+66,7
@@
$.wiki.Perspective.prototype.onExit.call(this);
this.doc.setText(this.codemirror.getValue());
$.wiki.Perspective.prototype.onExit.call(this);
this.doc.setText(this.codemirror.getValue());
- if ($('.vsplitbar').hasClass('active') && $('#SearchPerspective').hasClass('active')) {
- $.wiki.switchToTab('#ScanGalleryPerspective');
- }
+ $.wiki.exitTab('#SearchPerspective');
if(success) success();
}
if(success) success();
}
diff --git
a/src/redakcja/static/js/wiki/view_editor_wysiwyg.js
b/src/redakcja/static/js/wiki/view_editor_wysiwyg.js
index
2f510a2
..
5183a97
100644
(file)
--- a/
src/redakcja/static/js/wiki/view_editor_wysiwyg.js
+++ b/
src/redakcja/static/js/wiki/view_editor_wysiwyg.js
@@
-743,6
+743,8
@@
var self = this;
self.caret.detach();
var self = this;
self.caret.detach();
+
+ $.wiki.exitTab('#PropertiesPerspective');
$.blockUI({
message: 'Zapisywanie widoku...'
$.blockUI({
message: 'Zapisywanie widoku...'
diff --git
a/src/redakcja/static/js/wiki/view_properties.js
b/src/redakcja/static/js/wiki/view_properties.js
index
fd53f04
..
204a4de
100644
(file)
--- 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;
PropertiesPerspective.prototype.edit = function(element) {
let self = this;
- let $node = $(element);
$("#parents", self.$pane).empty();
$("#bubbles").empty();
$("#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 = $("<div class='badge badge-primary'></div>").text($node.attr('x-node'));
b.data('node', element);
$("#bubbles").append(b);
let b = $("<div class='badge badge-primary'></div>").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);
node = $(element).attr('x-node');
$("h1", self.$pane).text(node);
- $f = $("#properties-form", self.$pane);
- $f.empty();
self.$edited = $(element);
let nodeDef = elementDefs[node];
self.$edited = $(element);
let nodeDef = elementDefs[node];
@@
-372,6
+378,16
@@
this.edit(p);
}
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);
$.wiki.PropertiesPerspective = PropertiesPerspective;
})(jQuery);