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

Selecting a word to create a link with a double click causes the link to be appended to the start of the text. #504

Open
morpheus-87 opened this issue Jul 25, 2016 · 32 comments

Comments

@morpheus-87
Copy link
Contributor

When I have the text hello in my text block, the DOM tree looks like

<div contenteditable="true" class="st-text-block">
  <p>
    hello<br>
  </p>
</div>

When I then select the text and add a link to http://google.de, the resulting DOM tree is

<div contenteditable="true" class="st-text-block">
  <p>
    <a href="http://google.de">
      http://google.de
    </a>
    hello<br>
  </p>
</div>
@SgtOddball
Copy link
Contributor

How are you selecting the text? Are you using the keyboard to highlight the text or double clicking to select the text?

Main reason I ask is that the link generation is something handled by scribe rather than by Sir Trev so sometimes it's not Sir Trev thats causing the issue.

@raffij
Copy link
Contributor

raffij commented Jul 25, 2016

What browser?

@morpheus-87
Copy link
Contributor Author

morpheus-87 commented Jul 25, 2016

I'm selecting the text by pressing the left mouse button down and moving the cursor - and I'm using Firefox in version 47.0.

@raffij
Copy link
Contributor

raffij commented Jul 25, 2016

Tested the latest version in windows and osx firefox 7. I'm able to add links using both the keyboard and mouse functionality as expected. Are you getting any javascript errors in the console?

@morpheus-87
Copy link
Contributor Author

I using Ubuntu, for your information. I'm not getting any errors in the console, no. The problem ist, that the link text is the same than the URL I entered and not the selected text, that stays like before.

@raffij
Copy link
Contributor

raffij commented Jul 25, 2016

Does this work for you?
http://guardian.github.io/scribe/

That's the scribe demo page.

If so I can build a version of Sir Trevor with the latest scribe and see if that works for you.

@morpheus-87
Copy link
Contributor Author

Yes, that works perfekt for me.

@raffij
Copy link
Contributor

raffij commented Jul 25, 2016

Ok. I'll build you a version to test.

@raffij
Copy link
Contributor

raffij commented Jul 25, 2016

http://madebymany.github.io/sir-trevor-js/example.html works correctly in ubuntu 16.04 firefox 47

@morpheus-87
Copy link
Contributor Author

morpheus-87 commented Jul 25, 2016

Thanks, @raffij! But it's not working for me:

link

@raffij
Copy link
Contributor

raffij commented Jul 25, 2016

So I type hallo. then select hallo with the mouse and enter the url?

@morpheus-87
Copy link
Contributor Author

morpheus-87 commented Jul 25, 2016

Exactly, that I did. I

  1. wrote the text
  2. selected the text with the mouse
  3. clicked on the link icon in the format bar
  4. entered the url
  5. confirmed

The result you can see on the screenshot. I also tried selecting the text with the keyboard, but the result was the same.

@raffij
Copy link
Contributor

raffij commented Jul 25, 2016

What version of ubuntu are you using?

@raffij
Copy link
Contributor

raffij commented Jul 25, 2016

Sorry can't recreate so not sure how to help.

@SgtOddball
Copy link
Contributor

@morpheus-87 Do you have any other plug-ins running on firefox? It might be worth double checking the error using firefox safe mode and see if you still get the issue.

@raffij
Copy link
Contributor

raffij commented Jul 25, 2016

Good thinking @SgtOddball

@morpheus-87
Copy link
Contributor Author

Thanks for that hint, @SgtOddball - I just tried it, but it's still the same result.

@raffij
Copy link
Contributor

raffij commented Jul 25, 2016

@morpheus-87 what version of ubuntu is this?

@SgtOddball
Copy link
Contributor

SgtOddball commented Jul 25, 2016

Got it! Did you get the warning about adding http before the link? If you did it creates a new entry in front of the highlighted text instead of applying the link to the highlighted text.

Sooooo @morpheus-87 can you see if you can add a link as http://google.de and then another link after it with google.de and see if they behave differently?

@SgtOddball
Copy link
Contributor

Also.... i've got it doing the same if the highlighted word is the first word at the very start. Place a space infront and it works as intended, no space and it borks.

@raffij
Copy link
Contributor

raffij commented Jul 25, 2016

@SgtOddball is this in firefox too? i've managed to do it once.

@morpheus-87
Copy link
Contributor Author

morpheus-87 commented Jul 26, 2016

It's Xubuntu 16.04, @raffij.

I've also managed to do it once, @SgtOddball - but since the second try, it was again the same.

@SgtOddball
Copy link
Contributor

@raffij Yes, sorry should have confirmed Firefox 47.0.1 on Win 10.

It's strange how after it throws the error the first time round, it then works ok. I've also double checked against the current demo of scribe and it refuses to misbehave (but then the content was already present).

@raffij
Copy link
Contributor

raffij commented Jul 26, 2016

@morpheus-87 Xubuntu 16.04 firefox 47 is working correctly on my system

https://www.dropbox.com/s/j3oytx4j1fy217u/Untitled.mov?dl=0

@morpheus-87
Copy link
Contributor Author

Thanks for that screencast, @raffij! I think, I found the point, that's causing the problem:

When I select a word by double-clicking it, I run into problems - when I select it by clicking the mouse and moving the cursor, everything works as expected. Can you confirm that?

@raffij
Copy link
Contributor

raffij commented Jul 26, 2016

@morpheus-87 agreed. Renaming the issue.

@raffij raffij changed the title Error when generating a link Selecting a word to create a link with a double click causes the link to be appended to the start of the text. Jul 26, 2016
@raffij raffij added the Bug label Jul 26, 2016
@raffij raffij added this to the v0.6.2 milestone Jul 26, 2016
@raffij
Copy link
Contributor

raffij commented Jul 26, 2016

It's a bug in scribe probably http://guardian.github.io/scribe/ can reproduce everytime.

@raffij raffij modified the milestones: Iced, v0.6.2 Jul 26, 2016
@morpheus-87
Copy link
Contributor Author

morpheus-87 commented Jul 26, 2016

For me, everything is working fine on the scribe demo page.

@raffij
Copy link
Contributor

raffij commented Jul 26, 2016

@morpheus-87
Copy link
Contributor Author

Ok, I can reproduce, what you did in the screencast. I just selected the text, that was already there on the demo page, by double-click and there was no problem.

@raffij
Copy link
Contributor

raffij commented Jul 26, 2016

Ok it's a firefox 47 problem, doesn't appear platform specific.

Raise a bug on:

@raffij raffij modified the milestones: v1.0, Iced Jul 27, 2016
@raffij
Copy link
Contributor

raffij commented Mar 7, 2019

Replicated in firefox 65.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants