From 15ff3df9df1a661b391218f7aa60a9681038e229 Mon Sep 17 00:00:00 2001 From: azivner Date: Tue, 22 Aug 2017 20:19:46 -0400 Subject: [PATCH] small simplification in parsing --- static/js/html2notecase.js | 12 +++++++----- static/js/init.js | 1 + 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/static/js/html2notecase.js b/static/js/html2notecase.js index 19f0a1e1b..786b2ac21 100644 --- a/static/js/html2notecase.js +++ b/static/js/html2notecase.js @@ -120,18 +120,20 @@ function html2notecase(contents, note) { } } else { - let linkMatch = /^((https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/i.exec(curContent); + let linkMatch = /^(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|]/i.exec(curContent); if (linkMatch !== null) { note.links.push({ note_id: note.detail.note_id, note_offset: index, - target_url: linkMatch[1], - lnk_text: linkMatch[1] + target_url: linkMatch[0], + lnk_text: linkMatch[0] }); - found = true; - index += linkMatch[1].length; + console.log(linkMatch[0]); + console.log(linkMatch[0].length); + + index += linkMatch[0].length; } else { index++; diff --git a/static/js/init.js b/static/js/init.js index c1ec81af5..7172e33f5 100644 --- a/static/js/init.js +++ b/static/js/init.js @@ -12,5 +12,6 @@ jQuery.hotkeys.options.filterContentEditable = true; $(document).bind('keypress', 'alt+ctrl+h', function() { const toggle = $(".hide-toggle"); + // use visibility instead of display so that content isn't moved around and stays set in place toggle.css('visibility', toggle.css('visibility') === 'hidden' ? 'visible' : 'hidden'); }); \ No newline at end of file