Skip to content

Instantly share code, notes, and snippets.

@daalvand
Last active June 9, 2025 08:58
Show Gist options
  • Select an option

  • Save daalvand/da1264b3ebe3bbce25f51bd688503ff2 to your computer and use it in GitHub Desktop.

Select an option

Save daalvand/da1264b3ebe3bbce25f51bd688503ff2 to your computer and use it in GitHub Desktop.
Jira RTL
// add this file into jira banner
// https://{{jira_domain}}/secure/admin/EditAnnouncementBanner!default.jspa
<style>
.jira-rtl-content {
font-family: Tahoma, Arial, sans-serif!important;
}
</style>
<script>
;(function(){
const selMain = [
'#summary p, #summary-val, [data-field-id="summary"]',
'#description p, #description-val, .js-description',
'.comment-body, .user-content-block p',
'[id^="comment-"] div.twixi-wrap.verbose.actionContainer div.action-body.flooded p'
].join(',');
function applyAutoDirection(){
document.querySelectorAll(selMain).forEach(el=>{
el.setAttribute('dir','auto');
el.classList.add('jira-rtl-content');
});
}
function applyEditorAutoDirection(){
const iframe = document.querySelector('[id^="mce_"][id$="_ifr"]');
if (!iframe) return;
const d = iframe.contentDocument || iframe.contentWindow.document;
d?.querySelectorAll('#tinymce p').forEach(el => {
el.setAttribute('dir', 'auto');
el.classList.add('jira-rtl-content');
});
}
applyAutoDirection();
applyEditorAutoDirection();
new MutationObserver(m=>{
if (m.some(x=>x.addedNodes.length)) {
applyAutoDirection();
applyEditorAutoDirection();
}
}).observe(document.body, { subtree:true, childList:true });
if (typeof JIRA !== 'undefined') JIRA.Events.on('issueRefreshed', applyAutoDirection);
window.addEventListener('hashchange', applyAutoDirection);
})();
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment