diff --git a/res/css/views/rooms/_EventTile.pcss b/res/css/views/rooms/_EventTile.pcss index 9fa9ace1076..5d55e8bf34a 100644 --- a/res/css/views/rooms/_EventTile.pcss +++ b/res/css/views/rooms/_EventTile.pcss @@ -548,7 +548,7 @@ $left-gutter: 64px; pre, code { font-family: $monospace-font-family !important; - background-color: $codeblock-background-color; + background-color: $system; } code:not(pre *) { @@ -578,6 +578,8 @@ $left-gutter: 64px; background: transparent; } + border: 1px solid $quinary-content; + code { white-space: pre; /* we want code blocks to be scrollable and not wrap */ @@ -756,6 +758,8 @@ $left-gutter: 64px; .mx_EventTile_collapsedCodeBlock { max-height: 30vh; + padding-top: $spacing-12; + padding-bottom: $spacing-12; } /* Inserted adjacent to
blocks, (See TextualBody) */ diff --git a/res/css/views/rooms/wysiwyg_composer/components/_Editor.pcss b/res/css/views/rooms/wysiwyg_composer/components/_Editor.pcss index dcebf80a241..21db71a774b 100644 --- a/res/css/views/rooms/wysiwyg_composer/components/_Editor.pcss +++ b/res/css/views/rooms/wysiwyg_composer/components/_Editor.pcss @@ -46,10 +46,23 @@ limitations under the License. // model output always includes a linebreak but we do not want the user // to see it when writing input in lists - :is(ol, ul) + br:last-of-type { + :is(ol, ul, pre) + br:last-of-type { display: none; } + > pre { + font-size: $font-15px; + line-height: $font-24px; + + margin-top: 0; + margin-bottom: 0; + padding: $spacing-8 $spacing-12; + + background-color: $inlinecode-background-color; + border: 1px solid $inlinecode-border-color; + border-radius: 2px; + } + code { font-family: $monospace-font-family !important; background-color: $inlinecode-background-color; diff --git a/res/img/element-icons/room/composer/code_block.svg b/res/img/element-icons/room/composer/code_block.svg new file mode 100644 index 00000000000..dd0be2aefc6 --- /dev/null +++ b/res/img/element-icons/room/composer/code_block.svg @@ -0,0 +1,3 @@ + diff --git a/src/components/views/rooms/wysiwyg_composer/components/FormattingButtons.tsx b/src/components/views/rooms/wysiwyg_composer/components/FormattingButtons.tsx index 11c797d646d..c80857b9f16 100644 --- a/src/components/views/rooms/wysiwyg_composer/components/FormattingButtons.tsx +++ b/src/components/views/rooms/wysiwyg_composer/components/FormattingButtons.tsx @@ -26,6 +26,7 @@ import { Icon as InlineCodeIcon } from "../../../../../../res/img/element-icons/ import { Icon as LinkIcon } from "../../../../../../res/img/element-icons/room/composer/link.svg"; import { Icon as BulletedListIcon } from "../../../../../../res/img/element-icons/room/composer/bulleted_list.svg"; import { Icon as NumberedListIcon } from "../../../../../../res/img/element-icons/room/composer/numbered_list.svg"; +import { Icon as CodeBlockIcon } from "../../../../../../res/img/element-icons/room/composer/code_block.svg"; import AccessibleTooltipButton from "../../../elements/AccessibleTooltipButton"; import { Alignment } from "../../../elements/Tooltip"; import { KeyboardShortcut } from "../../../settings/KeyboardShortcut"; @@ -132,6 +133,12 @@ export function FormattingButtons({ composer, actionStates }: FormattingButtonsP onClick={() => composer.inlineCode()} icon={} /> +