Open TakeshiHoshina opened 4 years ago
(I encountered this error, too)
Steps to reproduce:
Atom: 1.52.0 x64 OS: macOS 10.15.7
I also like your error. You can fix that by following steps. C:\Users\XXXX.atom\packages\plantuml-viewer\lib\plantuml-viewer-view.js ① function saveAs () { ↓ async function saveAs () { ② var savePath = atom.showSaveDialogSync(options) ↓ const savePath = await atom.showSaveDialogSync(options) ③ last replare using savePath -> savePath.filePath
I also like your error. You can fix that by following steps. C:\Users\XXXX.atom\packages\plantuml-viewer\lib\plantuml-viewer-view.js ① function saveAs () { ↓ async function saveAs () { ② var savePath = atom.showSaveDialogSync(options) ↓ const savePath = await atom.showSaveDialogSync(options) ③ last replare using savePath -> savePath.filePath
thank you for your share. It is useful. ③ should be: last, please replace "savePath" with "savePath.filePath", beside the "const savePath = await atom.showSaveDialogSync(options)"
Same error encountered. Jan 2021.
Same issue
Here is the fix made by @nguyenquangson , I put it here as I didn't understand the number 3 :
async function saveAs () {
var filters = [
{ name: 'Encapsulated PostScript (.eps)', extensions: ['eps'] },
{ name: 'Scalable Vector Graphics (.svg)', extensions: ['svg'] },
{ name: 'Portable Network Graphics (.png)', extensions: ['png'] }
]
var filePath = editor.getPath().replace(/\.[^/.]+$/, '')
var options = { defaultPath: filePath, filters: filters }
const savePath = await atom.showSaveDialogSync(options)
if (savePath.filePath) {
var extension = savePath.filePath.substr(savePath.filePath.lastIndexOf('.') + 1)
var fileStream = fs.createWriteStream(savePath.filePath)
var plantumlOptions = {
format: extension,
include: includePath,
dot: atom.config.get('plantuml-viewer.graphvizDotExecutable') || getDetectedPathFor('dot'),
config: atom.config.get('plantuml-viewer.configFile'),
charset: atom.config.get('plantuml-viewer.charset')
}
var gen = plantuml.generate(editor.getText(), plantumlOptions)
gen.out.pipe(fileStream)
}
}
[Enter steps to reproduce:]
Atom: 1.52.0 x64 Electron: 6.1.12 OS: Mac OS X 10.15.5 Thrown From: plantuml-viewer package 0.7.2
Stack Trace
Uncaught TypeError: savePath.lastIndexOf is not a function
Commands
Non-Core Packages