I just want to preface this with a disclaimer. There are a lot of users that know way more about this stuff than I do. My statements on the matter are based on what I know.
Unless you are talking about an editor other that the 2017 source mode or the 2010 editor, I don't think a fix will be that simple. I don't know the script too well but based on a quick look, it appears to rely on identifying the selected area in the text field of the editing form and then inserting the text. However, both new editors appear to work quite differently. It seems that they wrap each and every line in a bunch of container tags that are all children of what visually appears to be a text field; but it isn't. Each line is its own subtree in the DOM tree.
I tried to see if simply copy-pasting a line in the DOM would register as added content. In the 2017 editor, it doesn't display the added line and the added line appears to interfere with line identification. Let's say I insert a duplicate of line 1 as the new first line using my browser's dev tools. As I run my cursor over the elements in the element inspector, it should highlight them on the page. The new line 1, despite not being displayed, highlights the old line 1. The old line 1 highlights the old line 2; and so on. The 2010 editor does not have this issue. The inserted lines display and are associated correctly. However, in both cases, the inserted lines apparently don't register with whatever is responsible for saving the edit. I try to save the changes and no change is actually made.
So it appears that there is some other program running in the background keeping track of each line and that its content is what actually gets saved. Unless and until it is clear what that program is and there is a way for site JS to interact with it, then it seems unlikely PreloadTemplates can be adapted.