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

Enable tag search in editor after typing # #192

Closed
guoliu opened this issue Aug 2, 2020 · 7 comments · Fixed by #221
Closed

Enable tag search in editor after typing # #192

guoliu opened this issue Aug 2, 2020 · 7 comments · Fixed by #221
Assignees

Comments

@guoliu
Copy link
Contributor

guoliu commented Aug 2, 2020

Is your feature request related to a problem? Please describe.
Currently an user can type @ in editor and enable user search and selection. As tag become more important, an user should also be able to type # in editor and enable tag search and selection

Describe the solution you'd like
When an user type # and some content in editor, a dropdown of tags should appear according to the content the user typed, allowing the user to select which tag s/he would like to mention. This should be similar with typing @ for an user.

Additional context
Currently the editor API only support mentioning user, see example here. We need to either add mention tag to the API, or generalize to any type of mentioning.

@mayyyc mayyyc self-assigned this Aug 2, 2020
@guoliu
Copy link
Contributor Author

guoliu commented Aug 12, 2020

This should mostly be editor changes, moving to editor repo now.

@MMMayC do you have an editor API design in mind? Examples of current usage can be found here and here. The API was really a PoC and is quite out dated, if you have a new API design in mind we can work together 😄

@guoliu guoliu transferred this issue from thematters/developer-resource Aug 12, 2020
@guoliu guoliu self-assigned this Aug 12, 2020
@guoliu guoliu added this to To do in New Features via automation Aug 12, 2020
@mayyyc
Copy link
Contributor

mayyyc commented Aug 14, 2020

@guoliu I'm thinking something like this

<MattersArticleEditor
          editorContent={content || ''}
          editorContentId={id}
          editorUpdate={update}
          editorUpload={upload}
          eventName={ADD_TOAST}
          language={lang.toUpperCase()}
          mentionLoading={loading}
          mentionKeywordChange={mentionKeywordChange}
          mentionUsers={mentionUsers}
          mentionListComponent={MentionUserList}
          **mentionTags={mentionTags}
          mentionTagListComponent={MentionTagList}
          mentionTagLoading={tagLoading}
          mentionTagKeywordChange={mentionTagKeywordChange}**
          readOnly={readyOnly}
          siteDomain="matters.news"
          theme="bubble"
          titleDefaultValue={title || ''}
          uploadAssetDomain={process.env.NEXT_PUBLIC_ASSET_DOMAIN || ''}
        />

on the editor side, I'm looking at src/modules/mention.ts and thinking extend it to make it work for tags as well.

Let me know if you have any suggestions on the API or if I'm on the right path.

I've been struggling a little bit understanding Quill last weekend, but I've set aside my today for this issue so hopefully i can figure something out. I'm really keen on this =)

@robertu7
Copy link
Contributor

robertu7 commented Aug 15, 2020

Hi @mayyyc, Thanks for diving into this repo!

I'm refactoring this repo and plan to remove mention* props. Here are some backgrounds:

In this PR, we added a new component called <SearchSelectDialoag>, to search & select nodes, which can be used by # (add a tag) and @ (mention a user).

While typing @ or #, instead of showing the mentionListComponent inside the <Mention> of matters-editor, we will popup the <SearchSelectDialoag> outside of it. I expect this move will make the API cleaner.

Feel free to comment if you have any ideas!

@mayyyc
Copy link
Contributor

mayyyc commented Aug 15, 2020

@robertu7 so all the mentionLoading/mentionUsers/mentionListComponent will be handled outside the editor? and we only listen to @ or # in the editor and show <SearchSelectDialog>?

That sounds like a nice and clean solution, I like it. I'll look into the implementation of mention module a little more and keep this in mind.

Thanks for the update.

@robertu7
Copy link
Contributor

@mayyyc Yes! that's what I thought.

Since what I am working on could block the development of #, let's figure out how the workflow would be:

For mention user (@) refactoring, I have pushed a commit as the first step, next will be working on src/modules/mention, to handle the typing, showing, inserting logics. (@robertu7 working in progress)

For tag adding (#) feature of this issue, we can make a blot first, then the module. (@mayyyc feel free to pick if you like :D)

mayyyc added a commit to mayyyc/matters-editor that referenced this issue Aug 22, 2020
@mayyyc
Copy link
Contributor

mayyyc commented Sep 2, 2020

@robertu7 how is your progress on modules/mention? I'm thinking it will handle tag as well, is that right?

If you haven't started, i might give it a go.

@robertu7
Copy link
Contributor

robertu7 commented Sep 3, 2020

@mayyyc We are working on other features, so #195 may not have any commit during the next few weeks. Please feel free to take it, thanks a lot!

BTW, thematters/matters-web#1440 has already been deployed to production, currently used by 「添加精選作品」and「添加我的作品」in tag detail page, you might have a try.

@guoliu guoliu moved this from To do to Select for development in New Features Sep 15, 2020
@guoliu guoliu linked a pull request Sep 16, 2020 that will close this issue
@guoliu guoliu moved this from Select for development to In progress in New Features Sep 16, 2020
@guoliu guoliu linked a pull request Sep 22, 2020 that will close this issue
New Features automation moved this from In progress to Done Sep 22, 2020
tx0c pushed a commit that referenced this issue Oct 5, 2021
this is picked up from PR #195 rebased to latest develop

but why #192 relevant?
tx0c pushed a commit that referenced this issue Oct 5, 2021
this is picked up from PR #195 rebased to latest develop

but why #192 relevant?
tx0c pushed a commit that referenced this issue Oct 6, 2021
this is picked up from PR #195 rebased to latest develop

but why #192 relevant?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
New Features
  
Done
Development

Successfully merging a pull request may close this issue.

3 participants