Render custom css in public view

This commit is contained in:
Robbie Antenesse 2019-07-10 16:45:15 -06:00 committed by Robbie Antenesse
parent 1cf547dd2e
commit c07ae23f8a
1 changed files with 15 additions and 0 deletions

View File

@ -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');