(core) Support bare links in Markdown cells

Summary:
Also tweaks the bottom margin of a few Markdown
element types when they are the last element in a
cell, and fixes an alignment issue with list items
containing paragraphs.

Test Plan: Browser and manual tests.

Reviewers: jarek

Reviewed By: jarek

Subscribers: jarek

Differential Revision: https://phab.getgrist.com/D4334
This commit is contained in:
George Gevoian
2024-08-31 22:00:18 -04:00
parent 80f8168cab
commit 5e4140fcae
3 changed files with 31 additions and 8 deletions

View File

@@ -9,6 +9,7 @@ import { NTextBox } from 'app/client/widgets/NTextBox';
import { dom, styled, subscribeBindable } from 'grainjs';
import { Marked } from 'marked';
import { markedHighlight } from 'marked-highlight';
import markedLinkifyIt from 'marked-linkify-it';
/**
* Creates a widget for displaying Markdown-formatted text.
@@ -27,7 +28,8 @@ export class MarkdownTextBox extends NTextBox {
const highlightCode = await highlightCodePromise;
return highlightCode(code);
},
})
}),
markedLinkifyIt(),
);
}
@@ -71,7 +73,7 @@ const cssFieldClip = styled('div.field_clip', `
& > *:first-child {
margin-top: 0px !important;
}
& > *:last-child {
& > :not(blockquote, ol, pre, ul):last-child {
margin-bottom: 0px !important;
}
& h1, & h2, & h3, & h4, & h5, & h6 {
@@ -156,16 +158,11 @@ const cssFieldClip = styled('div.field_clip', `
white-space: nowrap;
}
& ul, & ol {
list-style-position: inside;
padding-left: 1em;
padding-left: 2em;
}
& li > ol, & li > ul {
margin: 0;
}
&:not(&-text-wrap) li {
overflow: hidden;
text-overflow: ellipsis;
}
& li + li,
& li > ol > li:first-child,
& li > ul > li:first-child {