Skip to main content

FrontEditorSelected

WLJS
Execution environment
Notebook`EditorUtils`
Context

Manipulates the last selected input cell's editor

FrontEditorSelected[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

FrontEditorSelected["Cursor", opt___] 

Get all content from the editor

FrontEditorSelected["GetDoc", opt___] 

Set content of the editor

FrontEditorSelected["SetDoc", doc_String, opt___] 

Get UID of the last used editor

FrontEditorSelected["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