Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support matching suggestions on spacebar #1

Merged
merged 1 commit into from
Sep 19, 2019

Conversation

ndrjkvc
Copy link

@ndrjkvc ndrjkvc commented Sep 12, 2019

Use-case/Problem

draft-js-plugins#1048

Implementation

Pass a matching function(with suggestions and lastSearchValue as arguments) from config as a prop to MentionSuggestions component. Use this function after spacebar is pressed to find a matching solution if there is one.

@ndrjkvc ndrjkvc force-pushed the feature/match-suggestion-on-spacebar branch 2 times, most recently from 78992a6 to 62b6d28 Compare September 12, 2019 17:03
Copy link

@szist szist left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can't you just point npm to a subfolder of a github repo?
like:
github:stocktwits/draft-js-plugins/draft-js-mention-plugin ?

I would prefer not installing the whole repo as a runtime dependency everywhere :(

@szist
Copy link

szist commented Sep 13, 2019

nevermind, you can't: npm/npm#2974
Although there is a mention of gitpkg in a similar issue for yarn: yarnpkg/yarn#4725 see commit yarnpkg/yarn#4725 (comment) Might be good to investigate, but we might need yet-another repo from @afahy if we want to push the built package into it's own lib :)

@szist
Copy link

szist commented Sep 13, 2019

fun fact, that issue for npm is 7 years old, so I don't think anything will change soon.

@szist
Copy link

szist commented Sep 13, 2019

@ndrjkvc Anyhow, if we just want to move on, you would have to install the whole draft-js-plugins and if you want to use your built library should be able to just include:
import createMentionPlugin from "draft-js-plugins/draft-js-mention-plugin"

@ndrjkvc
Copy link
Author

ndrjkvc commented Sep 13, 2019

@ndrjkvc Anyhow, if we just want to move on, you would have to install the whole draft-js-plugins and if you want to use your built library should be able to just include:
import createMentionPlugin from "draft-js-plugins/draft-js-mention-plugin"

That does not work, the plugins subfolders are empty after draft-js-plugins install (not really empty, they contain changelog, license, and readme)

@ndrjkvc
Copy link
Author

ndrjkvc commented Sep 13, 2019

But there may be something we can write into package.json to let npm know it should download that folder fully. @szist

@ndrjkvc ndrjkvc force-pushed the feature/match-suggestion-on-spacebar branch from 62b6d28 to 005e987 Compare September 13, 2019 08:23
@szist
Copy link

szist commented Sep 13, 2019

But there may be something we can write into package.json to let npm know it should download that folder fully. @szist

you should add/create a .npmignore file, so that it doesn't use the .gitignore to remove all libs. See https://github.com/stocktwits/web-shared/blob/develop/.npmignore vs https://github.com/stocktwits/web-shared/blob/develop/.gitignore

@ndrjkvc ndrjkvc force-pushed the feature/match-suggestion-on-spacebar branch 2 times, most recently from 66b2398 to 412284a Compare September 13, 2019 10:06
Copy link

@szist szist left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we still need the lib/*.js in git and the files in package.json ?

@ndrjkvc ndrjkvc force-pushed the feature/match-suggestion-on-spacebar branch 2 times, most recently from eabb5c0 to 7fa4455 Compare September 16, 2019 10:25
@ndrjkvc
Copy link
Author

ndrjkvc commented Sep 16, 2019

do we still need the lib/*.js in git and the files in package.json ?

No. 🎉

@ndrjkvc ndrjkvc requested a review from szist September 16, 2019 10:38
@ndrjkvc ndrjkvc force-pushed the feature/match-suggestion-on-spacebar branch from 7fa4455 to 60d66df Compare September 17, 2019 08:52
@szist szist merged commit 3773798 into master Sep 19, 2019
@szist szist deleted the feature/match-suggestion-on-spacebar branch September 19, 2019 08:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants