Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface ExtMonacoEditorFramed

Hierarchy

Index

Properties

cfg

The widget-specific configuration of this widget instance.

id

id: string

jq

jq: JQuery

A reference to the base (container) element of this widget.

jqEl

jqEl: HTMLElement

A reference to the base (container) element of this widget.

jqId

jqId: string

widgetVar

widgetVar: string

The widget variable of this widget instance.

Methods

callBehavior

  • callBehavior(name: string, ...args: unknown[]): void
  • If it exists, calls the behavior with the given name.

    Parameters

    • name: string

      Name of the behavior.

    • Rest ...args: unknown[]

      Additional arguments for the behavior.

    Returns void

destroy

  • destroy(): void
  • Destroys this widget. Called by the PrimeFaces framework.

    Returns void

getEditorContainer

  • getEditorContainer(): JQuery
  • Returns JQuery

    The HTML container element holding the editor. It exists even if the editor was not created yet.

getInput

  • getInput(): JQuery
  • Returns JQuery

    The hidden textarea holding the value of the editor (eg. the code being edited, this is also the value that is sent when the form is submitted).

getJQ

  • getJQ(): JQuery
  • Returns JQuery

    A reference to the base (container) element of this widget.

getValue

  • getValue(): Promise<string>
  • Gets the value of this editor. May be called as soon as this widget is accessible, even when the monaco editor was not loaded or initialized yet.

    Returns Promise<string>

    A promise with the current value of this editor.

hasBehavior

  • hasBehavior(name: string): boolean
  • Parameters

    • name: string

      Name of the behavior to check.

    Returns boolean

    Whether any handlers are registered for the given behavior.

init

  • init(configuration: {}): void
  • Initializes this widget. Called by the PrimeFaces framework.

    Parameters

    • configuration: {}

      Configuration as set on the server-side.

      • [key: string]: any

    Returns void

invokeMonaco

  • invokeMonaco<K>(method: K, ...args: Parameters<IStandaloneCodeEditor[K]>): ReturnType<IStandaloneCodeEditor[K]>
  • Invokes the given method on the monaco editor instance in the iframe, and returns the result. As the communication with the iframes is done via postMessage, the result is returned asynchronously.

    Type parameters

    Parameters

    • method: K

      A method of the monaco editor instance to invoke.

    • Rest ...args: Parameters<IStandaloneCodeEditor[K]>

      Arguments that are passed to the method.

    Returns ReturnType<IStandaloneCodeEditor[K]>

    A promise that resolves with the value returned by the given method.

invokeMonacoScript

  • invokeMonacoScript<TRetVal, TArgs>(script: string | ((editor: IStandaloneCodeEditor, ...args: TArgs) => TRetVal), ...args: TArgs): Promise<TRetVal>
  • Invokes the given script on the monaco editor instance in the iframe, and returns the result. As the communication with the iframes is done via postMessage, the result is returned asynchronously. Note that the script if converted to a string, send to the framed editor and executed. Closing over variables in the lambda is NOT supported. Explicitly specify those variables as the arguments, they will be passed to the iframe.

    Type parameters

    • TRetVal

    • TArgs: any[]

    Parameters

    • script: string | ((editor: IStandaloneCodeEditor, ...args: TArgs) => TRetVal)
    • Rest ...args: TArgs

      Arguments that are passed to the method.

    Returns Promise<TRetVal>

    A promise that resolves with the value returned by the given method.

isDetached

  • isDetached(): boolean
  • Whether this widget is attached to the DOM currently.

    Returns boolean

isReady

  • isReady(): boolean
  • Returns boolean

    true when the editor was already loaded and initialized and can be interacted with via getMonaco(), false otherwise.

refresh

  • refresh(configuration: {}): void
  • Refreshes this widget with the given configuration.

    Parameters

    • configuration: {}

      New configuration for this widget.

      • [key: string]: any

    Returns void

removeScriptElement

  • removeScriptElement(clientId: string): void
  • Parameters

    • clientId: string

      Client ID of the script element to remove.

    Returns void

setValue

  • setValue(newValue: string): Promise<void>
  • Sets the value of this editor. May be called as soon as this widget is accessible, even when monaco editor was not loaded or initialized yet. The value will be set on the editor once it becomes ready.

    Parameters

    • newValue: string

      The new value to set.

    Returns Promise<void>

    A promise that resolves once the value was set.

whenReady

  • whenReady(): Promise<this>
  • Returns Promise<this>

    A promise that is resolved once the editor has finished loading and was created successfully.

Generated using TypeDoc