You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@corinthia.apache.org by pm...@apache.org on 2015/02/26 06:27:33 UTC
incubator-corinthia git commit: splitAroundSelection: don't split
footnotes
Repository: incubator-corinthia
Updated Branches:
refs/heads/master 8266b657b -> 297741ac1
splitAroundSelection: don't split footnotes
Project: http://git-wip-us.apache.org/repos/asf/incubator-corinthia/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-corinthia/commit/297741ac
Tree: http://git-wip-us.apache.org/repos/asf/incubator-corinthia/tree/297741ac
Diff: http://git-wip-us.apache.org/repos/asf/incubator-corinthia/diff/297741ac
Branch: refs/heads/master
Commit: 297741ac15ed6ac67b1712f27efc2bcc3fca7aa9
Parents: 8266b65
Author: Peter Kelly <pe...@uxproductivity.com>
Authored: Thu Feb 26 12:26:56 2015 +0700
Committer: Peter Kelly <pe...@uxproductivity.com>
Committed: Thu Feb 26 12:26:56 2015 +0700
----------------------------------------------------------------------
Editor/src/Formatting.js | 8 ++++----
Editor/src/types.js | 5 +++++
.../splitAroundSelection-endnote01-expected.html | 10 ++++++++++
.../dom/splitAroundSelection-endnote01-input.html | 18 ++++++++++++++++++
.../splitAroundSelection-endnote02-expected.html | 10 ++++++++++
.../dom/splitAroundSelection-endnote02-input.html | 18 ++++++++++++++++++
.../splitAroundSelection-endnote03-expected.html | 10 ++++++++++
.../dom/splitAroundSelection-endnote03-input.html | 18 ++++++++++++++++++
.../splitAroundSelection-footnote01-expected.html | 10 ++++++++++
.../splitAroundSelection-footnote01-input.html | 18 ++++++++++++++++++
.../splitAroundSelection-footnote02-expected.html | 10 ++++++++++
.../splitAroundSelection-footnote02-input.html | 18 ++++++++++++++++++
.../splitAroundSelection-footnote03-expected.html | 10 ++++++++++
.../splitAroundSelection-footnote03-input.html | 18 ++++++++++++++++++
Editor/tests/index.js | 6 ++++++
15 files changed, 183 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/297741ac/Editor/src/Formatting.js
----------------------------------------------------------------------
diff --git a/Editor/src/Formatting.js b/Editor/src/Formatting.js
index 0f2d9d4..9322062 100644
--- a/Editor/src/Formatting.js
+++ b/Editor/src/Formatting.js
@@ -126,12 +126,12 @@ var Formatting_MERGEABLE_BLOCK_AND_INLINE;
range.start.offset = 0;
}
else if (range.start.node.nodeType == Node.ELEMENT_NODE) {
- Formatting_movePreceding(range.start,isBlockNode);
+ Formatting_movePreceding(range.start,isBlockOrNoteNode);
}
else {
Formatting_movePreceding(new Position(range.start.node.parentNode,
DOM_nodeOffset(range.start.node)),
- isBlockNode);
+ isBlockOrNoteNode);
}
// Save the start and end position of the range. The mutation listeners will move it
@@ -146,12 +146,12 @@ var Formatting_MERGEABLE_BLOCK_AND_INLINE;
Formatting_splitTextAfter(range.end);
}
else if (range.end.node.nodeType == Node.ELEMENT_NODE) {
- Formatting_moveFollowing(range.end,isBlockNode);
+ Formatting_moveFollowing(range.end,isBlockOrNoteNode);
}
else {
Formatting_moveFollowing(new Position(range.end.node.parentNode,
DOM_nodeOffset(range.end.node)+1),
- isBlockNode);
+ isBlockOrNoteNode);
}
range.start.node = startNode;
http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/297741ac/Editor/src/types.js
----------------------------------------------------------------------
diff --git a/Editor/src/types.js b/Editor/src/types.js
index 473997d..b49a709 100644
--- a/Editor/src/types.js
+++ b/Editor/src/types.js
@@ -138,6 +138,11 @@ function isBlockNode(node)
return BLOCK_ELEMENTS[node._type];
}
+function isBlockOrNoteNode(node)
+{
+ return BLOCK_ELEMENTS[node._type] || isNoteNode(node);
+}
+
function isInlineNode(node)
{
return INLINE_ELEMENTS[node._type];
http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/297741ac/Editor/tests/dom/splitAroundSelection-endnote01-expected.html
----------------------------------------------------------------------
diff --git a/Editor/tests/dom/splitAroundSelection-endnote01-expected.html b/Editor/tests/dom/splitAroundSelection-endnote01-expected.html
new file mode 100644
index 0000000..648d67e
--- /dev/null
+++ b/Editor/tests/dom/splitAroundSelection-endnote01-expected.html
@@ -0,0 +1,10 @@
+<html>
+ <head></head>
+ <body>
+ <p>
+ one
+ <span class="endnote">[two] three four</span>
+ five
+ </p>
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/297741ac/Editor/tests/dom/splitAroundSelection-endnote01-input.html
----------------------------------------------------------------------
diff --git a/Editor/tests/dom/splitAroundSelection-endnote01-input.html b/Editor/tests/dom/splitAroundSelection-endnote01-input.html
new file mode 100644
index 0000000..394273a
--- /dev/null
+++ b/Editor/tests/dom/splitAroundSelection-endnote01-input.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+function performTest()
+{
+ var range = Selection_get();
+ Range_trackWhileExecuting(range,function() {
+ Formatting_splitAroundSelection(range);
+ });
+ showRangeAsBrackets(range);
+}
+</script>
+</head>
+<body>
+ <p>one <span class="endnote">[two] three four</span> five</p>
+</body>
+</html>
http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/297741ac/Editor/tests/dom/splitAroundSelection-endnote02-expected.html
----------------------------------------------------------------------
diff --git a/Editor/tests/dom/splitAroundSelection-endnote02-expected.html b/Editor/tests/dom/splitAroundSelection-endnote02-expected.html
new file mode 100644
index 0000000..e722f31
--- /dev/null
+++ b/Editor/tests/dom/splitAroundSelection-endnote02-expected.html
@@ -0,0 +1,10 @@
+<html>
+ <head></head>
+ <body>
+ <p>
+ one
+ <span class="endnote">two [three] four</span>
+ five
+ </p>
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/297741ac/Editor/tests/dom/splitAroundSelection-endnote02-input.html
----------------------------------------------------------------------
diff --git a/Editor/tests/dom/splitAroundSelection-endnote02-input.html b/Editor/tests/dom/splitAroundSelection-endnote02-input.html
new file mode 100644
index 0000000..bf3250d
--- /dev/null
+++ b/Editor/tests/dom/splitAroundSelection-endnote02-input.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+function performTest()
+{
+ var range = Selection_get();
+ Range_trackWhileExecuting(range,function() {
+ Formatting_splitAroundSelection(range);
+ });
+ showRangeAsBrackets(range);
+}
+</script>
+</head>
+<body>
+ <p>one <span class="endnote">two [three] four</span> five</p>
+</body>
+</html>
http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/297741ac/Editor/tests/dom/splitAroundSelection-endnote03-expected.html
----------------------------------------------------------------------
diff --git a/Editor/tests/dom/splitAroundSelection-endnote03-expected.html b/Editor/tests/dom/splitAroundSelection-endnote03-expected.html
new file mode 100644
index 0000000..f3ac04e
--- /dev/null
+++ b/Editor/tests/dom/splitAroundSelection-endnote03-expected.html
@@ -0,0 +1,10 @@
+<html>
+ <head></head>
+ <body>
+ <p>
+ one
+ <span class="endnote">two three [four]</span>
+ five
+ </p>
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/297741ac/Editor/tests/dom/splitAroundSelection-endnote03-input.html
----------------------------------------------------------------------
diff --git a/Editor/tests/dom/splitAroundSelection-endnote03-input.html b/Editor/tests/dom/splitAroundSelection-endnote03-input.html
new file mode 100644
index 0000000..ed7cb29
--- /dev/null
+++ b/Editor/tests/dom/splitAroundSelection-endnote03-input.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+function performTest()
+{
+ var range = Selection_get();
+ Range_trackWhileExecuting(range,function() {
+ Formatting_splitAroundSelection(range);
+ });
+ showRangeAsBrackets(range);
+}
+</script>
+</head>
+<body>
+ <p>one <span class="endnote">two three [four]</span> five</p>
+</body>
+</html>
http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/297741ac/Editor/tests/dom/splitAroundSelection-footnote01-expected.html
----------------------------------------------------------------------
diff --git a/Editor/tests/dom/splitAroundSelection-footnote01-expected.html b/Editor/tests/dom/splitAroundSelection-footnote01-expected.html
new file mode 100644
index 0000000..5245a0c
--- /dev/null
+++ b/Editor/tests/dom/splitAroundSelection-footnote01-expected.html
@@ -0,0 +1,10 @@
+<html>
+ <head></head>
+ <body>
+ <p>
+ one
+ <span class="footnote">[two] three four</span>
+ five
+ </p>
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/297741ac/Editor/tests/dom/splitAroundSelection-footnote01-input.html
----------------------------------------------------------------------
diff --git a/Editor/tests/dom/splitAroundSelection-footnote01-input.html b/Editor/tests/dom/splitAroundSelection-footnote01-input.html
new file mode 100644
index 0000000..256fdc7
--- /dev/null
+++ b/Editor/tests/dom/splitAroundSelection-footnote01-input.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+function performTest()
+{
+ var range = Selection_get();
+ Range_trackWhileExecuting(range,function() {
+ Formatting_splitAroundSelection(range);
+ });
+ showRangeAsBrackets(range);
+}
+</script>
+</head>
+<body>
+ <p>one <span class="footnote">[two] three four</span> five</p>
+</body>
+</html>
http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/297741ac/Editor/tests/dom/splitAroundSelection-footnote02-expected.html
----------------------------------------------------------------------
diff --git a/Editor/tests/dom/splitAroundSelection-footnote02-expected.html b/Editor/tests/dom/splitAroundSelection-footnote02-expected.html
new file mode 100644
index 0000000..fce0569
--- /dev/null
+++ b/Editor/tests/dom/splitAroundSelection-footnote02-expected.html
@@ -0,0 +1,10 @@
+<html>
+ <head></head>
+ <body>
+ <p>
+ one
+ <span class="footnote">two [three] four</span>
+ five
+ </p>
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/297741ac/Editor/tests/dom/splitAroundSelection-footnote02-input.html
----------------------------------------------------------------------
diff --git a/Editor/tests/dom/splitAroundSelection-footnote02-input.html b/Editor/tests/dom/splitAroundSelection-footnote02-input.html
new file mode 100644
index 0000000..737c18d
--- /dev/null
+++ b/Editor/tests/dom/splitAroundSelection-footnote02-input.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+function performTest()
+{
+ var range = Selection_get();
+ Range_trackWhileExecuting(range,function() {
+ Formatting_splitAroundSelection(range);
+ });
+ showRangeAsBrackets(range);
+}
+</script>
+</head>
+<body>
+ <p>one <span class="footnote">two [three] four</span> five</p>
+</body>
+</html>
http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/297741ac/Editor/tests/dom/splitAroundSelection-footnote03-expected.html
----------------------------------------------------------------------
diff --git a/Editor/tests/dom/splitAroundSelection-footnote03-expected.html b/Editor/tests/dom/splitAroundSelection-footnote03-expected.html
new file mode 100644
index 0000000..772d336
--- /dev/null
+++ b/Editor/tests/dom/splitAroundSelection-footnote03-expected.html
@@ -0,0 +1,10 @@
+<html>
+ <head></head>
+ <body>
+ <p>
+ one
+ <span class="footnote">two three [four]</span>
+ five
+ </p>
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/297741ac/Editor/tests/dom/splitAroundSelection-footnote03-input.html
----------------------------------------------------------------------
diff --git a/Editor/tests/dom/splitAroundSelection-footnote03-input.html b/Editor/tests/dom/splitAroundSelection-footnote03-input.html
new file mode 100644
index 0000000..7dd0542
--- /dev/null
+++ b/Editor/tests/dom/splitAroundSelection-footnote03-input.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+function performTest()
+{
+ var range = Selection_get();
+ Range_trackWhileExecuting(range,function() {
+ Formatting_splitAroundSelection(range);
+ });
+ showRangeAsBrackets(range);
+}
+</script>
+</head>
+<body>
+ <p>one <span class="footnote">two three [four]</span> five</p>
+</body>
+</html>
http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/297741ac/Editor/tests/index.js
----------------------------------------------------------------------
diff --git a/Editor/tests/index.js b/Editor/tests/index.js
index 22f01b6..dbd6b2c 100644
--- a/Editor/tests/index.js
+++ b/Editor/tests/index.js
@@ -751,6 +751,12 @@ var tests = [
"replaceElement08",
"replaceElement09",
"replaceElement10",
+ "splitAroundSelection-endnote01",
+ "splitAroundSelection-endnote02",
+ "splitAroundSelection-endnote03",
+ "splitAroundSelection-footnote01",
+ "splitAroundSelection-footnote02",
+ "splitAroundSelection-footnote03",
"splitAroundSelection-nested01",
"splitAroundSelection-nested02",
"splitAroundSelection-nested03",