mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-11-13 08:44:12 +03:00
Merge pull request #4478 from atom/mb-panel-markup
Allow PanelElements to be instantiated with markup
This commit is contained in:
commit
caf6fdd5ac
@ -1,5 +1,6 @@
|
||||
{CompositeDisposable} = require 'event-kit'
|
||||
{callAttachHooks} = require './space-pen-extensions'
|
||||
Panel = require './panel'
|
||||
|
||||
class PanelElement extends HTMLElement
|
||||
createdCallback: ->
|
||||
@ -13,14 +14,15 @@ class PanelElement extends HTMLElement
|
||||
@subscriptions.add @model.onDidDestroy(@destroyed.bind(this))
|
||||
this
|
||||
|
||||
getModel: -> @model
|
||||
getModel: ->
|
||||
@model ?= new Panel
|
||||
|
||||
getItemView: ->
|
||||
atom.views.getView(@model.getItem())
|
||||
atom.views.getView(@getModel().getItem())
|
||||
|
||||
attachedCallback: ->
|
||||
callAttachHooks(@getItemView()) # for backward compatibility with SpacePen views
|
||||
@visibleChanged(@model.isVisible())
|
||||
@visibleChanged(@getModel().isVisible())
|
||||
|
||||
visibleChanged: (visible) ->
|
||||
if visible
|
||||
|
@ -14,7 +14,7 @@ class Panel
|
||||
Section: Construction and Destruction
|
||||
###
|
||||
|
||||
constructor: ({@item, @visible, @priority, @className}) ->
|
||||
constructor: ({@item, @visible, @priority, @className}={}) ->
|
||||
@emitter = new Emitter
|
||||
@visible ?= true
|
||||
@priority ?= 100
|
||||
|
Loading…
Reference in New Issue
Block a user