diff --git a/core/modules/ckeditor/js/ckeditor.js b/core/modules/ckeditor/js/ckeditor.js index 497393f..865fd10 100644 --- a/core/modules/ckeditor/js/ckeditor.js +++ b/core/modules/ckeditor/js/ckeditor.js @@ -273,6 +273,24 @@ } }); + /** + * Pull the ID from the original textarea, that gets hidden. Specifically for + * jump-to links used with Inline Form Errors. + */ + function redirectTextareaFragmentToCKEditorInstance() { + var hash = location.hash.substr(1); + var element = document.getElementById(hash); + if (element) { + var editor = CKEDITOR.dom.element.get(element).getEditor(); + if (editor) { + var id = editor.container.getAttribute('id'); + document.location.hash = '#' + id; + } + } + } + // Use one() to prevent triggering the redirect callback twice. + $(window).one('hashchange', redirectTextareaFragmentToCKEditorInstance); + // Set the CKEditor cache-busting string to the same value as Drupal. CKEDITOR.timestamp = drupalSettings.ckeditor.timestamp;