MCPcopy Index your code
hub / github.com/DeepNotesApp/DeepNotes / goToPage

Method goToPage

apps/client/src/code/pages/pages.ts:251–306  ·  view source on GitHub ↗
(
    pageId: string,
    params?: { fromParent?: boolean; openInNewTab?: boolean; elemId?: string },
  )

Source from the content-addressed store, hash-verified

249 }
250
251 async goToPage(
252 pageId: string,
253 params?: { fromParent?: boolean; openInNewTab?: boolean; elemId?: string },
254 ) {
255 mainLogger.sub('Pages.goToPage').info('pageId: %s', pageId);
256
257 // Open in a new tab
258
259 if (params?.openInNewTab) {
260 window.open(
261 multiModePath(
262 `/pages/${pageId}${params?.elemId ? `?elem=${params?.elemId}` : ''}`,
263 ),
264 '_blank',
265 );
266 return;
267 }
268
269 if (params?.fromParent && this.react.pageId !== pageId) {
270 this.parentPageId = this.react.pageId;
271 }
272
273 this.react.page.editing.stop();
274
275 await router().push({
276 name: 'page',
277 params: { pageId },
278 query: { elem: params?.elemId },
279 });
280
281 const cachedPage = this.pageCache.get(pageId);
282
283 if (
284 cachedPage != null &&
285 cachedPage.react.status === 'success' &&
286 !cachedPage.react.loading &&
287 isNanoID(params?.elemId ?? '')
288 ) {
289 const elem =
290 cachedPage.notes.fromId(params?.elemId!) ??
291 cachedPage.arrows.fromId(params?.elemId!);
292
293 if (elem != null) {
294 cachedPage.selection.set(elem);
295
296 const elemElem =
297 elem.type === 'note'
298 ? elem.getElem('note-frame')
299 : elem.getHitboxElem();
300
301 if (elemElem != null) {
302 scrollIntoView(elemElem, { centerCamera: true });
303 }
304 }
305 }
306 }
307 async goToGroup(
308 groupId: string,

Callers 4

goBackwardMethod · 0.95
goForwardMethod · 0.95

Calls 10

multiModePathFunction · 0.90
isNanoIDFunction · 0.90
scrollIntoViewFunction · 0.90
subMethod · 0.80
stopMethod · 0.80
getElemMethod · 0.80
getHitboxElemMethod · 0.80
getMethod · 0.65
setMethod · 0.65
fromIdMethod · 0.45

Tested by

no test coverage detected