2022-07-25 02:33:09 +00:00
|
|
|
|
$draftail-editor-text: $color-input-text;
|
2023-01-17 17:21:45 +00:00
|
|
|
|
$draftail-placeholder-text: theme('colors.grey.400');
|
2022-08-08 07:40:50 +00:00
|
|
|
|
// w-body-text-large
|
|
|
|
|
|
$draftail-editor-font-size: theme('fontSize.18');
|
|
|
|
|
|
$draftail-editor-line-height: theme('lineHeight.normal');
|
|
|
|
|
|
|
2022-07-13 00:35:22 +00:00
|
|
|
|
$draftail-editor-chrome: theme('colors.primary.DEFAULT');
|
|
|
|
|
|
$draftail-editor-chrome-text: $color-white;
|
2022-07-09 06:32:51 +00:00
|
|
|
|
// This needs to remain a Sass value due to a limitation in Draftail.
|
|
|
|
|
|
// $draftail-editor-chrome-active: $color-white;
|
|
|
|
|
|
$draftail-editor-chrome-active: #fff;
|
2020-01-25 00:05:27 +00:00
|
|
|
|
$draftail-editor-chrome-accent: transparent;
|
2018-01-15 03:35:34 +00:00
|
|
|
|
|
2022-07-13 00:35:22 +00:00
|
|
|
|
$draftail-base-spacing: 0.375rem;
|
2022-07-25 02:33:09 +00:00
|
|
|
|
$draftail-editor-radius: 0;
|
2018-01-15 03:35:34 +00:00
|
|
|
|
$draftail-editor-border: 0;
|
2022-08-08 07:40:50 +00:00
|
|
|
|
$draftail-editor-padding: theme('spacing.[2.5]') theme('spacing.5');
|
2022-07-13 00:35:22 +00:00
|
|
|
|
$draftail-editor-background: $color-white;
|
2022-08-08 07:40:50 +00:00
|
|
|
|
$draftail-block-spacing: theme('spacing.[2.5]');
|
2022-07-25 02:33:09 +00:00
|
|
|
|
$draftail-toolbar-radius: theme('borderRadius.DEFAULT');
|
2018-04-11 08:35:03 +00:00
|
|
|
|
$draftail-toolbar-icon-size: 1em;
|
2018-01-15 03:35:34 +00:00
|
|
|
|
|
2022-08-18 21:03:37 +00:00
|
|
|
|
$draftail-trigger-additional-size: 30px;
|
|
|
|
|
|
$draftail-block-hoverable-area-offset: 40px;
|
|
|
|
|
|
|
2021-12-23 04:21:23 +00:00
|
|
|
|
$draftail-editor-font-family: $font-sans;
|
2018-01-10 23:38:18 +00:00
|
|
|
|
|
2018-01-10 21:47:49 +00:00
|
|
|
|
@import '../../../../node_modules/draft-js/dist/Draft';
|
2022-07-06 07:04:29 +00:00
|
|
|
|
@import '../../../../node_modules/draftail/src/index';
|
2018-01-10 23:38:18 +00:00
|
|
|
|
|
|
|
|
|
|
@import './Tooltip/Tooltip';
|
2021-04-07 09:26:50 +00:00
|
|
|
|
@import './CommentableEditor/CommentableEditor';
|
2018-02-27 15:34:22 +00:00
|
|
|
|
@import './EditorFallback/EditorFallback';
|
2018-01-10 23:38:18 +00:00
|
|
|
|
|
|
|
|
|
|
@import './decorators/TooltipEntity';
|
|
|
|
|
|
|
|
|
|
|
|
@import './blocks/MediaBlock';
|
|
|
|
|
|
@import './blocks/ImageBlock';
|
|
|
|
|
|
@import './blocks/EmbedBlock';
|
2017-12-05 17:49:17 +00:00
|
|
|
|
|
2018-01-17 08:43:23 +00:00
|
|
|
|
@include draftail-richtext-styles {
|
2022-02-04 11:57:55 +00:00
|
|
|
|
h1,
|
|
|
|
|
|
h2,
|
|
|
|
|
|
h3,
|
|
|
|
|
|
h4,
|
|
|
|
|
|
h5,
|
|
|
|
|
|
h6 {
|
2022-07-25 02:33:09 +00:00
|
|
|
|
// Overrides for heading styles of Wagtail itself.
|
|
|
|
|
|
color: inherit;
|
2022-09-14 12:58:43 +00:00
|
|
|
|
line-height: theme('lineHeight.tight');
|
|
|
|
|
|
font-weight: theme('fontWeight.bold');
|
2022-02-04 11:57:55 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
h1 {
|
2022-09-14 12:58:43 +00:00
|
|
|
|
font-size: theme('fontSize.30');
|
2022-02-04 11:57:55 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
h2 {
|
2022-09-14 12:58:43 +00:00
|
|
|
|
font-size: theme('fontSize.24');
|
2022-02-04 11:57:55 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
h3 {
|
2022-09-14 12:58:43 +00:00
|
|
|
|
font-size: theme('fontSize.22');
|
2022-02-04 11:57:55 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
h4 {
|
2022-09-14 12:58:43 +00:00
|
|
|
|
font-size: theme('fontSize.18');
|
2022-02-04 11:57:55 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
h5 {
|
2022-09-14 12:58:43 +00:00
|
|
|
|
font-size: theme('fontSize.16');
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
h6 {
|
|
|
|
|
|
font-size: theme('fontSize.14');
|
2022-02-04 11:57:55 +00:00
|
|
|
|
}
|
2017-12-05 17:49:17 +00:00
|
|
|
|
}
|
2018-01-18 09:59:08 +00:00
|
|
|
|
|
2022-08-08 07:56:30 +00:00
|
|
|
|
.Draftail-Editor {
|
2023-01-17 17:21:45 +00:00
|
|
|
|
@include input-base();
|
2022-12-08 13:44:09 +00:00
|
|
|
|
// Number used inside a `calc` function, which doesn’t support unitless zero.
|
|
|
|
|
|
// stylelint-disable-next-line length-zero-no-unit
|
|
|
|
|
|
--draftail-offset-inline-start: 0px;
|
2023-01-17 17:21:45 +00:00
|
|
|
|
|
|
|
|
|
|
&--focus {
|
|
|
|
|
|
outline: $focus-outline-width solid $color-focus-outline;
|
|
|
|
|
|
}
|
2022-08-08 07:56:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2022-07-25 02:33:09 +00:00
|
|
|
|
.Draftail-Editor__wrapper {
|
|
|
|
|
|
// Ensure elements within the editor are positioned according to this container.
|
|
|
|
|
|
position: relative;
|
2022-07-25 14:20:19 +00:00
|
|
|
|
// Make fields take up the whole available width in their container.
|
|
|
|
|
|
width: 100%;
|
2018-01-18 12:43:15 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2020-01-25 00:05:27 +00:00
|
|
|
|
.Draftail-Toolbar {
|
2023-01-17 17:21:45 +00:00
|
|
|
|
border-width: 0;
|
|
|
|
|
|
// Remove once we drop support for Safari 14.
|
|
|
|
|
|
// stylelint-disable-next-line property-disallowed-list
|
|
|
|
|
|
border-bottom-left-radius: 0;
|
|
|
|
|
|
border-end-start-radius: 0;
|
|
|
|
|
|
// Remove once we drop support for Safari 14.
|
|
|
|
|
|
// stylelint-disable-next-line property-disallowed-list
|
|
|
|
|
|
border-bottom-right-radius: 0;
|
|
|
|
|
|
border-end-end-radius: 0;
|
|
|
|
|
|
background-color: $draftail-editor-background;
|
|
|
|
|
|
color: $draftail-placeholder-text;
|
|
|
|
|
|
|
|
|
|
|
|
.Draftail-Editor--focus & {
|
|
|
|
|
|
color: $draftail-editor-text;
|
|
|
|
|
|
top: calc(theme('spacing.slim-header') * 2);
|
|
|
|
|
|
|
|
|
|
|
|
@include media-breakpoint-up(sm) {
|
|
|
|
|
|
top: theme('spacing.slim-header');
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2020-01-25 00:05:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2022-07-13 00:35:22 +00:00
|
|
|
|
.Draftail-MetaToolbar {
|
2022-07-25 02:33:09 +00:00
|
|
|
|
position: absolute;
|
|
|
|
|
|
inset-inline-end: 0;
|
|
|
|
|
|
visibility: hidden;
|
2023-01-17 17:21:45 +00:00
|
|
|
|
background-color: transparent;
|
|
|
|
|
|
|
|
|
|
|
|
&:empty {
|
|
|
|
|
|
display: none;
|
|
|
|
|
|
}
|
2022-08-01 15:38:49 +00:00
|
|
|
|
|
|
|
|
|
|
// Make sure the toolbar is always visible for devices that do not hover.
|
|
|
|
|
|
@media (hover: hover) {
|
|
|
|
|
|
visibility: hidden;
|
2022-07-13 00:35:22 +00:00
|
|
|
|
|
2022-08-01 15:38:49 +00:00
|
|
|
|
.Draftail-Editor:focus-within &,
|
|
|
|
|
|
.Draftail-Editor:hover & {
|
|
|
|
|
|
visibility: visible;
|
|
|
|
|
|
}
|
2022-07-13 00:35:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-08-08 07:56:30 +00:00
|
|
|
|
.Draftail-BlockToolbar {
|
2022-08-18 21:03:37 +00:00
|
|
|
|
position: absolute;
|
|
|
|
|
|
background: transparent;
|
|
|
|
|
|
// Adds additional hoverable area so block trigger will be shown when hovering to the side of the field.
|
|
|
|
|
|
width: $draftail-block-hoverable-area-offset;
|
|
|
|
|
|
inset-inline-start: -$draftail-block-hoverable-area-offset;
|
|
|
|
|
|
top: 0;
|
|
|
|
|
|
height: 100%;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
justify-content: center;
|
2022-08-08 07:56:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.Draftail-BlockToolbar__trigger {
|
|
|
|
|
|
color: theme('colors.secondary.DEFAULT');
|
|
|
|
|
|
width: theme('spacing.4');
|
|
|
|
|
|
height: theme('spacing.4');
|
2023-01-18 10:57:58 +00:00
|
|
|
|
margin-inline-end: 1px;
|
2022-08-08 07:56:30 +00:00
|
|
|
|
|
|
|
|
|
|
@include media-breakpoint-up(sm) {
|
|
|
|
|
|
width: theme('spacing.5');
|
|
|
|
|
|
height: theme('spacing.5');
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-08-18 21:03:37 +00:00
|
|
|
|
// Increase the hoverable area of the trigger button
|
|
|
|
|
|
&::before {
|
|
|
|
|
|
content: '';
|
|
|
|
|
|
background: transparent;
|
|
|
|
|
|
display: block;
|
|
|
|
|
|
position: absolute;
|
2023-01-19 12:06:43 +00:00
|
|
|
|
transform: translate(calc(var(--w-direction-factor) * -50%), -50%);
|
2022-08-18 21:03:37 +00:00
|
|
|
|
inset-inline-start: 50%;
|
|
|
|
|
|
top: 50%;
|
|
|
|
|
|
width: $draftail-trigger-additional-size;
|
|
|
|
|
|
height: $draftail-trigger-additional-size;
|
|
|
|
|
|
border-radius: theme('borderRadius.DEFAULT');
|
|
|
|
|
|
z-index: 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-08-08 07:56:30 +00:00
|
|
|
|
// Hide the trigger unless the editor is hovered, focused, or an element within it is focused.
|
|
|
|
|
|
.Draftail-Editor:not(:hover, .Draftail-Editor--focus, :focus-within) & {
|
|
|
|
|
|
// Hide even if the conditions to display it are met.
|
|
|
|
|
|
// stylelint-disable-next-line declaration-no-important
|
|
|
|
|
|
visibility: hidden !important;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-08-12 12:17:40 +00:00
|
|
|
|
&:hover,
|
|
|
|
|
|
&:focus-visible {
|
|
|
|
|
|
color: $color-white;
|
|
|
|
|
|
background-color: $color-teal;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-08-08 07:56:30 +00:00
|
|
|
|
.icon {
|
2023-01-18 10:00:31 +00:00
|
|
|
|
transition: transform 0.3s ease;
|
2022-08-08 07:56:30 +00:00
|
|
|
|
width: theme('spacing.3');
|
|
|
|
|
|
height: theme('spacing.3');
|
|
|
|
|
|
}
|
2023-01-18 10:00:31 +00:00
|
|
|
|
|
|
|
|
|
|
&[aria-expanded='true'] .icon {
|
|
|
|
|
|
transform: rotate(45deg);
|
|
|
|
|
|
}
|
2022-08-08 07:56:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2022-07-13 00:35:22 +00:00
|
|
|
|
.Draftail-ToolbarGroup::before {
|
|
|
|
|
|
display: none;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-07-28 14:53:01 +00:00
|
|
|
|
.Draftail-ToolbarButton {
|
2022-07-13 00:35:22 +00:00
|
|
|
|
height: 1.875rem;
|
|
|
|
|
|
min-width: 1.875rem;
|
|
|
|
|
|
padding: 0;
|
|
|
|
|
|
margin-inline-end: 0.625rem;
|
|
|
|
|
|
|
|
|
|
|
|
.Draftail-ToolbarGroup:last-of-type &:last-of-type {
|
|
|
|
|
|
margin-inline-end: 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-04-11 15:40:06 +00:00
|
|
|
|
&[disabled] {
|
|
|
|
|
|
opacity: 0.3;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-02-04 11:57:55 +00:00
|
|
|
|
&:hover,
|
|
|
|
|
|
&:active {
|
|
|
|
|
|
border: 1px solid $color-grey-3;
|
|
|
|
|
|
}
|
2023-03-31 03:46:34 +00:00
|
|
|
|
|
|
|
|
|
|
.icon {
|
|
|
|
|
|
width: $draftail-toolbar-icon-size;
|
|
|
|
|
|
height: $draftail-toolbar-icon-size;
|
|
|
|
|
|
vertical-align: middle;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.icon-h1,
|
|
|
|
|
|
.icon-h2,
|
|
|
|
|
|
.icon-h3,
|
|
|
|
|
|
.icon-h4,
|
|
|
|
|
|
.icon-h5,
|
|
|
|
|
|
.icon-h6 {
|
|
|
|
|
|
width: 1.25 * $draftail-toolbar-icon-size;
|
|
|
|
|
|
height: 1.25 * $draftail-toolbar-icon-size;
|
|
|
|
|
|
}
|
2020-07-28 14:53:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2023-01-17 17:21:45 +00:00
|
|
|
|
.Draftail-ToolbarButton--pin {
|
|
|
|
|
|
min-width: theme('spacing.6');
|
|
|
|
|
|
height: theme('spacing.6');
|
|
|
|
|
|
border: 1px solid theme('colors.primary.DEFAULT');
|
|
|
|
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
|
|
border-color: theme('colors.primary.DEFAULT');
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.Draftail-Toolbar & {
|
|
|
|
|
|
border-color: $color-input-border;
|
|
|
|
|
|
background-color: theme('colors.grey.50');
|
|
|
|
|
|
border-top-width: 0;
|
|
|
|
|
|
border-inline-end-width: 0;
|
|
|
|
|
|
|
|
|
|
|
|
.Draftail-Editor:hover & {
|
|
|
|
|
|
border-color: $color-input-hover-border;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2018-01-18 12:43:15 +00:00
|
|
|
|
}
|
2019-03-15 00:39:18 +00:00
|
|
|
|
|
|
|
|
|
|
.Draftail-block--blockquote {
|
2022-03-15 13:21:06 +00:00
|
|
|
|
border-inline-start: 0.25em solid $color-grey-3;
|
2022-02-04 11:57:55 +00:00
|
|
|
|
color: $color-grey-2;
|
|
|
|
|
|
margin: 1em 0;
|
|
|
|
|
|
padding: 1em 2em;
|
2019-03-15 00:39:18 +00:00
|
|
|
|
}
|
2022-07-25 02:33:09 +00:00
|
|
|
|
|
|
|
|
|
|
.DraftEditor-editorContainer {
|
|
|
|
|
|
border: 0;
|
|
|
|
|
|
}
|