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

Dropdown not working after saving #7

Open
kelvinau opened this issue Apr 21, 2018 · 1 comment
Open

Dropdown not working after saving #7

kelvinau opened this issue Apr 21, 2018 · 1 comment

Comments

@kelvinau
Copy link

Dropdowns of Formatting Styles, Paragraph Format, Font Name, and Font Size cannot be opened after saving. They work fine before that. Now I need to refresh the page to use it properly.

@kelvinau
Copy link
Author

Found out that it's related to this line

$wrapper->append('<script src="'.str_replace('/panel/index.php','',$_SERVER['SCRIPT_NAME']) . '/site/fields/ckeditor/assets/js/ckeditor.js"></script><script>CKEDITOR.inline( "'.$this->name().'" );</script>');

A new DOM with the same ID is appended every time after saving. For a quick fix, removing the previous element will solve it, like this

$wrapper->append('
            <script src="'.str_replace('/panel/index.php','',$_SERVER['SCRIPT_NAME']) . '/site/fields/ckeditor/assets/js/ckeditor.js"></script>
            <script>
                $("#cke_form-field-' . $this->name() . '").remove();
                CKEDITOR.inline( "'.$this->name().'" );
            </script>
        ');

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant