zotero-gpt
zotero-gpt copied to clipboard
Rtl Problem
Has this issue been reported before?
- [X] I confirm that there is no existing issue, and I have read the FAQ
Operating Environment
- OS: win 11
- Zotero version: 6.0.23
- Plugin version: 0.2.3
Current Configuration Information
No response
Issue Details
Hi actually, it's not problem in first sight, But its problem for all user that write in right of book. Can I add RTL config for showing answer or question in plugins?
Additional Information
No response
I can do this, but the language I am using does not have RTL. So, the effect I understand may be different from what you need. Can you give me an example?
Hi, This is RTL example: «این یک متن تست هست» for example, when in meddle of sentence use English word like "hello", this text showing like: «تست است hello این یک متن » I think you can solve this with add this code on CSS:
.ltr {
direction: ltr;
text-align: left;
}
.rtl {
direction: rtl;
text-align: right;
}
and for call this in js this cade may be enough:
function isRTL(s) {
const rtlChars = '\u0600-\u06FF\u0750-\u077F\u08A0-\u08FF\uFB50-\uFF\uFE70-\uFEFF';
const rtlDirCheck = new RegExp(`^[^${rtlChars}]*[${rtlChars}]`);
return rtlDirCheck.test(s);
}
function detectTextDirection(input) {
if (isRTL(input.value)) {
input.classList.remove('ltr');
input.classList.add('rtl');
} else {
input.classList.remove('rtl');
input.classList.add('ltr');
}
}
function addInputListeners() {
const inputs = document.querySelectorAll('input[type="text"], textarea');
inputs.forEach((input) => {
input.addEventListener('input', function () {
detectTextDirection(this);
});
});
}
addInputListeners();
Thanks For quick reply.
Hi, I added your code to plugin.
https://github.com/MuiseDestiny/zotero-gpt/releases/download/0.2.9/zotero-gpt-129.xpi
But it need to test.
Hi, and tnx for added quicly. I test it ;in Question section, this is woking Fine. But in Answer section that chatgpt write text its showing like before and RTL doesnt work