I have a contentEditable div where I want to allow users to type text, as well as insert input elements such as text boxes and dropdowns. The elements will be i
I think you could use a ember-cli plugin called ember-wormhole. What this component do is basically move the dom of you ember component to an html element that contains an id
attribute.
e.g.
document.selection.createRange().pasteHTML('');
use my-component-id to ember-wormhole destinantion
attribute:
{{#ember-wormhole to="my-component-id"}}
{{my-component...}}
{{/ember-wormhole}}
Regarding that, you could do something like:
click() {
let componentId = 'my-component-id';
document.selection.createRange().pasteHTML(``);
this.get('components').pushObject(componentId); // components being an array
}
in your handlebars template:
{{#each components as |componentId|}}
{{#ember-wormhole to=componentId}}
{{my-component...}}
{{/ember-wormhole}}
{{/each}}