Skip to content

Commit

Permalink
move rtl class to root el
Browse files Browse the repository at this point in the history
  • Loading branch information
edsilv committed Oct 18, 2023
1 parent 1f2cdcf commit c146cb4
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ export class TreeView extends BaseView {
create(): void {
this.setConfig("contentLeftPanel");
super.create();

this.$tree = $('<div class="iiif-tree-component rtl"></div>');
this.$tree = $('<div class="iiif-tree-component"></div>');
this.$element.append(this.$tree);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,6 @@
font-weight: normal;
overflow: auto;

.iiif-tree-component.rtl {
direction: rtl;
padding-right: @padding-medium-horizontal;
}

.iiif-tree-component ul li a.selected {
color: @brand-primary !important;
}
Expand All @@ -132,6 +127,19 @@
}
}

.uv-iiif-extension-host.rtl {
.leftPanel {
.views {
.treeView {
.iiif-tree-component {
direction: rtl;
padding-right: @padding-medium-horizontal;
}
}
}
}
}

.uv.browser-Explorer {
.leftPanel {
.views {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1313,13 +1313,6 @@ export class OpenSeadragonCenterPanel extends CenterPanel {
this.$title.text(sanitize(this.title));
}

// if the manifest has a right-to-left viewing direction, add a class to the title to display it rtl
if (this.extension.helper.isRightToLeft()) {
this.$title.addClass("rtl");
} else {
this.$title.removeClass("rtl");
}

if (
this.extension.helper.isMultiCanvas() &&
this.$prevButton &&
Expand Down
29 changes: 18 additions & 11 deletions src/content-handlers/iiif/modules/uv-shared-module/BaseExtension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,10 @@ export class BaseExtension implements IExtension {
this.$element.addClass("fullscreen");
}

if (this.helper.isRightToLeft()) {
this.$element.addClass("rtl");
}

this.$element.on("mousemove", (e) => {
this.mouseX = e.pageX;
this.mouseY = e.pageY;
Expand Down Expand Up @@ -319,7 +323,8 @@ export class BaseExtension implements IExtension {
);

this.extensionHost.subscribe(IIIFEvents.CLOSE_LEFT_PANEL, () => {
if (that.$element.hasClass("loading")) that.$element.removeClass("loading")
if (that.$element.hasClass("loading"))
that.$element.removeClass("loading");
this.resize();
});

Expand Down Expand Up @@ -475,11 +480,11 @@ export class BaseExtension implements IExtension {
}

public async loadConfig(locale: string, extension: string): Promise<any> {

let uv_locale = locale;
if(extension) {
uv_locale = '_';
this.locales['_'] = () => import(`../../extensions/${extension}/config/config.json`)
if (extension) {
uv_locale = "_";
this.locales["_"] = () =>
import(`../../extensions/${extension}/config/config.json`);
}

let config = this.locales[uv_locale];
Expand All @@ -497,14 +502,16 @@ export class BaseExtension implements IExtension {
return this.translateLocale(config, locale);
}

private async translateLocale(config: Object, locale: String): Promise<Object> {

let localeStrings = await import(`../../../../locales/${locale}.json`);
private async translateLocale(
config: Object,
locale: String
): Promise<Object> {
let localeStrings = await import(`../../../../locales/${locale}.json`);
let conf = JSON.stringify(config);

for(let str in localeStrings) {
let replaceStr = str.replace('$','');
let re = new RegExp(`\\$${replaceStr}\\b`, 'g');
for (let str in localeStrings) {
let replaceStr = str.replace("$", "");
let re = new RegExp(`\\$${replaceStr}\\b`, "g");
conf = conf.replace(re, localeStrings[str]);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@
text-overflow: ellipsis;
line-height: 30px;

&.rtl {
direction: rtl;
}

.xl-mediaquery({
padding: 0 20px 0 20px;
});
Expand Down Expand Up @@ -161,3 +157,12 @@
}
}
}

.uv-iiif-extension-host.rtl {
.centerPanel {
.title {
direction: rtl;
padding-right: @padding-medium-horizontal;
}
}
}

1 comment on commit c146cb4

@vercel
Copy link

@vercel vercel bot commented on c146cb4 Oct 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.