White space Handling

By default, Xeditor doesn't allow inserting multiple white spaces. This is due to the fact that most XML processors ignore multiple white spaces anyway. In addition, rendering all spaces as is would lead to some issues:

  • Pretty printed XML documents would have a weird styling if all spaces would be displayed as is
  • XML is about creating structured content, and is not meant to be used for layouting. Being able to insert multiple spaces, would encourage the user to "style" the document by inserting them

However, most XML Schemas do offer a space attribute, most commonly used xml:space with it's value set to preserve taken from xml.xsd. Its main purpose is to indicate elements in which spaces should be preserved and displayed as is. It is mostly set within codeblock elements.

Xeditor does support this attributes, you can configure them by setting the configurations for preserveWhiteSpaceAttribute and preserveWhiteSpaceValue.

However, if you want to turn off Xeditors whitespace handling, you can do so by adding the following override:

Ext.override(Ext.ux.xeditor.Element, {
shouldPreserveWhitespaces: function(ignoreParents) {
return true;
}
});