diff --git a/src/lib/stores/app/misc.js b/src/lib/stores/app/misc.js index bcb7207..423abc4 100644 --- a/src/lib/stores/app/misc.js +++ b/src/lib/stores/app/misc.js @@ -1,4 +1,4 @@ -import {writable} from 'svelte/store' +import {derived, writable} from 'svelte/store' export const saved = writable(true) @@ -14,6 +14,17 @@ export const onMobile = !import.meta.env.SSR ? writable(/Android|webOS|iPhone|iP export const locale = writable('en') +export const writingDirection = derived( + locale, + $locale => ( + $locale === 'ar' || + $locale === 'he' || + $locale === 'fa' || + $locale === 'ur' || + $locale === 'bal' + ) ? 'rtl' : 'ltr' +) + export const highlightedElement = writable(null) export const locked_blocks = writable([]) \ No newline at end of file diff --git a/src/lib/views/editor/Page.svelte b/src/lib/views/editor/Page.svelte index 8d00853..56465a9 100644 --- a/src/lib/views/editor/Page.svelte +++ b/src/lib/views/editor/Page.svelte @@ -11,7 +11,7 @@ import { isEqual, cloneDeep } from 'lodash-es' import Spinner from '../../ui/misc/Spinner.svelte' import { code as siteCode } from '../../stores/data/site' - import { locale, locked_blocks, showingIDE } from '../../stores/app/misc' + import { locale, writingDirection, locked_blocks, showingIDE } from '../../stores/app/misc' import { active_page } from '../../stores/actions' import modal from '../../stores/app/modal' import { @@ -316,6 +316,7 @@ bind:this={page_el} class:fadein={page_mounted} lang={$locale} + dir={$writingDirection} use:dndzone={{ items: draggable_sections, flipDurationMs, diff --git a/src/lib/views/modal/PageEditor/PageEditor.svelte b/src/lib/views/modal/PageEditor/PageEditor.svelte index a2942c7..0d82d99 100644 --- a/src/lib/views/modal/PageEditor/PageEditor.svelte +++ b/src/lib/views/modal/PageEditor/PageEditor.svelte @@ -20,7 +20,7 @@ import GenericFields from '../../../components/GenericFields.svelte' import { autoRefresh } from '../../../components/misc/CodePreview.svelte' import { buildStaticPage } from '../../../stores/helpers' - import { locale, onMobile } from '../../../stores/app/misc' + import { locale, writingDirection, onMobile } from '../../../stores/app/misc' import { modal } from '../../../stores/app' import { active_page } from '../../../stores/actions' import activePage, { @@ -304,7 +304,7 @@ bind:bottomPaneSize={$bottomPaneSize} hideRightPanel={$onMobile} > -
+
{#if $activeTab === 'content'} -
+
{#if $activeTab === 'code'} -
+
{#if tab === 'code'}