diff --git a/app/modules/components/wysiwyg/wysiwyg.directive.coffee b/app/modules/components/wysiwyg/wysiwyg.directive.coffee
index 5568ead1..df1c8bc2 100644
--- a/app/modules/components/wysiwyg/wysiwyg.directive.coffee
+++ b/app/modules/components/wysiwyg/wysiwyg.directive.coffee
@@ -56,6 +56,23 @@ Medium = ($translate, $confirm, $storage, wysiwygService, animationFrame, tgLoad
wysiwygCodeHightlighterService.addCodeLanguageSelectors(elm)
+
+ AlignRightButton = MediumEditor.extensions.button.extend({
+ name: 'rtl',
+ init: () ->
+ this.button = this.document.createElement('button')
+ this.button.classList.add('medium-editor-action')
+ this.button.innerHTML = 'RTL'
+ this.button.title = 'RTL'
+ this.on(this.button, 'click', this.handleClick.bind(this))
+
+ getButton: () ->
+ return this.button
+ handleClick: (event) ->
+ document.execCommand('justifyRight', false)
+
+ })
+
# MediumEditor extension to add
CodeButton = MediumEditor.extensions.button.extend({
name: 'code',
@@ -294,12 +311,14 @@ Medium = ($translate, $confirm, $storage, wysiwygService, animationFrame, tgLoad
'h3',
'quote',
'removeFormat',
+ 'rtl',
'code'
]
},
extensions: {
code: new CodeButton(),
autolist: new AutoList(),
+ alignright: new AlignRightButton(),
mediumMention: new MentionExtension({
getItems: (mention, mentionCb) ->
wysiwygMentionService.search(mention).then(mentionCb)