Skip to content

Instantly share code, notes, and snippets.

//code from this repo https://github.com/kavirajk/isRTL/blob/master/isRTL.js
let reRTL, rtlChars;
rtlChars = [
/* arabic ranges*/
"\u0600-\u06FF",
"\u0750-\u077F",
"\uFB50-\uFDFF",
"\uFE70-\uFEFF",
const onInputFocus = (e) => {
setFocussed(true);
if (e.target.value === "" && locale === "ar") {
setDir("rtl");
return;
}
isRTL(e.target.value) ? setDir("rtl") : setDir("ltr");
};
const onInputBlur = (e) => {
setFocussed(false);
if (e.target.value === "" && locale === "ar") {
setDir("rtl");
return;
}
locale === "ar" ? setDir("rtl") : setDir("ltr");
};
@Mood-al
Mood-al / +page.svelte
Created December 20, 2022 00:57
svelte-tabs-scrollable usage
<script>
// @ts-nocheck
import Tabs from '$lib/Tabs.svelte';
import Tab from '$lib/Tab.svelte';
let isRTL = false;
const onClick = () => {
isRTL = !isRTL;
};