Announce: html-tab


#1

From the read-me …

html-tab package

Example Atom editor package to open any HTML in a tab

This example package includes the minimum amount of code to open arbitrary HTML in a tab in the Atom editor. It can be examined for educational purposes and it can act as a template for a new HTML package.

Feel free to ask questions at the Atom discussion group: https://discuss.atom.io/

Usage

  • Install with apm install html-tab
  • Press ctrl-alt-H
  • Read the source
    • Open the settings tab
    • Type html in the package search box on the left
    • Select Html Tab
    • On the right side click Open In Atom

Future

Expand this into a full browser. (easy peasy)

License

Copyright Mark Hahn by MIT license


#2

Is this still the recommended approach for implementing a new view in a tab?

I read somewhere in these forums that space pen is deprecated. Looking at the sources it looks like the new way to create views is using a pattern like:

  • ItemModel
  • ItemView
  • ItemElement
  • Then use ViewRegistry to create an association

The trouble is I’m not really sure how these things are all supposed to plug together in a minimal way. Looking through the sources I think some of the code must be around for legacy reasons.

Is anyone aware of a simple example that uses the new approach?

Jesse


#3

Space Pen isn’t deprecated for third-party packages. It just isn’t the recommended way of doing things anymore.


#4

@leedohm Thanks…

Is there a recommended way now? From what I can tell it seems like the internals are moving to subclassing HTMLElement. Is that correct? And if so are there any simple examples of this new approach?

Looking at the internal classes it seems things are being implemented with a Model, View, Element grouping. But am I correct in thinking that the view part of that is just around for legacy reasons?

Jesse


#5

Well … to be clear, the Atom team wants all of Atom’s first-party code to use the method you’re describing, native DOM elements. Third-party package authors are free to use Space Pen, native DOM elements or whatever other strategy they wish. Most of the most prolific package authors are switching to native DOM elements … but there is no requirement to do so.

As far as what is “recommended” for third-party package authors. There isn’t a good answer for that right now. Space Pen is still available and still supported … it just isn’t going to be improved going forward, to my understanding.

As for whether or not “Views” are legacy, no … they’re not legacy. But it was making the API confusing to have some things on the model and some things on the views. Some of the views were getting particularly thick. So the Atom team decided to push all of the API to the models and remove access to their respective views. In the 1.0 API the Element is the view. But the goal is that you should never have to interact with the view directly to get things done … more or less :grinning:


#6

No. I will be updating html-tab asap.

I’m in the process of removing my deprecations and dealing with the shadow dom in all my packages. It is turning out to be a real pain but I knew I would be dealing with something like this before 1.0.

I am a big fan of space-pen and jquery for add-on packages. My arguments with core when they were going to abandon space-pen contributed to their decision to continue supporting it.

However, I’m being forced to deal with native DOM methods as I remove deprecations. They are pretty much the same functions jQuery has but I am having to learn the native method signatures and names. So at this time my package rewrites are a mixture of space-pen, jquery, and native elements.

My brain is having some problem using the native functions and jQuery functions at the same time. I am going to have to switch to all native functions, as the core team wants, to end this confusion. I can’t do this until I find a template solution to replace the really cool @div methods that space-pen uses.

There is a npm package teacup that predates space-pen and offers the same kind of templating. It is actually better because you can just use div instead of @div. I’ve used it before.

Anyone have any ideas for what new templating should be used on packages? There is none in the sample package generated by package-generator which makes it useless.


#7

The html-tab package 1.0.0 now matches Atom 1.0.0 standards.