fix RTL profile, wrong place for Text modules pop-up windows after pressing

#1832
This commit is contained in:
Felix Niklas 2018-02-14 15:45:55 +01:00
parent e40209f3f6
commit 6d4b039811

View file

@ -200,21 +200,30 @@
// set height of widget // set height of widget
Plugin.prototype.movePosition = function() { Plugin.prototype.movePosition = function() {
if (!this._position) return if (!this._position) return
var height = this.$element.outerHeight() + 2 var height = this.$element.outerHeight() + 2
var widgetHeight = this.$widget.find('ul').height() //+ 60 // + height var widgetHeight = this.$widget.find('ul').height() //+ 60 // + height
var top = -( widgetHeight + height ) + this._position.top var rtl = document.dir == 'rtl'
var left = this._position.left - 6 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(rtl){
if (left + this._width > this.$element.innerWidth()) { start = availableWidth - start
left = this.$element.innerWidth() - this._width
} }
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, top: top,
left: left,
width: this._width width: this._width
}) }
css[rtl ? 'right' : 'left'] = start
this.$widget.css(css)
} }
// set position of widget // set position of widget