ace.d.ts 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. import { Ace } from "ace-builds";
  2. import * as AceBuilds from "ace-builds";
  3. import * as PropTypes from "prop-types";
  4. import * as React from "react";
  5. import { IAceEditor, IAceOptions, ICommand, IEditorProps, IMarker } from "./types";
  6. /**
  7. * See https://github.com/ajaxorg/ace/wiki/Configuring-Ace
  8. */
  9. export interface IAceEditorProps {
  10. name?: string;
  11. style?: React.CSSProperties;
  12. /** For available modes see https://github.com/thlorenz/brace/tree/master/mode */
  13. mode?: string | object;
  14. /** For available themes see https://github.com/thlorenz/brace/tree/master/theme */
  15. theme?: string;
  16. height?: string;
  17. width?: string;
  18. className?: string;
  19. fontSize?: number | string;
  20. showGutter?: boolean;
  21. showPrintMargin?: boolean;
  22. highlightActiveLine?: boolean;
  23. focus?: boolean;
  24. cursorStart?: number;
  25. wrapEnabled?: boolean;
  26. readOnly?: boolean;
  27. minLines?: number;
  28. maxLines?: number;
  29. navigateToFileEnd?: boolean;
  30. debounceChangePeriod?: number;
  31. enableBasicAutocompletion?: boolean | string[];
  32. enableLiveAutocompletion?: boolean | string[];
  33. tabSize?: number;
  34. value?: string;
  35. placeholder?: string;
  36. defaultValue?: string;
  37. scrollMargin?: number[];
  38. enableSnippets?: boolean;
  39. onSelectionChange?: (value: any, event?: any) => void;
  40. onCursorChange?: (value: any, event?: any) => void;
  41. onInput?: (event?: any) => void;
  42. onLoad?: (editor: Ace.Editor) => void;
  43. onValidate?: (annotations: Ace.Annotation[]) => void;
  44. onBeforeLoad?: (ace: typeof AceBuilds) => void;
  45. onChange?: (value: string, event?: any) => void;
  46. onSelection?: (selectedText: string, event?: any) => void;
  47. onCopy?: (value: string) => void;
  48. onPaste?: (value: string) => void;
  49. onFocus?: (event: any, editor?: Ace.Editor) => void;
  50. onBlur?: (event: any, editor?: Ace.Editor) => void;
  51. onScroll?: (editor: IEditorProps) => void;
  52. editorProps?: IEditorProps;
  53. setOptions?: IAceOptions;
  54. keyboardHandler?: string;
  55. commands?: ICommand[];
  56. annotations?: Ace.Annotation[];
  57. markers?: IMarker[];
  58. }
  59. export default class ReactAce extends React.Component<IAceEditorProps> {
  60. static propTypes: PropTypes.ValidationMap<IAceEditorProps>;
  61. static defaultProps: Partial<IAceEditorProps>;
  62. editor: IAceEditor;
  63. refEditor: HTMLElement;
  64. debounce: (fn: any, delay: number) => (...args: any) => void;
  65. silent: boolean;
  66. constructor(props: IAceEditorProps);
  67. isInShadow(node: HTMLElement): boolean;
  68. componentDidMount(): void;
  69. componentDidUpdate(prevProps: IAceEditorProps): void;
  70. handleScrollMargins(margins?: number[]): void;
  71. componentWillUnmount(): void;
  72. onChange(event: any): void;
  73. onSelectionChange(event: any): void;
  74. onCursorChange(event: any): void;
  75. onInput(event?: any): void;
  76. onFocus(event: any): void;
  77. onBlur(event: any): void;
  78. onCopy({ text }: {
  79. text: string;
  80. }): void;
  81. onPaste({ text }: {
  82. text: string;
  83. }): void;
  84. onScroll(): void;
  85. handleOptions(props: IAceEditorProps): void;
  86. handleMarkers(markers: IMarker[]): void;
  87. updatePlaceholder(): void;
  88. updateRef(item: HTMLElement): void;
  89. render(): JSX.Element;
  90. }