mirror of
https://github.com/cheeaun/phanpy.git
synced 2024-11-21 16:55:25 +03:00
Remove target=_blank from username links
Mobile Safari ignores the click preventDefault and not show the Account popover. Removing target_blank fixes this ignorance Kinda hacky fix for now
This commit is contained in:
parent
ee074bec7f
commit
039d4661fb
3 changed files with 17 additions and 4 deletions
|
@ -15,7 +15,7 @@ export default ({ account, showAvatar, showAcct, short, external }) => {
|
|||
<a
|
||||
class={`name-text ${short ? 'short' : ''}`}
|
||||
href={url}
|
||||
target="_blank"
|
||||
// target="_blank"
|
||||
title={`@${acct}`}
|
||||
onClick={(e) => {
|
||||
if (external) return;
|
||||
|
|
|
@ -506,7 +506,7 @@ function Status({ statusID, status, withinContext, size = 'm', skeleton }) {
|
|||
{size !== 's' && (
|
||||
<a
|
||||
href={url}
|
||||
target="_blank"
|
||||
// target="_blank"
|
||||
title={`@${acct}`}
|
||||
onClick={(e) => {
|
||||
e.preventDefault();
|
||||
|
@ -604,6 +604,14 @@ function Status({ statusID, status, withinContext, size = 'm', skeleton }) {
|
|||
dangerouslySetInnerHTML={{
|
||||
__html: enhanceContent(content, {
|
||||
emojis,
|
||||
postEnhanceDOM: (dom) => {
|
||||
dom
|
||||
.querySelectorAll('a.u-url[target="_blank"]')
|
||||
.forEach((a) => {
|
||||
// Remove target="_blank" from links
|
||||
a.removeAttribute('target');
|
||||
});
|
||||
},
|
||||
}),
|
||||
}}
|
||||
/>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import emojifyText from './emojify-text';
|
||||
|
||||
export default (content, opts = {}) => {
|
||||
const { emojis } = opts;
|
||||
const { emojis, postEnhanceDOM = () => {} } = opts;
|
||||
let enhancedContent = content;
|
||||
const dom = document.createElement('div');
|
||||
dom.innerHTML = enhancedContent;
|
||||
|
@ -27,7 +27,7 @@ export default (content, opts = {}) => {
|
|||
const pre = document.createElement('pre');
|
||||
const code = document.createElement('code');
|
||||
const breaks = block.querySelectorAll('br');
|
||||
Array.from(breaks).forEach((br) => br.replaceWith('\n'));
|
||||
breaks.forEach((br) => br.replaceWith('\n'));
|
||||
code.innerHTML = block.innerText
|
||||
.trim()
|
||||
// .replace(/^```/g, '')
|
||||
|
@ -37,6 +37,11 @@ export default (content, opts = {}) => {
|
|||
block.replaceWith(pre);
|
||||
});
|
||||
|
||||
if (postEnhanceDOM) {
|
||||
postEnhanceDOM(dom); // mutate dom
|
||||
}
|
||||
|
||||
enhancedContent = dom.innerHTML;
|
||||
|
||||
return enhancedContent;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue