From f65cc86b9c6747a92c350bdb14c4e1e43592ef11 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Thu, 7 Dec 2023 15:23:46 +0100 Subject: [PATCH] wip #6543 @1.5 --- resources/linkeditor/js/linkeditor.js | 9 +++------ resources/linkeditor/js/linkeditor.links.js | 9 ++++++++- resources/linkeditor/js/linkeditor.utils.js | 8 ++++++-- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/resources/linkeditor/js/linkeditor.js b/resources/linkeditor/js/linkeditor.js index 7ebf4d89c..7f9ccd304 100644 --- a/resources/linkeditor/js/linkeditor.js +++ b/resources/linkeditor/js/linkeditor.js @@ -30,7 +30,6 @@ window.tippy = tippy; window.Noty = Noty; window.GrahamScan = GrahamScan; - window.key.filter = function (event) { let tagName = (event.target || event.srcElement).tagName; //let field=tagName == 'INPUT' || tagName == 'SELECT' || tagName == 'TEXTAREA'; @@ -63,6 +62,7 @@ $.ajaxSetup({ function LinkEditor() { this.mobileFirst = FLUIDBOOK_DATA.settings.mobileNavigationType === 'mobilefirst'; this.single = ['mobilefirst', 'portrait'].indexOf(FLUIDBOOK_DATA.settings.mobileNavigationType) >= 0 || FLUIDBOOK_DATA.settings.pages <= 1; + this.rtl = FLUIDBOOK_DATA.id==30547 && !this.single && ['ar', 'he', 'fa', 'ku', 'pa', 'sd', 'ur'].indexOf(FLUIDBOOK_DATA.locale) >= 0; this.pw = FLUIDBOOK_DATA.settings.width; this.ph = FLUIDBOOK_DATA.settings.height; @@ -85,7 +85,6 @@ function LinkEditor() { this.dimensionProperties = ['left', 'top', 'width', 'height']; - this.init(); } @@ -459,9 +458,9 @@ LinkEditor.prototype = { window.location.hash = '#' + this.currentPage; this.clearLinksAndRulers(); - this.loader.loadPage(this.currentPage, 'left'); + this.loader.loadPage(this.currentPage, this.rtl ? 'right' : 'left'); if (!this.single && !isSpecial) { - this.loader.loadPage(this.currentPage + 1, 'right'); + this.loader.loadPage(this.currentPage + 1, this.rtl ? 'left' : 'right'); } $("#linkeditor-page-field input").val(this.currentNumericPage); this.resize.resize(); @@ -560,10 +559,8 @@ LinkEditor.prototype = { getCurrentPage: function () { return this.currentPage; }, - } - $(function () { window.linkeditor = new LinkEditor(); }); diff --git a/resources/linkeditor/js/linkeditor.links.js b/resources/linkeditor/js/linkeditor.links.js index ca609b6db..e95f51fb0 100644 --- a/resources/linkeditor/js/linkeditor.links.js +++ b/resources/linkeditor/js/linkeditor.links.js @@ -864,11 +864,13 @@ LinkeditorLinks.prototype = { }, normalizeLinksPage() { + let $this = this; let pw = this.linkeditor.pw; let single = this.linkeditor.single; + let rtl = this.linkeditor.rtl $.each(LINKS, function (uid, link) { link.left = parseFloat(link.left) - if (!single) { + if (!rtl) { if (link.page % 2 === 0 && link.left > pw) { link.page++; link.left -= pw; @@ -877,6 +879,11 @@ LinkeditorLinks.prototype = { link.page--; link.left += pw; } + } else { + if (link.page % 2 === 0) { + link.page++; + link.left += pw; + } } LINKS[uid] = link; }); diff --git a/resources/linkeditor/js/linkeditor.utils.js b/resources/linkeditor/js/linkeditor.utils.js index 05a3efd64..de2dc5075 100644 --- a/resources/linkeditor/js/linkeditor.utils.js +++ b/resources/linkeditor/js/linkeditor.utils.js @@ -147,9 +147,13 @@ LinkeditorUtils.prototype = { roundDimension: function (v) { return (Math.round(v * 100000) / 100000); - }, intersectRect: function (r1, r2) { + }, + + intersectRect: function (r1, r2) { return !(r2.left > r1.right || r2.right < r1.left || r2.top > r1.bottom || r2.bottom < r1.top); - }, isfocusOnFormItem: function () { + }, + + isfocusOnFormItem: function () { return $(document.activeElement).is('input[type="text"],input[type="email"],input[type="number"],input[type="tel"],input[type="search"],textarea,select'); }, -- 2.39.5