fnp
/
fnpeditor.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
fd61d32
)
boundries → boundaries
author
Jan Szejko
<janek37@gmail.com>
Wed, 22 Feb 2017 16:22:55 +0000
(17:22 +0100)
committer
Jan Szejko
<janek37@gmail.com>
Wed, 22 Feb 2017 16:25:56 +0000
(17:25 +0100)
src/editor/modules/documentCanvas/canvas/canvas.js
patch
|
blob
|
history
src/editor/modules/documentCanvas/canvas/canvas.test.js
patch
|
blob
|
history
src/editor/plugins/core/core.js
patch
|
blob
|
history
src/editor/plugins/core/edumed/gaps/actions.js
patch
|
blob
|
history
src/editor/plugins/core/edumed/replace/actions.js
patch
|
blob
|
history
src/editor/plugins/core/footnote.js
patch
|
blob
|
history
src/editor/plugins/core/lists.js
patch
|
blob
|
history
src/smartxml/fragments.js
patch
|
blob
|
history
src/wlxml/extensions/list/list.test.js
patch
|
blob
|
history
src/wlxml/wlxml.test.js
patch
|
blob
|
history
diff --git
a/src/editor/modules/documentCanvas/canvas/canvas.js
b/src/editor/modules/documentCanvas/canvas/canvas.js
index
bc7e2a7
..
7ebecc8
100644
(file)
--- a/
src/editor/modules/documentCanvas/canvas/canvas.js
+++ b/
src/editor/modules/documentCanvas/canvas/canvas.js
@@
-554,18
+554,18
@@
$.extend(Cursor.prototype, {
return this.getSelectionAnchor();
},
getSelectionStart: function() {
return this.getSelectionAnchor();
},
getSelectionStart: function() {
- return this.getSelectionBoundry('start');
+ return this.getSelectionBound
a
ry('start');
},
getSelectionEnd: function() {
},
getSelectionEnd: function() {
- return this.getSelectionBoundry('end');
+ return this.getSelectionBound
a
ry('end');
},
getSelectionAnchor: function() {
},
getSelectionAnchor: function() {
- return this.getSelectionBoundry('anchor');
+ return this.getSelectionBound
a
ry('anchor');
},
getSelectionFocus: function() {
},
getSelectionFocus: function() {
- return this.getSelectionBoundry('focus');
+ return this.getSelectionBound
a
ry('focus');
},
},
- getSelectionBoundry: function(which) {
+ getSelectionBound
a
ry: function(which) {
/* globals window */
var selection = window.getSelection(),
anchorElement = this.canvas.getDocumentElement(selection.anchorNode),
/* globals window */
var selection = window.getSelection(),
anchorElement = this.canvas.getDocumentElement(selection.anchorNode),
diff --git
a/src/editor/modules/documentCanvas/canvas/canvas.test.js
b/src/editor/modules/documentCanvas/canvas/canvas.test.js
index
be4a8b9
..
028c767
100644
(file)
--- a/
src/editor/modules/documentCanvas/canvas/canvas.test.js
+++ b/
src/editor/modules/documentCanvas/canvas/canvas.test.js
@@
-489,7
+489,7
@@
describe('Cursor', function() {
});
});
});
});
- it('returns boundries of selection when browser selection not collapsed', function() {
+ it('returns bound
a
ries of selection when browser selection not collapsed', function() {
var c = getCanvasFromXML('<section>Alice <span>has</span> a <span>big</span> cat</section>'),
dom = c.doc().dom,
text = {
var c = getCanvasFromXML('<section>Alice <span>has</span> a <span>big</span> cat</section>'),
dom = c.doc().dom,
text = {
@@
-521,7
+521,7
@@
describe('Cursor', function() {
});
});
});
});
- it('recognizes when browser selection boundries lies in sibling DocumentTextElements', function() {
+ it('recognizes when browser selection bound
a
ries lies in sibling DocumentTextElements', function() {
var c = getCanvasFromXML('<section>Alice <span>has</span> a <span>big</span> cat</section>'),
dom = c.doc().dom,
text = {
var c = getCanvasFromXML('<section>Alice <span>has</span> a <span>big</span> cat</section>'),
dom = c.doc().dom,
text = {
diff --git
a/src/editor/plugins/core/core.js
b/src/editor/plugins/core/core.js
index
c56c5db
..
bc74e6b
100644
(file)
--- a/
src/editor/plugins/core/core.js
+++ b/
src/editor/plugins/core/core.js
@@
-488,7
+488,7
@@
var createWrapTextAction = function(createParams) {
});
}
});
}
- if(params.fragment instanceof params.fragment.TextRangeFragment && params.fragment.hasSiblingBoundries()) {
+ if(params.fragment instanceof params.fragment.TextRangeFragment && params.fragment.hasSiblingBound
a
ries()) {
parent = params.fragment.startNode.parent();
if(parent && parent.is(createParams.klass) || parent.isInside(createParams.klass)) {
return _.extend(state, {allowed: false});
parent = params.fragment.startNode.parent();
if(parent && parent.is(createParams.klass) || parent.isInside(createParams.klass)) {
return _.extend(state, {allowed: false});
@@
-616,7
+616,7
@@
var linkAction = {
}
if(params.fragment instanceof params.fragment.TextRangeFragment) {
}
if(params.fragment instanceof params.fragment.TextRangeFragment) {
- if(!params.fragment.hasSiblingBoundries() || params.fragment.startNode.parent().is('link')) {
+ if(!params.fragment.hasSiblingBound
a
ries() || params.fragment.startNode.parent().is('link')) {
return {allowed: false};
}
return {
return {allowed: false};
}
return {
diff --git
a/src/editor/plugins/core/edumed/gaps/actions.js
b/src/editor/plugins/core/edumed/gaps/actions.js
index
e91faa4
..
e4d4e8a
100644
(file)
--- a/
src/editor/plugins/core/edumed/gaps/actions.js
+++ b/
src/editor/plugins/core/edumed/gaps/actions.js
@@
-41,7
+41,7
@@
var createGap = {
allowed: params.fragment &&
params.fragment.isValid() &&
params.fragment instanceof params.fragment.TextRangeFragment &&
allowed: params.fragment &&
params.fragment.isValid() &&
params.fragment instanceof params.fragment.TextRangeFragment &&
- params.fragment.hasSiblingBoundries() &&
+ params.fragment.hasSiblingBound
a
ries() &&
params.fragment.startNode.isInside('exercise.gap') &&
!params.fragment.startNode.isInside({tagName: 'aside', klass: 'gap'}),
params.fragment.startNode.isInside('exercise.gap') &&
!params.fragment.startNode.isInside({tagName: 'aside', klass: 'gap'}),
diff --git
a/src/editor/plugins/core/edumed/replace/actions.js
b/src/editor/plugins/core/edumed/replace/actions.js
index
be4782a
..
29eceb5
100644
(file)
--- a/
src/editor/plugins/core/edumed/replace/actions.js
+++ b/
src/editor/plugins/core/edumed/replace/actions.js
@@
-54,7
+54,7
@@
var markToReplace = {
allowed: params.fragment &&
params.fragment.isValid() &&
params.fragment instanceof params.fragment.TextRangeFragment &&
allowed: params.fragment &&
params.fragment.isValid() &&
params.fragment instanceof params.fragment.TextRangeFragment &&
- params.fragment.hasSameBoundries() &&
+ params.fragment.hasSameBound
a
ries() &&
params.fragment.startNode.isInside('exercise.replace') &&
!params.fragment.startNode.isInside({tagName: 'span', klass: 'answer'}),
params.fragment.startNode.isInside('exercise.replace') &&
!params.fragment.startNode.isInside({tagName: 'span', klass: 'answer'}),
diff --git
a/src/editor/plugins/core/footnote.js
b/src/editor/plugins/core/footnote.js
index
2fa314a
..
6c3004f
100644
(file)
--- a/
src/editor/plugins/core/footnote.js
+++ b/
src/editor/plugins/core/footnote.js
@@
-45,7
+45,7
@@
var footnoteAction = {
if(!params.fragment || !params.fragment.isValid()) {
return {allowed: false};
}
if(!params.fragment || !params.fragment.isValid()) {
return {allowed: false};
}
- if(params.fragment instanceof params.fragment.TextRangeFragment && params.fragment.hasSiblingBoundries()) {
+ if(params.fragment instanceof params.fragment.TextRangeFragment && params.fragment.hasSiblingBound
a
ries()) {
return {
allowed: true,
description: gettext('Create footnote from selection'),
return {
allowed: true,
description: gettext('Create footnote from selection'),
diff --git
a/src/editor/plugins/core/lists.js
b/src/editor/plugins/core/lists.js
index
151103d
..
1ff6ccd
100644
(file)
--- a/
src/editor/plugins/core/lists.js
+++ b/
src/editor/plugins/core/lists.js
@@
-4,11
+4,11
@@
define(function() {
/* globals gettext, interpolate */
/* globals gettext, interpolate */
-var getBoundriesForAList = function(fragment) {
+var getBound
a
riesForAList = function(fragment) {
var node;
var node;
- if(fragment instanceof fragment.RangeFragment && fragment.hasSiblingBoundries()) {
- return fragment.startNode.hasSameContextRoot(fragment.endNode) && fragment.boundriesSiblingParents();
+ if(fragment instanceof fragment.RangeFragment && fragment.hasSiblingBound
a
ries()) {
+ return fragment.startNode.hasSameContextRoot(fragment.endNode) && fragment.bound
a
riesSiblingParents();
}
if(fragment instanceof fragment.NodeFragment) {
node = fragment.node.getNearestElementNode();
}
if(fragment instanceof fragment.NodeFragment) {
node = fragment.node.getNearestElementNode();
@@
-23,10
+23,10
@@
var getBoundriesForAList = function(fragment) {
}
};
}
};
-var countItems = function(boundries) {
- var ptr = boundries.node1,
+var countItems = function(bound
a
ries) {
+ var ptr = bound
a
ries.node1,
c = 1;
c = 1;
- while(ptr && !ptr.sameNode(boundries.node2)) {
+ while(ptr && !ptr.sameNode(bound
a
ries.node2)) {
c++;
ptr = ptr.next();
}
c++;
ptr = ptr.next();
}
@@
-37,39
+37,39
@@
var toggleListAction = function(type) {
var execute = {
add: function(callback, params) {
var execute = {
add: function(callback, params) {
- var bound
ries = getBound
riesForAList(params.fragment),
+ var bound
aries = getBounda
riesForAList(params.fragment),
listParams = {klass: type === 'Bullet' ? 'list' : 'list.enum'},
action = this;
listParams = {klass: type === 'Bullet' ? 'list' : 'list.enum'},
action = this;
- if(bound
ries && bound
ries.node1) {
- boundries.node1.document.transaction(function() {
- var iterNode = boundries.node1;
+ if(bound
aries && bounda
ries.node1) {
+ bound
a
ries.node1.document.transaction(function() {
+ var iterNode = bound
a
ries.node1;
while(true) {
if(!iterNode.is({tagName: 'div', klass: 'p'})) {
if(iterNode.is({tagName: 'header'})) {
var newNode = iterNode.setTag('div');
newNode.setClass('p');
while(true) {
if(!iterNode.is({tagName: 'div', klass: 'p'})) {
if(iterNode.is({tagName: 'header'})) {
var newNode = iterNode.setTag('div');
newNode.setClass('p');
- if(iterNode.sameNode(boundries.node1)) {
- boundries.node1 = newNode;
+ if(iterNode.sameNode(bound
a
ries.node1)) {
+ bound
a
ries.node1 = newNode;
}
}
- if(iterNode.sameNode(boundries.node2)) {
- boundries.node2 = newNode;
+ if(iterNode.sameNode(bound
a
ries.node2)) {
+ bound
a
ries.node2 = newNode;
}
iterNode = newNode;
} else {
throw new Error('Invalid element');
}
}
}
iterNode = newNode;
} else {
throw new Error('Invalid element');
}
}
- if(iterNode.sameNode(boundries.node2))
+ if(iterNode.sameNode(bound
a
ries.node2))
break;
iterNode = iterNode.next();
}
break;
iterNode = iterNode.next();
}
- listParams.node1 = boundries.node1;
- listParams.node2 = boundries.node2;
- var list = boundries.node1.document.createList(listParams),
+ listParams.node1 = bound
a
ries.node1;
+ listParams.node2 = bound
a
ries.node2;
+ var list = bound
a
ries.node1.document.createList(listParams),
item1 = list.object.getItem(0),
text = item1 ? item1.contents()[0] : undefined, //
item1 = list.object.getItem(0),
text = item1 ? item1.contents()[0] : undefined, //
- doc = boundries.node1.document;
+ doc = bound
a
ries.node1.document;
if(text) {
return doc.createFragment(doc.CaretFragment, {node: text, offset:0});
}
if(text) {
return doc.createFragment(doc.CaretFragment, {node: text, offset:0});
}
@@
-81,7
+81,7
@@
var toggleListAction = function(type) {
success: callback
});
} else {
success: callback
});
} else {
- throw new Error('Invalid boundries');
+ throw new Error('Invalid bound
a
ries');
}
},
remove: function(callback, params) {
}
},
remove: function(callback, params) {
@@
-197,9
+197,9
@@
var toggleListAction = function(type) {
};
}
};
}
- var bound
ries = getBound
riesForAList(params.fragment);
- if(bound
ries && boundries.node1.hasSameContextRoot(bound
ries.node2)) {
- var iterNode = boundries.node1;
+ var bound
aries = getBounda
riesForAList(params.fragment);
+ if(bound
aries && boundaries.node1.hasSameContextRoot(bounda
ries.node2)) {
+ var iterNode = bound
a
ries.node1;
while(true) {
if(!iterNode.is({tagName: 'div', klass: 'p'}) && !iterNode.is({tagName: 'header'})) {
return {
while(true) {
if(!iterNode.is({tagName: 'div', klass: 'p'}) && !iterNode.is({tagName: 'header'})) {
return {
@@
-207,14
+207,14
@@
var toggleListAction = function(type) {
description: gettext('Invalid element for a list item')
}
}
description: gettext('Invalid element for a list item')
}
}
- if(iterNode.sameNode(boundries.node2))
+ if(iterNode.sameNode(bound
a
ries.node2))
break;
iterNode = iterNode.next();
}
return {
allowed: true,
break;
iterNode = iterNode.next();
}
return {
allowed: true,
- description: interpolate(gettext('Make %s fragment(s) into list'), [countItems(getBoundriesForAList(params.fragment))]),
+ description: interpolate(gettext('Make %s fragment(s) into list'), [countItems(getBound
a
riesForAList(params.fragment))]),
execute: execute.add
};
}
execute: execute.add
};
}
diff --git
a/src/smartxml/fragments.js
b/src/smartxml/fragments.js
index
d932592
..
f15a9e8
100644
(file)
--- a/
src/smartxml/fragments.js
+++ b/
src/smartxml/fragments.js
@@
-76,20
+76,20
@@
$.extend(RangeFragment.prototype, {
this.startNode = this.document.getNodeByPath(this.startNodePath);
this.endNode = this.document.getNodeByPath(this.endNodePath);
},
this.startNode = this.document.getNodeByPath(this.startNodePath);
this.endNode = this.document.getNodeByPath(this.endNodePath);
},
- hasSiblingBoundries: function() {
+ hasSiblingBound
a
ries: function() {
return this.isValid() && this.startNode.isSiblingOf(this.endNode);
},
return this.isValid() && this.startNode.isSiblingOf(this.endNode);
},
- hasSameBoundries: function() {
+ hasSameBound
a
ries: function() {
return this.isValid() && this.startNode.sameNode(this.endNode);
},
return this.isValid() && this.startNode.sameNode(this.endNode);
},
- boundriesSiblingParents: function() {
+ bound
a
riesSiblingParents: function() {
return this.startNode.document.getSiblingParents({
node1: this.startNode,
node2: this.endNode
});
},
getCommonParent: function() {
return this.startNode.document.getSiblingParents({
node1: this.startNode,
node2: this.endNode
});
},
getCommonParent: function() {
- var siblingParents = this.boundriesSiblingParents();
+ var siblingParents = this.bound
a
riesSiblingParents();
if(siblingParents) {
return siblingParents.node1.parent();
}
if(siblingParents) {
return siblingParents.node1.parent();
}
diff --git
a/src/wlxml/extensions/list/list.test.js
b/src/wlxml/extensions/list/list.test.js
index
277e828
..
2887b4f
100644
(file)
--- a/
src/wlxml/extensions/list/list.test.js
+++ b/
src/wlxml/extensions/list/list.test.js
@@
-60,7
+60,7
@@
describe('Lists extension', function() {
expect(child3.contents()[0].getText()).to.equal('cat');
});
expect(child3.contents()[0].getText()).to.equal('cat');
});
- it('Handles text nodes on the boundries', function() {
+ it('Handles text nodes on the bound
a
ries', function() {
var doc = getDocumentFromXML('<section>Alice<span>has</span>a cat</section>'),
textNode1 = doc.root.contents()[0],
textNode2 = doc.root.contents()[2];
var doc = getDocumentFromXML('<section>Alice<span>has</span>a cat</section>'),
textNode1 = doc.root.contents()[0],
textNode2 = doc.root.contents()[2];
diff --git
a/src/wlxml/wlxml.test.js
b/src/wlxml/wlxml.test.js
index
93b6df9
..
c0ddff7
100644
(file)
--- a/
src/wlxml/wlxml.test.js
+++ b/
src/wlxml/wlxml.test.js
@@
-55,7
+55,7
@@
describe('WLXMLDocument', function() {
expect(node.contents()[0].getText()).to.equal('Alice ');
expect(node.contents()[2].getText()).to.equal(' a cat');
});
expect(node.contents()[0].getText()).to.equal('Alice ');
expect(node.contents()[2].getText()).to.equal(' a cat');
});
- it('normalizes string of white characters to one space at the inline element boundries', function() {
+ it('normalizes string of white characters to one space at the inline element bound
a
ries', function() {
var node = nodeFromXML('<span> Alice has a cat </span>');
expect(node.contents()[0].getText()).to.equal(' Alice has a cat ');
});
var node = nodeFromXML('<span> Alice has a cat </span>');
expect(node.contents()[0].getText()).to.equal(' Alice has a cat ');
});