dakboard / Cloud-Platform

Feature requests, enhancements and anything you'd like to see in DAKboard!
https://dakboard.com
166 stars 39 forks source link

Custom Fonts added by CSS will not show in the Screen editor #2037

Closed rsalsbery closed 6 months ago

rsalsbery commented 7 months ago

When changing the font on a Screen using the Custom CSS method, the Font does update the Screen but it is not reflected when looking at it in the Screen editor. See below:

Screen Editor:

image

Screen in View:

image

This case is to see if we can have custom CSS reflected in the Editor.

cocarrig commented 7 months ago

Loading it on page refresh would be acceptable, if live update is not feasible.

Dan-Peck commented 7 months ago

Successfully tested an approach to updating Custom CSS on-the-fly that should work going forward.

However, there are some inherent issues that prevent some Custom CSS from displaying as expected in the Live Editor versus the actual Screen. This does not mean it is not possible however! This means the Custom CSS will need to be written in a certain manner to achieve it and avoid side effects.

These are the recommendations:

These are the reasons:

For example, I would rewrite the original CSS noted in this issue to be:

@import url('https://fontlibrary.org/face/umberto');

#screen-container-live, #screen-container-no-edit
{
  font-family: 'umberto';
}

Or, in the more preferable form, specifying only the named-block that we want to target:

@import url('https://fontlibrary.org/face/umberto');

#screen-container-live .block--MyNamedTextBlock,
#screen-container-no-edit .block--MyNamedTextBlock
{
  font-family: 'umberto';
}

NOTE: These CSS rewrites will work with existing Production code, no code changes required for that part.

Dan-Peck commented 6 months ago

Merged in @ 85af459 and added to the queue for upcoming release to the live site.