From 9d6c9dcf5e7e630cf0359e8c396fcf2267d33f64 Mon Sep 17 00:00:00 2001 From: yflory Date: Mon, 29 Oct 2018 11:47:57 +0100 Subject: [PATCH] Fix font issue with new paragraph in pads (#284) --- www/pad/inner.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/www/pad/inner.js b/www/pad/inner.js index 6a84018ff..cd382b5b6 100644 --- a/www/pad/inner.js +++ b/www/pad/inner.js @@ -430,6 +430,24 @@ define([ var documentBody = ifrWindow.document.body; + var observer = new MutationObserver(function (muts) { + muts.forEach(function (mut) { + if (mut.type === 'childList') { + var $a; + for (var i = 0; i < mut.addedNodes.length; i++) { + $a = $(mut.addedNodes[i]); + if ($a.is('p') && $a.find('> span:empty').length + && $a.find('> br').length && $a.children().length === 2) { + $a.find('> span').append($a.find('> br')); + } + } + } + }); + }); + observer.observe(documentBody, { + childList: true + }); + var inner = window.inner = documentBody; var cursor = module.cursor = Cursor(inner);