FIX: Split link watched words from replace (PR #13196)

It was not clear that replace watched words can be used to replace text with URLs. This introduces a new watched word type that makes it easier to understand.

GitHub

I think we should order the hash here by the number representing the action code. Another developer might come along and incorrectly use 8 if they do not notice that it has already exists.

I think the id needs to be unique within a HTML document so we can’t just reuse the id from the input above.

Nice :+1:

Was wondering if we need any client side verification to ensure it is a valid HTTP URL?

When it is a link, should we verify on the server side that URL is valid? Do we only support URLs with HTTP protocol or are other protocols also supported?

The wrong order here is on purpose, because we want “Link” above “Replace”. I can add a comment saying that 9 is the ID of the next watched word type. Will that work?

The two inputs will never show at the same time, so the ID is unique.

Good point, I guess we can try to parse it as a URL and reject anything that throws an exception/error?

This is a good point, but checking for URLs is not an easy task. I tried using URL as Regis mentioned, but it did not work with relative URLs.

Hmm is somewhere in the code depending on the specific order of the keys in the hash?

ahh icic got it :+1:

The server serializes the actions and then the client renders them in exact same order.

ooo icic. Ideally, the UI wouldn’t depend on the ordering of code in the backend but I guess the ship has already sailed on this one. I guess we can punt on this for now :slight_smile: Thank you for the explaination.