mirror of
https://github.com/marktext/marktext.git
synced 2025-05-02 17:50:02 +08:00
feat: set default name of exported file to current filename (#2902)
This changes the default name set when saving an exported file, defaulting to the name of .md file, and then to the first header. Previously, it defaulted to the first header. Issues: #2731
This commit is contained in:
parent
ddd1879c61
commit
7242204508
@ -53,9 +53,9 @@ const handleResponseForExport = async (e, { type, content, pathname, title, page
|
||||
const win = BrowserWindow.fromWebContents(e.sender)
|
||||
const extension = EXTENSION_HASN[type]
|
||||
const dirname = pathname ? path.dirname(pathname) : getPath('documents')
|
||||
let nakedFilename = title
|
||||
let nakedFilename = pathname ? path.basename(pathname, '.md') : title
|
||||
if (!nakedFilename) {
|
||||
nakedFilename = pathname ? path.basename(pathname, '.md') : 'Untitled'
|
||||
nakedFilename = 'Untitled'
|
||||
}
|
||||
|
||||
const defaultPath = path.join(dirname, `${nakedFilename}${extension}`)
|
||||
|
Loading…
Reference in New Issue
Block a user