From 18eb3273455aa8341cef4ffe98af953e0e1cdac5 Mon Sep 17 00:00:00 2001 From: Juanfran Date: Mon, 23 Jan 2017 08:32:12 +0100 Subject: [PATCH] description rtl support --- .../wysiwyg/wysiwyg.directive.coffee | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) 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)