03-14-2014, 04:16 PM | #16 |
null operator (he/him)
Posts: 20,588
Karma: 26954694
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
How about putting the text that was selected & auto-deleted into the clipboard so the user can paste it back again as the label?
After creating the link the cursor is already positioned at the correct position to do that. Then its on the users head if they paste something they shouldn't. Preventing users from making mistakes can result in denying them opportunity to learn from them. BR |
03-14-2014, 04:21 PM | #17 |
Dead account. Bye
Posts: 587
Karma: 668244
Join Date: Mar 2011
Device: none
|
Hi, I also don't agree with the current behaviour.
I'd expect a <a href="whatever"></a> pair embracing my current selection, but not deleting it. More over, it seems somehow incoherent with other features in the editor, as example the B, I, U buttons which just work in that way: adding a pair of tags around the selected text, without deleting it. Why should the <a> tag be different? Maybe a tick could be added to the Insert Hyperlink dialogue in order to toggle that deletion on/off as desired? (And of course, Kovid, forget about checking for valid/invalid HTML in either case: with or without deletion of the selected text. It's just TOO hard. I've just noticed that the only check the B/I/U buttons seem to do is that, if the selected text begins or ends in the middle of any tag, the added <b/i/u> tags avoid those incomplete tags. I do agree this is the "good" behaviour, and possibly the only one you can easily and coherently code. But even doing that check, nothing guarantees you that the obtained HTML code is valid; an example: if the selected text is just a tag like "</div>" where you are in trouble it doesn't matter if you keep it or not). Last edited by arspr; 03-14-2014 at 04:34 PM. |
03-14-2014, 04:22 PM | #18 |
Well trained by Cats
Posts: 29,818
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
|
03-14-2014, 05:19 PM | #19 |
Color me gone
Posts: 2,089
Karma: 1445295
Join Date: Apr 2008
Location: Central Oregon Coast
Device: PRS-300
|
One can hope for fewer opportunities for such learning.
I can't agree that protecting somebody from themselves when they are editing the HTML directly is a priority. There are a million changes to screw it up without even trying. I know, I did a global search and replace and scrunched all the paragraphs together and did only an undo instead of a revert. I had to bring in whole sections from an earlier document. If you could edit the viewing window, I would agree, but you can only work in the HTML window. |
03-14-2014, 08:21 PM | #20 | |
Grand Sorcerer
Posts: 24,907
Karma: 47303748
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
|
Quote:
A possibility is to add a field to the dialog. Put the selected text in there. Add a warning if there are any tags. The user can clear or type whatever they need. |
|
03-14-2014, 10:49 PM | #21 |
creator of calibre
Posts: 43,869
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Hmm, well I can change it so that it works like the bold, italic, etc. button, where the selection is automatically adjusted to ensure it does not end within a tag definition, but otherwise just wraps the selected text.
That is a compromise I am happy with, and I think all of you should be happy with as well. |
03-15-2014, 01:14 AM | #22 |
Dead account. Bye
Posts: 587
Karma: 668244
Join Date: Mar 2011
Device: none
|
Yes, Kovid, that's good. But if you are really interested in "your" way, and as it is an already made coding work, don't throw it away. Put the toggle in the tool dialogue and we would have both methods... As you previosly posted, "your" way can also be useful in some situations. It's just not intuitive, it's just not the expected default behaviour, but nobody can say that "it's wrong".
|
03-15-2014, 05:47 AM | #23 |
Wizard
Posts: 1,161
Karma: 1404241
Join Date: Nov 2010
Location: Germany
Device: Sony PRS-650
|
+1, Kovid, this sounds good.
Maybe you can add as well an input mask for a text within the hyperlink window. You can put the selected text in this mask if selected and if not, the user can make an input or not and have all possibile variations open (if this is possible to do w/o a huge amount of coding) |
03-15-2014, 06:45 AM | #24 |
creator of calibre
Posts: 43,869
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
@Divingduck: A good idea. There's no reason the text field cannot be pre-filled in with the selected text, if any, that way the present code does not have to be changed at all either. It will simply continue to delete the selection, but also insert the contents of the text field, which will be prefilled with the selected text, giving a smooth default workflow.
|
03-15-2014, 08:29 AM | #25 |
Dead account. Bye
Posts: 587
Karma: 668244
Join Date: Mar 2011
Device: none
|
Yes, a great idea. Nevertheless, Kovid, do not forget the in-the-middle-of-tags test. I mean maybe you should "shorten" this kind of plainly wrong selections before actually calling the tool dialogue.
|
03-15-2014, 11:32 AM | #26 |
Well trained by Cats
Posts: 29,818
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
to all these
|
03-15-2014, 01:00 PM | #27 |
Bookish
Posts: 907
Karma: 1803094
Join Date: Jun 2011
Device: PC, t1, t2, t3, aura 2 v1, clara HD, Libra 2, Nxtpaper 11
|
|
03-15-2014, 10:59 PM | #28 |
Ex-Helpdesk Junkie
Posts: 19,422
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
I'm liking this suggestion much better, thanks!
|
03-21-2014, 12:02 PM | #29 |
Wizard
Posts: 1,161
Karma: 1404241
Join Date: Nov 2010
Location: Germany
Device: Sony PRS-650
|
Kovid, thanks for implementing this
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Hyperlink to PDF | Macsurfcat | ePub | 4 | 04-18-2013 04:20 PM |
Hyperlink an image | scheife | ePub | 2 | 03-07-2013 07:43 AM |
"Offending" hyperlink bug in InDesign CS5 causes TOC to fail and missing text | eggheadbooks1 | ePub | 0 | 11-16-2011 12:18 AM |
Hyperlink | adachim | Kobo Reader | 0 | 11-02-2010 10:57 PM |
Hyperlink? | fcoulter | Sigil | 3 | 03-28-2010 10:31 AM |