From 00e5f6ad868bdae3158da0c3cf468c6497837976 Mon Sep 17 00:00:00 2001 From: Jeffrey Hearn Date: Fri, 28 Oct 2016 11:16:07 -0400 Subject: [PATCH] Make link classes survive link manipulation by wagtaillink plugin --- .../static/wagtailtinymce/js/tinymce-plugins/wagtaillink.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/wagtailtinymce/static/wagtailtinymce/js/tinymce-plugins/wagtaillink.js b/wagtailtinymce/static/wagtailtinymce/js/tinymce-plugins/wagtaillink.js index 89fe5bcc..98b6834a 100644 --- a/wagtailtinymce/static/wagtailtinymce/js/tinymce-plugins/wagtaillink.js +++ b/wagtailtinymce/static/wagtailtinymce/js/tinymce-plugins/wagtaillink.js @@ -91,6 +91,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // select and replace text-only target insertElement = function(elem) { mceSelection.select($targetNode.get(0)); + // bring over any classes present + if ($targetNode.attr('class')) { + elem.setAttribute('class', $targetNode.attr('class')); + } mceSelection.setNode(elem); }; }