AbstractEditor.js 855 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. import React from 'react';
  2. import PropTypes from 'prop-types';
  3. export default class AbstractEditor extends React.Component {
  4. constructor(props) {
  5. super(props);
  6. }
  7. forceToFocus() {
  8. }
  9. /**
  10. * set caret position of codemirror
  11. * @param {string} number
  12. */
  13. setCaretLine(line) {
  14. }
  15. /**
  16. * scroll
  17. * @param {number} line
  18. */
  19. setScrollTopByLine(line) {
  20. }
  21. /**
  22. * insert text
  23. * @param {string} text
  24. */
  25. insertText(text) {
  26. }
  27. /**
  28. * dispatch onSave event
  29. */
  30. dispatchSave() {
  31. if (this.props.onSave != null) {
  32. this.props.onSave();
  33. }
  34. }
  35. }
  36. AbstractEditor.propTypes = {
  37. value: PropTypes.string,
  38. editorOptions: PropTypes.object,
  39. onChange: PropTypes.func,
  40. onScroll: PropTypes.func,
  41. onScrollCursorIntoView: PropTypes.func,
  42. onSave: PropTypes.func,
  43. onPasteFiles: PropTypes.func,
  44. };