Compare commits
6 Commits
a712ca12da
...
77b429a742
| Author | SHA1 | Date | |
|---|---|---|---|
| 77b429a742 | |||
| 0c1c56b54a | |||
| 73a139ef9a | |||
| 5796bc56b5 | |||
| 7c1910c919 | |||
| 60a4df2efc |
@@ -106,7 +106,7 @@ function Article({ cache }) {
|
||||
|
||||
if (v.nodeName === '#text') {
|
||||
const text = v.data;
|
||||
if (text.includes('\\[') || text.includes('\\(') || text.includes('$$') || text.includes('$')) {
|
||||
if (text.includes('\\[') || text.includes('\\(') || text.includes('$$') || /\$(?:[^$]*[^\s$])\$/.test(text)) {
|
||||
return <Latex key={key} delimiters={latexDelimiters}>{text}</Latex>;
|
||||
}
|
||||
|
||||
|
||||
@@ -360,3 +360,33 @@ button.comment {
|
||||
border-width: 0 2px 2px 0;
|
||||
transform: rotate(45deg);
|
||||
}
|
||||
|
||||
.tooltip .tooltiptext {
|
||||
visibility: hidden;
|
||||
width: 140px;
|
||||
background-color: #555;
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
border-radius: 6px;
|
||||
padding: 5px 0;
|
||||
position: absolute;
|
||||
z-index: 1;
|
||||
bottom: 110%;
|
||||
left: 50%;
|
||||
margin-left: -70px;
|
||||
opacity: 0;
|
||||
transition: opacity 0.2s;
|
||||
font-size: 0.9rem;
|
||||
line-height: 1.3;
|
||||
}
|
||||
|
||||
.forwardDot .tooltiptext {
|
||||
left: auto;
|
||||
right: 0;
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
.tooltip.show-tooltip .tooltiptext {
|
||||
visibility: visible;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React from 'react';
|
||||
import React, { useState } from 'react';
|
||||
import moment from 'moment';
|
||||
import { Link } from 'react-router-dom';
|
||||
|
||||
@@ -32,6 +32,8 @@ export const ToggleDot = ({ id, article }) => (
|
||||
);
|
||||
|
||||
export const BackwardDot = () => {
|
||||
const [showTooltip, setShowTooltip] = useState(false);
|
||||
|
||||
const goBackward = () => {
|
||||
localStorage.setItem('scrollLock', 'True');
|
||||
window.history.back();
|
||||
@@ -42,15 +44,25 @@ export const BackwardDot = () => {
|
||||
if (!document.fullscreenElement) return null;
|
||||
|
||||
return (
|
||||
<div className='dot backwardDot' onClick={goBackward}>
|
||||
<div
|
||||
className={'dot backwardDot tooltip' + (showTooltip ? ' show-tooltip' : '')}
|
||||
onClick={goBackward}
|
||||
onMouseEnter={() => setShowTooltip(true)}
|
||||
onMouseLeave={() => setShowTooltip(false)}
|
||||
onTouchStart={() => setShowTooltip(true)}
|
||||
onTouchEnd={() => setShowTooltip(false)}
|
||||
>
|
||||
<div className='button'>
|
||||
|
||||
</div>
|
||||
<span className="tooltiptext">Browser Back</span>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export const ForwardDot = () => {
|
||||
const [showTooltip, setShowTooltip] = useState(false);
|
||||
|
||||
const goForward = () => {
|
||||
localStorage.setItem('scrollLock', 'True');
|
||||
window.history.forward();
|
||||
@@ -60,10 +72,18 @@ export const ForwardDot = () => {
|
||||
if (!isMobile) return null;
|
||||
|
||||
return (
|
||||
<div className='dot forwardDot' onClick={goForward}>
|
||||
<div
|
||||
className={'dot forwardDot tooltip' + (showTooltip ? ' show-tooltip' : '')}
|
||||
onClick={goForward}
|
||||
onMouseEnter={() => setShowTooltip(true)}
|
||||
onMouseLeave={() => setShowTooltip(false)}
|
||||
onTouchStart={() => setShowTooltip(true)}
|
||||
onTouchEnd={() => setShowTooltip(false)}
|
||||
>
|
||||
<div className='button'>
|
||||
|
||||
</div>
|
||||
<span className="tooltiptext">Browser Forward</span>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user