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

initial text for each tags #68

Open
@hakimscode

Description

@hakimscode

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 🤝

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions