WLJS LogoWLJS Notebook

FrontEditorSelected

Frontend symbol

Manipulates the last selected input cell's editor

FrontEditorSelected[op_String, arguments__, opt___] Null | _String

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

Methods

There are following methods available

Get selected content

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

FrontEditorSelected["Set", data_String, opt___] 

Inserts or replaces selected text with a provided string

With[{},
  EventHandler[InputButton["Replace"],
    Function[Null, 
      FrontSubmit[FrontEditorSelected["Set", "Yo"]];
    ]
  ]
] 

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

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

On this page