2
0
Fork 0
Vmeda.Online/src/theme/components/format-text.scss

741 lines
22 KiB
SCSS
Raw Normal View History

2021-01-27 16:04:21 +00:00
/** Format Text - Show more styles. */
/** Styles of elements inside the directive should be placed in format-text.scss */
@import "~theme/globals";
core-format-text {
--core-format-text-background: var(--background, var(--ion-item-background));
--core-format-text-background-gradient-rgb: var(--background-rgb, #{$ion-item-background-rgb});
--core-format-text-viewer-icon-background: rgba(255, 255, 255, .5);
--core-format-text-loader-shine: 251,251,251;
}
body.dark core-format-text {
--core-format-text-background-gradient-rgb: var(--background-rgb, #{$ion-item-background-dark-rgb});
--core-format-text-viewer-icon-background: rgba(0, 0, 0, .5);
--core-format-text-loader-shine: 90,90,90;
}
2021-01-27 16:04:21 +00:00
core-format-text {
display: contents;
.core-format-text-loader {
opacity: 0;
@include core-transition(opacity, 200ms);
display: contents;
}
&.core-format-text-loading {
position: relative;
width: 100%;
height: 100%;
opacity: 1;
background-color: rgba(0,0,0,.1);
overflow: hidden;
border-radius: 5px;
display: block;
.core-format-text-loader {
position: absolute;
left: -45%;
height: 100%;
width: 45%;
background-image: -webkit-linear-gradient(to left, rgba(var(--core-format-text-loader-shine), .05), rgba(var(--core-format-text-loader-shine), .3), rgba(var(--core-format-text-loader-shine), .6), rgba(var(--core-format-text-loader-shine), .3), rgba(var(--core-format-text-loader-shine), .05));
background-image: linear-gradient(to left, rgba(var(--core-format-text-loader-shine), .05), rgba(var(--core-format-text-loader-shine), .3), rgba(var(--core-format-text-loader-shine), .6), rgba(var(--core-format-text-loader-shine), .3), rgba(var(--core-format-text-loader-shine), .05));
animation: loading 1s infinite;
opacity: 1;
display: inline;
}
.core-format-text-content {
opacity: 0;
display: inline;
}
.core-format-text-toggle {
display: none !important;
}
}
.core-format-text-toggle {
display: none;
}
.core-format-text-content {
opacity: 1;
@include core-transition(opacity, 200ms);
display: contents;
user-select: text;
word-break: break-word;
word-wrap: break-word;
}
2021-01-27 16:04:21 +00:00
&[maxHeight],
&[ng-reflect-max-height] {
display: block;
2021-01-27 16:04:21 +00:00
position: relative;
width: 100%;
overflow: hidden;
/* Force display inline */
&.inline {
display: inline-block;
width: auto;
}
// This is to allow clicks in radio/checkbox content.
&.core-text-formatted {
cursor: pointer;
pointer-events: auto;
.core-format-text-toggle {
display: block;
position: absolute;
bottom: 0;
left: 0;
right: 0;
text-align: center;
z-index: 7;
text-transform: none;
text-align: end;
font-size: 14px;
background-color: var(--core-format-text-background);
color: var(--text-color);
margin: 0;
.core-format-text-arrow {
width: var(--a11y-min-target-size);
height: var(--a11y-min-target-size);
background-position: center;
background-repeat: no-repeat;
background-size: 14px 14px;
@include core-transition(transform, 500ms);
@include push-arrow-color(626262, true);
@include darkmode() {
@include push-arrow-color(ffffff, true);
}
}
2021-01-27 16:04:21 +00:00
}
&.core-text-format-collapsed {
2021-01-27 16:04:21 +00:00
overflow: hidden;
min-height: 50px;
.core-format-text-arrow {
transform: rotate(90deg);
2021-01-27 16:04:21 +00:00
}
&:before {
content: '';
height: 100%;
position: absolute;
@include position(null, 0, 0, 0);
background: -webkit-linear-gradient(top, rgba(var(--core-format-text-background-gradient-rgb), 0) calc(100% - 60px), rgba(var(--core-format-text-background-gradient-rgb), 1) calc(100% - 40px));
background: linear-gradient(to bottom, rgba(var(--core-format-text-background-gradient-rgb), 0) calc(100% - 60px), rgba(var(--core-format-text-background-gradient-rgb), 1) calc(100% - 40px));
2021-01-27 16:04:21 +00:00
z-index: 6;
}
}
&.core-text-format-expanded {
max-height: none !important;
2021-01-27 16:04:21 +00:00
padding-bottom: 50px; // So the Show less button can fit.
.core-format-text-arrow {
transform: rotate(-90deg);
}
2021-01-27 16:04:21 +00:00
}
}
}
@if ($core-format-text-never-shorten) {
&[maxHeight],
&[ng-reflect-max-height] {
&.core-text-formatted.core-text-format-expanded {
max-height: none !important;
.core-format-text-toggle {
display: none !important;
}
&:before {
display: none !important;
}
}
}
}
.core-adapted-img-container {
position: relative;
display: inline-block;
max-width: 100%;
}
.core-image-viewer-icon {
position: absolute;
@include position(null, 10px, 10px, null);
color: var(--ion-text-color);
border-radius: 5px;
background-color: var(--core-format-text-viewer-icon-background);
display: flex;
width: var(--a11y-min-target-size);
height: var(--a11y-min-target-size);
max-width: var(--a11y-min-target-size);
font-size: 24px;
ion-icon {
flex: 1;
align-self: center;
/** Fix iOS icon size */
margin: 0 auto;
position: absolute;
left: 0;
right: 0;
}
&:hover {
opacity: .7;
}
&.hidden {
display: none;
}
}
// Disable clicks in links inside MathJax equations.
.core-format-text-content .filter_mathjaxloader_equation .MathJax_Preview a {
pointer-events: none;
}
.MathJax_SVG_Display {
overflow-x: auto;
margin: 0;
padding: 10px 0;
}
}
@keyframes loading {
0% {
left: -45%;
}
100% {
left: 100%;
}
}
/** Styles to match web platform */
// Those styles are omitted on RTE
core-format-text {
ul {
padding-left: 1rem;
-webkit-margin-start: .2rem;
}
.atto_image_button_text-top,
.atto_image_button_middle,
.atto_image_button_text-bottom,
.atto_image_button_left,
.atto_image_button_right {
height: auto;
width: auto;
&.img-responsive {
height: auto;
width: auto;
}
}
// Embed video responsive classes.
// Taken from https://github.com/twbs/bootstrap/blob/v4-dev/scss/utilities/_embed.scss
.embed-responsive {
position: relative;
display: block;
width: 100%;
padding: 0;
overflow: hidden;
&::before {
display: block;
content: "";
}
.embed-responsive-item,
iframe,
embed,
object,
video {
position: absolute;
@include position(0, null, 0, 0);
width: 100%;
height: 100%;
border: 0;
}
iframe iframe {
width: 100%;
height: 100%;
}
}
.embed-responsive-21by9 {
&::before {
padding-top: percentage(9 / 21);
}
}
.embed-responsive-16by9 {
&::before {
padding-top: percentage(9 / 16);
}
}
.embed-responsive-4by3 {
&::before {
padding-top: percentage(3 / 4);
}
}
.embed-responsive-1by1 {
&::before {
padding-top: percentage(1 / 1);
}
}
}
core-format-text .core-format-text-content,
core-rich-text-editor .core-rte-editor {
@include core-headings();
p {
margin-bottom: 1rem;
margin-block-start: 0;
}
.no-overflow {
overflow: auto;
}
// Fix lists styles in core-format-text.
ol {
list-style-type: decimal;
}
ul, ol {
ol {
list-style-type: lower-latin;
}
ul, ol {
@include margin(null, null, null, 15px);
}
}
sub, sup {
overflow: visible !important;
}
.badge {
position: initial !important;
}
.core-disable-media-adapt,
.core-disable-media-adapt .core-media-adapt-width {
max-width: none !important;
max-height: none !important;
width: initial !important;
height: initial !important;
display: inline-block !important;
}
img.icon {
font-size: 16px;
width: 16px;
height: 16px;
margin: 0;
padding: 0;
-webkit-box-sizing: content-box;
box-sizing: content-box;
margin-right: .5rem;
}
// Form controls
// ------------------------
select,
input:not([type=checkbox]):not([type=radio]):not([type=hidden]) {
height: 30px;
display: inline-block;
border: 1px solid var(--gray-dark);
background: var(--contrast-background);
padding: 6px 8px;
border-radius: 4px;
margin-left: 2px;
margin-right: 2px;
margin-bottom: 10px;
}
select {
background-color: var(--contrast-background);
background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23000000%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E');
background-repeat: no-repeat, repeat;
background-position: right .7em top 50%, 0 0;
background-size: .65em auto, 100%;
padding-right: 24px;
appearance: none;
-webkit-appearance: none;
}
input[type=radio],
input[type=checkbox] {
position: relative;
--color: var(--text-color);
--color-checked: var(--color);
width: var(--size);
height: var(--size);
border-radius: var(--border-radius);
border-width: var(--outer-border-width);
border-style: var(--border-style);
border-color: var(--color);
appearance: none;
display: inline-block;
margin-left: 2px;
margin-right: 2px;
margin-top: 2px;
&:checked {
background-color: var(--color-checked);
}
& + label {
line-height: var(--size);
}
}
input[type=radio]::after {
position: absolute;
content: ' ';
width: calc(50% + var(--outer-border-width));
height: calc(50% + var(--outer-border-width));
border-radius: var(--border-radius);
transform: scale3d(0, 0, 0) translate(-50%,-50%);
background: var(--contrast-background);
border: 0 !important;
top: 50%;
left: 50%;
}
input[type=radio]:checked::after {
transform: scale3d(1, 1, 1) translate(-50%,-50%);
}
input[type=checkbox]:checked::after {
position: absolute;
width: 33%;
height: 50%;
content: ' ';
transform: rotate(45deg);
border-width: 0px 2px 2px 0px;
border-style: solid;
border-color: var(--contrast-background);
left: 4px;
top: 2px;
}
// Atto styles
// -------------------------
.atto_image_preview {
width: 100%;
height: 100%;
margin-left: auto;
margin-right: auto;
}
.atto_image_preview_box {
max-height: 200px;
margin-bottom: 1em;
overflow: auto;
}
.editor_atto_content img {
cursor: pointer;
}
.atto_image_size {
display: inline-block;
}
.atto_image_size input[type=checkbox] {
@include margin(null, 1em, null, 1em);
}
.atto_image_size input[type=text] {
width: 3em;
}
.atto_image_size label {
display: inline-block;
}
.atto_image_button_text-top,
.atto_image_button_middle,
.atto_image_button_text-bottom,
.atto_image_button_left,
.atto_image_button_right {
vertical-align: middle;
max-width: 100%;
display: inline-block;
margin: 0 0.5em;
&.img-responsive {
/* If the image is display: block then linking the image to URLs won't work. */
/*display: inline-block;*/
max-width: 100%;
}
}
.atto_image_button_text-top {
vertical-align: text-top;
}
.atto_image_button_middle {
vertical-align: middle;
}
.atto_image_button_text-bottom {
vertical-align: text-bottom;
}
.atto_image_button_left {
@include float(start);
@include margin(0, 0.5em, 0, 0);
}
.atto_image_button_right {
@include float(end);
@include margin(0, 0, 0, 0.5em);
}
// Bootstrap 4 Styles
// -------------------------
// _media.scss
.media {
display: flex;
align-items: flex-start;
}
.media-body {
flex: 1;
}
// _alert.scss
.alert {
position: relative;
padding: .75rem 1.25rem;
margin-bottom: 1rem;
border: 0 solid transparent;
}
// Headings for larger alerts
.alert-heading {
// Specified to prevent conflicts of changing headings-color
color: inherit;
}
// Provide class for links that match alerts
.alert-link {
font-weight: 400;
}
@each $color-name, $base in $colors {
.alert-#{$color-name} {
--color-base: var(--ion-color-#{$color-name});
color: var(--color-base);
border-color: var(--color-base);
background-color: var(--ion-color-#{$color-name}-lighter);
.alert-link {
color: var(--ion-color-#{$color-name}-shade);
}
}
.alert-#{$color-name} p {
color: var(--color-base);
}
}
// utilities/_align.scss
.align-baseline { vertical-align: baseline !important; } // Browser default
.align-top { vertical-align: top !important; }
.align-middle { vertical-align: middle !important; }
.align-bottom { vertical-align: bottom !important; }
.align-text-bottom { vertical-align: text-bottom !important; }
.align-text-top { vertical-align: text-top !important; }
// utilities/_border.scss
.border { border: 1px solid var(--gray-dark) !important; }
.border-top { border-top: 1px solid var(--gray-dark) !important; }
.border-right { border-right: 1px solid var(--gray-dark) !important; }
.border-bottom { border-bottom: 1px solid var(--gray-dark) !important; }
.border-left { border-left: 1px solid var(--gray-dark) !important; }
.border-0 { border: 0 !important; }
.border-top-0 { border-top: 0 !important; }
.border-right-0 { border-right: 0 !important; }
.border-bottom-0 { border-bottom: 0 !important; }
.border-left-0 { border-left: 0 !important; }
@each $color-name, $base in $colors {
.border-#{$color-name} {
border-color: var(--ion-color-#{$color-name}) !important;
}
}
.border-white {
border-color: var(--white) !important;
}
// utilities/_flex.scss
.flex-row { flex-direction: row !important; }
.flex-column { flex-direction: column !important; }
.flex-row-reverse { flex-direction: row-reverse !important; }
.flex-column-reverse { flex-direction: column-reverse !important; }
.flex-wrap { flex-wrap: wrap !important; }
.flex-nowrap { flex-wrap: nowrap !important; }
.flex-wrap-reverse { flex-wrap: wrap-reverse !important; }
.flex-fill { flex: 1 1 auto !important; }
.flex-grow-0 { flex-grow: 0 !important; }
.flex-grow-1 { flex-grow: 1 !important; }
.flex-shrink-0 { flex-shrink: 0 !important; }
.flex-shrink-1 { flex-shrink: 1 !important; }
.justify-content-start { justify-content: flex-start !important; }
.justify-content-end { justify-content: flex-end !important; }
.justify-content-center { justify-content: center !important; }
.justify-content-between { justify-content: space-between !important; }
.justify-content-around { justify-content: space-around !important; }
.align-items-start { align-items: flex-start !important; }
.align-items-end { align-items: flex-end !important; }
.align-items-center { align-items: center !important; }
.align-items-baseline { align-items: baseline !important; }
.align-items-stretch { align-items: stretch !important; }
.align-content-start { align-content: flex-start !important; }
.align-content-end { align-content: flex-end !important; }
.align-content-center { align-content: center !important; }
.align-content-between { align-content: space-between !important; }
.align-content-around { align-content: space-around !important; }
.align-content-stretch { align-content: stretch !important; }
.align-self-auto { align-self: auto !important; }
.align-self-start { align-self: flex-start !important; }
.align-self-end { align-self: flex-end !important; }
.align-self-center { align-self: center !important; }
.align-self-baseline { align-self: baseline !important; }
.align-self-stretch { align-self: stretch !important; }
// utilities/_visibility.scss
.visible {
visibility: visible !important;
}
.invisible {
visibility: hidden !important;
}
// utilities/_text.scss
.text-monospace { font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace !important; }
.text-justify { text-align: justify !important; }
.text-wrap { white-space: normal !important; }
.text-nowrap { white-space: nowrap !important; }
.text-truncate {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.text-left { text-align: left !important; }
.text-right { text-align: right !important; }
.text-center { text-align: center !important; }
.text-lowercase { text-transform: lowercase !important; }
.text-uppercase { text-transform: uppercase !important; }
.text-capitalize { text-transform: capitalize !important; }
.font-weight-light { font-weight: 300 !important; }
.font-weight-lighter { font-weight: lighter !important; }
.font-weight-normal { font-weight: 400 !important; }
.font-weight-bold { font-weight: 700 !important; }
.font-weight-bolder { font-weight: bolder !important; }
.font-italic { font-style: italic !important; }
.text-white { color: var(--white) !important; }
@each $color-name, $base in $colors {
.text-#{$color-name} {
color: var(--ion-color-#{$color-name});
}
}
.text-body { color: var(--ion-text-color) !important; }
.text-muted { color: var(--subdued-text-color) !important; }
.text-black-50 { color: rgba(0, 0, 0, .5) !important; }
.text-white-50 { color: rgba(255, 255, 255, .5) !important; }
.text-decoration-none { text-decoration: none !important; }
.text-break {
word-break: break-word !important; // Deprecated, but avoids issues with flex containers
word-wrap: break-word !important; // Used instead of `overflow-wrap` for IE & Edge Legacy
}
.text-reset { color: inherit !important; }
.label {
display: inline-block;
padding: .25em .4em;
font-size: 75%;
font-weight: 700;
line-height: 1;
text-align: center;
white-space: nowrap;
vertical-align: baseline;
transition: color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out;
color: var(--white);
background-color: var(--gray-darker);
}
.label-important {
color: var(--ion-color-danger-contrast);
background-color: var(--ion-color-danger);
}
@each $color-name, $base in $colors {
.label-#{$color-name} {
color: var(--ion-color-#{$color-name}-contrast);
background-color: var(--ion-color-#{$color-name});
}
}
}
// h1 is too big and ugly, reduce size when loading.
ion-header.ios h1 core-format-text {
&.core-format-text-loading {
max-height: 30px;
margin-top: 10px;
}
&.core-format-text-content {
display: block;
margin-top: -10px;
}
}
body.dark core-format-text select,
body.dark core-rich-text-editor .core-rte-editor select {
background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23FFFFFF%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E');
}