- Fix notes issues. Now, notes are part of a CDATA seccion

This commit is contained in:
Paulo Veiga 2011-11-27 20:55:52 -03:00
parent 0ac513ea1e
commit 30de8b44ed
3 changed files with 307 additions and 291 deletions

View File

@ -163,9 +163,6 @@ mindplot.FixedDistanceBoard = new Class({
}
// @todo: Esto hace backtraking. Hay que cambiar la implementacion del set position de
// forma tal que no se mande a hacer el update de todos los hijos.
// Workout center the new topic center...
var refence = this.getReferencePoint();
var lowerLimit;

View File

@ -174,7 +174,8 @@ mindplot.XMLMindmapSerializer_Pela = new Class({
_noteToXML : function(document, note) {
var noteDom = document.createElement("note");
noteDom.setAttribute('text', note.getText());
var cdata = document.createCDATASection(note.getText());
noteDom.appendChild(cdata);
return noteDom;
},
@ -313,14 +314,13 @@ mindplot.XMLMindmapSerializer_Pela = new Class({
if ($defined(position)) {
var pos = position.split(',');
topic.setPosition(pos[0], pos[1]);
// topic.setFinalPosition(pos[0], pos[1]);
}
//Creating icons and children nodes
var children = domElem.childNodes;
for (var i = 0; i < children.length; i++) {
var child = children[i];
if (child.nodeType == 1) {
if (child.nodeType == Node.ELEMENT_NODE) {
$assert(child.tagName == "topic" || child.tagName == "icon" || child.tagName == "link" || child.tagName == "note", 'Illegal node type:' + child.tagName);
if (child.tagName == "topic") {
var childTopic = this._deserializeNode(child, mindmap);
@ -349,7 +349,17 @@ mindplot.XMLMindmapSerializer_Pela = new Class({
},
_deserializeNote : function(domElem, topic) {
return topic.createNote(domElem.getAttribute("text"));
var value = domElem.getAttribute("text");
if(!$defined(value)){
var children = domElem.childNodes;
for (var i = 0; i < children.length; i++) {
var child = children[i];
if(child.nodeType == Node.CDATA_SECTION_NODE){
value = child.nodeValue;
}
}
}
return topic.createNote(value);
},
_deserializeRelationship : function(domElement, mindmap) {

View File

@ -78,6 +78,15 @@
}
}
});
// @Todo: Hack for testing save ...
window.MapEditorService = {};
window.MapEditorService.saveMap = function(mapId, xmlMapStr, pref, saveHistory){
console.log(xmlMapStr);
};
</script>
<link rel="icon" href="../images/favicon.ico" type="image/x-icon">