![]() |
#1 |
Fanatic
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 500
Karma: 3498633
Join Date: May 2011
Location: Surrey, UK
Device: Kobo Aura One, Sony PRS 600/650
|
ID and Link placement
Something that has been puzzling me for some time is the rule regarding the placement of Ids and Links.
I am in the process of adding some footnotes to a book that has existing footnotes. A percentage of the existing footnote links are at the end of paragraphs, situated between the period and the paragraph ending tag (.{link}</p>) as you can see in this example If I try to add a new ID or link in a similar position I get the error message If I move the cursor to the left of the period ({link}.</p>) then it works OK. The odd thing is that having created the ID or Link I can move the period to the left of the link and all is fine. So why can't I create it there in the first place as it appears to be a valid location? |
![]() |
![]() |
![]() |
#2 |
A Hairy Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,347
Karma: 20171571
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 15/11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
|
This sounds like a similar bug to the one for inserting images?? It had something to do with verifying it was a valid location by looking at the space to the immediate right of the insertion point...it found a < and said "nope".
I'm sure this one can be fixed very quickly. In the meantime you can continue using a period, or a space, or any character as a padding. I used a space because then the html clean function would automagically remove it. |
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,756
Karma: 5706256
Join Date: Nov 2009
Device: many
|
The highlighted text start is just before the < of the a tag, that is not a valid location to insert an id. Why did you select a section of text instead of just placing the cursor after the "a" anyplace and asking to insert an id? Or is that "<a" selected/highlighted for some other reason?
Any cursor point anyplace inside the < to > and after tag name should work, just not before. If that does not work, it is a bug. |
![]() |
![]() |
![]() |
#4 | |
Fanatic
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 500
Karma: 3498633
Join Date: May 2011
Location: Surrey, UK
Device: Kobo Aura One, Sony PRS 600/650
|
Quote:
I was not trying to insert a new link at that point, and the only reason it's highlighted is because I was using a search to find an example to show. As Turtle91 points out, it seems that if you try to insert an ID, link or image between a period and </p> Sigil wont let you despite it appearing to be a valid location. .(ID/Link/Image)</p> - Not allowed .(ID/Link/Image)[any character]</p> - Allowed Create (ID, Link or Image) and delete [any character] - Allowed Does that make sense? |
|
![]() |
![]() |
![]() |
#5 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,756
Karma: 5706256
Join Date: Nov 2009
Device: many
|
Yes. The issue is even though the cursor shows "after" the period but "before" the < of the ending p tag, according to Qt the character under the cursor is in fact the "<" which is not a valid location.
I will have to add code to special case this for all the various things inserted. The best workaround is add a space after the period and place the cursor before the space if you want to insert a link before the ending p tag. |
![]() |
![]() |
Advert | |
|
![]() |
#6 | |
Fanatic
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 500
Karma: 3498633
Join Date: May 2011
Location: Surrey, UK
Device: Kobo Aura One, Sony PRS 600/650
|
Quote:
It was just puzzling me that I could see existing links in that location, but Sigil would not let me add new ones. |
|
![]() |
![]() |
![]() |
#7 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,756
Karma: 5706256
Join Date: Nov 2009
Device: many
|
Actually, I just tested this with Sigil-1.9.2 and here is what I am seeing:
Insert ID - adds an attribute id="blah" to a single or opening tag. It works as expected. If the insertion point is anywhere after the tag name even just before the ending ">". Insert File (Image or Media) - adds an img, video, or audio tag and it must be outside of opening or closing tags and it appears to work as expected. That said Insert Link - adds an anchor tag if needed and sets the href to the selected destination. It must be added outside of opening and closing tags or in an existing anchor tag. This one has an issue with the cursor right before the start of an tag (ending </p>) and it needs the workaround. You should be seeing the same thing. Please let me know if you are not just in case I am missing something in my testing. Last edited by KevinH; 03-16-2022 at 12:15 PM. |
![]() |
![]() |
![]() |
#8 |
Fanatic
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 500
Karma: 3498633
Join Date: May 2011
Location: Surrey, UK
Device: Kobo Aura One, Sony PRS 600/650
|
This is what I see with 1.9.2.
Insert ID - works anywhere apart from immediately before or within a closing tag. Insert image - works as expected apart from within the opening and closing tags. Insert Link - works anywhere apart from inside opening or closing tags and immediately before a closing tag. |
![]() |
![]() |
![]() |
#9 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,756
Karma: 5706256
Join Date: Nov 2009
Device: many
|
Yes, Insert ID adds an id attribute and those can only be added to opening or single tags so that is correct. Insert File is correct as well I think.
The only problem is in Insert link. |
![]() |
![]() |
![]() |
#10 |
Fanatic
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 500
Karma: 3498633
Join Date: May 2011
Location: Surrey, UK
Device: Kobo Aura One, Sony PRS 600/650
|
If I am reading you correctly, you are saying that Insert ID works for you immediately before a closing tag?
If that is so, then I am not seeing that. |
![]() |
![]() |
![]() |
#11 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,756
Karma: 5706256
Join Date: Nov 2009
Device: many
|
It has two modes.
The first mode adds an id attribute to an existing block level tag. So the cursor must be inside an opening tag not in a closing tag or in text. So it works for me here (where the cursor is represented by the | char) <p|> If you instead select some text, it will use the second mode and will wrap an anchor a tag around the selected text and then put the id attribute on that anchor tag. If we let [ ] indicate the highlighted text, then the following works just fine: <p>This is a piece of [text.]</p> (so the word "text." is selected and highlighted), it will produce the following assuming I want to add the id "jjj": <p>This is a piece of <a id="jjj">text.</a></p> There may be other modes to how people use it that I know nothing about (unfortunately). Both of these modes seem to work perfectly in my testing. So just to be clear how do you typically use it. I may learn something here! The only bug I see is that it even works (incorrectly) in self-closing tags: <hr|/> Is that what you are seeing? Thanks, Kevin |
![]() |
![]() |
![]() |
#12 |
Fanatic
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 500
Karma: 3498633
Join Date: May 2011
Location: Surrey, UK
Device: Kobo Aura One, Sony PRS 600/650
|
I confirm that what you have outlined below works for me too.
But, and this is where we differ, you are highlighting existing text and applying an ID or link to that, whereas I am trying to insert an ID without anything selected. <p>This is a piece of [text.]</p> - highlighting [text.] clicking Insert ID works as it should. <p>This is a piece of text.↨</p> (where ↨ represents the cursor) clicking Insert ID generates the error message. <p>This is a piece of text.↨ </p> clicking Insert ID works as it should. I think this must be what you said earlier about QT is referencing one character to the right and not the cursor position. As I said previously, I was more puzzled why it was not working rather than it actually being an annoyance. |
![]() |
![]() |
![]() |
#13 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,756
Karma: 5706256
Join Date: Nov 2009
Device: many
|
Okay, I never thought to use it to add an empty anchor. Once I tried that it did fail. I will look into it.
Thanks! |
![]() |
![]() |
![]() |
#14 |
Fanatic
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 500
Karma: 3498633
Join Date: May 2011
Location: Surrey, UK
Device: Kobo Aura One, Sony PRS 600/650
|
Thanks Kevin.
As I said it's not a huge issue, and a very easy workaround, so not top of the list. I'm sure you have more pressing things to do. |
![]() |
![]() |
![]() |
#15 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,756
Karma: 5706256
Join Date: Nov 2009
Device: many
|
No problems. Both InsertId and InsertLink now work when cursor immediately before an ending tag |</tag>. InsertFile already worked in that position.
This fix has been pushed to master and will appear in the next release. Thank you for you bug report and helping to make Sigil better! |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Image placement | mrmikel | Editor | 1 | 12-22-2013 10:01 PM |
Image placement in ePubs | JCarig | ePub | 3 | 05-11-2011 03:46 PM |
Placement of D pad | bugeyed | Kobo Reader | 18 | 11-08-2010 01:11 PM |