mirror of
https://github.com/vector-im/element-web.git
synced 2024-11-17 05:55:00 +08:00
Merge pull request #3379 from matrix-org/bwindels/cider-deserialize-headers
Message editing: deserialize headers from html back to markdown
This commit is contained in:
commit
6a0842d1ab
@ -71,8 +71,20 @@ function parseCodeBlock(n, partCreator) {
|
|||||||
return parts;
|
return parts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function parseHeader(el, partCreator) {
|
||||||
|
const depth = parseInt(el.nodeName.substr(1), 10);
|
||||||
|
return partCreator.plain("#".repeat(depth) + " ");
|
||||||
|
}
|
||||||
|
|
||||||
function parseElement(n, partCreator, state) {
|
function parseElement(n, partCreator, state) {
|
||||||
switch (n.nodeName) {
|
switch (n.nodeName) {
|
||||||
|
case "H1":
|
||||||
|
case "H2":
|
||||||
|
case "H3":
|
||||||
|
case "H4":
|
||||||
|
case "H5":
|
||||||
|
case "H6":
|
||||||
|
return parseHeader(n, partCreator);
|
||||||
case "A":
|
case "A":
|
||||||
return parseLink(n, partCreator);
|
return parseLink(n, partCreator);
|
||||||
case "BR":
|
case "BR":
|
||||||
|
Loading…
Reference in New Issue
Block a user