Skip to content
This repository has been archived by the owner on Dec 1, 2023. It is now read-only.

TinyMCE cleans HTML code and it can't be disabled #7

Open
AhmedAtef opened this issue Jul 2, 2016 · 2 comments
Open

TinyMCE cleans HTML code and it can't be disabled #7

AhmedAtef opened this issue Jul 2, 2016 · 2 comments

Comments

@AhmedAtef
Copy link

There are no editor settings to disable code cleaning

@humantex
Copy link

I came across this today, and was surprised that there's no built-in parameters to change the behaviour inside pagekit's system settings, I had no choice but to modify the core code and force the addition/editing of code to remain after saving. Adding in a CSS class to any appropriate HTML element certainly isn't invalid coding, but it was impossible to do without making these changes.

These edits were done to: /packages/pagekit/tinymce/app/components/editor-tinymce.js

The original code, beginning at line 46 is:

                entity_encoding: "raw",

                init_instance_callback: function (editor) {

The code after the 4 lines of modifications were inserted:

                entity_encoding: "raw",
                
                cleanup: false,
                
                verify_html: false,
                
                valid_elements: '*[*]',
                
                extended_valid_elements: '*[*]',

                init_instance_callback: function (editor) {

This may not be the best approach. Having some toggles within pagekit itself would certainly be the better solution, and not having to edit core files that would be overwritten on any updates. The modifications I made might also be overkill, and/or valid only for tinymce v3... but at least it solved my immediate problem.

@humantex
Copy link

After a recent update to Pagekit 1.0.15, I've had to retrace my steps for any previous edits I've made to core files, and redo them from scratch. It's been quite some time since I'd modified the TinyMCE files, and in order to have the changes work this time, it required unminifying the file (now) located as: /packages/pagekit/tinymce/app/bundle/tinymce.js, to get a more easily readable/editable file.

The line numbers will be different, and should be somewhere around line 36, where the entity_encoding: "raw", value-pair can be found to insert the same 4 lines below it, in order to modify the editor's behavior.

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

No branches or pull requests

2 participants