Skip to content

Commit

Permalink
lie some more and use the TextareaEditor
Browse files Browse the repository at this point in the history
  • Loading branch information
robojumper committed Jan 6, 2023
1 parent b4be32a commit 16bdb7f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 105 deletions.
100 changes: 0 additions & 100 deletions src/app/dim-ui/text-complete/InputTextEditor.ts

This file was deleted.

8 changes: 3 additions & 5 deletions src/app/dim-ui/text-complete/text-complete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { TextareaEditor } from '@textcomplete/textarea';
import { getHashtagsFromNote } from 'app/inventory/note-hashtags';
import clsx from 'clsx';
import { useEffect } from 'react';
import { InputTextEditor } from './InputTextEditor';

import styles from './text-complete.m.scss';

Expand Down Expand Up @@ -52,10 +51,9 @@ export function useAutocomplete(
) {
useEffect(() => {
if (textArea.current) {
const isInput = textArea.current instanceof HTMLInputElement;
const editor = isInput
? new InputTextEditor(textArea.current)
: new TextareaEditor(textArea.current);
// commit a type crime here because textcomplete says it only works with
// TextArea but happens to also work entirely fine with Input[type=text]
const editor = new TextareaEditor(textArea.current as unknown as HTMLTextAreaElement);
const textcomplete = new Textcomplete(editor, [createTagsCompleter(textArea, tags)], {
dropdown: {
className: clsx(styles.dropdownMenu, 'textcomplete-dropdown'),
Expand Down

0 comments on commit 16bdb7f

Please sign in to comment.