mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2025-01-01 19:35:23 +03:00
Add back ability to open an arbitrary window
atom.open now takes an options has that can contain either pathsToOpen or the complete settings of a new window. This will be used by the collaboration package to open the window when a session is being joined.
This commit is contained in:
parent
90da89d31c
commit
6e2fd18f62
@ -207,7 +207,8 @@ describe "Window", ->
|
||||
spyOn(atom, "open")
|
||||
event = buildDragEvent("drop", [ {path: "/fake1"}, {path: "/fake2"} ])
|
||||
window.onDrop(event)
|
||||
expect(atom.open.callCount).toBe 2
|
||||
expect(atom.open.callCount).toBe 1
|
||||
expect(atom.open.argsForCall[0][0]).toEqual pathsToOpen: ['/fake1', '/fake2']
|
||||
|
||||
describe "when a non-file is dragged to window", ->
|
||||
it "does nothing", ->
|
||||
|
@ -128,9 +128,12 @@ class AtomApplication
|
||||
event.preventDefault()
|
||||
@applicationMenu.showDownloadUpdateItem(version, quitAndUpdateCallback)
|
||||
|
||||
ipc.on 'open', (processId, routingId, pathsToOpen) =>
|
||||
if pathsToOpen?.length > 0
|
||||
@openPaths({pathsToOpen})
|
||||
ipc.on 'open', (processId, routingId, options) =>
|
||||
if options?
|
||||
if options.pathsToOpen?.length > 0
|
||||
@openPaths(options)
|
||||
else
|
||||
new AtomWindow(options)
|
||||
else
|
||||
@promptForPath()
|
||||
|
||||
|
@ -130,8 +130,8 @@ window.atom =
|
||||
packages.push(metadata)
|
||||
packages
|
||||
|
||||
open: (url...) ->
|
||||
ipc.sendChannel('open', [url...])
|
||||
open: (options) ->
|
||||
ipc.sendChannel('open', options)
|
||||
|
||||
confirm: (message, detailedMessage, buttonLabelsAndCallbacks...) ->
|
||||
buttons = []
|
||||
|
@ -2,6 +2,7 @@ fsUtils = require 'fs-utils'
|
||||
path = require 'path'
|
||||
telepath = require 'telepath'
|
||||
$ = require 'jquery'
|
||||
_ = require 'underscore'
|
||||
less = require 'less'
|
||||
remote = require 'remote'
|
||||
ipc = require 'ipc'
|
||||
@ -86,8 +87,8 @@ window.installApmCommand = (callback) ->
|
||||
window.onDrop = (e) ->
|
||||
e.preventDefault()
|
||||
e.stopPropagation()
|
||||
for file in e.originalEvent.dataTransfer.files
|
||||
atom.open(file.path)
|
||||
pathsToOpen = _.pluck(e.originalEvent.dataTransfer.files, 'path')
|
||||
atom.open({pathsToOpen}) if pathsToOpen.length > 0
|
||||
|
||||
window.deserializeEditorWindow = ->
|
||||
RootView = require 'root-view'
|
||||
|
Loading…
Reference in New Issue
Block a user