Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions lib/image-edit-session.coffee
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
path = require 'path'

_ = require 'underscore'
{_, fs} = require 'atom'
telepath = require 'telepath'

fsUtils = require 'fs-utils'

# Public: Manages the states between {Editor}s, images, and the project as a whole.
#
# Essentially, the graphical version of a {EditSession}.
Expand All @@ -17,15 +15,14 @@ class ImageEditSession
@activate: ->
# Files with these extensions will be opened as images
imageExtensions = ['.gif', '.jpeg', '.jpg', '.png']
Project = require 'project'
Project.registerOpener (filePath) ->
project.registerOpener (filePath) ->
if _.include(imageExtensions, path.extname(filePath))
new ImageEditSession(path: filePath)

@deserialize: (state) ->
relativePath = state.get('relativePath')
resolvedPath = project.resolve(relativePath) if relativePath
if fsUtils.isFileSync(resolvedPath)
if fs.isFileSync(resolvedPath)
new ImageEditSession(state)
else
console.warn "Could not build image edit session for path '#{relativePath}' because that file no longer exists"
Expand Down
4 changes: 1 addition & 3 deletions lib/image-view.coffee
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
ScrollView = require 'scroll-view'
_ = require 'underscore'
$ = require 'jquery'
{_, $, ScrollView} = require 'atom'

# Public: Renders images in the {Editor}.
module.exports =
Expand Down