Handle long content better
parent
e45e81ab97
commit
83abec6015
4
index.js
4
index.js
|
|
@ -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})`;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue