# Rich text element's core functions?

**URL:** <https://community.weweb.io/t/rich-text-elements-core-functions/13679>\
**Category:** How do I?\
**Created:** [October 1, 2024, 11:47pm UTC](https://community.weweb.io/t/rich-text-elements-core-functions/13679 "2024-10-01T23:47:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![chrishaha](https://avatars.discourse-cdn.com/v4/letter/c/7cd45c/32.png) [@chrishaha](https://community.weweb.io/u/chrishaha)\
**Post date:** [October 1, 2024, 11:47pm UTC](https://community.weweb.io/t/rich-text-elements-core-functions/13679/1 "2024-10-01T23:47:44Z")

</div>

Is there any way to alter the rich text editor’s core behavior?

This post had someone from Weweb saying he’d come back with to help, but never did:

> [@Dynamically add text inside rich text editor](https://community.weweb.io/t/dynamically-add-text-inside-rich-text-editor/8225):
>
> I’m trying to build on top of WW’s rich text editor. I’ve added a “+” button in the editor’s toolbar. When clicked, I want to trigger some javascript that would insert a given string inside the editor. document.getElementById('editor').querySelector('div[contenteditable="true"]').appendChild('hello world'); The problem with the code above is that I can’t get the cursor (caret) position within the “contenteditable” div—the text gets added at the end of the element tree. How do I get the curso…

In my case, I need to add custom parameters to `new Editor()`. My goal is to prevent markdown (as well as other stuff like the auto insertion of checkboxes when typing “[” and “]”), and to do so one needs to access or otherwise alter TipTap’s code (see: [How to disable markdown behaviour and input/paste rules in Tiptap? · Issue #271 · ueberdosis/tiptap · GitHub](https://github.com/ueberdosis/tiptap/issues/271)).

---

<div class="post-metadata">

**Author:** ![DanielL](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/daniell/32/13398_2.png) [@DanielL](https://community.weweb.io/u/DanielL)\
**Post date:** [October 9, 2024, 8:51pm UTC](https://community.weweb.io/t/rich-text-elements-core-functions/13679/3 "2024-10-09T20:51:33Z")

</div>

Hi, @chrishaha

I’ve answered on that topic.

You will need custom JS. I don’t think you need to change TipTap’s code, at least I didn’t need to with my custom script for that topic. I just selected the element with document.querySelector(‘[contenteditable=“true”]’); and manipulated it with Vanilla JS.
