Skip to content
This repository was archived by the owner on Mar 3, 2023. It is now read-only.
This repository was archived by the owner on Mar 3, 2023. It is now read-only.

Help on contributing #7974

Closed
Closed

Description

@ricardopieper

Hello! This is my first time doing something into a big open source project, and i'm quite lost. But I did solve a problem for future atom versions... I think.

I downloaded Atom and installed some plugins, but it was quite sad when I discovered that Virtualbox and Chrome 41 are screwing everything on Ubuntu. I read #6306, and @yuki-takei did some work to make Atom build with newer Electron versions. It looks like Atom is still using atom-shell 0.22 and in that version, Chrome doesn't know how to correctly determine if I'm using a mouse or a tablet.

Ok, I downloaded Yuki's deb package and text selection started working just fine, but a new problem appeared, which I think Yuki already knew and tried to solve by modifying command-registry.coffee. The problem is described here atom/notifications#85, where I tried to contribute too. I created this issue to address this problem.

So I forked the atom main repo and applied the same code that Yuki did, but in my case I tried building with electron 0.29.2, which worked fine but the results are the same.

Basically when I try to save a Haskell file with haskell-language installed (don't know if there is any relation here, but with .coffee files this doesn't happen) or clicking on the encoding or grammar selector (happens every time in our custom build), it throws a Uncaught TypeError: Cannot read property 'nodeName' of undefined. What I did to solve this was to add a new object to the synteticEvent object in command-register.coffee, in the function handleCommandEvent, so the object looks like this now:

syntheticEvent = Object.create {},
  eventPhase: value: Event.BUBBLING_PHASE
  currentTarget: get: -> currentTarget
  target: value: currentTarget ####this is the line I added
  preventDefault: value: ->
    originalEvent.preventDefault()
  stopPropagation: value: ->
    originalEvent.stopPropagation()
    propagationStopped = true
  stopImmediatePropagation: value: ->
    originalEvent.stopImmediatePropagation()
    propagationStopped = true
    immediatePropagationStopped = true
  abortKeyBinding: value: ->
    originalEvent.abortKeyBinding?()

#this is some code I took from Yuki's repo
for k, v of originalEvent when k not in syntheticEvent
  syntheticEvent[k] = v

There are some other changes in this same file, which can be found at Yuki's repo (#taken from https://github.com/yuki-takei/atom-using-electron-chrome-42/tree/edd8eec11d605ee77459232a010c1ac8a3a1ec42) or at my repo (https://github.com/ricardopieper/atom/blob/master/src/command-registry.coffee).

After adding this target: value: currentTarget, the problem stopped happening.

But I don't know the Atom infrastructure, or if this is "correct" Coffeescript/Javascript programming at all. Could someone provide me some feedback? I think this is not necessary for now since it seems like it only happens on newer versions of Electron. I haven't tested the whole application to see if everything is working, but for me at least is working more than before 😄

I'm happy I solved my problem, but I want to know if I'm going in the right direction.

Thanks!

Activity

  1. mnquintana commented on Jul 28, 2015

    @mnquintana
    Contributor

    @ricardopieper Since @yuki-takei clarified in #6306 (comment), I'm going to close this out. You can subscribe to #7877 for progress on finally updating to the latest Electron. 😄

  2. lock commented on Jan 21, 2019

    @lock

    This issue has been automatically locked since there has not been any recent activity after it was closed. If you can still reproduce this issue in Safe Mode then please open a new issue and fill out the entire issue template to ensure that we have enough information to address your issue. Thanks!

  3. locked as resolved and limited conversation to collaborators on Jan 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions