backdrop-contrib / tinymce

Integration for the TinyMCE editor in Backdrop CMS
https://backdropcms.org/project/tinymce
GNU General Public License v2.0
2 stars 1 forks source link

Buttons / plugins using inline styles #12

Closed indigoxela closed 11 months ago

indigoxela commented 11 months ago

I thought, I found and fixed them all, but indent and outdent also use inline styles.

This isn't a problem with lists (ul / ol), as those get transformed to nested lists, but this format also works on any block element - and then it adds padding via inline styles. And that won't work with the Filter module restriction (on display).

Apparently, the table plugin also uses inline styles?

Not sure, how to work around that, yet.

indigoxela commented 11 months ago

Very odd workaround for indent/outdent: override the exec command with an empty function.


editor.on('PreInit', function (event) {
  event.target.editorCommands.commands.exec.indent = function () {
    console.log('can override indent');
  }
  event.target.editorCommands.commands.exec.outdent = function () {
    console.log('can override outdent');
  }
});

It's weird, that this works... The core IndentOutdent commands do nothing on lists, so list (li in ul/ol) indent/outdent still works. Too odd to just implement. Might break any time.

indigoxela commented 11 months ago

While slightly different, this comment suggests a similar approach, which means, it might not be completely silly.

Will give editor.addCommand('indent', function () {}); a try.

Update: works, and committed.

indigoxela commented 11 months ago

Closing for now, although I suspect, more hidden inline style usage might exist.