jcu-eresearch / matrix-helpers

100% Unguessable™. Public bug tracker, pages, designs and helpers that make life in Squiz Matrix easier. The metaphorical red pill.
https://jcu-eresearch.github.io/matrix-helpers/
GNU Affero General Public License v3.0
3 stars 0 forks source link

CSS Integration with the Edit+ editor (and/or admin UI) #14

Open davidjb opened 7 years ago

davidjb commented 7 years ago

Pages with any form of specialised CSS display fine on the frontend but display without styling (or with incorrect styling) in Edit+ or within the admin Viper UI. The consequence of this is that users see content that looks one way in the editor and looks completely different in the rendered page. A simple example is the blockquote and here's the comparison:

In Edit+

image

On rendered page

image

In a more complex example using HTML and the Bootstrap grid system from the JCU Web Framework, because divs are not displayed or laid out as you expect, the result is a string of content down the page that bears almost no resemblance to the final page.

Not having client-specific CSS in the admin UI is less of a concern, as the user is probably technical anyway, or else can switch to using Edit+ to see things correctly.

davidjb commented 7 years ago

My solution to date has been to rebuild the Edit+ styles to integrate with the JCU Web Framework. This involved stripping out most of the 'reset' CSS used in the easyedit.css and all the hard-coded styles that applied to the WYSIWYG field (eg where styles for things like the blockquote were present), and creating workarounds for any further conflicts between Edit+ and the JCU Web Framework (eg Edit+ uses 'row' and so does our Framework).

This solution is fairly robust, but is prone to being affected by any Matrix upgrades and needs to be kept in lock-step. Core Issues:

davidjb commented 7 years ago

The best solution would be to either a) separate the WYSIWYG editor from the main DOM context (via an iframe, like how TinyMCE does it) and have a documented way of including custom CSS inside the editor's iframe, or b) having a documented way of adjusting / integrating the Edit+ styles with other code (eg ensure all Edit+ classes are namespaced?)

Reported at https://squizmap.squiz.net/matrix/9733