xonomy
xonomy copied to clipboard
Can't edit content of XML with empty tag
I have an xml document that includes empty tags:
<dataStatistics>
<statistic></statistic>
<dataStatistics>
I have specified in the settings that the content of <statistics> should be settable (at least if I understand correctly).
elements: {
"statistic": {
asker: Xonomy.askString,
menu: [
{
caption: "Delete this <statistic>",
action: Xonomy.deleteElement
}
]
}
}
In the editor, the <statistic> tag appears as <statistic/>, and there appears no way to add text content inside of it.
Is this a bug, or am I doing something wrong?
Here is a workaround I just came up with until this is sorted correctly.
var stdMenu = [
{
caption: "Make Null",
action: function(htmlID, actionParameter) {
Xonomy.editRaw(htmlID, actionParameter);
},
actionParameter: {
fromJs: function(jsElement) {
return "<" + jsElement.name + " />";
},
toXml: function(txt, origElement) {
return txt;
}
}
},
{
caption: "Make ?",
action: function(htmlID, actionParameter) {
Xonomy.editRaw(htmlID, actionParameter);
},
actionParameter: {
fromJs: function(jsElement) {
return "<" + jsElement.name + ">?</" + jsElement.name + ">";
},
toXml: function(txt, origElement) {
return txt;
}
}
}
];
var docSpec = {
elements: {
"MessageID": { oneliner: true, menu: stdMenu }
}
}
Now when you "click" on the element name it will pop open this standard menu and use the inbuilt "editRaw" function to set the contents of the element.
@rexrhino You should set hasText:true for the statistics element.