From 6056e9cb1bc4f8073aef07b83f7417edbe7f2ac4 Mon Sep 17 00:00:00 2001 From: Loz Calver Date: Thu, 10 Sep 2015 09:57:50 +0100 Subject: [PATCH] FIX: Editing existing file links in HtmlEditorField was broken --- javascript/HtmlEditorField.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/javascript/HtmlEditorField.js b/javascript/HtmlEditorField.js index b992d08b1..3bcdb374e 100644 --- a/javascript/HtmlEditorField.js +++ b/javascript/HtmlEditorField.js @@ -823,9 +823,11 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE; } else if(el.is(':radio')) { el.val([selected]).change(); } else if(fieldName == 'file') { - // Can't rely on fieldName, ad UploadFields have different naming convention - el = $('#' + fieldName); - + // UploadField inputs have a slightly different naming convention + el = this.find(':input[name="' + fieldName + '[Uploads][]"]'); + // We need the UploadField "field", not just the input + el = el.parents('.ss-uploadfield'); + // We have to wait for the UploadField to initialise (function attach(el, selected) { if( ! el.getConfig()) {