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

fix(SmartPicker): Insert smart picker links as preview per default #5846

Merged
merged 1 commit into from
Jun 18, 2024

Conversation

mejo-
Copy link
Member

@mejo- mejo- commented May 29, 2024

Summary

Behaviour:

  • Inserts a link preview with smart picker from the toolbar if editor selection is empty
  • Inserts a text link with smart picker from the toolbar if editor selection is not empty
  • Always inserts a link preview with smart picker from / command as it's impossible to have ane editor selection when typing /

🖼️ Screenshots

🏡 Screencast
recording1

🏁 Checklist

  • Code is properly formatted (npm run lint / npm run stylelint / composer run cs:check)
  • Sign-off message is added to all commits
  • Tests (unit, integration and/or end-to-end) passing and the changes are covered with tests

@mejo- mejo- added this to the Nextcloud 30 milestone May 29, 2024
@mejo- mejo- requested a review from max-nextcloud May 29, 2024 15:12
@mejo- mejo- self-assigned this May 29, 2024
@mejo- mejo- changed the title fix(SmartPicker): Show smart picker links as preview per default fix(SmartPicker): Insert smart picker links as preview per default May 31, 2024
@juliusknorr
Copy link
Member

Can we also do this when using the smart picker with typing / ?

Fixes: #5838

Signed-off-by: Jonas <jonas@freesources.org>
@mejo- mejo- added 3. to review enhancement New feature or request and removed 2. developing labels Jun 18, 2024
@mejo-
Copy link
Member Author

mejo- commented Jun 18, 2024

Can we also do this when using the smart picker with typing / ?

Yep, implemented now.

@mejo- mejo- marked this pull request as ready for review June 18, 2024 13:54
@mejo- mejo- requested review from juliusknorr and enjeck June 18, 2024 14:03
Copy link
Member

@juliusknorr juliusknorr left a comment

Choose a reason for hiding this comment

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

Very nice, just two questions, not blocking

cypress/e2e/nodes/Preview.spec.js Show resolved Hide resolved
attrs: { href: link, title: 'preview' },
content: [{
type: 'text',
marks: [{
Copy link
Member

Choose a reason for hiding this comment

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

Seems a bit unexpected that the preview node still has an additional mark, can you tell why?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it matches the data structure created otherwise. We basically change the wrapping block node between paragraph and preview when switching between the two:

The setPreview function above converts the surrounding paragraph of a link into a preview node:
grafik

If you look at unsetPreview above it also only unwraps the link inside the preview node:
grafik

Copy link
Collaborator

@max-nextcloud max-nextcloud left a comment

Choose a reason for hiding this comment

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

Looks great!

@mejo-
Copy link
Member Author

mejo- commented Jun 18, 2024

/backport to stable29

@mejo- mejo- merged commit 00cc04e into main Jun 18, 2024
61 of 63 checks passed
@mejo- mejo- deleted the fix/smart_picker_preview branch June 18, 2024 16:15
@nextcloud nextcloud deleted a comment from backportbot bot Jun 18, 2024
mejo- added a commit that referenced this pull request Jun 19, 2024
Follow-up for #5846

Signed-off-by: Jonas <jonas@freesources.org>
backportbot bot pushed a commit that referenced this pull request Jun 24, 2024
Follow-up for #5846

Signed-off-by: Jonas <jonas@freesources.org>
mejo- added a commit that referenced this pull request Jun 26, 2024
Follow-up for #5846

Signed-off-by: Jonas <jonas@freesources.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review enhancement New feature or request
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Display links inserted from smart picker as preview per default
3 participants