From cab0d260971a8e2b3ed9cdd2eaf5abe7df4cc0b7 Mon Sep 17 00:00:00 2001 From: "maria.cano" Date: Wed, 19 Oct 2022 13:40:22 +0200 Subject: [PATCH 1/5] fix: hide styles when no className --- views/js/qtiCreator/helper/formatStyles.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/views/js/qtiCreator/helper/formatStyles.js b/views/js/qtiCreator/helper/formatStyles.js index b685d0a96..ccc9da683 100644 --- a/views/js/qtiCreator/helper/formatStyles.js +++ b/views/js/qtiCreator/helper/formatStyles.js @@ -41,6 +41,8 @@ define([ const assetClassName = asset.children[0].className.match(/[\w-]*tao-[\w-]*/g) || asset.children[1].className.match(/[\w-]*tao-[\w-]*/g); if (assetClassName) { _formatStyles(linkTag.sheet, assetClassName[0]); + } else { + _hideStyles(linkTag.sheet); } }); return; @@ -74,6 +76,23 @@ define([ } } + function _hideStyles(linkTag) { + /** + * @type {CSSRuleList} + * @see https://developer.mozilla.org/en-US/docs/Web/API/CSSRuleList + */ + const { cssRules } = linkTag || {}; + const CSSStyleSheet = linkTag || {}; + + if (cssRules) { + Object.values(cssRules).map((index, rule) => { + CSSStyleSheet.deleteRule(index); + }); + } + + return; + } + function _formatStyles(linkTag, className) { /** * @type {CSSRuleList} From b91869e7a7ab9a3e25ace60eed2070a1deaf70f7 Mon Sep 17 00:00:00 2001 From: "maria.cano" Date: Wed, 19 Oct 2022 13:40:36 +0200 Subject: [PATCH 2/5] fix: remove mainClass --- .../component/tpl/sharedStimulusAuthoring.tpl | 24 +++++++++---------- .../editor/styleEditor/colorSelector.js | 10 +++----- .../editor/styleEditor/fontSelector.js | 3 +-- .../editor/styleEditor/fontSizeChanger.js | 2 +- 4 files changed, 17 insertions(+), 22 deletions(-) diff --git a/views/js/qtiCreator/component/tpl/sharedStimulusAuthoring.tpl b/views/js/qtiCreator/component/tpl/sharedStimulusAuthoring.tpl index 4e8e580de..4e15fe2f2 100644 --- a/views/js/qtiCreator/component/tpl/sharedStimulusAuthoring.tpl +++ b/views/js/qtiCreator/component/tpl/sharedStimulusAuthoring.tpl @@ -75,28 +75,28 @@ + data-target="body div.qti-item" data-additional="padding:20px">
+ data-target="body div.qti-item">
+ data-target="body div.qti-item" data-additional="border-width:4px;border-style:solid;padding:20px">
+ data-target="body div.qti-item table th">
@@ -108,7 +108,7 @@
{{__ 'Font size'}}
- +