From 6d4b039811c46bb492f60f18462b0b34c775a9a2 Mon Sep 17 00:00:00 2001 From: Felix Niklas Date: Wed, 14 Feb 2018 15:45:55 +0100 Subject: [PATCH] fix RTL profile, wrong place for Text modules pop-up windows after pressing #1832 --- .../app/lib/base/jquery.textmodule.js | 29 ++++++++++++------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/app/assets/javascripts/app/lib/base/jquery.textmodule.js b/app/assets/javascripts/app/lib/base/jquery.textmodule.js index 738d87249..40b95fffe 100644 --- a/app/assets/javascripts/app/lib/base/jquery.textmodule.js +++ b/app/assets/javascripts/app/lib/base/jquery.textmodule.js @@ -200,21 +200,30 @@ // set height of widget Plugin.prototype.movePosition = function() { if (!this._position) return - var height = this.$element.outerHeight() + 2 - var widgetHeight = this.$widget.find('ul').height() //+ 60 // + height - var top = -( widgetHeight + height ) + this._position.top - var left = this._position.left - 6 + var height = this.$element.outerHeight() + 2 + var widgetHeight = this.$widget.find('ul').height() //+ 60 // + height + var rtl = document.dir == 'rtl' + var top = -( widgetHeight + height ) + this._position.top + var start = this._position.left - 6 + var availableWidth = this.$element.innerWidth() - // position the element further left if it would break out of the textarea width - if (left + this._width > this.$element.innerWidth()) { - left = this.$element.innerWidth() - this._width + if(rtl){ + start = availableWidth - start } - this.$widget.css({ + // position the element further left if it would break out of the textarea width + if (start + this._width > availableWidth) { + start = this.$element.innerWidth() - this._width + } + + var css = { top: top, - left: left, width: this._width - }) + } + + css[rtl ? 'right' : 'left'] = start + + this.$widget.css(css) } // set position of widget