mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-11-28 01:52:56 +03:00
Merge pull request #644 from esteemapp/bugfix/596
fixed h tag height issue
This commit is contained in:
commit
1d66da2a8d
@ -14,6 +14,20 @@ export default EStyleSheet.create({
|
||||
color: '$primaryBlue',
|
||||
fontFamily: '$primaryFont',
|
||||
},
|
||||
h4: {
|
||||
fontSize: 15,
|
||||
marginHorizontal: 10,
|
||||
marginVertical: 5,
|
||||
},
|
||||
h1: {
|
||||
fontSize: 30,
|
||||
},
|
||||
h2: {
|
||||
fontSize: 25,
|
||||
},
|
||||
h3: {
|
||||
fontSize: 20,
|
||||
},
|
||||
img: {
|
||||
// height: 50,
|
||||
marginTop: 10,
|
||||
|
@ -22,6 +22,7 @@ const urlRegex = /(http|ftp|https):\/\/([\w_-]+(?:(?:\.[\w_-]+)+))([\w.,@?^=%&:/
|
||||
const aTagRegex = /(<\s*a[^>]*>(.*?)<\s*[/]\s*a>)/g;
|
||||
const imgTagRegex = /(<img[^>]*>)/g;
|
||||
const iframeRegex = /(?:<iframe[^>]*)(?:(?:\/>)|(?:>.*?<\/iframe>))/g;
|
||||
const hTagRegex = /(<h([1-6])>([^<]*)<\/h([1-6])>)/g;
|
||||
|
||||
export const markDown2Html = (input) => {
|
||||
if (!input) {
|
||||
@ -81,6 +82,10 @@ export const markDown2Html = (input) => {
|
||||
output = handleATag(output);
|
||||
}
|
||||
|
||||
if (hTagRegex.test(output)) {
|
||||
output = handleHTag(output);
|
||||
}
|
||||
|
||||
// if (copiedPostRegex.test(output)) {
|
||||
// output = handleMarkdownLink(output);
|
||||
// }
|
||||
@ -130,6 +135,8 @@ const handleATag = input => input.replace(aTagRegex, (link) => {
|
||||
return link;
|
||||
});
|
||||
|
||||
const handleHTag = input => input.replace(hTagRegex, tag => `<div>${tag}</div>`);
|
||||
|
||||
const handleMarkdownLink = input => input.replace(copiedPostRegex, (link) => {
|
||||
const postMatch = link.match(copiedPostRegex);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user