From 820220255bb6c2f0e0b088637cb98812cef66095 Mon Sep 17 00:00:00 2001 From: rakeshkumar1019 Date: Fri, 3 Jan 2025 12:37:09 +0530 Subject: [PATCH 1/7] test --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index d5847863ac..2604e29900 100644 --- a/index.html +++ b/index.html @@ -58,7 +58,7 @@ From 1e981229516a251830a0da9bee801248db3c8694 Mon Sep 17 00:00:00 2001 From: rakeshkumar1019 Date: Mon, 6 Jan 2025 10:09:44 +0530 Subject: [PATCH 2/7] nuxeo-app.js --- elements/nuxeo-app.js | 53 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 51 insertions(+), 2 deletions(-) diff --git a/elements/nuxeo-app.js b/elements/nuxeo-app.js index 320050a355..087917d572 100644 --- a/elements/nuxeo-app.js +++ b/elements/nuxeo-app.js @@ -144,18 +144,33 @@ Polymer({ width: var(--nuxeo-sidebar-width); height: 53px; top: var(--nuxeo-app-top); - left: 0; z-index: 102; box-sizing: border-box; outline: none; background-color: var(--nuxeo-sidebar-background); } + :host([dir='rtl']) #logo { + left: auto; + right: 0; + } + + :host([dir='ltr']) #logo { + left: 0; + right: auto; + } + #logo img { width: var(--nuxeo-sidebar-width); height: 53px; } + :host([dir='rtl']) #logo { + right: 0px; + height: 53px; + left: auto; + } + /* menu */ #menu { @apply --nuxeo-sidebar; @@ -211,6 +226,11 @@ Polymer({ cursor: pointer; } + :host([dir='rtl']) #drawer .toggle { + left: -16px; + right: auto; + } + #drawer .toggle iron-icon { visibility: hidden; color: var(--nuxeo-drawer-background); @@ -235,6 +255,11 @@ Polymer({ background-color: var(--nuxeo-drawer-background); } + :host([dir='rtl']) #drawer iron-pages { + margin-right: var(--nuxeo-sidebar-width); + margin-left: 0; + } + #drawer nuxeo-menu-item:hover, #drawer list-item:hover { @apply --nuxeo-block-hover; @@ -323,6 +348,7 @@ Polymer({ drawer-width="[[drawerWidth]]" responsive-width="720px" edge-swipe-sensitivity="0" + right-drawer$="[[_isRTL]]" >
@@ -394,7 +420,7 @@ Polymer({
- +
@@ -597,6 +623,13 @@ Polymer({ _routedSearch: { type: Object, }, + + _isRTL: { + type: Boolean, + value: false, + reflectToAttribute: true, + observer: '_directionChanged', + }, }, listeners: { @@ -641,6 +674,7 @@ Polymer({ ], ready() { + this._checkRtl(); this.$.drawerPanel.closeDrawer(); this.drawerWidth = this.sidebarWidth = getComputedStyle(this).getPropertyValue('--nuxeo-sidebar-width'); this.$.drawerPanel.$.drawer.addEventListener('transitionend', () => { @@ -675,6 +709,21 @@ Polymer({ }); }, + _checkRtl() { + const dir = document.documentElement.getAttribute('dir'); + this._isRTL = dir === 'rtl'; + }, + + _directionChanged(isRTL) { + if (isRTL) { + this.$.drawerPanel.setAttribute('right-drawer', ''); + this.toggleChevronIcon = 'icons:chevron-right'; + } else { + this.$.drawerPanel.removeAttribute('right-drawer'); + this.toggleChevronIcon = 'icons:chevron-left'; + } + }, + _resetTaskSelection() { this.currentTask = null; this.currentTaskId = null; From 7358723ca2392eac2ae284d2a79ec4fff2a620ac Mon Sep 17 00:00:00 2001 From: rakeshkumar1019 Date: Mon, 6 Jan 2025 10:19:37 +0530 Subject: [PATCH 3/7] index.js --- index.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/index.js b/index.js index 6776d221d9..f2d613c48e 100644 --- a/index.js +++ b/index.js @@ -2,6 +2,17 @@ import { config } from '@nuxeo/nuxeo-elements'; import { importHTML, importHref } from '@nuxeo/nuxeo-ui-elements/import-href.js'; import { setFallbackNotificationTarget } from '@nuxeo/nuxeo-elements/nuxeo-notify-behavior.js'; +// RTL configuration setup +const setupRTLSupport = () => { + window.nuxeo = window.nuxeo || {}; + window.nuxeo.I18n = window.nuxeo.I18n || {}; + const userLanguage = navigator.language || navigator.userLanguage || 'en'; + const rtlLanguages = ['ar', 'he', 'fa', 'ur']; + const isRTL = rtlLanguages.some((lang) => userLanguage?.startsWith(lang)); + window.nuxeo.I18n.direction = isRTL ? 'rtl' : 'ltr'; + document.documentElement.dir = window.nuxeo.I18n.direction; +}; + // To fix WEBUI-833 and to disable the Roboto font request const disableRobotoFont = () => { window.polymerSkipLoadingFontRoboto = true; @@ -35,6 +46,7 @@ const setupApp = async () => if (!Nuxeo.UI.app) { console.error('could not find nuxeo-app'); } + Nuxeo.UI.app.setAttribute('dir', window.nuxeo.I18n.direction); setFallbackNotificationTarget(Nuxeo.UI.app); } else { console.error('could not find nuxeo-app'); @@ -57,6 +69,7 @@ const ready = ready .then(disableRobotoFont) + .then(setupRTLSupport) .then(loadApp) .then(loadLegacy) .then(loadBundle) From 74b59b735b23b6757853989b87c3ee79e22f00e3 Mon Sep 17 00:00:00 2001 From: rakeshkumar1019 Date: Mon, 6 Jan 2025 10:38:19 +0530 Subject: [PATCH 4/7] index.jsp,index.html & rtl-setup.js --- index.html | 2 +- .../src/main/resources/web/nuxeo.war/ui/index.jsp | 3 +++ rtl-setup.js | 11 +++++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 rtl-setup.js diff --git a/index.html b/index.html index 2604e29900..1e8399ab57 100644 --- a/index.html +++ b/index.html @@ -61,7 +61,7 @@ http-equiv="Content-Security-Policy" test content="img-src data: blob: *; default-src blob: *; script-src data: * 'nonce-dummy'; style-src 'unsafe-inline' *; font-src data: *" /> --> - + diff --git a/plugin/web-ui/addon/src/main/resources/web/nuxeo.war/ui/index.jsp b/plugin/web-ui/addon/src/main/resources/web/nuxeo.war/ui/index.jsp index daa86a7c81..0daaa719af 100644 --- a/plugin/web-ui/addon/src/main/resources/web/nuxeo.war/ui/index.jsp +++ b/plugin/web-ui/addon/src/main/resources/web/nuxeo.war/ui/index.jsp @@ -117,6 +117,9 @@ limitations under the License. + diff --git a/rtl-setup.js b/rtl-setup.js new file mode 100644 index 0000000000..cb0c65ccc6 --- /dev/null +++ b/rtl-setup.js @@ -0,0 +1,11 @@ +window.nuxeo = window.nuxeo || {}; +window.nuxeo.I18n = window.nuxeo.I18n || {}; +const userLanguage = navigator.language || navigator.userLanguage || 'en'; +const rtlLanguages = ['ar', 'he', 'fa', 'ur']; +const isRTL = rtlLanguages.some((lang) => userLanguage?.startsWith(lang)); +window.nuxeo.I18n.direction = isRTL ? 'rtl' : 'ltr'; +document.documentElement.setAttribute('dir', window.nuxeo.I18n.direction || 'ltr'); +const nuxeoApp = document.querySelector('nuxeo-app'); +if (nuxeoApp) { + nuxeoApp.setAttribute('dir', window.nuxeo.I18n.direction || 'ltr'); +} From c270156f988663df1a342c232b439ad9ecbec301 Mon Sep 17 00:00:00 2001 From: rakeshkumar1019 Date: Mon, 6 Jan 2025 10:49:35 +0530 Subject: [PATCH 5/7] index.html --- index.html | 1 - 1 file changed, 1 deletion(-) diff --git a/index.html b/index.html index 1e8399ab57..e0ae5718a6 100644 --- a/index.html +++ b/index.html @@ -61,7 +61,6 @@ http-equiv="Content-Security-Policy" test content="img-src data: blob: *; default-src blob: *; script-src data: * 'nonce-dummy'; style-src 'unsafe-inline' *; font-src data: *" /> --> - From b9a6b1b386ca69898f0f0b3029765ef1d765789a Mon Sep 17 00:00:00 2001 From: rakeshkumar1019 Date: Mon, 6 Jan 2025 11:08:25 +0530 Subject: [PATCH 6/7] index.html & index.jsp --- index.html | 1 + .../addon/src/main/resources/web/nuxeo.war/ui/index.jsp | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index e0ae5718a6..1e8399ab57 100644 --- a/index.html +++ b/index.html @@ -61,6 +61,7 @@ http-equiv="Content-Security-Policy" test content="img-src data: blob: *; default-src blob: *; script-src data: * 'nonce-dummy'; style-src 'unsafe-inline' *; font-src data: *" /> --> + diff --git a/plugin/web-ui/addon/src/main/resources/web/nuxeo.war/ui/index.jsp b/plugin/web-ui/addon/src/main/resources/web/nuxeo.war/ui/index.jsp index 0daaa719af..c6f21c9ff7 100644 --- a/plugin/web-ui/addon/src/main/resources/web/nuxeo.war/ui/index.jsp +++ b/plugin/web-ui/addon/src/main/resources/web/nuxeo.war/ui/index.jsp @@ -117,9 +117,9 @@ limitations under the License. - --> From 28cf6b4380effab5a995b50ecd073c2eb28aeb56 Mon Sep 17 00:00:00 2001 From: rakeshkumar1019 Date: Mon, 6 Jan 2025 11:19:25 +0530 Subject: [PATCH 7/7] index.jsp --- .../addon/src/main/resources/web/nuxeo.war/ui/index.jsp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/plugin/web-ui/addon/src/main/resources/web/nuxeo.war/ui/index.jsp b/plugin/web-ui/addon/src/main/resources/web/nuxeo.war/ui/index.jsp index c6f21c9ff7..973c2b0b2b 100644 --- a/plugin/web-ui/addon/src/main/resources/web/nuxeo.war/ui/index.jsp +++ b/plugin/web-ui/addon/src/main/resources/web/nuxeo.war/ui/index.jsp @@ -117,9 +117,6 @@ limitations under the License. - @@ -142,7 +139,9 @@ limitations under the License. - + + +