Coder Social home page Coder Social logo

oxygenbuilder-rtl-fix's Introduction

RTL OxygenBuilder Fix

Why this script?

If you have an RTL site running OxygenBuilder, then you'll need to add this snippet to your site. RTL Languages: Arabic, Aramaic, Azeri, Dhivehi/Maldivian, Hebrew, Kurdish (Sorani), Persian/Farsi, and Urdu.

The issue

If you install the OxygenBuilder plugin for the first time, and have your site in one of the RTL languages, the editor layout will be broken, page preview is not complete, tabs and settings will appear in weird places and a lot of funny stuff:

As you can see in the above screenshot, there's a blank space on the left of the page preview

Even worst when you have a code block open

How to fix the issue?

  1. First you'll need to install a plugin that let's you add/manage code snippets on your site. I use the free WPCode Plugin. Go ahead to Plugins > Add New > and search for WPCode and Install & Activate the plugin enter image description here
  2. After installing WPCode, go to Code Snippets > + Add Snippet and add the following snippet. Full snippet located inside the script.js file on this repo.
// Fix Oxygen Builder Editor Layout for RTL sites
// Get the current window location
const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);
const oxy_builder = urlParams.get("ct_builder");

// Check if the current page is an editor page
if (oxy_builder == "true") {
  // if it's the editor, make the page direction LTR
  // Making the page direction LTR will ensure that the builder itself will show up correctly
  // While the page's content will remain RTL
  // It works!

  document
    .querySelector('html[ng-app="CTFrontendBuilderUI"]')
    .setAttribute("dir", "ltr");
}
  1. Save the snippet and don't forget to make it activeAdd the snippet and Activate it
  2. That's it. Now everytime the editor loads, it will be set to display correctlEditor appears as usual

No weird stuff happening

oxygenbuilder-rtl-fix's People

Contributors

dotjalil avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.