Skip to content

Commit

Permalink
feat!: Dropping Sass support from builtin html block, replacing with …
Browse files Browse the repository at this point in the history
…vanilla CSS
  • Loading branch information
farhan committed Oct 30, 2024
1 parent d54e3bd commit f520507
Show file tree
Hide file tree
Showing 5 changed files with 746 additions and 31 deletions.
12 changes: 6 additions & 6 deletions xmodule/assets/editor/_edit.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@
@include linear-gradient(top, #d4dee8, #c9d5e2);

position: relative;
padding: ($baseline/4);
padding: calc(var(--baseline)/4);
border-bottom-color: #a5aaaf;

button {
display: inline-block;

@include float(left);

padding: 3px ($baseline/2) 5px;
padding: 3px calc(var(--baseline)/2) 5px;
margin-left: 7px;
border: 0;
border-radius: 2px;
Expand All @@ -53,7 +53,7 @@

li {
@include float(left);
@include margin-right($baseline/4);
@include margin-right(calc(var(--baseline)/4));

&:last-child {
@include margin-right(0);
Expand All @@ -67,16 +67,16 @@
border: 1px solid #a5aaaf;
border-radius: 3px 3px 0 0;

@include linear-gradient(top, $transparent 87%, rgba(0, 0, 0, .06));
@include linear-gradient(top, var(--transparent) 87%, rgba(0, 0, 0, .06));

background-color: #e5ecf3;
font-size: 13px;
color: #3c3c3c;
box-shadow: 1px -1px 1px rgba(0, 0, 0, .05);

&.current {
background: $white;
border-bottom-color: $white;
background: var(--white);
border-bottom-color: var(--white);
}
}
}
Expand Down
44 changes: 22 additions & 22 deletions xmodule/assets/html/_display.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,26 @@
}

h1 {
color: $body-color;
font: normal 2em/1.4em $font-family-sans-serif;
color: var(--body-color);
font: normal 2em/1.4em var(--font-family-sans-serif);
letter-spacing: 1px;

@include margin(0, 0, 1.416em, 0);
}

h2 {
color: #646464;
font: normal 1.2em/1.2em $font-family-sans-serif;
font: normal 1.2em/1.2em var(--font-family-sans-serif);
letter-spacing: 1px;
margin-bottom: ($baseline*0.75);
margin-bottom: calc((var(--baseline)*0.75));
-webkit-font-smoothing: antialiased;
}

h3,
h4,
h5,
h6 {
@include margin(0, 0, ($baseline/2), 0);
@include margin(0, 0, calc((var(--baseline)/2)), 0);

font-weight: 600;
}
Expand All @@ -54,7 +54,7 @@ p {
margin-bottom: 1.416em;
font-size: 1em;
line-height: 1.6em !important;
color: $body-color;
color: var(--body-color);
}

em,
Expand All @@ -78,11 +78,11 @@ b {
p + p,
ul + p,
ol + p {
margin-top: $baseline;
margin-top: var(--baseline);
}

blockquote {
margin: 1em ($baseline*2);
margin: 1em calc((var(--baseline)*2));
}

ol,
Expand All @@ -91,7 +91,7 @@ ul {
@include bi-app-compact(padding, 0, 0, 0, 1em);

margin: 1em 0;
color: $body-color;
color: var(--body-color);

li {
margin-bottom: 0.708em;
Expand All @@ -112,7 +112,7 @@ a {
&:hover,
&:active,
&:focus {
color: $blue;
color: var(--blue);
}
}

Expand All @@ -122,31 +122,31 @@ img {

pre {
margin: 1em 0;
color: $body-color;
color: var(--body-color);
font-family: monospace, serif;
font-size: 1em;
white-space: pre-wrap;
word-wrap: break-word;
}

code {
color: $body-color;
color: var(--body-color);
font-family: monospace, serif;
background: none;
padding: 0;
}

table {
width: 100%;
margin: $baseline 0;
margin: var(--baseline) 0;
border-collapse: collapse;
font-size: 16px;

td,
th {
margin: $baseline 0;
padding: ($baseline/2);
border: 1px solid $gray-l3;
margin: var(--baseline) 0;
padding: calc((var(--baseline)/2));
border: 1px solid var(--gray-l3);
font-size: 14px;

&.cont-justified-left {
Expand Down Expand Up @@ -179,12 +179,12 @@ th {

position: absolute;
display: block;
padding: ($baseline/4) 7px;
padding: calc((var(--baseline)/4)) 7px;
border-radius: 5px;
opacity: 0.9;
background: $white;
color: $black;
border: 2px solid $black;
background: var(--white);
color: var(--black);
border: 2px solid var(--black);

.label {
font-weight: bold;
Expand Down Expand Up @@ -269,11 +269,11 @@ th {
position: relative;

&.action-zoom-in {
margin-right: ($baseline/4);
margin-right: calc((var(--baseline)/4));
}

&.action-zoom-out {
margin-left: ($baseline/4);
margin-left: calc((var(--baseline)/4));
}

&.is-disabled {
Expand Down
6 changes: 3 additions & 3 deletions xmodule/html_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from xmodule.html_checker import check_html
from xmodule.stringify import stringify_children
from xmodule.util.misc import escape_html_characters
from xmodule.util.builtin_assets import add_webpack_js_to_fragment, add_sass_to_fragment
from xmodule.util.builtin_assets import add_webpack_js_to_fragment, add_css_to_fragment
from xmodule.x_module import (
ResourceTemplates,
shim_xmodule_js,
Expand Down Expand Up @@ -90,7 +90,7 @@ def student_view(self, _context):
Return a fragment that contains the html for the student view
"""
fragment = Fragment(self.get_html())
add_sass_to_fragment(fragment, 'HtmlBlockDisplay.scss')
add_css_to_fragment(fragment, 'HtmlBlockDisplay.css')
add_webpack_js_to_fragment(fragment, 'HtmlBlockDisplay')
shim_xmodule_js(fragment, 'HTMLModule')
return fragment
Expand Down Expand Up @@ -136,7 +136,7 @@ def studio_view(self, _context):
fragment = Fragment(
self.runtime.service(self, 'mako').render_cms_template(self.mako_template, self.get_context())
)
add_sass_to_fragment(fragment, 'HtmlBlockEditor.scss')
add_css_to_fragment(fragment, 'HtmlBlockEditor.css')
add_webpack_js_to_fragment(fragment, 'HtmlBlockEditor')
shim_xmodule_js(fragment, 'HTMLEditingDescriptor')
return fragment
Expand Down
Loading

0 comments on commit f520507

Please sign in to comment.