From c07ae23f8aaf91e31a2c772dae7a4d45d0be2cc9 Mon Sep 17 00:00:00 2001 From: Robbie Antenesse Date: Wed, 10 Jul 2019 16:45:15 -0600 Subject: [PATCH] Render custom css in public view --- src/js/view/render.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/js/view/render.js b/src/js/view/render.js index cd83db8..18ea29c 100644 --- a/src/js/view/render.js +++ b/src/js/view/render.js @@ -10,6 +10,7 @@ import { setupSearchFilters } from '../setupListeners/search'; export function renderAll() { renderTheme(); + renderCustomCSS(); renderDictionaryDetails(); renderPartsOfSpeech(); sortWords(); @@ -21,6 +22,20 @@ export function renderTheme() { document.body.id = theme + 'Theme'; } +export function renderCustomCSS() { + const { customCSS } = window.currentDictionary.settings; + const stylingId = 'customCSS'; + const stylingElement = document.getElementById(stylingId); + if (!stylingElement) { + const styling = document.createElement('style'); + styling.id = stylingId; + styling.innerHTML = customCSS; + document.body.appendChild(styling); + } else { + stylingElement.innerHTML = customCSS; + } +} + export function renderDictionaryDetails() { renderName(); showSection('description');