MCPcopy
hub / github.com/marktext/marktext / createWindow

Method createWindow

packages/desktop/src/main/app/index.ts:382–406  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

380 }
381
382 const createWindow = (): void => {
383 if (isRestorePathway) {
384 // We will restore based off the previous buffer, one window per buffer store file
385 const bufferStores = editorBufferStore.getAll()
386 const bufferStoreList = Object.values(bufferStores) as Array<{
387 id: string
388 filePath: string | null
389 }>
390 if (bufferStoreList.length === 0) {
391 this._createEditorWindow()
392 return
393 }
394
395 bufferStoreList.forEach((bufferStoreInfo) => {
396 // Read the buffer store file and pass the content
397 this._createEditorWindow(null, [], [], {}, bufferStoreInfo)
398 })
399 } else if (_openFilesCache.length) {
400 // We should wipe the buffer store if not it will keep creating new windows whenever we open files via double click in the file manager
401 editorBufferStore.clearBufferStoresWithAllSaved()
402 this._openFilesToOpen()
403 } else {
404 this._createEditorWindow()
405 }
406 }
407
408 if (isLinux) {
409 let windowCreated = false

Callers

nothing calls this directly

Calls 5

_createEditorWindowMethod · 0.95
_openFilesToOpenMethod · 0.95
getAllMethod · 0.65
forEachMethod · 0.45

Tested by

no test coverage detected