# Customize freetext tool to change text and behavior programatically

**URL:** <https://pdfjs.community/t/customize-freetext-tool-to-change-text-and-behavior-programatically/94>\
**Category:** Technical Support\
**Created:** [June 26, 2020, 7:35am UTC](https://pdfjs.community/t/customize-freetext-tool-to-change-text-and-behavior-programatically/94 "2020-06-26T07:35:21Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![zzhang](https://avatars.discourse-cdn.com/v4/letter/z/b9e5f3/32.png) [@zzhang](https://pdfjs.community/u/zzhang)\
**Post date:** [June 26, 2020, 8:23pm UTC](https://pdfjs.community/t/customize-freetext-tool-to-change-text-and-behavior-programatically/94/2 "2020-06-26T20:23:51Z")

</div>

Hi,

A)  
The initialText function actually lives on the prototype instead of the function itself, so I believe you should do

```javascript
Tools.FreeTextCreateTool.prototype.initialText = 'REDACTED'

```

B)  
You can listen to the [editorFocus](https://pdfjs.express/api/CoreControls.EditBoxManager.html#event:editorFocused__anchor) event of [editboxManager](https://pdfjs.express/api/CoreControls.AnnotationManager.html#getEditBoxManager__anchor) and in the event callback you can grab the editor element inside the page container and then call the blur method of it. The id of an editor element looks like `freetext-editor-${annotation.Id}`.

C)  
You can listen to the editorBlur event and then use this.wvInstance.annotManager to deselect all the annotaitons.

Thanks,  
Zhijie

---

_[View the full topic](https://pdfjs.community/t/customize-freetext-tool-to-change-text-and-behavior-programatically/94)._
