What is the proper way to create an atom-text-editor?


#1

Hey guys,

I’m having trouble figuring out how to create an <atom-text-editor> element properly. I’m currently loading the DOM from a template like so:

Template = require './my-template.html'
{registerElement} = require 'elmer'

module.exports =
DebuggerElement = registerElement 'my-element',
  createdCallback: ->
    @appendChild(Template.clone())

my-template.html:

<div class="my-element">
  <atom-text-editor mini>Type things here</atom-text-editor>
</div>

But the text editor element is uneditable/unselectable. Are there extra steps to making a working text editor view? I’m having a lot of trouble finding any documentation for doing this in a package.


#2

#3

@Maushundb is correct, this does appear to be a duplicate of the previous topic. Please let us know if you feel this isn’t the case, otherwise continue the conversation on the original topic.

We like to unify similar discussions under one topic so that people don’t have to read a bunch of different threads to get the whole story. I’ll be closing this topic as duplicate in 24 hours if I don’t hear back.


#4

@leedohm yea, you can close it, but I want to leave one note for anyone that finds this topic since my searches did not yield the linked topic.

It seems in order for atom elements to initiate properly, they have to be added to the DOM via createElement or some other direct method, not a template. So document.createElement('atom-text-editor') and then appending that object should work.


#5

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.