}
});
- this.wrapper.on('click', '[wlxml-tag], [wlxml-text]', function(e) {
+ this.wrapper.on('click', '[wlxml-tag], [document-text-element]', function(e) {
e.stopPropagation();
canvas.setCurrentElement(canvas.getDocumentElement(e.target), {caretTo: false});
});
var config = { attributes: false, childList: false, characterData: true, subtree: true, characterDataOldValue: true};
observer.observe(this.d[0], config);
- this.wrapper.on('mouseover', '[wlxml-tag], [wlxml-text]', function(e) {
+
+ this.wrapper.on('mouseover', '[wlxml-tag], [document-text-element]', function(e) {
var el = canvas.getDocumentElement(e.target);
if(!el)
return;
el = el.parent();
el.toggleLabel(true);
});
- this.wrapper.on('mouseout', '[wlxml-tag], [wlxml-text]', function(e) {
+ this.wrapper.on('mouseout', '[wlxml-tag], [document-text-element]', function(e) {
var el = canvas.getDocumentElement(e.target);
if(!el)
return;
});
describe('Internal HTML representation of a DocumentTextElement', function() {
- it('is text node wrapped in a div with wlxml-text attribute set', function() {
+ it('is text node wrapped in a div with document-text-element attribute set', function() {
var dom = canvas.fromXML('<section>Alice</section>').doc().children()[0].dom();
expect(dom.prop('tagName')).to.equal('DIV');
- expect(dom.attr('wlxml-text')).to.equal('');
+ expect(dom.attr('document-text-element')).to.equal('');
expect(dom.contents().length).to.equal(1);
expect(dom.contents()[0].nodeType).to.equal(Node.TEXT_NODE);
expect($(dom.contents()[0]).text()).to.equal('Alice');
var $element = $(htmlElement);
if(htmlElement.nodeType === Node.ELEMENT_NODE && $element.attr('document-node-element') !== undefined)
return DocumentNodeElement.fromHTMLElement(htmlElement, canvas);
- if($element.attr('wlxml-text') !== undefined || (htmlElement.nodeType === Node.TEXT_NODE && $element.parent().attr('wlxml-text') !== undefined))
+ if($element.attr('document-text-element') !== undefined || (htmlElement.nodeType === Node.TEXT_NODE && $element.parent().attr('document-text-element') !== undefined))
return DocumentTextElement.fromHTMLElement(htmlElement, canvas);
return undefined;
}
$.extend(DocumentTextElement, {
createDOM: function(params) {
return $('<div>')
- .attr('wlxml-text', '')
+ .attr('document-text-element', '')
.text(params.text || utils.unicode.ZWS);
},
return new this(htmlElement, canvas);
},
isContentContainer: function(htmlElement) {
- return htmlElement.nodeType === Node.TEXT_NODE && $(htmlElement).parent().is('[wlxml-text]');
+ return htmlElement.nodeType === Node.TEXT_NODE && $(htmlElement).parent().is('[document-text-element]');
}
});
-[wlxml-text] {
+[document-text-element] {
display: inline;
margin: 0 1px;
border: 1px solid white;