U4-1242 - Template editor sometimes stops editing.

Created by Douglas Robar 22 Nov 2012, 15:18:17 Updated by Sebastiaan Janssen 05 Jun 2015, 16:28:23

(seen in 4.10.1)

[in v4.9 and maybe a few versions earlier this was seen only with IE; now it happens with all browsers]

Editing templates sometimes becomes impossible when the cursor is 'stuck' in one position. You can't move the insertion point with the arrow keys. You can't select another insertion point with the mouse. You can't type or delete with the keyboard.

Haven't been able to find a pattern to when this happens but a number of students have seen this in Chrome, Firefox, and IE9. I've also experienced it in Chrome (which I never did in earlier versions).

I think it is a codemirror error that breaks but can't prove it yet. I'll add comments if I can find a reproducible case or a javascript error.

Sorry to be so vague. Hopefully others can chime in with additional details.

Only workaround is to save the template and reload it to restore editing.

1 Attachments

Download UmbracoEditor.js


Douglas Robar 25 Mar 2013, 21:44:02

Also seen in umbraco 6.0.2.

Seems to happen (semi-reliably) when you're editing a template and click the 'insert umbraco page field' icon in the toolbar. After that, you won't have appropriate editing. For instance, hitting the backspace key will go to the browser (and return you to your previous page, losing any unsaved changes), or you might find you can't position the cursor, or you can't type.

When I say, 'semi-reliably' I mean that it doesn't always happen after inserting an umbraco:item tag, but when it does happen it seems to be immediately after adding the umbraco:item tag via the toolbar icon. So there's a relationship there but not 100% repeatable.

As reported before, you will only get back to a normal condition after you save the template and then reload it.

Funka! 26 Mar 2013, 02:02:48

Yes, I was going to chime in that I think the "insert page field" dialog causes this problem the most for me. Saving the template, leaving the page, then coming back to the page has become second-nature for me when this hits.

Andy Butland 26 Mar 2013, 09:01:06

Commenting as may give some clues, but also as a quicker workaround - I've found when I see this if I right-click to bring up the browser context menu, and then don't select anything but left-click back in the template area - editing is restored. On Chrome at least.

Anthony Candaele 16 May 2013, 14:19:54

Having the same problem in Umbraco 4.11.8 After inserting a page field, it seems like the Template editor freezes I have to reload the template to do further editing.

greetings, Anthony

Casey Neehouse 22 May 2013, 20:38:46

A temp work-around: you don't need to reload the page, but need to refocus the editor. simply click into the name field at the top, then back to the editor.

Douglas Robar 30 Sep 2013, 11:12:22

Still there in 6.1.5. Really, really annoying for anyone using the umbraco interface for editing templates.

Casey's workaround works but it's such an obvious bug (especially for new users) it would be great if this could be fixed.

Bo Kingo Damgaard 30 Sep 2013, 12:48:01

Is this a problem if uComponents is not installed? I seem to have this problem only if it's installed

Casey Neehouse 30 Sep 2013, 12:50:41

Yes. I rarely install uComponents. It is just a focus issue. The editor needs re-focused once the dialog inserts the code.

Casey Neehouse 30 Sep 2013, 12:53:43

It should be as simple as cm.focus() (where cm is the codemirror object), once the text has been inserted and after the dialog is closed. I'll look at doing a pull request, but I think they are looking at Ace Editor moving forward, but not 100% sure.

Casey Neehouse 30 Sep 2013, 13:55:20

@Doug - try replacing /umbraco-client/CodeArea/UmbracoEditor.js with the attached file. I think this should fix the problem, but want to test before I do the pull request.

Sebastiaan Janssen 01 Oct 2013, 11:17:33

I've been looking into Ace and will try to get it into an upcoming version but CodeMirror is going to stay around for a while, so Ace will be a config option. Would love to hear if this fix works!

Sebastiaan Janssen 01 Oct 2013, 11:17:53

(I'll give it a go myself too, but in the middle of a course at the moment).

Sebastiaan Janssen 05 Oct 2013, 17:27:36

Seems to work here! Not saying this will fix all editing problems but this seems to be the one that is reproducible. Have applied the fix in rev 9f3784aaed46b2621740794868fb072fffe8ad3d.

Priority: Normal

Type: Bug

State: Fixed


Difficulty: Normal


Backwards Compatible: True

Fix Submitted: Inline code

Affected versions:

Due in version: 6.2.0


Story Points: