Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 39f5fc0

Browse files
authored
Paragraph integration for rich text editor (#10008)
* integrates paragraph refactor in rich text editor * minor CSS changes to accomodate this * bumps rich text editor version to 0.22.0
1 parent 43c67ce commit 39f5fc0

File tree

4 files changed

+21
-13
lines changed

4 files changed

+21
-13
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
"dependencies": {
5858
"@babel/runtime": "^7.12.5",
5959
"@matrix-org/analytics-events": "^0.4.0",
60-
"@matrix-org/matrix-wysiwyg": "^0.20.0",
60+
"@matrix-org/matrix-wysiwyg": "^0.22.0",
6161
"@matrix-org/react-sdk-module-api": "^0.0.3",
6262
"@sentry/browser": "^7.0.0",
6363
"@sentry/tracing": "^7.0.0",

res/css/views/rooms/_EventTile.pcss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -639,8 +639,8 @@ $left-gutter: 64px;
639639
list-style-type: disc;
640640
}
641641

642-
/* Remove top and bottom margin for better consecutive list display */
643-
> :is(ol, ul) {
642+
/* Remove top and bottom margin for better display in rich text editor output */
643+
:is(p, ol, ul) {
644644
margin-top: 0;
645645
margin-bottom: 0;
646646
}

res/css/views/rooms/wysiwyg_composer/components/_Editor.pcss

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,20 @@ limitations under the License.
3737
user-select: all;
3838
}
3939

40+
// we always have a <br/> tag at the end of the html, we need it to be present at first then hide it as soon as
41+
// we have any other elements
42+
br:not(:only-child) {
43+
display: none;
44+
}
45+
46+
p {
47+
margin-top: 0;
48+
margin-bottom: 0;
49+
// this may seem redundant, but we need to handle zero content formatting tags, which occur when we split a
50+
// formatting tag into paragraphs
51+
min-height: $font-22px;
52+
}
53+
4054
ul,
4155
ol {
4256
margin-top: 0;
@@ -56,12 +70,6 @@ limitations under the License.
5670
margin-inline-end: 0;
5771
}
5872

59-
// model output always includes a linebreak but we do not want the user
60-
// to see it when writing input in lists
61-
:is(ol, ul, pre, blockquote) + br:last-of-type {
62-
display: none;
63-
}
64-
6573
> pre {
6674
font-size: $font-15px;
6775
line-height: $font-24px;

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1589,10 +1589,10 @@
15891589
resolved "https://registry.yarnpkg.com/@matrix-org/matrix-sdk-crypto-js/-/matrix-sdk-crypto-js-0.1.0-alpha.2.tgz#a09d0fea858e817da971a3c9f904632ef7b49eb6"
15901590
integrity sha512-oVkBCh9YP7H9i4gAoQbZzswniczfo/aIptNa4dxRi4Ff9lSvUCFv6Hvzi7C+90c0/PWZLXjIDTIAWZYmwyd2fA==
15911591

1592-
"@matrix-org/matrix-wysiwyg@^0.20.0":
1593-
version "0.20.0"
1594-
resolved "https://registry.yarnpkg.com/@matrix-org/matrix-wysiwyg/-/matrix-wysiwyg-0.20.0.tgz#6193f790b031eaa96e944b647fe2b27018639d57"
1595-
integrity sha512-9VqzyccwizglssShi/M+tCxdZDgzsecH4WjlS0HC5KkLmljIxxlHFstf/D3C/G4ZfRodFUh6wUvd+oQI/ScPpw==
1592+
"@matrix-org/matrix-wysiwyg@^0.22.0":
1593+
version "0.22.0"
1594+
resolved "https://registry.yarnpkg.com/@matrix-org/matrix-wysiwyg/-/matrix-wysiwyg-0.22.0.tgz#53f1e80d9ae7be0940e0ca905a3952804b029b29"
1595+
integrity sha512-3b5jGMI56zcqZ2PktrSPMAbzfWmkdupuzcLeemWQ0fT8QuiG4dA72NUxdDyarlz+1eQ+Qm4fu9j/zsPlvNpy8g==
15961596

15971597
"@matrix-org/olm@https://gitlab.matrix.org/api/v4/projects/27/packages/npm/@matrix-org/olm/-/@matrix-org/olm-3.2.14.tgz":
15981598
version "3.2.14"

0 commit comments

Comments
 (0)