fnp
/
fnpeditor.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Changing main tabs order
[fnpeditor.git]
/
modules
/
documentCanvas
/
documentCanvas.js
diff --git
a/modules/documentCanvas/documentCanvas.js
b/modules/documentCanvas/documentCanvas.js
index
05fbcdd
..
9d2e725
100644
(file)
--- a/
modules/documentCanvas/documentCanvas.js
+++ b/
modules/documentCanvas/documentCanvas.js
@@
-6,7
+6,7
@@
define([
'./wlxmlNode',
\r
'libs/text!./template.html'], function(_, transformations, wlxmlNode, template) {
\r
\r
'./wlxmlNode',
\r
'libs/text!./template.html'], function(_, transformations, wlxmlNode, template) {
\r
\r
-
\r
+'use strict';
\r
\r
return function(sandbox) {
\r
\r
\r
return function(sandbox) {
\r
\r
@@
-57,7
+57,7
@@
return function(sandbox) {
_.each(mutation.addedNodes, function(node) {
\r
node = $(node);
\r
node.parent().find('[wlxml-tag]').each(function() {
\r
_.each(mutation.addedNodes, function(node) {
\r
node = $(node);
\r
node.parent().find('[wlxml-tag]').each(function() {
\r
- tag = $(this);
\r
+
var
tag = $(this);
\r
if(!tag.attr('id'))
\r
tag.attr('id', 'xxxxxxxx-xxxx-xxxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {var r = Math.random()*16|0,v=c=='x'?r:r&0x3|0x8;return v.toString(16);}));
\r
});
\r
if(!tag.attr('id'))
\r
tag.attr('id', 'xxxxxxxx-xxxx-xxxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {var r = Math.random()*16|0,v=c=='x'?r:r&0x3|0x8;return v.toString(16);}));
\r
});
\r
@@
-232,11
+232,16
@@
return function(sandbox) {
var transformed = transformations.fromXML.getDocumentDescription(xml);
\r
view.setBody(transformed.HTMLTree);
\r
view.selectFirstNode();
\r
var transformed = transformations.fromXML.getDocumentDescription(xml);
\r
view.setBody(transformed.HTMLTree);
\r
view.selectFirstNode();
\r
- //isDirty = false;
\r
+ sandbox.publish('documentSet');
\r
+ },
\r
+ getDocument: function() {
\r
+ return transformations.toXML.getXML(view.getBody());
\r
},
\r
modifyCurrentNode: function(attr, value) {
\r
},
\r
modifyCurrentNode: function(attr, value) {
\r
- if(view.currentNode)
\r
- view.currentNode.attr('wlxml-'+attr, value);
\r
+ if(view.currentNode) {
\r
+ view.getNodeElement(view.currentNode).attr('wlxml-'+attr, value);
\r
+ sandbox.publish('contentChanged');
\r
+ }
\r
},
\r
highlightNode: function(wlxmlNode) {
\r
view.highlightNode(wlxmlNode);
\r
},
\r
highlightNode: function(wlxmlNode) {
\r
view.highlightNode(wlxmlNode);
\r
@@
-245,7
+250,8
@@
return function(sandbox) {
view.dimNode(wlxmlNode);
\r
},
\r
selectNode: function(wlxmlNode) {
\r
view.dimNode(wlxmlNode);
\r
},
\r
selectNode: function(wlxmlNode) {
\r
- view.selectNode(wlxmlNode, {moveCarret: true});
\r
+ if(!wlxmlNode.is(view.currentNode))
\r
+ view.selectNode(wlxmlNode, {moveCarret: true});
\r
},
\r
toggleGrid: function(toggle) {
\r
view.toggleGrid(toggle);
\r
},
\r
toggleGrid: function(toggle) {
\r
view.toggleGrid(toggle);
\r