gpt-4.1-mini-2025-04-14· OpenAI
WildChat-4.8M (AI2)
html css js text editor 100000000000 chars copy share "#/"
- User
html css js text editor 100000000000 chars copy share "#/"
- Assistant
html css js text editor 100000000000 chars copy share "#/"
Creating a basic web-based text editor that can handle very large text inputs (up to 100 billion characters) is an extreme, likely impractical requirement for a browser environment due to memory and performance constraints. However, I can provide a straightforward example for a simple text editor implemented with HTML, CSS, and JavaScript that allows editing, copying all text, and sharing a link with the content encoded in the URL after #/.
<textarea>)#/ (using encodeURIComponent)<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Simple Text Editor with Share & Copy</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 1em;
display: flex;
flex-direction: column;
height: 100vh;
}
#editor {
flex: 1;
width: 100%;
font-family: monospace;
font-size: 1rem;
padding: 0.5em;
box-sizing: border-box;
resize: none;
}
.buttons {
margin-top: 0.5em;
}
button {
margin-right: 0.5em;
padding: 0.5em 1em;
}
#share-link {
margin-top: 0.5em;
width: 100%;
font-size: 0.9rem;
}
</style>
</head>
<body>
<textarea id="editor" spellcheck="false" placeholder="Type or paste your text here..."></textarea>
<div class="buttons">
<button id="copy">Copy All</button>
<button id="share">Generate Share Link</button>
</div>
<input type="text" id="share-link" readonly placeholder="Share link will appear here" />
<script>
const editor = document.getElementById('editor');
const copyBtn = document.getElementById('copy');
const shareBtn = document.getElementById('share');
const shareLinkInput = document.getElementById('share-link');
// Load text from URL hash if present
function loadFromHash() {
if (location.hash.length > 2) { // "#/" + something
try {
const data = decodeURIComponent(location.hash.slice(2));
editor.value = data;
} catch(e) {
console.warn('Failed to decode URL data');
}
}
}
// Copy all text to clipboard
copyBtn.addEventListener('click', () => {
editor.select();
try {
const successful = document.execCommand('copy');
if (successful) {
alert('Text copied to clipboard!');
} else {
alert('Copy failed.');
}
} catch(e) {
alert('Copy not supported');
}
window.getSelection().removeAllRanges();
});
// Generate share link with encoded text
shareBtn.addEventListener('click', () => {
const text = editor.value;
if (!text) {
alert('Editor is empty - nothing to share!');
shareLinkInput.value = '';
return;
}
try {
// Encode the text safely for URL
const encoded = encodeURIComponent(text);
// Use current location without hash
const base = location.href.split('#')[0];
const shareURL = base + '#/' + encoded;
if (shareURL.length > 2000) {
// Warn about URL length; this is browser and server dependent
if (!confirm('Warning: URL may be very long and unsupported by some browsers. Continue?')) {
return;
}
}
shareLinkInput.value = shareURL;
shareLinkInput.select();
alert('Share URL generated and selected. You can now copy it.');
} catch (e) {
alert('Failed to generate share link');
}
});
loadFromHash();
</script>
</body>
</html>
#/.If you want a solution for large files involving storage/sharing, you would likely need backend services or local filesystem APIs. Let me know if you want a more robust solution!
Not yet included in a published release.