getSelectText.ts 223 B

12345678
  1. import {selectIsEditor} from "./selection";
  2. export const getSelectText = (editor: HTMLElement, range?: Range) => {
  3. if (selectIsEditor(editor, range)) {
  4. return getSelection().toString();
  5. }
  6. return "";
  7. };