Doodad insert code:
Range range = toolbarUpdateListener.getSelectionRange();
final CMutableDocument document = harness.getEditor().getDocument();
final Point<ContentNode> point = document.locate(range.getStart());
document.insertXml(point, XmlStringBuilder.
createFromXmlString("<p>paragraph</p>"));
harness.getEditor().focus(false);
I what to replace "paragraph" with current selected range's characters.
Full source:
http://code.google.com/p/wave-editor/source/browse/src/com/appspot/ast/client/layout/WaveEditor.java
result looks like this:
http://ast.appspot.com/editor/
On Wed, Aug 10, 2011 at 13:14, David Hearnden <[email protected]> wrote:
> Hi Anton,
>
> Could you please clarify what you're trying to do?
>
> Are you trying to insert a doodad programmatically into a document? Or are
> you trying to add code to replace the current browser selection in a
> document being edited with a doodad? Or are you trying to make a doodad
> appear when a user makes a selection over some text?
>
> -Dave
>
> On Wed, Aug 10, 2011 at 6:33 PM, Anton Starcev <[email protected]>wrote:
>
>> Hi all,
>>
>> How can I set doodad over selection?
>>
>> At first I tried to get text:
>>
>> Editor richEditor = harness.getRichEditor();
>> DocInitialization docInitialization =
>> richEditor.getContent().asOperation();
>> String string = docInitialization.getCharactersString(range.getStart());
>>
>> but can't find proper method for that.
>>
>>
>> --
>> Anton Startsev
>>
>
--
Anton Startsev