|
@@ -17,7 +17,7 @@ import AttachmentIcon from './Icons/AttachmentIcon';
|
|
|
import HistoryIcon from './Icons/HistoryIcon';
|
|
import HistoryIcon from './Icons/HistoryIcon';
|
|
|
import ShareLinkIcon from './Icons/ShareLinkIcon';
|
|
import ShareLinkIcon from './Icons/ShareLinkIcon';
|
|
|
import PageAttachment from './PageAttachment';
|
|
import PageAttachment from './PageAttachment';
|
|
|
-import { PageHistory } from './PageHistory';
|
|
|
|
|
|
|
+import { PageHistory, getQueryParam } from './PageHistory';
|
|
|
import ShareLink from './ShareLink/ShareLink';
|
|
import ShareLink from './ShareLink/ShareLink';
|
|
|
|
|
|
|
|
import styles from './PageAccessoriesModal.module.scss';
|
|
import styles from './PageAccessoriesModal.module.scss';
|
|
@@ -38,12 +38,6 @@ const PageAccessoriesModal = (): JSX.Element => {
|
|
|
|
|
|
|
|
const { data: status, mutate, close } = usePageAccessoriesModal();
|
|
const { data: status, mutate, close } = usePageAccessoriesModal();
|
|
|
|
|
|
|
|
- // Get string from 'compare' query params
|
|
|
|
|
- const getQueryParam = () => {
|
|
|
|
|
- const query: URLSearchParams = new URL(window.location.href).searchParams;
|
|
|
|
|
- return query.get('compare');
|
|
|
|
|
- };
|
|
|
|
|
-
|
|
|
|
|
// add event handler when opened
|
|
// add event handler when opened
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
|
if (status == null || status.onOpened != null) {
|
|
if (status == null || status.onOpened != null) {
|
|
@@ -63,14 +57,16 @@ const PageAccessoriesModal = (): JSX.Element => {
|
|
|
// https://regex101.com/r/YHTDsr/1
|
|
// https://regex101.com/r/YHTDsr/1
|
|
|
const regex = /^([0-9a-f]{24})...([0-9a-f]{24})$/i;
|
|
const regex = /^([0-9a-f]{24})...([0-9a-f]{24})$/i;
|
|
|
|
|
|
|
|
- if (queryParams == null || regex.test(queryParams)) {
|
|
|
|
|
|
|
+ if (queryParams == null || !regex.test(queryParams)) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const matches = queryParams.match(regex);
|
|
const matches = queryParams.match(regex);
|
|
|
|
|
+
|
|
|
if (matches == null) {
|
|
if (matches == null) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
const [, sourceRevisionId, targetRevisionId] = matches;
|
|
const [, sourceRevisionId, targetRevisionId] = matches;
|
|
|
setSourceRevisionId(sourceRevisionId);
|
|
setSourceRevisionId(sourceRevisionId);
|
|
|
setTargetRevisionId(targetRevisionId);
|
|
setTargetRevisionId(targetRevisionId);
|