Permalink
Browse files

Add command for justified text alignment

  • Loading branch information...
1 parent 36d1fc1 commit 8545f9549031eb532daec693144651365ae3a9e5 @joepie91 joepie91 committed Jul 15, 2012
Showing with 26 additions and 2 deletions.
  1. +5 −1 examples/css/stylesheet.css
  2. +19 −0 src/commands/justifyFill.js
  3. +2 −1 test/index.html
@@ -110,6 +110,10 @@
text-align: left;
}
+.wysiwyg-text-align-justify {
+ text-align: justify;
+}
+
.wysiwyg-float-left {
float: left;
margin: 0 8px 8px 0;
@@ -126,4 +130,4 @@
.wysiwyg-clear-left {
clear: left;
-}
+}
@@ -0,0 +1,19 @@
+(function(wysihtml5) {
+ var undef,
+ CLASS_NAME = "wysiwyg-text-align-justify",
+ REG_EXP = /wysiwyg-text-align-[0-9a-z]+/g;
+
+ wysihtml5.commands.justifyFill = {
+ exec: function(composer, command) {
+ return wysihtml5.commands.formatBlock.exec(composer, "formatBlock", null, CLASS_NAME, REG_EXP);
+ },
+
+ state: function(composer, command) {
+ return wysihtml5.commands.formatBlock.state(composer, "formatBlock", null, CLASS_NAME, REG_EXP);
+ },
+
+ value: function() {
+ return undef;
+ }
+ };
+})(wysihtml5);
View
@@ -65,6 +65,7 @@
<script src="../src/commands/justifyCenter.js"></script>
<script src="../src/commands/justifyLeft.js"></script>
<script src="../src/commands/justifyRight.js"></script>
+<script src="../src/commands/justifyFill.js"></script>
<script src="../src/commands/redo.js"></script>
<script src="../src/commands/underline.js"></script>
<script src="../src/commands/undo.js"></script>
@@ -122,4 +123,4 @@ <h1 id="qunit-header">wysihtml5 - Test Suite</h1>
<h2 id="qunit-banner"></h2>
<div id="qunit-testrunner-toolbar"></div>
<h2 id="qunit-userAgent"></h2>
-<ol id="qunit-tests"></ol>
+<ol id="qunit-tests"></ol>

0 comments on commit 8545f95

Please sign in to comment.