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

Added support for slides.com #30

Merged
merged 16 commits into from
Oct 23, 2019

Conversation

anuraghazra
Copy link
Contributor

@anuraghazra anuraghazra commented Oct 11, 2019

What:
Added support for slides.com

Why:
closes #8

Checklist:

  • Documentation
  • Tests
  • Ready to be merged

@anuraghazra

This comment has been minimized.

@MichaelDeBoey
Copy link
Owner

@anuraghazra (#8 (comment)):

I tried to implement this, seems like it's a bit tricky to implement the shouldTransform check because slides don't have a distinct url to check for embeds

i tried this approach, is it good? do you have any idea how we can do it?

(host === 'slides.com' || host === 'www.slides.com') && !!pathname.match(/^\/.*\w\/.*\w\/?[^embed].\/?$/ig)

although it fails in this case

    'Slides url (valid) with extra pathname': {
      url: 'https://slides.com/news/math/asdasd',
      valid: false,
    },

@MichaelDeBoey
Copy link
Owner

@anuraghazra (#8 (comment)):

above check passes in all these tests

  {
    'non-Slides url': {
      url: 'https://not-a-slides-url.com',
      valid: false,
    },
    "non-Slides url ending with 'slides.com'": {
      url: 'https://this-is-not-slides.com',
      valid: false,
    },
    "non-Slides url ending with 'slides.com' and having '/embed/'": {
      url: 'https://this-is-not-codepen.io/news/math/embed',
      valid: false,
    },
    'explore page': {
      url: 'https://slides.com/explore',
      valid: false,
    },
    'random page': {
      url: 'https://slides.com/random-page',
      valid: false,
    },
    'Slides embed url': {
      url: 'https://slides.com/news/math/embed',
      valid: false,
    },
    'Slides embed url with trailing slash': {
      url: 'https://slides.com/news/math/embed/',
      valid: false,
    },
    'Slides homepage': {
      url: 'https://slides.com/',
      valid: false,
    },
    'Slides url': {
      url: 'https://slides.com/news/math',
      valid: true,
    },
    'Slides user slide': {
      url: 'https://slides.com/valentinogagliardi/django-rest#/1',
      valid: true,
    },
    'Slides url with trailing slash': {
      url: 'https://slides.com/news/math/',
      valid: true,
    },
    "Slides url having 'www' subdomain": {
      url: 'https://www.slides.com/news/math',
      valid: true,
    },
  }

@anuraghazra
Copy link
Contributor Author

anuraghazra commented Oct 12, 2019

@MichaelDeBoey i tried with a different approach for checking if the url is valid or not, seems like its working, can you reviewing the code and adding more tests if necessary? (maybe needs some refactoring because i just wanted to make sure it works at first)

EDIT: also did manual testing, seems to be working fine, valid ones also works fine with extra query params
Hello World   Gatsby Starter Blog (1)

@MichaelDeBoey MichaelDeBoey added the ⚙️ Slides Issue or pull request regarding Slides label Oct 13, 2019
Copy link
Owner

@MichaelDeBoey MichaelDeBoey left a comment

Choose a reason for hiding this comment

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

Hi @anuraghazra!

Thanks for taking the time to implement the @slides transformer.
@hakimel commented on Twitter for all the possible formats.
https://twitter.com/hakimel/status/1182724020824883202

src/Slides.js Outdated Show resolved Hide resolved
src/__tests__/Slides.js Outdated Show resolved Hide resolved
src/__tests__/Slides.js Outdated Show resolved Hide resolved
src/Slides.js Outdated Show resolved Hide resolved
src/index.js Show resolved Hide resolved
@MichaelDeBoey
Copy link
Owner

Please also rebase on latest master so you get the newest tests added in #27. 🙂

@anuraghazra
Copy link
Contributor Author

@MichaelDeBoey i will try to do above changes as soon as possible when i get some time.

@anuraghazra
Copy link
Contributor Author

@MichaelDeBoey fixed the /embed#1 hash issues check it out.

src/Slides.js Outdated Show resolved Hide resolved
src/__tests__/Slides.js Outdated Show resolved Hide resolved
@anuraghazra
Copy link
Contributor Author

anuraghazra commented Oct 22, 2019

Don't know what happened there, it automatically says merged master. and my own commit msg doesn't show up. (something is wrong with my branch, or maybe i'm doing something wrong)

whatever, i pushed the changes. 😃

@MichaelDeBoey
Copy link
Owner

@anuraghazra I rebased your branch on upstream/master, so everything should be fine now 🙂

@anuraghazra
Copy link
Contributor Author

What else should i do? 🤔

@MichaelDeBoey
Copy link
Owner

@anuraghazra I've updated the tests.
If these tests pass, I think you've covered all possible Deck urls. 🙂

@anuraghazra
Copy link
Contributor Author

Okay! i will cover the tests. 😄

@anuraghazra
Copy link
Contributor Author

anuraghazra commented Oct 22, 2019

Hey @MichaelDeBoey just wondering if its possible to create a slide named "embed"?

https://team.slides.com/teamname/embed
https://slides.com/michaeldeboey/embed

EDIT: okay it is possible https://slides.com/anuraghazra/embed/embed#/

@anuraghazra
Copy link
Contributor Author

anuraghazra commented Oct 22, 2019

i changed this, i think if we provide www it should not remove www from url

FAIL  src/__tests__/Slides.js
[test]   ● get Slides iframe url › user Deck url having 'www' subdomain

[test]     Expected: "https://slides.com/kentcdodds/oss-we-want/embed"
[test]     Received: "https://www.slides.com/kentcdodds/oss-we-want/embed"

Copy link
Owner

@MichaelDeBoey MichaelDeBoey left a comment

Choose a reason for hiding this comment

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

@anuraghazra I've rebased onto upstream/master again.
Still 1 tests that fails tho. 😕

Also left some comments

src/Slides.js Outdated Show resolved Hide resolved
src/Slides.js Outdated Show resolved Hide resolved
src/Slides.js Outdated Show resolved Hide resolved
@MichaelDeBoey
Copy link
Owner

@anuraghazra Since we remove the www part in the other transformers, I think we should do it here too for consistency.

@anuraghazra
Copy link
Contributor Author

@MichaelDeBoey okay updated the code, well i did not noticed that you updated some code in master branch.

src/Slides.js Outdated Show resolved Hide resolved
src/Slides.js Outdated Show resolved Hide resolved
@anuraghazra
Copy link
Contributor Author

@MichaelDeBoey 🤔 why tests are not running? curious!

src/Slides.js Outdated Show resolved Hide resolved
src/Slides.js Outdated Show resolved Hide resolved
src/index.js Show resolved Hide resolved
src/Slides.js Outdated Show resolved Hide resolved
src/Slides.js Outdated Show resolved Hide resolved
src/Slides.js Outdated Show resolved Hide resolved
src/Slides.js Outdated Show resolved Hide resolved
@anuraghazra
Copy link
Contributor Author

@MichaelDeBoey done!

Copy link
Owner

@MichaelDeBoey MichaelDeBoey left a comment

Choose a reason for hiding this comment

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

@anuraghazra One last remark and this one's good to merge 🙂

src/Slides.js Outdated Show resolved Hide resolved
@anuraghazra
Copy link
Contributor Author

oh wait we should also remove webkitallowfullscreen mozallowfullscreen allowfullscreen and use allow instead

@MichaelDeBoey
Copy link
Owner

@anuraghazra I'm not in favor of doing that right now tbh.
The official embed (when doing it on the Slides website) have them in their, so I'd like to keep them in there too for now.

We can still change that on a later moment.

@anuraghazra
Copy link
Contributor Author

Okay no problem, let it be as it is.

Copy link
Owner

@MichaelDeBoey MichaelDeBoey left a comment

Choose a reason for hiding this comment

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

Thanks for taking the time to implement the Slides transformer @anuraghazra! 👊

I just rebased your branch onto upstream/master, made getSlidesIFrameSrc a bit clearer and added a comment to getTrimmedPathName so people don't have to figure out what the regex is doing.

@MichaelDeBoey MichaelDeBoey merged commit fe01502 into MichaelDeBoey:master Oct 23, 2019
@MichaelDeBoey
Copy link
Owner

🎉 This PR is included in version 1.4.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released ⚙️ Slides Issue or pull request regarding Slides
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support Slides.com
2 participants