Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface ExtMonacoEditorInline

The monaco editor widget. This is a thin wrapper around the actual monaco editor and mainly takes care of initializing the editor, ie. it serves as a bridge between JSF/PrimeFaces and monaco editor.

Please note that monaco editor is initialized asynchronously - getMonaco() may return undefined until monaco editor was created successfully. You can use whenReady to be notified once the editor was created.

Hierarchy

Index

Properties

cfg

The widget-specific configuration of this widget instance.

Readonly extender

extender: Partial<MonacoExtenderInline>

The extender that was set for this monaco editor widget. It can be used to customize the editor via JavaScript.

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

Readonly options

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.

getMonaco

  • Finds the current instance of the monaco editor, if it was created already. Use this to interact with the editor via JavaScript. See also the monaco editor API docs.

    Returns IStandaloneCodeEditor | undefined

    The current monaco editor instance. undefined in case the editor was not created yet.

getValue

  • getValue(): 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 string

    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

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): 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 void

tryWithMonaco

  • tryWithMonaco<TReturn>(handler: (editor: IStandaloneCodeEditor) => TReturn, defaultReturnValue: TReturn): TReturn
  • tryWithMonaco<TReturn>(handler: (editor: IStandaloneCodeEditor) => TReturn): TReturn | undefined
  • Calls the given handler with the current monaco editor instance if it exists.

    Type parameters

    • TReturn

      Type of the return value.

    Parameters

    • handler: (editor: IStandaloneCodeEditor) => TReturn

      Handler that is invoked with the current monaco editor instance.

    • defaultReturnValue: TReturn

      Default value that is returned when no editor exists currently, or when the handler throws.

    Returns TReturn

    The return value of the handler, or the default return value if either no editor exists or the handler throws an error.

  • Calls the given handler with the current monaco editor instance if it exists.

    Type parameters

    • TReturn

      Type of the return value.

    Parameters

    Returns TReturn | undefined

    The return value of the handler, or undefined if either no editor exists or the handler throws an error.

whenReady

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

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

withMonaco

  • Calls the given handler with the current monaco editor instance if it exists.

    Type parameters

    • TReturn

      Type of the return value.

    Parameters

    Returns TReturn

    The return value of the handler, or the default return value if no editor exists.

  • Calls the given handler with the current monaco editor instance if it exists.

    Type parameters

    • TReturn

      Type of the return value.

    Parameters

    Returns TReturn | undefined

    The return value of the handler, or undefined if no editor exists.

Generated using TypeDoc