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

Add generic search engine menu item #164

Closed

Conversation

hns258
Copy link
Contributor

@hns258 hns258 commented Sep 11, 2022

Adding an addSearchWithOther option that displays a Search with {searchEngine} menu item when an object containing the title and url of a search engine is provided.

Just wanted to mention a few items I wasn't sure about (still relatively new to js):

  • Considered creating an interface or typedef for the object addSearchWithOther expects but wasn't sure if that'd be "overkill" since a developer has to jump to another section to see the properties needed. I can update to one of those if preferred, though.
  • Was on the fence for the option name. I'm willing to change to showSearchWithOther, showOtherSearchEngine, or anything else. I just wasn't sure if there might be confusion with the others starting with show... being booleans (but maybe it's clear enough with the readme and types file?) so for now decided to err on "more clarity" despite looking a bit out of place.
  • Considered doing some validation on the url provided but due to the following, it seemed safe to assume that for ~95% of the use cases, the url would be "clean" so decided not to but can update, if preferred.
    • the URLs should be from a small set of sites
    • this module is used by developers
    • the check seems to need a helper function or 3rd party lib (didn't want to unnecessarily clutter the code)

Fixes #155

Squashed commits:

[WIP] Simpler implementation of adding generic "Search with ..." menu item (search engine title and url provided by user). Still needs some tweaking

[WIP] Ensure URLs copied from Chrome's available search engines work with this implementation

[WIP] Update documentation, renaming option

apply fixes indicated by XO

Merge branch 'sindresorhus:main' into add-other-search-engine

wording tweaks, clean ups to be more consistent

simplify

more tweaks

more tweaks

reword

use tabs instead of spaces for example (shows up in readme with refined github)

properly handle case when addSearchWithOther option is not set

add a "control" test where no options are set to ensure default scenario is working

Revert "add a "control" test where no options are set to ensure default scenario is working"

This reverts commit 39d8512.

fix casing

more doc tweaks

missed rewording

simplify @Property items

* move length check of addSearchWithOther closer to undefined check (confused when revisiting after awhile) * update ts types file to match readme's property section * fix whitespaces

more tweaks

fix XO trailing space errors

add types for addSearchWithOther properties
@hns258 hns258 force-pushed the add-other-search-engine-squashed branch from 6eeade7 to 53a6837 Compare September 11, 2022 17:50
@sindresorhus
Copy link
Owner

Make sure you have updated all the required places. See earlier submission for what to update:

@sindresorhus
Copy link
Owner

Considered creating an interface or typedef for the object addSearchWithOther expects but wasn't sure if that'd be "overkill" since a developer has to jump to another section to see the properties needed. I can update to one of those if preferred, though.

I don't think that's needed.

Considered doing some validation on the url provided but due to the following, it seemed safe to assume that for ~95% of the use cases, the url would be "clean" so decided not to but can update, if preferred.

I don't think validation is needed.

index.js Outdated Show resolved Hide resolved
index.d.ts Outdated Show resolved Hide resolved
@hns258 hns258 force-pushed the add-other-search-engine-squashed branch from 0e0c4d6 to 7d9280f Compare October 27, 2022 13:42
@hns258 hns258 force-pushed the add-other-search-engine-squashed branch from 18f7d07 to e934d0e Compare October 27, 2022 14:27
@hns258
Copy link
Contributor Author

hns258 commented Nov 2, 2022

Realized this PR probably isn't the preferred solution to the referenced issue, closing it. Apologies for any wasted time.

@hns258 hns258 closed this Nov 2, 2022
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.

Add other search engines
2 participants