Skip to content
This repository has been archived by the owner on Jun 13, 2023. It is now read-only.

initial text for each tags #68

Open
hakimscode opened this issue Nov 11, 2020 · 0 comments
Open

initial text for each tags #68

hakimscode opened this issue Nov 11, 2020 · 0 comments

Comments

@hakimscode
Copy link

hakimscode commented Nov 11, 2020

Hello @peterp ,

I was wondering if there is feature for initial text for each tags. Because, in props initialText just affect on the first tag. So it would be nice if the initial text also implement on every tags.

For example I want user to automatically input tags with the first character is '#'.

I try to modified your library, just basically add a new props initialEachText and put it on

showLastTag = () => {
    this.setState(state =>
      ({
        tags: state.tags.slice(0, -1),
        text: state.tags.slice(-1)[0] || this.state.initialEachText
      }),
      () =>
        this.props.onChangeTags && this.props.onChangeTags(this.state.tags)
    );
  };

  addTag = text => {
    this.setState(state =>
      ({
        tags: [...state.tags, text.trim()],
        text: this.state.initialEachText
      }),
      () => this.props.onChangeTags && this.props.onChangeTags(this.state.tags)
    );
  };

Just changed the " " (space) to initialEachText that can be modified.

And I just set the props initialText={'#'} and initialEachText={'#'}.

This would be great if you considering to add this feature. Thank you 🤝

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant