feat: tag suggestions (#2036)

* feat: figure out how to read caret position

* feat: figure out how to read caret position

* feat: create and style Editor/TagSuggestions.txs

* feat: progress on detect when to show and hide

* feat: progress on when to show and hide and setting position

* feat: toggling and exact placement done

* fix: pnpm lock problems

* feat: filter suggestions by partially typed tag name

* style: prettier

* chore: add types package for textarea-caret

* feat: handle option click

* style: prettier

* style: reorder imports

Co-authored-by: boojack <stevenlgtm@gmail.com>

---------

Co-authored-by: boojack <stevenlgtm@gmail.com>
This commit is contained in:
Maciej Kasprzyk
2023-07-30 16:55:45 +02:00
committed by GitHub
parent c1cbfd5766
commit 5d3ea57d82
4 changed files with 963 additions and 723 deletions

View File

@ -1,4 +1,5 @@
import { forwardRef, ReactNode, useCallback, useEffect, useImperativeHandle, useRef } from "react";
import TagSuggestions from "./TagSuggestions";
import "@/less/editor.less";
export interface EditorRefActions {
@ -134,6 +135,7 @@ const Editor = forwardRef(function Editor(props: Props, ref: React.ForwardedRef<
onPaste={onPaste}
onInput={handleEditorInput}
></textarea>
<TagSuggestions editorRef={editorRef} editorActions={ref} />
</div>
);
});