From 3d40ab7e8c8eb161e07b6ae319e34dd0e01cf5b3 Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Fri, 18 Jun 2021 17:20:52 -0400 Subject: [PATCH] CSS: Move author color padding to `setAuthorStyle()` This prevents the padding from clashing with plugins that use the `aceSetAuthorStyle` hook. --- src/static/css/iframe_editor.css | 5 ----- src/static/js/ace2_inner.js | 20 ++++++++++---------- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/src/static/css/iframe_editor.css b/src/static/css/iframe_editor.css index 912174411..a29c11573 100644 --- a/src/static/css/iframe_editor.css +++ b/src/static/css/iframe_editor.css @@ -58,11 +58,6 @@ html.outer-editor, html.inner-editor { color: inherit; } -#innerdocbody.authorColors span { - padding-top: 3px; - padding-bottom: 4px; -} - option { text-transform: capitalize; } diff --git a/src/static/js/ace2_inner.js b/src/static/js/ace2_inner.js index bbe26a06b..afb3b5e7c 100644 --- a/src/static/js/ace2_inner.js +++ b/src/static/js/ace2_inner.js @@ -226,18 +226,18 @@ function Ace2Inner(editorInfo, cssManagers) { if ((typeof info.fade) === 'number') { bgcolor = fadeColor(bgcolor, info.fade); } - - const authorStyle = cssManagers.inner.selectorStyle(authorSelector); - const parentAuthorStyle = cssManagers.parent.selectorStyle(authorSelector); - - // author color - authorStyle.backgroundColor = bgcolor; - parentAuthorStyle.backgroundColor = bgcolor; - const textColor = colorutils.textColorFromBackgroundColor(bgcolor, parent.parent.clientVars.skinName); - authorStyle.color = textColor; - parentAuthorStyle.color = textColor; + const styles = [ + cssManagers.inner.selectorStyle(authorSelector), + cssManagers.parent.selectorStyle(authorSelector), + ]; + for (const style of styles) { + style.backgroundColor = bgcolor; + style.color = textColor; + style['padding-top'] = '3px'; + style['padding-bottom'] = '4px'; + } } };