Skip to content

Commit

Permalink
Merge pull request tiff#149 from joepie91/master
Browse files Browse the repository at this point in the history
Add command for justified text alignment
  • Loading branch information
tiff committed Jul 16, 2012
2 parents c653cfc + 8545f95 commit 11c52d9
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
6 changes: 5 additions & 1 deletion examples/css/stylesheet.css
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@
text-align: left;
}

.wysiwyg-text-align-justify {
text-align: justify;
}

.wysiwyg-float-left {
float: left;
margin: 0 8px 8px 0;
Expand All @@ -126,4 +130,4 @@

.wysiwyg-clear-left {
clear: left;
}
}
19 changes: 19 additions & 0 deletions src/commands/justifyFill.js
Original file line number Diff line number Diff line change
@@ -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);
3 changes: 2 additions & 1 deletion test/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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 11c52d9

Please sign in to comment.