Opened 10 years ago

Closed 10 years ago

# Allow option to change behavior of implicit link supression

Reported by: Owned by: Jason Winnebeck Jun Omae high TracWysiwygPlugin normal 0.10

### Description

In the current mode of the editor if I type a wiki link either something like [2732] or CamelCase, it comes out as plain text with a ! in front of it to suppress the link. You can click the button to do it and type in the link to be inserted, but it is not as easy as doing it directly, one of the things I like about Trac wiki.

Perhaps a checkbox to toggle the option "links as you type" will work. However, if it is felt that it is not user-friendly to automatically make links I think it is almost as good to have a shortcut key for it (maybe like ctrl-L) so I can type the shortcut, then the trac link, then enter, and it will appear as an actual link.

### comment:1 Changed 10 years ago by jtiai

Priority: normal → high

I rising this higher priority since It's very inconvenient to type powerful trac-links by using popup inputbox.

It's more than common and normal in Trac wiki/tickets that you can simply write CamelCase, r123, [123] or #123 and they appear as trac links. It would be more useful to introduce "no links" option for text that you don't want links to appear.

### comment:2 Changed 10 years ago by Jun Omae

Resolution: → fixed new → closed

### comment:3 Changed 10 years ago by Jason Winnebeck

Thanks, this is a good change! Looks like it took a lot of code to get to this; I was surprised. It works well, but the generated style could be improved. If I type WikiStart, when you go to textarea you get [WikiStart WikiStart], which if I "round-trip", results as [wiki:WikiStart]. So, the autolinks generation doesn't match what a round-trip would do, which would lead to spurious changes.

However, links such as r123 and #13 do come out as plain text, even after a round-trip, which is good now. My comment on ticket 2182 I think still applies on wiki page links, to use WikiStart rather than [wiki:WikiStart] as it does for rev and ticket links now.

### comment:4 Changed 10 years ago by Jun Omae

(In [2849]) refs #2142

• Fixed a problem that the autolinks generation convert from CamelCase to [CamelCase CamelCase].
• Fixed a problem that text like CamelCase get [wiki:CamelCase] instead of CamelCase.
• Fixed some bugs.

### comment:5 follow-up:  6 Changed 10 years ago by Jason Winnebeck

This works well, but I notice now if you type SandBox and then I put an s to make SandsBox, then it makes [wiki:SandBox SandsBox] as output, even after roundtrip. I also noticed if you put the cursor at the end of a link, then the cursor is "inside" the link, so if I type SandBox then put the cursor immediately after the x, then start typing ", the best page ever" then I get [wiki:SandBox SandBox, the best page ever].

Actually this might be a desired feature, and makes more sense now, because when it is a link, and you type into the link, then you're actually changing the link's text. The generator just replaces [X X] with X, it seems. But it is a bit unintuitive I think... I don't know if there is an easy solution.

### comment:6 in reply to:  5 Changed 10 years ago by Jun Omae

I also noticed if you put the cursor at the end of a link, then the cursor is "inside" the link, so if I type SandBox then put the cursor immediately after the x, then start typing ", the best page ever" then I get [wiki:SandBox SandBox, the best page ever].

It depends implementation of designMode in each browser. It happens in Firefox. But it doesn't happen in IE6.

Actually this might be a desired feature, and makes more sense now, because when it is a link, and you type into the link, then you're actually changing the link's text. The generator just replaces [X X] with X, it seems. But it is a bit unintuitive I think... I don't know if there is an easy solution.

I think it is unintuitive, too. I will remove the feature that is changing link's text.

### comment:7 Changed 10 years ago by anonymous

I am wondering something retrospectively. Really what you are doing is converting a tags into wiki, right? It seems like converting implicit trac links into HTML makes it harder to deconflict whether it's an explicit or implicit link. If my reasoning is that you are converting wiki -> HTML DOM -> wiki, then this is way off, but I wonder if you could convert with an attribute on the "a" tag or to a different tag (say span, just to get the blue underline) if it would be easier to reverse it back.

I've noticed that now this change is in that I am starting to use the editor now a lot more whereas before I always used text mode. The editor is really there for the non-technical users. I think with this linking being intuitive and robust the only thing left that annoys me enough to not use it is the weird newline handling, where sometimes it makes a new paragraph and other times it makes 1 or more BRs.

This plugin is excellent work. It's coming along very nicely and I could see it be a huge step in making Trac adoptable because the biggest complaint I hear from the non-programmers is that the wiki formatting is hard. Personally I like it a lot since it is diffable and I think it's very easy, but not everyone agrees. This editor lets you keep the benefits and ease-of-use. This ticket is part of it because it still keeps implicit links "easy." OK enough side-comments.

### Modify Ticket

Change Properties