Handle long content better

master
Boris Kubiak 2020-04-27 19:08:35 +02:00
parent e45e81ab97
commit 83abec6015
1 changed files with 3 additions and 1 deletions

View File

@ -128,7 +128,9 @@ const openInNewTab = () => {
// Build a shareable URL // Build a shareable URL
const buildUrl = (rawData, mode) => { 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') { if (mode === 'markdown') {
return `[NoPaste snippet](${url})`; return `[NoPaste snippet](${url})`;
} }