Skip to main content

FrontEditorSelected

WLJS
Execution environment
Notebook`EditorUtils`
Context

Manipulates the last selected input cell's editor

FrontEndEditorSelected[op_String, arguments__, opt___] Null | _String
warning

This has to be executed in WLJS interpreter, i.e. using FrontSubmit or FrontFetchAsync

Methods

There are following methods available

Get selected content

FrontEndEditorSelected["Get", opt___] _String

Returns selected string. For example

With[{win = CurrentWindow[]},
EventHandler[InputButton[], Function[Null,

Then[FrontFetchAsync[FrontEditorSelected["Get"], "Window"->win], Function[result,
Print[result];
]
]
]]
]

Insert or replace selected content

FrontEndEditorSelected["Set", data_String, opt___] 

Inserts or replaces selected text with a provided string

With[{win = CurrentWindow[]},
EventHandler[InputButton["Replace"],
Function[Null,
FrontSubmit[FrontEditorSelected["Set", "Yo"], "Window"->win];
]
]
]

Get cursor position

FrontEndEditorSelected["Cursor", opt___] 

Get all content from the editor

FrontEndEditorSelected["GetDoc", opt___] 

Set content of the editor

FrontEndEditorSelected["SetDoc", doc_String, opt___] 

Get UID of the last used editor

FrontEndEditorSelected["Editor"] _String 

See Options for applications.

Evaluate

danger

Not implemented

Options

"Editor"

Specify an editor, from which the all properties will be taken or modified. By the default it takes the last editor, that a user operated

You can get an id or an editor using Get UID of the last used editor