1
0

Clean some console.logs

This commit is contained in:
Zef Hemel 2024-01-25 16:48:05 +01:00
parent 8e7a371c88
commit 8112616cb2
2 changed files with 0 additions and 9 deletions

View File

@ -378,7 +378,6 @@ export class Client {
} }
if (pos !== undefined) { if (pos !== undefined) {
// setTimeout(() => { // setTimeout(() => {
console.log("Doing this pos set to", pos);
this.editorView.dispatch({ this.editorView.dispatch({
selection: { anchor: pos! }, selection: { anchor: pos! },
effects: EditorView.scrollIntoView(pos!, { effects: EditorView.scrollIntoView(pos!, {
@ -403,7 +402,6 @@ export class Client {
initialCursorPos = match[0].length; initialCursorPos = match[0].length;
} }
// By default scroll to the top // By default scroll to the top
console.log("Scrolling to place after frontmatter", initialCursorPos);
this.editorView.scrollDOM.scrollTop = 0; this.editorView.scrollDOM.scrollTop = 0;
this.editorView.dispatch({ this.editorView.dispatch({
selection: { anchor: initialCursorPos }, selection: { anchor: initialCursorPos },

View File

@ -46,27 +46,23 @@ export class PathPageNavigator {
const cleanState = { ...currentState, pos: undefined, anchor: undefined }; const cleanState = { ...currentState, pos: undefined, anchor: undefined };
this.openPages.set(currentState.page || this.indexPage, cleanState); this.openPages.set(currentState.page || this.indexPage, cleanState);
if (!replaceState) { if (!replaceState) {
console.log("Updating current state", currentState);
window.history.replaceState( window.history.replaceState(
cleanState, cleanState,
"", "",
`/${currentState.page}`, `/${currentState.page}`,
); );
console.log("Pushing new state", pageRef);
window.history.pushState( window.history.pushState(
pageRef, pageRef,
"", "",
`/${pageRef.page}`, `/${pageRef.page}`,
); );
} else { } else {
// console.log("Replacing state", pageRef);
window.history.replaceState( window.history.replaceState(
pageRef, pageRef,
"", "",
`/${pageRef.page}`, `/${pageRef.page}`,
); );
} }
// console.log("Explicitly dispatching the popstate", pageRef);
globalThis.dispatchEvent( globalThis.dispatchEvent(
new PopStateEvent("popstate", { new PopStateEvent("popstate", {
state: pageRef, state: pageRef,
@ -110,16 +106,13 @@ export class PathPageNavigator {
// Pretty low-context popstate, so let's leverage openPages // Pretty low-context popstate, so let's leverage openPages
const openPage = this.openPages.get(popState.page); const openPage = this.openPages.get(popState.page);
if (openPage) { if (openPage) {
console.log("Pulling open page state", openPage);
popState.selection = openPage.selection; popState.selection = openPage.selection;
popState.scrollTop = openPage.scrollTop; popState.scrollTop = openPage.scrollTop;
} }
} }
console.log("Got popstate state, using", popState);
await pageLoadCallback(popState); await pageLoadCallback(popState);
} else { } else {
// This occurs when the page is loaded completely fresh with no browser history around it // This occurs when the page is loaded completely fresh with no browser history around it
// console.log("Got null state so using", this.parseURI());
const pageRef = parsePageRefFromURI(); const pageRef = parsePageRefFromURI();
if (!pageRef.page) { if (!pageRef.page) {
pageRef.page = this.indexPage; pageRef.page = this.indexPage;