mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-09-19 23:17:16 +03:00
Default save as dialog to directory of active item
This commit is contained in:
parent
8e92499ebb
commit
0bb7d3ba09
@ -1,3 +1,4 @@
|
||||
* Fixed: Save As dialog now defaults to directory path of current editor
|
||||
* Fixed: Using toggle comment shortcut respects indentation level
|
||||
|
||||
* Fixed: Search never completing in the command panel
|
||||
|
@ -2,6 +2,7 @@ PaneContainer = require 'pane-container'
|
||||
Pane = require 'pane'
|
||||
{View} = require 'space-pen'
|
||||
$ = require 'jquery'
|
||||
{dirname} = require 'path'
|
||||
|
||||
describe "Pane", ->
|
||||
[container, view1, view2, editSession1, editSession2, pane] = []
|
||||
@ -373,7 +374,7 @@ describe "Pane", ->
|
||||
|
||||
pane.trigger 'core:save-as'
|
||||
|
||||
expect(atom.showSaveDialogSync).toHaveBeenCalled()
|
||||
expect(atom.showSaveDialogSync).toHaveBeenCalledWith(dirname(editSession2.getPath()))
|
||||
expect(editSession2.saveAs).toHaveBeenCalledWith('/selected/path')
|
||||
|
||||
describe "when the current item does not have a saveAs method", ->
|
||||
|
@ -199,9 +199,10 @@ window.atom =
|
||||
showSaveDialog: (callback) ->
|
||||
callback(showSaveDialogSync())
|
||||
|
||||
showSaveDialogSync: ->
|
||||
showSaveDialogSync: (defaultPath) ->
|
||||
defaultPath ?= project?.getPath()
|
||||
currentWindow = remote.getCurrentWindow()
|
||||
dialog.showSaveDialog currentWindow, title: 'Save File'
|
||||
dialog.showSaveDialog currentWindow, {title: 'Save File', defaultPath}
|
||||
|
||||
openDevTools: ->
|
||||
remote.getCurrentWindow().openDevTools()
|
||||
|
@ -1,3 +1,4 @@
|
||||
{dirname} = require 'path'
|
||||
{View} = require 'space-pen'
|
||||
$ = require 'jquery'
|
||||
_ = require 'underscore'
|
||||
@ -222,7 +223,10 @@ class Pane extends View
|
||||
|
||||
saveItemAs: (item, nextAction) ->
|
||||
return unless item.saveAs?
|
||||
path = atom.showSaveDialogSync()
|
||||
|
||||
itemPath = item.getUri?()
|
||||
itemPath = dirname(itemPath) if itemPath
|
||||
path = atom.showSaveDialogSync(itemPath)
|
||||
if path
|
||||
item.saveAs(path)
|
||||
nextAction?()
|
||||
|
Loading…
Reference in New Issue
Block a user