mirror of
https://github.com/ilyakooo0/urbit.git
synced 2025-01-01 19:46:36 +03:00
groups: add graph-url block below plain URL block
this commit suggests a possible UI to put back the rich embed URL right below (aka in context) the block where the plain URL has been inserted. in this way when pasting a URL the formatting does not break and yet a richer UI is still rendered.
This commit is contained in:
parent
96482ca99c
commit
dedacabb53
@ -271,7 +271,7 @@ function stitchInlineAfterBlock(a: Root, b: GraphMentionNode[]) {
|
||||
}
|
||||
|
||||
function stitchAsts(asts: [StitchMode, GraphAstNode][]) {
|
||||
return _.reduce(
|
||||
const t = _.reduce(
|
||||
asts,
|
||||
([prevMode, ast], [mode, val]): [StitchMode, GraphAstNode] => {
|
||||
if (prevMode === 'block' || prevMode === 'inline') {
|
||||
@ -298,6 +298,29 @@ function stitchAsts(asts: [StitchMode, GraphAstNode][]) {
|
||||
},
|
||||
['block', { type: 'root', children: [] }] as [StitchMode, GraphAstNode]
|
||||
);
|
||||
|
||||
t[1].children.map(c => {
|
||||
if (c?.children) {
|
||||
let links = [];
|
||||
c.children.filter(k => {
|
||||
if (k.type === 'link') {
|
||||
links.push({
|
||||
type: 'root',
|
||||
children: [
|
||||
{
|
||||
type: 'graph-url',
|
||||
url: k.url
|
||||
}
|
||||
]
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
c.children.push(...links);
|
||||
}
|
||||
});
|
||||
|
||||
return t
|
||||
}
|
||||
const header = ({ children, depth, ...rest }) => {
|
||||
const level = depth;
|
||||
|
Loading…
Reference in New Issue
Block a user