fnp
/
fnpeditor.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
1067bdc
)
editor: fix - better handle node removal in various views
author
Aleksander Łukasz
<aleksander.lukasz@nowoczesnapolska.org.pl>
Tue, 18 Feb 2014 15:10:58 +0000
(16:10 +0100)
committer
Aleksander Łukasz
<aleksander.lukasz@nowoczesnapolska.org.pl>
Wed, 23 Apr 2014 11:05:04 +0000
(13:05 +0200)
src/editor/modules/metadataEditor/metadataEditor.js
patch
|
blob
|
history
src/editor/modules/nodeBreadCrumbs/nodeBreadCrumbs.js
patch
|
blob
|
history
src/editor/modules/nodePane/nodePane.js
patch
|
blob
|
history
diff --git
a/src/editor/modules/metadataEditor/metadataEditor.js
b/src/editor/modules/metadataEditor/metadataEditor.js
index
1088247
..
70df62e
100644
(file)
--- a/
src/editor/modules/metadataEditor/metadataEditor.js
+++ b/
src/editor/modules/metadataEditor/metadataEditor.js
@@
-191,7
+191,7
@@
return function(sandbox) {
if(event.type === 'metadataRemoved' && event.meta.node.sameNode(currentNode)) {
view.removeMetadataRow(event.meta.row);
}
if(event.type === 'metadataRemoved' && event.meta.node.sameNode(currentNode)) {
view.removeMetadataRow(event.meta.row);
}
- if(event.type === 'nodeDetached' && event.meta.node.
same
Node(currentNode)) {
+ if(event.type === 'nodeDetached' && event.meta.node.
contains
Node(currentNode)) {
view.setMetadata(null);
}
});
view.setMetadata(null);
}
});
diff --git
a/src/editor/modules/nodeBreadCrumbs/nodeBreadCrumbs.js
b/src/editor/modules/nodeBreadCrumbs/nodeBreadCrumbs.js
index
188aa6e
..
0540542
100644
(file)
--- a/
src/editor/modules/nodeBreadCrumbs/nodeBreadCrumbs.js
+++ b/
src/editor/modules/nodeBreadCrumbs/nodeBreadCrumbs.js
@@
-8,7
+8,8
@@
define([
return function(sandbox) {
return function(sandbox) {
- var template = _.template(templateSrc);
+ var template = _.template(templateSrc),
+ listens = false;
var view = {
dom: $('<div>' + template({node:null, parents: null}) + '</div>'),
var view = {
dom: $('<div>' + template({node:null, parents: null}) + '</div>'),
@@
-58,6
+59,14
@@
return function(sandbox) {
start: function() { sandbox.publish('ready'); },
getView: function() { return view.dom; },
setNodeElement: function(nodeElement) {
start: function() { sandbox.publish('ready'); },
getView: function() { return view.dom; },
setNodeElement: function(nodeElement) {
+ if(!listens && nodeElement) {
+ nodeElement.document.on('change', function() {
+ if(view.currentNodeElement && !view.currentNodeElement.isInDocument()) {
+ view.setNodeElement(null);
+ }
+ });
+ listens = true;
+ }
view.setNodeElement(nodeElement);
},
highlightNode: function(id) { view.highlightNode(id); },
view.setNodeElement(nodeElement);
},
highlightNode: function(id) { view.highlightNode(id); },
diff --git
a/src/editor/modules/nodePane/nodePane.js
b/src/editor/modules/nodePane/nodePane.js
index
f7e6694
..
85a6fdd
100644
(file)
--- a/
src/editor/modules/nodePane/nodePane.js
+++ b/
src/editor/modules/nodePane/nodePane.js
@@
-35,6
+35,9
@@
return function(sandbox) {
var module = this;
if(!listens) {
wlxmlNodeElement.document.on('change', function(event) {
var module = this;
if(!listens) {
wlxmlNodeElement.document.on('change', function(event) {
+ if(currentNode && !currentNode.isInDocument()) {
+ module.setNodeElement(null);
+ }
if(event.type === 'nodeAttrChange' && event.meta.node.sameNode(currentNode)) {
module.setNodeElement(currentNode);
}
if(event.type === 'nodeAttrChange' && event.meta.node.sameNode(currentNode)) {
module.setNodeElement(currentNode);
}