|
|
@ -6,7 +6,8 @@ import * as Dom from UnitJS.Dom; |
|
|
|
import {appendTo, onNodes} from XML; |
|
|
|
|
|
|
|
return { |
|
|
|
display: display, |
|
|
|
edit: edit, |
|
|
|
display: display |
|
|
|
}; |
|
|
|
|
|
|
|
function display(ALTODoc) { |
|
|
@ -57,3 +58,27 @@ function display(ALTODoc) { |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
function edit(ALTODoc) { |
|
|
|
var printSpace = ALTODoc.querySelector('Page PrintSpace'); |
|
|
|
editElement(printSpace); |
|
|
|
return ALTODoc; |
|
|
|
} |
|
|
|
|
|
|
|
function editElement(xmlElement) { |
|
|
|
if(xmlElement.tagName == 'String') { |
|
|
|
return !isScoria(xmlElement.getAttribute('ID')); |
|
|
|
} else { |
|
|
|
editChildren(xmlElement, Element.schema[xmlElement.tagName]); |
|
|
|
return xmlElement.children.length > 0; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
function editChildren(xmlElement, childTag) { |
|
|
|
for(var i = 0; i < xmlElement.children.length; i++) { |
|
|
|
var child = xmlElement.children[i]; |
|
|
|
if(child.tagName == childTag && !editElement(child)) { |
|
|
|
xmlElement.removeChild(child); |
|
|
|
} |
|
|
|
} |
|
|
|
} |