Handle long content better
Boris Kubiak kubiakboris@gmail.com
Mon, 27 Apr 2020 19:08:35 +0200
1 files changed,
3 insertions(+),
1 deletions(-)
jump to
M
index.js
→
index.js
@@ -128,7 +128,9 @@ };
// Build a shareable URL const buildUrl = (rawData, mode) => { - const url = `${location.protocol}//${location.host}/` + rawData + `?lang=${encodeURIComponent(select.selected())}`; + const base = `${location.protocol}//${location.host}/`; + const query = `?lang=${encodeURIComponent(select.selected())}`; + const url = rawData.length <= 4000 ? base + rawData + query : base + query + '#' + rawData; if (mode === 'markdown') { return `[NoPaste snippet](${url})`; }