gpt-4.1-mini-2025-04-14· OpenAI
WildChat-4.8M (AI2)
html css js text editor 1tb copy share "#/"
- User
html css js text editor 1tb copy share "#/"
- Assistant
html css js text editor 1tb copy share "#/"
It sounds like you want a simple web-based text editor made with HTML, CSS, and JavaScript that has the following features:
#/<content>)I will create a simple example of a text editor that:
Since URL hash length is limited and you want to avoid issues, we'll encode the content in a compressed or encoded format (base64 or URI encoded). For simplicity, I'll use encodeURIComponent to encode the string into hash.
Here is an example implementation:
<!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 and Copy</title>
<style>
body {
margin: 0;
padding: 0;
height: 100vh;
display: flex;
flex-direction: column;
font-family: Arial, sans-serif;
}
textarea {
flex: 1;
padding: 10px;
font-size: 1rem;
resize: none;
border: none;
outline: none;
width: 100%;
box-sizing: border-box;
}
.toolbar {
background: #333;
padding: 10px;
display: flex;
gap: 10px;
color: white;
}
button {
background: #555;
border: none;
padding: 8px 16px;
border-radius: 4px;
color: white;
cursor: pointer;
}
button:hover {
background: #777;
}
#status {
margin-left: auto;
align-self: center;
font-size: 0.9rem;
opacity: 0.7;
}
</style>
</head>
<body>
<div class="toolbar">
<button id="copyBtn">Copy</button>
<button id="shareBtn">Share</button>
<div id="status"></div>
</div>
<textarea id="editor" placeholder="Start typing here..."></textarea>
<script>
(function() {
const editor = document.getElementById('editor');
const copyBtn = document.getElementById('copyBtn');
const shareBtn = document.getElementById('shareBtn');
const status = document.getElementById('status');
function updateStatus(msg, timeout = 2000) {
status.textContent = msg;
if(timeout) {
setTimeout(() => {
status.textContent = '';
}, timeout);
}
}
// Load content from URL hash if present
function loadFromHash() {
if(window.location.hash.startsWith('#/')) {
try {
const hashContent = decodeURIComponent(window.location.hash.slice(2));
editor.value = hashContent;
updateStatus('Loaded content from URL');
} catch (e) {
updateStatus('Failed to load content from URL');
}
}
}
// Copy textarea content to clipboard
copyBtn.addEventListener('click', () => {
editor.select();
try {
let successful = document.execCommand('copy');
if(successful) {
updateStatus('Copied!');
} else {
updateStatus('Copy failed');
}
} catch (e) {
updateStatus('Copy not supported');
}
editor.setSelectionRange(editor.selectionStart, editor.selectionEnd); // Keep selection
});
// Share content by updating URL hash
shareBtn.addEventListener('click', () => {
const text = editor.value;
if(text.length > 5000) {
// Warn if text is very long (URL length limits)
if(!confirm('Text is large and may not be sharable via URL. Continue?')) {
return;
}
}
const encoded = encodeURIComponent(text);
window.history.replaceState(null, '', '#/' + encoded);
updateStatus('Shareable link created');
});
// Load from hash on startup
loadFromHash();
// Optional: Also update the URL while typing? (Not required, but can be uncommented)
/*
editor.addEventListener('input', () => {
const encoded = encodeURIComponent(editor.value);
window.history.replaceState(null, '', '#/' + encoded);
});
*/
})();
</script>
</body>
</html>
If you want me to add any features like saving to local storage, themes, or line numbers, let me know!
Not yet included in a published release.