Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[nextgen-editor] feature request: rtl (dir attribute) support in div shortcode #311

Open
yankl opened this issue Sep 30, 2022 · 0 comments
Assignees
Labels
nextgen-editor NextGen Editor plugin

Comments

@yankl
Copy link

yankl commented Sep 30, 2022

It would be very useful for those of us who work with RTL languages to have the ability to set the dir attribute of a div element.

At first glance it seems easy enough to add to the shortcode core:
In this file, instead of

 $this->shortcode->getHandlers()->add('div', static function(ShortcodeInterface $sc) {
            $id = $sc->getParameter('id');
            $class = $sc->getParameter('class');
            $style = $sc->getParameter('style');

            $id_output = $id ? ' id="' . $id . '" ': '';
            $class_output = $class ? ' class="' . $class . '"' : '';
            $style_output = $style ? ' style="' . $style . '"' : '';

            return '<div ' . $id_output . $class_output . $style_output . '>' . $sc->getContent() . '</div>';
        });

you could have

 $this->shortcode->getHandlers()->add('div', static function(ShortcodeInterface $sc) {
            $id = $sc->getParameter('id');
            $class = $sc->getParameter('class');
            $style = $sc->getParameter('style');
            $dir = $sc->getParameter('dir');

            $id_output = $id ? ' id="' . $id . '" ': '';
            $class_output = $class ? ' class="' . $class . '"' : '';
            $style_output = $style ? ' style="' . $style . '"' : '';
            $dir_output = $dir ? ' dir="' . $dir . '"' : '';

            return '<div ' . $id_output . $class_output . $style_output . $dir_output . '>' . $sc->getContent() . '</div>';
        });

(I haven't tested this code.)
Or maybe I could override this shortcode on my own site. However, it seems to me that even in this case, the Nextgen Editor erases these efforts.

When in Expert Mode, if I create a div in shortcode with a dir attribute, save, and then switch to Nextgen Editor, and save again, the dir attribute disappears. So it seems that to have a hope of using this editor and having such a shortcode, there would first have to be some kind of support built in to the Nextgen Editor.
Is this correct?

@yankl yankl added the nextgen-editor NextGen Editor plugin label Sep 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
nextgen-editor NextGen Editor plugin
Projects
None yet
Development

No branches or pull requests

2 participants