From aeb5c810d5cd640e242d28571561cd0353c2f0be Mon Sep 17 00:00:00 2001 From: Damien Pobel Date: Mon, 3 Jun 2013 14:46:41 +0200 Subject: [PATCH] Fix EZP-20482: In IE8, "Enter" key does not work when creating a custom tag --- .../ezoe/design/standard/javascript/ezoe/popup_utils.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/extension/ezoe/design/standard/javascript/ezoe/popup_utils.js b/extension/ezoe/design/standard/javascript/ezoe/popup_utils.js index c5fea2d5289..0b8a59a3d29 100644 --- a/extension/ezoe/design/standard/javascript/ezoe/popup_utils.js +++ b/extension/ezoe/design/standard/javascript/ezoe/popup_utils.js @@ -50,6 +50,8 @@ var eZOEPopupUtils = { editorSelectedText: false, // Same as above but with markup editorSelectedHtml: false, + // the selected node in the editor, set on init + editorSelectedNode: false, // generates class name for tr elements in browse / search / bookmark list browseClassGenerator: function(){ return ''; }, // generates browse link for a specific mode @@ -109,6 +111,7 @@ var eZOEPopupUtils = { if ( jQuery.trim( selectedHtml ) !== '' ) s.editorSelectedHtml = selectedHtml; } + s.editorSelectedNode = ed.selection.getNode(); if ( s.onInit && s.onInit.call ) s.onInit.call( eZOEPopupUtils, s.editorElement, s.tagName, ed ); @@ -308,7 +311,8 @@ var eZOEPopupUtils = { */ insertTagCleanly: function( ed, tag, content, args ) { - var edCurrentNode = ed.selection.getNode(), newElement = edCurrentNode.ownerDocument.createElement( tag ); + var edCurrentNode = eZOEPopupUtils.settings.editorSelectedNode ? eZOEPopupUtils.settings.editorSelectedNode : ed.selection.getNode(), + newElement = edCurrentNode.ownerDocument.createElement( tag ); if ( tag !== 'img' ) newElement.innerHTML = content; if ( edCurrentNode.nodeName === 'TD' )