# Adding a poll button to the bottom of the composer

**URL:** <https://meta.discourse.org/t/adding-a-poll-button-to-the-bottom-of-the-composer/142778>\
**Category:** Development\
**Created:** [27 בפברואר,‏ 2020,‏ 3:38am UTC](https://meta.discourse.org/t/adding-a-poll-button-to-the-bottom-of-the-composer/142778 "2020-02-27T03:38:39Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![spirobel](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/spirobel/32/170908_2.png) [@spirobel](https://meta.discourse.org/u/spirobel)\
**Post date:** [27 בפברואר,‏ 2020,‏ 11:15am UTC](https://meta.discourse.org/t/adding-a-poll-button-to-the-bottom-of-the-composer/142778/3 "2020-02-27T11:15:28Z")

</div>

I couldnt help myself and looked down the rabit hole a bit. haha and now are 2 hours gone already.

 ![handlebars](https://global.discourse-cdn.com/meta/original/3X/d/8/d847f0d6d29995a6ee15c0bea9d837307e486b55.png)  
you need to add the handlebars file like this to display the button

 ![js](https://global.discourse-cdn.com/meta/original/3X/6/b/6b932a0b182cf1210121b7aab164be5fafc289bf.png)  
and then you need some action similar to the one in the poll plugin:

> <https://github.com/discourse/discourse/blob/f5180656540084cddcb3e4072d7ae9e4aa333ee4/plugins/poll/assets/javascripts/initializers/add-poll-ui-builder.js.es6#L24>

we can feed the poll builder modal a “fake” toolbar event, but the issue is that you also need to replicate the logic in the editor component

> <https://github.com/discourse/discourse/blob/9c96511ec47bf0eb450a0b7e15738d284ee3761f/app/assets/javascripts/discourse/components/d-editor.js.es6#L953>

the part with `_getSelected` and `_addText`. I would be very interested to know if there is some api to add text programmatically to the editor textarea from “the outside”.

---

_[View the full topic](https://meta.discourse.org/t/adding-a-poll-button-to-the-bottom-of-the-composer/142778)._
