From b610304676f279cf4b6668ca27deed6aca14ea0d Mon Sep 17 00:00:00 2001 From: skaught Date: Fri, 27 May 2016 16:22:59 -0400 Subject: [PATCH] add docblock --- core/modules/ckeditor/js/ckeditor.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/core/modules/ckeditor/js/ckeditor.js b/core/modules/ckeditor/js/ckeditor.js index 497393f..36c6676 100644 --- a/core/modules/ckeditor/js/ckeditor.js +++ b/core/modules/ckeditor/js/ckeditor.js @@ -273,6 +273,21 @@ } }); + /** + * 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(); + var id = editor.container.getAttribute('id'); + document.location.hash = '#' + id; + } + } + window.addEventListener('hashchange', redirectTextareaFragmentToCKEditorInstance); + // Set the CKEditor cache-busting string to the same value as Drupal. CKEDITOR.timestamp = drupalSettings.ckeditor.timestamp; -- 2.6.4