-
Notifications
You must be signed in to change notification settings - Fork 396
Open
Labels
Description
I'm trying to build a minimal HTML editor, in my HTML file I have some buttons and content-editable div like this :
<button id="tag_b">B</button>
<div id="text_prompt" contenteditable="true" data-editable data-name="main-content"></div>
The goal is when I click the button, the text selected in the div have the bold tag.
In the doc I saw the method ContentTools.Tool.apply(element, selection, callback)
In the source I saw that there is ContentTools.Bold.apply(element, selection, callback)
So I tried something like this :
editable = document.getElementBiId('text_prompt');
ContentTools.Bold.apply(editable, ContentSelect.Range.query(editable));
It does not work because editable is not a member of ContentTools.Node, I tried to load the editor and to put the first region as the first argument of the apply method with no success.
What is the right to do what I want to do ?