From f54bbc8132accdfaaa708f26936b757266b02022 Mon Sep 17 00:00:00 2001 From: ansuz Date: Thu, 6 Aug 2020 09:42:43 -0400 Subject: [PATCH] address XXX notes --- www/pad/inner.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/www/pad/inner.js b/www/pad/inner.js index 783ab2878..30499f618 100644 --- a/www/pad/inner.js +++ b/www/pad/inner.js @@ -440,7 +440,6 @@ define([ } else { $toc.hide(); } - Messages.pad_tocHide = "Outline"; // XXX var $tocButton = framework._.sfCommon.createButton('', true, { drawer: false, text: Messages.pad_tocHide, @@ -648,7 +647,7 @@ define([ }, 500); // 500ms to make sure it is sent after chainpad sync }; - var updateTOC = function () { + var updateTOC = Util.throttle(function () { var toc = []; $inner.find('h1, h2, h3').each(function (i, el) { toc.push({ @@ -674,7 +673,7 @@ define([ content.push(h('p.cp-pad-toc-'+level, a)); }); $toc.html('').append(content); - }; + }); // apply patches, and try not to lose the cursor in the process! framework.onContentUpdate(function(hjson) { @@ -948,11 +947,11 @@ define([ framework.localChange(); updateCursor(); editor.fire('cp-wc'); // Update word count - updateTOC(); // XXX throttle + updateTOC(); }); editor.on('change', function () { framework.localChange(); - updateTOC(); // XXX throttle + updateTOC(); }); var wordCount = h('span.cp-app-pad-wordCount');