Can't select panel text


#1

Hi,

I created an element with the following code:

@content: ->
    @div class: 'inset-panel panel-bottom run-command', =>
      @div class: 'panel-heading', =>
        @span 'Command: '
        @span outlet: 'header'
      @div class: 'panel-body padded results', outlet: 'resultsContainer', =>
        @pre '', outlet: 'results'

# In my show function
@panel ?= atom.workspace.addModalPanel(item: this)

When I try to select the text of this element nothing happens. Is this the expected behavior? And if so how to I make the text of this panel selectable?


#2

Almost every panel in every package, including mine, has this problem. Let me know if/when you find a fix.


#3

The panel in bug-report has selectable text:

I don’t know why that would be versus the code that is mentioned above, but maybe it’s a start?


#4

Can you actually copy the text?


#5

So this allows you to highlight it

@div class: 'inset-panel panel-bottom run-command', tabindex: -1, =>

But doesn’t allow copying.

@div class: 'inset-panel panel-bottom run-command native-key-bindings', tabindex: -1, =>

Allows for highlighting and copying. Thanks for leading me to that repo leedohm!


#6

Ah yes … the infamous native-key-bindings strikes again! :grinning:


#7

How would I get this to work on the below code?

   `module.exports =
    class MyFirstCsPackageView
    constructor: (serializedState) ->
    # Create root element
    @element = document.createElement('div')
    @element.classList.add('my-first-cs-package')

    # Create message element
    message = document.createElement('div')
    message.textContent = "The MyFirstCsPackage package is Alive! It's ALIVE!"
    message.classList.add('message')
    @element.appendChild(message)

  # Returns an object that can be retrieved when package is activated
  serialize: ->

  # Tear down any state and detach
  destroy: ->
    @element.remove()

  getElement: ->
    @element

  setCount: (count) ->
    displayText = "SAQL JSON: #{count}"
    @element.children[0].textContent = displayText
`