Add option for query id routing (#31)

This commit is contained in:
Ahmed Waleed
2025-06-29 12:47:24 +03:00
committed by GitHub
parent 7dc3edb5fd
commit 335c418c54
5 changed files with 64 additions and 8 deletions

View File

@@ -6,6 +6,7 @@ import styled from 'styled-components';
import themes, { Themes } from '../style/themes';
import { languages } from '../util/highlighting';
import { saveToBytebin } from '../util/storage';
import { useQueryRouting } from '../util/constants';
import Button from './Button';
import { ResetFunction } from './Editor';
import MenuButton from './MenuButton';
@@ -59,9 +60,15 @@ export default function EditorControls({
setSaving(false);
setRecentlySaved(true);
if (pasteId) {
history.replace({
pathname: pasteId,
});
if (useQueryRouting) {
history.replace({
search: `?id=${pasteId}`,
});
} else {
history.replace({
pathname: pasteId,
});
}
copy(window.location.href);
document.title = 'paste | ' + pasteId;
}