corinthia-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmke...@apache.org
Subject incubator-corinthia git commit: Fix disappearing footnotes/endnotes on formatting
Date Thu, 26 Feb 2015 12:04:32 GMT
Repository: incubator-corinthia
Updated Branches:
  refs/heads/master 297741ac1 -> 174c6b7ed


Fix disappearing footnotes/endnotes on formatting

Fix a bug that caused footnotes and endnotes to be converted back to
normal text when formatting was applied to any part of the paragraph,
either inside or outside the note.

This was caused by removePropertiesSingle looking at the span element,
seeing that it had no style set, and assuming that meant it could remove
it safely.

Actually, there's technically another bug here, in that if a span has a
class name, it shouldn't be removed at all. When we add support for
character styles, we should fix this as well.


Project: http://git-wip-us.apache.org/repos/asf/incubator-corinthia/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-corinthia/commit/174c6b7e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-corinthia/tree/174c6b7e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-corinthia/diff/174c6b7e

Branch: refs/heads/master
Commit: 174c6b7edf33614942ecb7b3446a2b3afc42b856
Parents: 297741a
Author: Peter Kelly <peter@uxproductivity.com>
Authored: Thu Feb 26 19:03:58 2015 +0700
Committer: Peter Kelly <peter@uxproductivity.com>
Committed: Thu Feb 26 19:03:58 2015 +0700

----------------------------------------------------------------------
 Editor/src/Formatting.js                             |  5 ++++-
 .../tests/formatting/inline-endnote01-expected.html  | 12 ++++++++++++
 Editor/tests/formatting/inline-endnote01-input.html  | 15 +++++++++++++++
 .../tests/formatting/inline-endnote02-expected.html  | 12 ++++++++++++
 Editor/tests/formatting/inline-endnote02-input.html  | 15 +++++++++++++++
 .../tests/formatting/inline-endnote03-expected.html  | 12 ++++++++++++
 Editor/tests/formatting/inline-endnote03-input.html  | 15 +++++++++++++++
 .../tests/formatting/inline-endnote04-expected.html  | 12 ++++++++++++
 Editor/tests/formatting/inline-endnote04-input.html  | 15 +++++++++++++++
 .../tests/formatting/inline-endnote05-expected.html  | 14 ++++++++++++++
 Editor/tests/formatting/inline-endnote05-input.html  | 15 +++++++++++++++
 .../tests/formatting/inline-endnote06-expected.html  | 14 ++++++++++++++
 Editor/tests/formatting/inline-endnote06-input.html  | 15 +++++++++++++++
 .../tests/formatting/inline-footnote01-expected.html | 12 ++++++++++++
 Editor/tests/formatting/inline-footnote01-input.html | 15 +++++++++++++++
 .../tests/formatting/inline-footnote02-expected.html | 12 ++++++++++++
 Editor/tests/formatting/inline-footnote02-input.html | 15 +++++++++++++++
 .../tests/formatting/inline-footnote03-expected.html | 12 ++++++++++++
 Editor/tests/formatting/inline-footnote03-input.html | 15 +++++++++++++++
 .../tests/formatting/inline-footnote04-expected.html | 12 ++++++++++++
 Editor/tests/formatting/inline-footnote04-input.html | 15 +++++++++++++++
 .../tests/formatting/inline-footnote05-expected.html | 14 ++++++++++++++
 Editor/tests/formatting/inline-footnote05-input.html | 15 +++++++++++++++
 .../tests/formatting/inline-footnote06-expected.html | 14 ++++++++++++++
 Editor/tests/formatting/inline-footnote06-input.html | 15 +++++++++++++++
 Editor/tests/index.js                                | 12 ++++++++++++
 26 files changed, 348 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/174c6b7e/Editor/src/Formatting.js
----------------------------------------------------------------------
diff --git a/Editor/src/Formatting.js b/Editor/src/Formatting.js
index 9322062..51bc5d3 100644
--- a/Editor/src/Formatting.js
+++ b/Editor/src/Formatting.js
@@ -1041,7 +1041,10 @@ var Formatting_MERGEABLE_BLOCK_AND_INLINE;
         if (span._type == HTML_SPAN) {
             if (span.hasAttribute(Keys.ABSTRACT_ELEMENT))
                 return true;
-            if (DOM_getStringAttribute(span,"class").indexOf(Keys.UXWRITE_PREFIX) == 0)
+            var className = DOM_getStringAttribute(span,"class");
+            if (className.indexOf(Keys.UXWRITE_PREFIX) == 0)
+                return true;
+            if ((className == "footnote") || (className == "endnote"))
                 return true;
         }
         return false;

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/174c6b7e/Editor/tests/formatting/inline-endnote01-expected.html
----------------------------------------------------------------------
diff --git a/Editor/tests/formatting/inline-endnote01-expected.html b/Editor/tests/formatting/inline-endnote01-expected.html
new file mode 100644
index 0000000..984c59c
--- /dev/null
+++ b/Editor/tests/formatting/inline-endnote01-expected.html
@@ -0,0 +1,12 @@
+<html>
+  <head></head>
+  <body>
+    <p>
+      one
+      <b>[two]</b>
+      three
+      <span class="endnote">four</span>
+      five
+    </p>
+  </body>
+</html>

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/174c6b7e/Editor/tests/formatting/inline-endnote01-input.html
----------------------------------------------------------------------
diff --git a/Editor/tests/formatting/inline-endnote01-input.html b/Editor/tests/formatting/inline-endnote01-input.html
new file mode 100644
index 0000000..e21130b
--- /dev/null
+++ b/Editor/tests/formatting/inline-endnote01-input.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+function performTest()
+{
+    Formatting_applyFormattingChanges(null,{"font-weight": "bold"});
+    showSelection();
+}
+</script>
+</head>
+<body>
+  <p>one [two] three <span class="endnote">four</span> five</p>
+</body>
+</html>

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/174c6b7e/Editor/tests/formatting/inline-endnote02-expected.html
----------------------------------------------------------------------
diff --git a/Editor/tests/formatting/inline-endnote02-expected.html b/Editor/tests/formatting/inline-endnote02-expected.html
new file mode 100644
index 0000000..2d0bd0c
--- /dev/null
+++ b/Editor/tests/formatting/inline-endnote02-expected.html
@@ -0,0 +1,12 @@
+<html>
+  <head></head>
+  <body>
+    <p>
+      one
+      <span style="color: red">[two]</span>
+      three
+      <span class="endnote">four</span>
+      five
+    </p>
+  </body>
+</html>

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/174c6b7e/Editor/tests/formatting/inline-endnote02-input.html
----------------------------------------------------------------------
diff --git a/Editor/tests/formatting/inline-endnote02-input.html b/Editor/tests/formatting/inline-endnote02-input.html
new file mode 100644
index 0000000..165b67d
--- /dev/null
+++ b/Editor/tests/formatting/inline-endnote02-input.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+function performTest()
+{
+    Formatting_applyFormattingChanges(null,{"color": "red"});
+    showSelection();
+}
+</script>
+</head>
+<body>
+  <p>one [two] three <span class="endnote">four</span> five</p>
+</body>
+</html>

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/174c6b7e/Editor/tests/formatting/inline-endnote03-expected.html
----------------------------------------------------------------------
diff --git a/Editor/tests/formatting/inline-endnote03-expected.html b/Editor/tests/formatting/inline-endnote03-expected.html
new file mode 100644
index 0000000..4c9d6c4
--- /dev/null
+++ b/Editor/tests/formatting/inline-endnote03-expected.html
@@ -0,0 +1,12 @@
+<html>
+  <head></head>
+  <body>
+    <p>
+      one
+      <span class="endnote">two</span>
+      three
+      <b>[four]</b>
+      five
+    </p>
+  </body>
+</html>

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/174c6b7e/Editor/tests/formatting/inline-endnote03-input.html
----------------------------------------------------------------------
diff --git a/Editor/tests/formatting/inline-endnote03-input.html b/Editor/tests/formatting/inline-endnote03-input.html
new file mode 100644
index 0000000..33244d5
--- /dev/null
+++ b/Editor/tests/formatting/inline-endnote03-input.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+function performTest()
+{
+    Formatting_applyFormattingChanges(null,{"font-weight": "bold"});
+    showSelection();
+}
+</script>
+</head>
+<body>
+  <p>one <span class="endnote">two</span> three [four] five</p>
+</body>
+</html>

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/174c6b7e/Editor/tests/formatting/inline-endnote04-expected.html
----------------------------------------------------------------------
diff --git a/Editor/tests/formatting/inline-endnote04-expected.html b/Editor/tests/formatting/inline-endnote04-expected.html
new file mode 100644
index 0000000..7e25e59
--- /dev/null
+++ b/Editor/tests/formatting/inline-endnote04-expected.html
@@ -0,0 +1,12 @@
+<html>
+  <head></head>
+  <body>
+    <p>
+      one
+      <span class="endnote">two</span>
+      three
+      <span style="color: red">[four]</span>
+      five
+    </p>
+  </body>
+</html>

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/174c6b7e/Editor/tests/formatting/inline-endnote04-input.html
----------------------------------------------------------------------
diff --git a/Editor/tests/formatting/inline-endnote04-input.html b/Editor/tests/formatting/inline-endnote04-input.html
new file mode 100644
index 0000000..3e965f5
--- /dev/null
+++ b/Editor/tests/formatting/inline-endnote04-input.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+function performTest()
+{
+    Formatting_applyFormattingChanges(null,{"color": "red"});
+    showSelection();
+}
+</script>
+</head>
+<body>
+  <p>one <span class="endnote">two</span> three [four] five</p>
+</body>
+</html>

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/174c6b7e/Editor/tests/formatting/inline-endnote05-expected.html
----------------------------------------------------------------------
diff --git a/Editor/tests/formatting/inline-endnote05-expected.html b/Editor/tests/formatting/inline-endnote05-expected.html
new file mode 100644
index 0000000..e8e64ae
--- /dev/null
+++ b/Editor/tests/formatting/inline-endnote05-expected.html
@@ -0,0 +1,14 @@
+<html>
+  <head></head>
+  <body>
+    <p>
+      one
+      <span class="endnote">
+        two
+        <b>[three]</b>
+        four
+      </span>
+      five
+    </p>
+  </body>
+</html>

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/174c6b7e/Editor/tests/formatting/inline-endnote05-input.html
----------------------------------------------------------------------
diff --git a/Editor/tests/formatting/inline-endnote05-input.html b/Editor/tests/formatting/inline-endnote05-input.html
new file mode 100644
index 0000000..672d698
--- /dev/null
+++ b/Editor/tests/formatting/inline-endnote05-input.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+function performTest()
+{
+    Formatting_applyFormattingChanges(null,{"font-weight": "bold"});
+    showSelection();
+}
+</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/174c6b7e/Editor/tests/formatting/inline-endnote06-expected.html
----------------------------------------------------------------------
diff --git a/Editor/tests/formatting/inline-endnote06-expected.html b/Editor/tests/formatting/inline-endnote06-expected.html
new file mode 100644
index 0000000..7b676ac
--- /dev/null
+++ b/Editor/tests/formatting/inline-endnote06-expected.html
@@ -0,0 +1,14 @@
+<html>
+  <head></head>
+  <body>
+    <p>
+      one
+      <span class="endnote">
+        two
+        <span style="color: red">[three]</span>
+        four
+      </span>
+      five
+    </p>
+  </body>
+</html>

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/174c6b7e/Editor/tests/formatting/inline-endnote06-input.html
----------------------------------------------------------------------
diff --git a/Editor/tests/formatting/inline-endnote06-input.html b/Editor/tests/formatting/inline-endnote06-input.html
new file mode 100644
index 0000000..daf5a7d
--- /dev/null
+++ b/Editor/tests/formatting/inline-endnote06-input.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+function performTest()
+{
+    Formatting_applyFormattingChanges(null,{"color": "red"});
+    showSelection();
+}
+</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/174c6b7e/Editor/tests/formatting/inline-footnote01-expected.html
----------------------------------------------------------------------
diff --git a/Editor/tests/formatting/inline-footnote01-expected.html b/Editor/tests/formatting/inline-footnote01-expected.html
new file mode 100644
index 0000000..407cc39
--- /dev/null
+++ b/Editor/tests/formatting/inline-footnote01-expected.html
@@ -0,0 +1,12 @@
+<html>
+  <head></head>
+  <body>
+    <p>
+      one
+      <b>[two]</b>
+      three
+      <span class="footnote">four</span>
+      five
+    </p>
+  </body>
+</html>

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/174c6b7e/Editor/tests/formatting/inline-footnote01-input.html
----------------------------------------------------------------------
diff --git a/Editor/tests/formatting/inline-footnote01-input.html b/Editor/tests/formatting/inline-footnote01-input.html
new file mode 100644
index 0000000..50f66fe
--- /dev/null
+++ b/Editor/tests/formatting/inline-footnote01-input.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+function performTest()
+{
+    Formatting_applyFormattingChanges(null,{"font-weight": "bold"});
+    showSelection();
+}
+</script>
+</head>
+<body>
+  <p>one [two] three <span class="footnote">four</span> five</p>
+</body>
+</html>

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/174c6b7e/Editor/tests/formatting/inline-footnote02-expected.html
----------------------------------------------------------------------
diff --git a/Editor/tests/formatting/inline-footnote02-expected.html b/Editor/tests/formatting/inline-footnote02-expected.html
new file mode 100644
index 0000000..c679c9a
--- /dev/null
+++ b/Editor/tests/formatting/inline-footnote02-expected.html
@@ -0,0 +1,12 @@
+<html>
+  <head></head>
+  <body>
+    <p>
+      one
+      <span style="color: red">[two]</span>
+      three
+      <span class="footnote">four</span>
+      five
+    </p>
+  </body>
+</html>

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/174c6b7e/Editor/tests/formatting/inline-footnote02-input.html
----------------------------------------------------------------------
diff --git a/Editor/tests/formatting/inline-footnote02-input.html b/Editor/tests/formatting/inline-footnote02-input.html
new file mode 100644
index 0000000..7bf7ee4
--- /dev/null
+++ b/Editor/tests/formatting/inline-footnote02-input.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+function performTest()
+{
+    Formatting_applyFormattingChanges(null,{"color": "red"});
+    showSelection();
+}
+</script>
+</head>
+<body>
+  <p>one [two] three <span class="footnote">four</span> five</p>
+</body>
+</html>

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/174c6b7e/Editor/tests/formatting/inline-footnote03-expected.html
----------------------------------------------------------------------
diff --git a/Editor/tests/formatting/inline-footnote03-expected.html b/Editor/tests/formatting/inline-footnote03-expected.html
new file mode 100644
index 0000000..2aa73ad
--- /dev/null
+++ b/Editor/tests/formatting/inline-footnote03-expected.html
@@ -0,0 +1,12 @@
+<html>
+  <head></head>
+  <body>
+    <p>
+      one
+      <span class="footnote">two</span>
+      three
+      <b>[four]</b>
+      five
+    </p>
+  </body>
+</html>

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/174c6b7e/Editor/tests/formatting/inline-footnote03-input.html
----------------------------------------------------------------------
diff --git a/Editor/tests/formatting/inline-footnote03-input.html b/Editor/tests/formatting/inline-footnote03-input.html
new file mode 100644
index 0000000..6fe6601
--- /dev/null
+++ b/Editor/tests/formatting/inline-footnote03-input.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+function performTest()
+{
+    Formatting_applyFormattingChanges(null,{"font-weight": "bold"});
+    showSelection();
+}
+</script>
+</head>
+<body>
+  <p>one <span class="footnote">two</span> three [four] five</p>
+</body>
+</html>

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/174c6b7e/Editor/tests/formatting/inline-footnote04-expected.html
----------------------------------------------------------------------
diff --git a/Editor/tests/formatting/inline-footnote04-expected.html b/Editor/tests/formatting/inline-footnote04-expected.html
new file mode 100644
index 0000000..b1ef955
--- /dev/null
+++ b/Editor/tests/formatting/inline-footnote04-expected.html
@@ -0,0 +1,12 @@
+<html>
+  <head></head>
+  <body>
+    <p>
+      one
+      <span class="footnote">two</span>
+      three
+      <span style="color: red">[four]</span>
+      five
+    </p>
+  </body>
+</html>

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/174c6b7e/Editor/tests/formatting/inline-footnote04-input.html
----------------------------------------------------------------------
diff --git a/Editor/tests/formatting/inline-footnote04-input.html b/Editor/tests/formatting/inline-footnote04-input.html
new file mode 100644
index 0000000..23f07d4
--- /dev/null
+++ b/Editor/tests/formatting/inline-footnote04-input.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+function performTest()
+{
+    Formatting_applyFormattingChanges(null,{"color": "red"});
+    showSelection();
+}
+</script>
+</head>
+<body>
+  <p>one <span class="footnote">two</span> three [four] five</p>
+</body>
+</html>

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/174c6b7e/Editor/tests/formatting/inline-footnote05-expected.html
----------------------------------------------------------------------
diff --git a/Editor/tests/formatting/inline-footnote05-expected.html b/Editor/tests/formatting/inline-footnote05-expected.html
new file mode 100644
index 0000000..91a8092
--- /dev/null
+++ b/Editor/tests/formatting/inline-footnote05-expected.html
@@ -0,0 +1,14 @@
+<html>
+  <head></head>
+  <body>
+    <p>
+      one
+      <span class="footnote">
+        two
+        <b>[three]</b>
+        four
+      </span>
+      five
+    </p>
+  </body>
+</html>

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/174c6b7e/Editor/tests/formatting/inline-footnote05-input.html
----------------------------------------------------------------------
diff --git a/Editor/tests/formatting/inline-footnote05-input.html b/Editor/tests/formatting/inline-footnote05-input.html
new file mode 100644
index 0000000..2b45eac
--- /dev/null
+++ b/Editor/tests/formatting/inline-footnote05-input.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+function performTest()
+{
+    Formatting_applyFormattingChanges(null,{"font-weight": "bold"});
+    showSelection();
+}
+</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/174c6b7e/Editor/tests/formatting/inline-footnote06-expected.html
----------------------------------------------------------------------
diff --git a/Editor/tests/formatting/inline-footnote06-expected.html b/Editor/tests/formatting/inline-footnote06-expected.html
new file mode 100644
index 0000000..9ecb197
--- /dev/null
+++ b/Editor/tests/formatting/inline-footnote06-expected.html
@@ -0,0 +1,14 @@
+<html>
+  <head></head>
+  <body>
+    <p>
+      one
+      <span class="footnote">
+        two
+        <span style="color: red">[three]</span>
+        four
+      </span>
+      five
+    </p>
+  </body>
+</html>

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/174c6b7e/Editor/tests/formatting/inline-footnote06-input.html
----------------------------------------------------------------------
diff --git a/Editor/tests/formatting/inline-footnote06-input.html b/Editor/tests/formatting/inline-footnote06-input.html
new file mode 100644
index 0000000..b19e110
--- /dev/null
+++ b/Editor/tests/formatting/inline-footnote06-input.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+function performTest()
+{
+    Formatting_applyFormattingChanges(null,{"color": "red"});
+    showSelection();
+}
+</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/174c6b7e/Editor/tests/index.js
----------------------------------------------------------------------
diff --git a/Editor/tests/index.js b/Editor/tests/index.js
index dbd6b2c..962d49e 100644
--- a/Editor/tests/index.js
+++ b/Editor/tests/index.js
@@ -952,6 +952,18 @@ var tests = [
             "inline-change20",
             "inline-change21",
             "inline-change22",
+            "inline-endnote01",
+            "inline-endnote02",
+            "inline-endnote03",
+            "inline-endnote04",
+            "inline-endnote05",
+            "inline-endnote06",
+            "inline-footnote01",
+            "inline-footnote02",
+            "inline-footnote03",
+            "inline-footnote04",
+            "inline-footnote05",
+            "inline-footnote06",
             "inline-remove01",
             "inline-remove02",
             "inline-remove03",


Mime
View raw message