Adds full justification, undo, and redo options to RichTextArea. These options are widely supported in all modern browsers.
Patch by: jlabanca
Review by: jgw
Issue: 1211, 2185
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@5630 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/user/src/com/google/gwt/user/client/ui/RichTextArea.java b/user/src/com/google/gwt/user/client/ui/RichTextArea.java
index 1b9860f..730defc 100644
--- a/user/src/com/google/gwt/user/client/ui/RichTextArea.java
+++ b/user/src/com/google/gwt/user/client/ui/RichTextArea.java
@@ -215,6 +215,11 @@
void leftIndent();
/**
+ * Redo an action that was just undone.
+ */
+ void redo();
+
+ /**
* Removes all formatting on the selected text.
*/
void removeFormat();
@@ -233,6 +238,11 @@
* Toggles strikethrough.
*/
void toggleStrikethrough();
+
+ /**
+ * Undo the last action.
+ */
+ void undo();
}
/**
@@ -309,6 +319,11 @@
public static final Justification CENTER = new Justification("Center");
/**
+ * Full justification.
+ */
+ public static final Justification FULL = new Justification("Full");
+
+ /**
* Left justification.
*/
public static final Justification LEFT = new Justification("Left");
diff --git a/user/src/com/google/gwt/user/client/ui/impl/RichTextAreaImplStandard.java b/user/src/com/google/gwt/user/client/ui/impl/RichTextAreaImplStandard.java
index 1b8be0c..275ee7e 100644
--- a/user/src/com/google/gwt/user/client/ui/impl/RichTextAreaImplStandard.java
+++ b/user/src/com/google/gwt/user/client/ui/impl/RichTextAreaImplStandard.java
@@ -138,6 +138,10 @@
execCommand("Outdent", null);
}
+ public void redo() {
+ execCommand("Redo", "false");
+ }
+
public void removeFormat() {
execCommand("RemoveFormat", null);
}
@@ -191,6 +195,8 @@
public void setJustification(Justification justification) {
if (justification == Justification.CENTER) {
execCommand("JustifyCenter", null);
+ } else if (justification == Justification.FULL) {
+ execCommand("JustifyFull", null);
} else if (justification == Justification.LEFT) {
execCommand("JustifyLeft", null);
} else if (justification == Justification.RIGHT) {
@@ -231,6 +237,10 @@
execCommand("Underline", "False");
}
+ public void undo() {
+ execCommand("Undo", "false");
+ }
+
@Override
public void uninitElement() {
// Issue 1897: initElement uses a timeout, so its possible to call this