-
Notifications
You must be signed in to change notification settings - Fork 280
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement paragraph aligning buttons
Fixes #123
- Loading branch information
Showing
6 changed files
with
222 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,11 +2,11 @@ | |
'use strict'; | ||
|
||
/** | ||
* The ButtonAlignImageLeft class provides functionality for aligning an image on left. | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
julien
Contributor
|
||
* The ButtonImageAlignLeft class provides functionality for aligning an image on left. | ||
* | ||
* @class ButtonAlignImageLeft | ||
* @class ButtonImageAlignLeft | ||
*/ | ||
var ButtonAlignImageLeft = React.createClass({ | ||
var ButtonImageAlignLeft = React.createClass({ | ||
mixins: [global.ButtonStyle, global.ButtonStateClasses, global.ButtonActionStyle], | ||
|
||
/** | ||
|
@@ -42,12 +42,12 @@ | |
var cssClass = 'alloy-editor-button ' + this.getStateClasses(); | ||
|
||
return ( | ||
<button className={cssClass} data-type="button-align-left" onClick={this.handleClick} tabIndex={this.props.tabIndex}> | ||
<button className={cssClass} data-type="button-image-align-left" onClick={this.handleClick} tabIndex={this.props.tabIndex}> | ||
<span className="alloy-editor-icon-align-left"></span> | ||
</button> | ||
); | ||
} | ||
}); | ||
|
||
global.AlloyEditor.Buttons[ButtonAlignImageLeft.key] = global.AlloyEditor.ButtonAlignImageLeft = ButtonAlignImageLeft; | ||
global.AlloyEditor.Buttons[ButtonImageAlignLeft.key] = global.AlloyEditor.ButtonImageAlignLeft = ButtonImageAlignLeft; | ||
}()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
src/ui/react/src/components/buttons/button-paragraph-align-left.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
(function () { | ||
'use strict'; | ||
|
||
/** | ||
* The ButtonParagraphAlignLeft class provides functionality for aligning a paragraph on left. | ||
* | ||
* @class ButtonParagraphAlignLeft | ||
*/ | ||
var ButtonParagraphAlignLeft = React.createClass({ | ||
mixins: [global.ButtonStyle, global.ButtonStateClasses, global.ButtonActionStyle], | ||
|
||
/** | ||
* Lifecycle. Provides static properties to the widget. | ||
* - key: The name which will be used as an alias of the button in the configuration. | ||
*/ | ||
statics: { | ||
key: 'paragraphLeft' | ||
}, | ||
|
||
/** | ||
* Lifecycle. Returns the default values of the properties used in the widget. | ||
* | ||
* @return {Object} The default properties. | ||
*/ | ||
getDefaultProps: function() { | ||
return { | ||
style: { | ||
element: 'p', | ||
styles: { | ||
float: 'left' | ||
} | ||
} | ||
}; | ||
}, | ||
|
||
/** | ||
* Lifecycle. Renders the UI of the button. | ||
* | ||
* @return {Object} The content which should be rendered. | ||
*/ | ||
render: function() { | ||
var cssClass = 'alloy-editor-button ' + this.getStateClasses(); | ||
|
||
return ( | ||
<button className={cssClass} data-type="button-paragraph-align-left" onClick={this.handleClick} tabIndex={this.props.tabIndex}> | ||
<span className="alloy-editor-icon-align-left"></span> | ||
</button> | ||
); | ||
} | ||
}); | ||
|
||
global.AlloyEditor.Buttons[ButtonParagraphAlignLeft.key] = global.AlloyEditor.ButtonParagraphAlignLeft = ButtonParagraphAlignLeft; | ||
}()); |
53 changes: 53 additions & 0 deletions
53
src/ui/react/src/components/buttons/button-paragraph-align-right.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
(function () { | ||
'use strict'; | ||
|
||
/** | ||
* The ButtonParagraphAlignRight class provides functionality for aligning a paragraph on right. | ||
* | ||
* @class ButtonParagraphAlignRight | ||
*/ | ||
var ButtonParagraphAlignRight = React.createClass({ | ||
mixins: [global.ButtonStyle, global.ButtonStateClasses, global.ButtonActionStyle], | ||
|
||
/** | ||
* Lifecycle. Provides static properties to the widget. | ||
* - key: The name which will be used as an alias of the button in the configuration. | ||
*/ | ||
statics: { | ||
key: 'paragraphRight' | ||
}, | ||
|
||
/** | ||
* Lifecycle. Returns the default values of the properties used in the widget. | ||
* | ||
* @return {Object} The default properties. | ||
*/ | ||
getDefaultProps: function() { | ||
return { | ||
style: { | ||
element: 'p', | ||
styles: { | ||
float: 'right' | ||
} | ||
} | ||
}; | ||
}, | ||
|
||
/** | ||
* Lifecycle. Renders the UI of the button. | ||
* | ||
* @return {Object} The content which should be rendered. | ||
*/ | ||
render: function() { | ||
var cssClass = 'alloy-editor-button ' + this.getStateClasses(); | ||
|
||
return ( | ||
<button className={cssClass} data-type="button-paragraph-align-right" onClick={this.handleClick} tabIndex={this.props.tabIndex}> | ||
<span className="alloy-editor-icon-align-right"></span> | ||
</button> | ||
); | ||
} | ||
}); | ||
|
||
global.AlloyEditor.Buttons[ButtonParagraphAlignRight.key] = global.AlloyEditor.ButtonParagraphAlignRight = ButtonParagraphAlignRight; | ||
}()); |
53 changes: 53 additions & 0 deletions
53
src/ui/react/src/components/buttons/button-paragraph-center.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
(function () { | ||
'use strict'; | ||
|
||
/** | ||
* The ButtonParagraphCenter class provides functionality for centering a paragraph. | ||
* | ||
* @class ButtonParagraphCenter | ||
*/ | ||
var ButtonParagraphCenter = React.createClass({ | ||
mixins: [global.ButtonStyle, global.ButtonStateClasses, global.ButtonActionStyle], | ||
|
||
/** | ||
* Lifecycle. Provides static properties to the widget. | ||
* - key: The name which will be used as an alias of the button in the configuration. | ||
*/ | ||
statics: { | ||
key: 'paragraphCenter' | ||
}, | ||
|
||
/** | ||
* Lifecycle. Returns the default values of the properties used in the widget. | ||
* | ||
* @return {Object} The default properties. | ||
*/ | ||
getDefaultProps: function() { | ||
return { | ||
style: { | ||
element: 'p', | ||
styles: { | ||
'text-align': 'center' | ||
} | ||
} | ||
}; | ||
}, | ||
|
||
/** | ||
* Lifecycle. Renders the UI of the button. | ||
* | ||
* @return {Object} The content which should be rendered. | ||
*/ | ||
render: function() { | ||
var cssClass = 'alloy-editor-button ' + this.getStateClasses(); | ||
|
||
return ( | ||
<button className={cssClass} data-type="button-paragraph-center" onClick={this.handleClick} tabIndex={this.props.tabIndex}> | ||
<span className="alloy-editor-icon-center"></span> | ||
</button> | ||
); | ||
} | ||
}); | ||
|
||
global.AlloyEditor.Buttons[ButtonParagraphCenter.key] = global.AlloyEditor.ButtonParagraphCenter = ButtonParagraphCenter; | ||
}()); |
53 changes: 53 additions & 0 deletions
53
src/ui/react/src/components/buttons/button-paragraph-justify.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
(function () { | ||
'use strict'; | ||
|
||
/** | ||
* The ButtonParagraphJustify class provides functionality for justfying a paragraph. | ||
* | ||
* @class ButtonParagraphJustify | ||
*/ | ||
var ButtonParagraphJustify = React.createClass({ | ||
mixins: [global.ButtonStyle, global.ButtonStateClasses, global.ButtonActionStyle], | ||
|
||
/** | ||
* Lifecycle. Provides static properties to the widget. | ||
* - key: The name which will be used as an alias of the button in the configuration. | ||
*/ | ||
statics: { | ||
key: 'paragraphJustify' | ||
}, | ||
|
||
/** | ||
* Lifecycle. Returns the default values of the properties used in the widget. | ||
* | ||
* @return {Object} The default properties. | ||
*/ | ||
getDefaultProps: function() { | ||
return { | ||
style: { | ||
element: 'p', | ||
styles: { | ||
'text-align': 'justify' | ||
} | ||
} | ||
}; | ||
}, | ||
|
||
/** | ||
* Lifecycle. Renders the UI of the button. | ||
* | ||
* @return {Object} The content which should be rendered. | ||
*/ | ||
render: function() { | ||
var cssClass = 'alloy-editor-button ' + this.getStateClasses(); | ||
|
||
return ( | ||
<button className={cssClass} data-type="button-paragraph-justify" onClick={this.handleClick} tabIndex={this.props.tabIndex}> | ||
<span className="alloy-editor-icon-justify"></span> | ||
</button> | ||
); | ||
} | ||
}); | ||
|
||
global.AlloyEditor.Buttons[ButtonParagraphJustify.key] = global.AlloyEditor.ButtonParagraphJustify = ButtonParagraphJustify; | ||
}()); |
Confused ...
"Implement paragraph aligning buttons" makes edits to code around alignment of images?