Render custom css in public view

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

View File

@ -10,6 +10,7 @@ import { setupSearchFilters } from '../setupListeners/search';
export function renderAll() { export function renderAll() {
renderTheme(); renderTheme();
renderCustomCSS();
renderDictionaryDetails(); renderDictionaryDetails();
renderPartsOfSpeech(); renderPartsOfSpeech();
sortWords(); sortWords();
@ -21,6 +22,20 @@ export function renderTheme() {
document.body.id = theme + 'Theme'; 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() { export function renderDictionaryDetails() {
renderName(); renderName();
showSection('description'); showSection('description');