ContentEditable Text Editor
How do I make an contenteditable text editor?
What is a contenteditable text editor? How do you make a contenteditable text editor? This script and codes were developed by AppleCrazy on 23 September 2022, Friday.
ContentEditable Text Editor - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>ContentEditable Text Editor</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div class="ce" id="editor" contenteditable>
Type your next novel here. No distractions, no frills.
</div>
<div class="loc" id="loc"> 1
</div>
<div class="opts"> <button id="dl">Download .txt</button>
</div> <script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js'></script>
<script src='https://cdn.rawgit.com/eligrey/FileSaver.js/master/FileSaver.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
ContentEditable Text Editor - Script Codes CSS Codes
body { margin: 0; padding: 0; width: 100vw; height: 100vh;
}
.ce, .loc, #dl { font-family: Hack, Menlo, Consolas, monospace; font-size: 10pt; line-height: 13pt;
}
.ce { margin: 0; margin: 32px; margin-top: 10px; padding: 0; width: calc(100vw - 64px); min-height: 100vh; outline: none;
}
.loc { position: absolute; z-index: 1000; left: 0; top: 0; margin: 0; padding: 5px 15px 5px 5px; padding-top: 10px; text-align: center; width: 10px; min-height: 100vh; background: lightgray;
}
#dl { position: fixed; bottom: 10px; right: 10px; border: none; outline: none; background: lightgray; border-radius: 5px; padding: 5px; display: block; cursor: pointer;
}
#dl:active { color: green;
}
ContentEditable Text Editor - Script Codes JS Codes
var editor = document.getElementById("editor");
var loc = document.getElementById("loc");
var dl = document.getElementById("dl");
editor.oninput = updateLineCount;
dl.onclick = download;
function updateLineCount(e) { var lineCount = e.target.innerHTML.split("<div>").length; var lines = Array.apply(null, {length: lineCount + 1}).map(Number.call, Number); lines.splice(0, 1); var linesStr = lines.join("\n"); loc.innerHTML = linesStr; save();
}
function save() { localStorage.setItem('savedText', editor.innerHTML);
}
function download() { var txt = $("#editor").text(); var bl = new Blob([txt], {type:'text/plain'}); saveAs(bl, txt.split('\n')[0] + ".txt");
}
window.onload = function() { editor.innerHTML = localStorage.getItem('savedText');
};
Developer | AppleCrazy |
Username | applecrazy |
Uploaded | September 23, 2022 |
Rating | 3 |
Size | 2,352 Kb |
Views | 42,504 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
Get Some Zen | 2,475 Kb |
Personal Portfolio | 3,064 Kb |
Google Web Fonts | 1,686 Kb |
Signal Reciever | 3,056 Kb |
Random Quote Generator | 1,446 Kb |
Uncartify1 | 2,948 Kb |
Pure JS Webpage | 1,995 Kb |
Watch the News | 2,679 Kb |
Bootstrap 4 Testdrive | 2,672 Kb |
Angular Swag | 1,641 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
Simple search using AngularJS | Haykou | 1,802 Kb |
Basic HTML Slideshow | Tomhodgins | 3,386 Kb |
Beveled corners using CSS border attribute | DawsonMediaD | 2,136 Kb |
Zeichensatz | Moklick | 2,058 Kb |
CMP5-Opdracht15 | SannevanGastel | 2,733 Kb |
Simple blog concept | Drew_mc | 2,666 Kb |
Weather App 2 | MightyJoeW | 2,877 Kb |
Simple Responsive Text | Fbrz | 2,282 Kb |
Sticky notes with CSS3 | HaiNguyen007 | 2,146 Kb |
Display properties | Hamzaerbay | 1,886 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!