prateekkalra / Selection-js

A lightweight javascipt library which provides users with a set of options in the form of a small popover over the selected portion of text.
https://prateekkalra.github.io/Selection-js/
MIT License
93 stars 61 forks source link

Add more features #2

Open prateekkalra opened 6 years ago

prateekkalra commented 6 years ago

Add more options in the popover along with the ones present.

AlexErling commented 6 years ago

Hi, I would also be interested in working on this one as well. What other options do you think would be good to add?

Thanks

prateekkalra commented 6 years ago

Anything that the user could do with the selected text. Avoid adding more sharing options(like linkedin,instagram).

sourabhbajaj commented 6 years ago

I am interested in doing this. Do you think API extension to include custom options with event functions will be useful? It can probably support font awesome icons by default and developer can specify an action for the click event on the custom icon.

prateekkalra commented 6 years ago

@sourabhbajaj Could you elaborate on what kind of custom options the user can add?

sourabhbajaj commented 6 years ago

Lets say this:

var selection = new Selection();
  selection.config({
    translate:{
        icon:'fa-language',
        'click':function(text){
              // Send text to Google Translate API and on return, replace the text into different language.
         }
    },
    speak:true,
    backgroundColor: 'crimson',
    iconColor: '#fff',
  }).init();

OR:

var selection = new Selection();
  selection.config({
    bounce:{
        icon:'fa-language',
        'click':function(text){
              // Add effects to text to make the character bounce
         }
    },
    speak:true,
    backgroundColor: 'crimson',
    iconColor: '#fff',
  }).init();

There of course are very vague examples but it will enable developers to extend the plugin as per their requirements.

prateekkalra commented 6 years ago

@sourabhbajaj You can work on it, but make sure the users still have the option to get a basic popover on their site with minimal code.

sourabhbajaj commented 6 years ago

Perfect! Thanks.

MadalinNitu commented 6 years ago

Hiii ... I want to improve this project, i codding already an demo for a future bookmarks, if you let me permission to push it ^_^

ghost commented 6 years ago

@prateekkalra I have opened a new pull request, for this issue ( new feature ), it opens Google Translator in a popup, with the word selected, already filled in. In addition, it identifies the language of the browser and auto-select the language of the translator. https://github.com/prateekkalra/Selection-js/pull/13

neelamsk commented 6 years ago

@prateekkalra , would like to add print option. let me know.

karishma-mhatre commented 5 years ago

@prateekkalra We can combine multiple sharing options into one share option on the popover and if the user clicks on share we can change the popover items to fb, twitter and much more. This way we can make the popover compact along with adding multiple options.

ashikvarma11 commented 4 years ago

@prateekkalra Is this project still under development? I would like to work on adding a dictionary feature by using an API. Implementation would be similar to this. https://github.com/prateekkalra/Selection-js/issues/2#issuecomment-394302268

I saw that we already have feature for searching a word in a separate window in google. But i guess it would be better to show the results in an expanded div right inside the popup.

MargotRasamy commented 2 years ago

@prateekkalra Hello ! Would it be interesting to add the option to export the selected text into PDF (or other formats) to immediately get a simple document to download ?