UNPKG

@arcgis/coding-components

Version:

Contains components for editing code in different languages. The currently supported languages are html, css, json, TypeScript, JavaScript, and Arcade.

79 lines (77 loc) 2.92 kB
/// <reference types="../../index.d.ts" /> import { Selection, editor as Editor } from 'monaco-editor'; import { PropertyValues } from 'lit'; import { PublicLitElement as LitElement, TargetedEvent } from '@arcgis/lumina'; /** * @internal */ export declare class ArcgisCodeEditor extends LitElement { /** * The instance of the Monaco Editor after the component has been rendered. * To determine when a component is rendered, you can use componentOnReady() method. * The method returns a Promise that resolves after the component rendered for the first time. * * @readonly */ get editorInstance(): Editor.IStandaloneCodeEditor | undefined; /** * Options to update on the editor. * For example: * ```json * { * "fontSize": 18 * } * ``` * * To get the full list of options set on the editor, use the editorInstance property and see Monaco Editor options documentation for more details. */ editorOptions: (Editor.IEditorOptions & Editor.IGlobalEditorOptions) | undefined; /** * The language for the editor. * Currently supported language: arcade, arcgis-sql-expression, json, css, html, javascript, typescript, and text. */ language: string | undefined; /** * A unique identifier for the model. * The unique identifier is sometimes used by language defaults to store model metadata. * For example, with arcade, the model id is used to store the arcade profile and other metadata. * The unique identifier is especially useful when there are multiple editors on the same page. */ modelId: string; /** * The initial value for the editor. * The value is the script, code, css, json, etc. */ value: string; /** @deprecated Use `value` property instead. */ getValue(): Promise<string>; /** * Inserts a snippet at the current position in the editor. * * @param {string} text - The string snippet to insert * @returns {Promise<void>} */ insertSnippet(text: string | null | undefined): Promise<void>; /** * Inserts a text at the current position in the editor. * * @param {string} text - The string to insert * @returns {Promise<void>} */ insertText(text: string | null | undefined): Promise<void>; /** * Sets the focus on the editor. * * @returns {Promise<void>} */ setFocus(): Promise<void>; /** @deprecated Use `value` property instead. */ setValue(text: string | null | undefined): Promise<void>; /** Emitted when the selection has changed. */ readonly arcgisSelectionChange: TargetedEvent<this, { selection: Selection; model: Editor.ITextModel | null | undefined; }>; /** Emitted when the value has changed (script, code, css, json, etc.) */ readonly arcgisValueChange: TargetedEvent<this, string>; }