UNPKG

@craftercms/studio-ui

Version:

Services, components, models & utils to build CrafterCMS authoring extensions.

91 lines (89 loc) 2.97 kB
/* * Copyright (C) 2007-2022 Crafter Software Corporation. All Rights Reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as published by * the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ /// <reference types="ace" /> import React from 'react'; import { CSSObject as CSSProperties } from 'tss-react'; export interface AceOptions { selectionStyle: 'line' | 'text'; highlightActiveLine: boolean; highlightSelectedWord: boolean; readOnly: boolean; cursorStyle: 'ace' | 'slim' | 'smooth' | 'wide'; mergeUndoDeltas: false | true | 'always'; behavioursEnabled: boolean; wrapBehavioursEnabled: boolean; autoScrollEditorIntoView: boolean; copyWithEmptySelection: boolean; useSoftTabs: boolean; navigateWithinSoftTabs: boolean; enableMultiselect: boolean; hScrollBarAlwaysVisible: boolean; vScrollBarAlwaysVisible: boolean; highlightGutterLine: boolean; animatedScroll: boolean; showInvisibles: boolean; showPrintMargin: boolean; printMarginColumn: number; printMargin: false | number; fadeFoldWidgets: boolean; showFoldWidgets: boolean; showLineNumbers: boolean; showGutter: boolean; displayIndentGuides: boolean; fontSize: number | string; fontFamily: string; maxLines: number; minLines: number; scrollPastEnd: number | boolean; fixedWidthGutter: boolean; theme: string; scrollSpeed: number; dragDelay: number; dragEnabled: boolean; focusTimout: number; tooltipFollowsMouse: boolean; firstLineNumber: number; overwrite: boolean; newLineMode: 'auto' | 'unix' | 'windows'; useWorker: boolean; tabSize: number; wrap: boolean | number; foldStyle: 'markbegin' | 'markbeginend' | 'manual'; mode: string; enableBasicAutocompletion: boolean; enableLiveAutocompletion: boolean; enableSnippets: boolean; enableEmmet: boolean; useElasticTabstops: boolean; } export type AceEditorClassKey = 'root' | 'editorRoot'; export type AceEditorStyles = Partial<Record<AceEditorClassKey, CSSProperties>>; export interface AceEditorProps extends Partial<AceOptions> { value?: any; classes?: Partial<Record<AceEditorClassKey, string>>; autoFocus?: boolean; styles?: AceEditorStyles; extensions?: string[]; onChange?(e: any): void; onInit?(editor: AceAjax.Editor): void; } declare global { interface Window { ace: AceAjax.Ace; } } export declare const AceEditor: React.ForwardRefExoticComponent<AceEditorProps & React.RefAttributes<AceAjax.Editor>>; export default AceEditor;