fnp
/
fnpeditor.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
b2f1929
)
internal container wip: refactoring
author
Aleksander Łukasz
<aleksander.lukasz@nowoczesnapolska.org.pl>
Sun, 4 Aug 2013 20:44:28 +0000
(22:44 +0200)
committer
Aleksander Łukasz
<aleksander.lukasz@nowoczesnapolska.org.pl>
Mon, 5 Aug 2013 10:20:06 +0000
(12:20 +0200)
modules/documentCanvas/canvas/canvas.js
patch
|
blob
|
history
modules/documentCanvas/canvas/canvas.test3.js
patch
|
blob
|
history
modules/documentCanvas/canvas/documentElement.js
patch
|
blob
|
history
modules/documentCanvas/nodes.less
patch
|
blob
|
history
diff --git
a/modules/documentCanvas/canvas/canvas.js
b/modules/documentCanvas/canvas/canvas.js
index
a89a148
..
f96e62e
100644
(file)
--- a/
modules/documentCanvas/canvas/canvas.js
+++ b/
modules/documentCanvas/canvas/canvas.js
@@
-206,7
+206,7
@@
$.extend(Canvas.prototype, {
}
});
}
});
- this.wrapper.on('click', '[wlxml-tag], [
wlxml-tex
t]', function(e) {
+ this.wrapper.on('click', '[wlxml-tag], [
document-text-elemen
t]', function(e) {
e.stopPropagation();
canvas.setCurrentElement(canvas.getDocumentElement(e.target), {caretTo: false});
});
e.stopPropagation();
canvas.setCurrentElement(canvas.getDocumentElement(e.target), {caretTo: false});
});
@@
-220,7
+220,8
@@
$.extend(Canvas.prototype, {
var config = { attributes: false, childList: false, characterData: true, subtree: true, characterDataOldValue: true};
observer.observe(this.d[0], config);
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;
var el = canvas.getDocumentElement(e.target);
if(!el)
return;
@@
-229,7
+230,7
@@
$.extend(Canvas.prototype, {
el = el.parent();
el.toggleLabel(true);
});
el = el.parent();
el.toggleLabel(true);
});
- this.wrapper.on('mouseout', '[wlxml-tag], [
wlxml-tex
t]', function(e) {
+ this.wrapper.on('mouseout', '[wlxml-tag], [
document-text-elemen
t]', function(e) {
var el = canvas.getDocumentElement(e.target);
if(!el)
return;
var el = canvas.getDocumentElement(e.target);
if(!el)
return;
diff --git
a/modules/documentCanvas/canvas/canvas.test3.js
b/modules/documentCanvas/canvas/canvas.test3.js
index
3b14b19
..
fc390ec
100644
(file)
--- a/
modules/documentCanvas/canvas/canvas.test3.js
+++ b/
modules/documentCanvas/canvas/canvas.test3.js
@@
-30,10
+30,10
@@
describe('Canvas', function() {
});
describe('Internal HTML representation of a DocumentTextElement', function() {
});
describe('Internal HTML representation of a DocumentTextElement', function() {
- it('is text node wrapped in a div with
wlxml-tex
t attribute set', function() {
+ it('is text node wrapped in a div with
document-text-elemen
t attribute set', function() {
var dom = canvas.fromXML('<section>Alice</section>').doc().children()[0].dom();
expect(dom.prop('tagName')).to.equal('DIV');
var dom = canvas.fromXML('<section>Alice</section>').doc().children()[0].dom();
expect(dom.prop('tagName')).to.equal('DIV');
- expect(dom.attr('
wlxml-tex
t')).to.equal('');
+ expect(dom.attr('
document-text-elemen
t')).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');
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');
diff --git
a/modules/documentCanvas/canvas/documentElement.js
b/modules/documentCanvas/canvas/documentElement.js
index
1354a84
..
f03719e
100644
(file)
--- a/
modules/documentCanvas/canvas/documentElement.js
+++ b/
modules/documentCanvas/canvas/documentElement.js
@@
-34,7
+34,7
@@
$.extend(DocumentElement, {
var $element = $(htmlElement);
if(htmlElement.nodeType === Node.ELEMENT_NODE && $element.attr('document-node-element') !== undefined)
return DocumentNodeElement.fromHTMLElement(htmlElement, canvas);
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-tex
t') !== undefined))
+ if($element.attr('
document-text-element') !== undefined || (htmlElement.nodeType === Node.TEXT_NODE && $element.parent().attr('document-text-elemen
t') !== undefined))
return DocumentTextElement.fromHTMLElement(htmlElement, canvas);
return undefined;
}
return DocumentTextElement.fromHTMLElement(htmlElement, canvas);
return undefined;
}
@@
-353,7
+353,7
@@
var DocumentTextElement = function(htmlElement, canvas) {
$.extend(DocumentTextElement, {
createDOM: function(params) {
return $('<div>')
$.extend(DocumentTextElement, {
createDOM: function(params) {
return $('<div>')
- .attr('
wlxml-tex
t', '')
+ .attr('
document-text-elemen
t', '')
.text(params.text || utils.unicode.ZWS);
},
.text(params.text || utils.unicode.ZWS);
},
@@
-365,7
+365,7
@@
$.extend(DocumentTextElement, {
return new this(htmlElement, canvas);
},
isContentContainer: function(htmlElement) {
return new this(htmlElement, canvas);
},
isContentContainer: function(htmlElement) {
- return htmlElement.nodeType === Node.TEXT_NODE && $(htmlElement).parent().is('[
wlxml-tex
t]');
+ return htmlElement.nodeType === Node.TEXT_NODE && $(htmlElement).parent().is('[
document-text-elemen
t]');
}
});
}
});
diff --git
a/modules/documentCanvas/nodes.less
b/modules/documentCanvas/nodes.less
index
1b325d6
..
cf1df16
100644
(file)
--- a/
modules/documentCanvas/nodes.less
+++ b/
modules/documentCanvas/nodes.less
@@
-1,4
+1,4
@@
-[
wlxml-tex
t] {
+[
document-text-elemen
t] {
display: inline;
margin: 0 1px;
border: 1px solid white;
display: inline;
margin: 0 1px;
border: 1px solid white;