Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save 11111000000/b4bf2925bbc2e1bbca67 to your computer and use it in GitHub Desktop.
Save 11111000000/b4bf2925bbc2e1bbca67 to your computer and use it in GitHub Desktop.
A Pen by Peter.
<html lang="en">
<head>
<meta charset="UTF-8"/>
<title>Test editor</title>
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<!--script type="text/javascript" src="https://ierange.googlecode.com/files/ierange-m2.js"></script-->
</head>
<body>
<div class="editor-container">
<div class="editor" contenteditable></div>
</div>
<div class="tools">
<button class="lorem-ipsum-btn">Lorem Ipsum</button>
<img alt="image" src="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBxQTEhQUExQVFhUXGB8ZGBgYGBwYIBwgHBodHiAcHSAfHiggHB0mGxkaIjEhJSkrMC4uHR8zODMtOCgtLisBCgoKDg0OGhAQGiwkHBwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLP/AABEIAI8BXwMBIgACEQEDEQH/xAAbAAACAwEBAQAAAAAAAAAAAAAFBgIDBAcBAP/EAEUQAAIBAgQEBAMFBQYEBQUAAAECEQMhAAQSMQUiQVEGE2FxBzKBFCNCkaEzUmKx8BUkksHR4VNygvEWF0NEwiU0Y6Ky/8QAGAEBAQEBAQAAAAAAAAAAAAAAAAECAwT/xAAhEQEAAgMBAAICAwAAAAAAAAAAARECEjEhAxNBsRQygf/aAAwDAQACEQMRAD8A6N408WvknoolEVTVDm76I0QexGxJJMRGAmV+Juoc1FdUkHSzaRAn5igmQRBAgzYnHnxUrBa2V1AQVqAmJMctp6C2qO6qemFKjligRKRUEzJhTJAgQIsNGwi8RJvjnllMSsQf08Z1pBfLKiE/Oasjr8o0S59Fk3xqTxfJChBJMCRUG5j9y2Oe8DzOVR6jVs3k1LFSVWqokrHMQDGqxE7kMdojDCnH+HAg/bMtI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MzbeSfyvt6e8zzXw1eo5qGuQxkyvLuCLRtHT/cy0LAKuYyHn1prUhl/JVqbLUmp5xdy2kSX1wFlY7Wxi4hm6VTLZUU81laeZePtNQ1lJWEkiNZElgAQPUWF8OFX4csykPUViRGsrDRM2iB6TE4yVPhQpMmp+DQOlgI/OOvoO2JoWWeK5ug9DK06WZylM6deZbzlMMqLygFiJY6ltHvFj7XzuTqZZozFBMzTqTIrqPOA7EsRBDELNgVW0DDRQ+FoUoRUB0AgAiRBmZ/M/0BiWY+GTNA88qo2VQALfSTcdSdzhpK2Gpn+Ha0HmZXSaRLKaihRU5RczqXk1C1on0wD4XxDJeVSpVnFKqSzHMJWouFhiImozEAwByqdViDcw5f8AlxU8ryvtB0fr+eI0fhoygjzyymeVgCLzcH5lMmeUjp2w0ktzTM5vmzFOg5el5y+XpUqGDcoCrB6mBsOthGOk/CN1+8VSGKcjMLgsCS0dwGJUHqFB649q/DMnWRV0M406lF1WNOlJkLItIE73ucH/AAL4OHD1ZVbUD+mNRiky/9k="/>
<img alt="image" src="https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcSQvaW-8ILpc4NKkrCjYjV3RBKNEI6UDGW1NEFlBxPOYfY4hB3gUA"/>
<img alt="image" src="https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcQy8umHXJUmfEbZC4mf41J4J4zyFsDokGlW6wph5QLK1bphcNbXbw"/>
</div>
</body>
<!--
-- SCRIPT
-->
<script>
</script>
<!-- STYLES -->>
<style>
</style>
</html>
/*
* Делает картику из файла или возвращает данные имеющейся
*/
function readImageFromEvent(event, callback) {
if (event.dataTransfer.files && event.dataTransfer.files[0]) {
var file = event.dataTransfer.files[0]
var reader = new FileReader();
reader.readAsDataURL( file );
reader.onload = function (e) {
callback($('<img>').attr('src', e.target.result));
}
}
else if(isIE()) {
var data = event.dataTransfer.getData('Text');
callback($( "<img />" ).attr('src', data));
}
else {
var data = event.dataTransfer.getData('text/html');
callback(data);
}
}
function pasteHtmlAtCaret(html, selectPastedContent) {
var sel, range;
if (window.getSelection) {
// IE9 and non-IE
sel = window.getSelection();
if (sel.getRangeAt && sel.rangeCount) {
range = sel.getRangeAt(0);
range.deleteContents();
var el = document.createElement("div");
el.innerHTML = html;
var frag = document.createDocumentFragment(), node, lastNode;
while ( (node = el.firstChild) ) {
lastNode = frag.appendChild(node);
}
var firstNode = frag.firstChild;
range.insertNode(frag);
// Preserve the selection
if (lastNode) {
range = range.cloneRange();
range.setStartAfter(lastNode);
if (selectPastedContent) {
range.setStartBefore(firstNode);
} else {
range.collapse(true);
}
sel.removeAllRanges();
sel.addRange(range);
}
}
} else if ( (sel = document.selection) && sel.type != "Control") {
// IE < 9
var originalRange = sel.createRange();
originalRange.collapse(true);
sel.createRange().pasteHTML(html);
if (selectPastedContent) {
range = sel.createRange();
range.setEndPoint("StartToStart", originalRange);
range.select();
}
}
}
function getRangeOfPoint (x,y) {
var range;
if (document.caretPositionFromPoint) {
var pos = document.caretPositionFromPoint(x, y);
range = document.createRange();
range.setStart(pos.offsetNode, pos.offset);
range.collapse();
}
else if (document.caretRangeFromPoint) {
range = document.caretRangeFromPoint(x, y);
}
else if (document.body.createTextRange) {
try {
range = document.body.createTextRange();
range.moveToPoint(x, y);
}
catch (ex){
console.log('fuck the IE!!!');
}
}
return range;
}
// function isIE () {
// console.log(navigator.userAgent);
// var myNav = navigator.userAgent.toLowerCase();
// return (myNav.indexOf('msie') != -1) ? parseInt(myNav.split('msie')[1]) : false;
// }
function isIE()
{
var rv = -1;
if (navigator.appName == 'Microsoft Internet Explorer')
{
var ua = navigator.userAgent;
var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
if (re.exec(ua) != null)
rv = parseFloat( RegExp.$1 );
}
else if (navigator.appName == 'Netscape')
{
var ua = navigator.userAgent;
var re = new RegExp("Trident/.*rv:([0-9]{1,}[\.0-9]{0,})");
if (re.exec(ua) != null)
rv = parseFloat( RegExp.$1 );
}
return rv;
}
/*
* Editor Prototype
*/
var Editor = function(className) {
var self = this;
self.editor = $(className);
self.IE = isIE();
if(self.IE) { console.log('IE', self.IE); }
/*
* Вставляет картинку в регион
*/
function pasteImageToRange(img, range) {
if (range && img) {
var container = $(range.startContainer);
if(!container.hasClass('image-container')) {
container = $('<div />').addClass('image-container');
range.insertNode(container.get(0));
}
container.append(img);
self.editor.trigger('input');
}
}
function pasteImageToIE(img, placeholder) {
if (placeholder && img) {
var parent = placeholder.parent();
var container = $(parent);
var next = placeholder[0].nextSibling;
var prev = placeholder[0].previousSibling;
if(next && next.nodeType != 3) {
container = container.add(placeholder.next());
}
if(prev && prev.nodeType != 3) {
container = container.add(placeholder.prev());
}
container = container.filter('.image-container').eq(0);
if(container.length == 0) {
container = $('<div />').addClass('image-container');
container.insertAfter(placeholder);
}
container.append(img);
placeholder.remove();
self.editor.trigger('input');
}
}
$.extend(true, self, {
defaults: {
maxImageWidth: 640
, imageMargin: 10
}
, baseWidth: self.editor.innerWidth()
, set : function (html) { self.editor.html(html) }
, updateImages: (function () {
function getNewWidth(sibLen) {
if(sibLen >= 0) return self.defaults.maxImageWidth / (sibLen + 1) - (2 * self.defaults.imageMargin)
}
if(self.editor) {
self.editor.find('img').each(function(i, img) {
$(img).width( getNewWidth( $(img).siblings('img').length ) );
})
}
})
});
/*
* События ,,,
*/
self.editor.on('input', function() {
self.updateImages();
});
self.editor.on('drop', function($event) {
$event.stopPropagation();
$event.preventDefault();
if(isIE() > 7) {
pasteHtmlAtCaret('<div id="ie_placeholder">FUCK THE IE</div>');
var placeholder = $('#ie_placeholder');
readImageFromEvent($event.originalEvent, function(img) {
if (img && placeholder) {
pasteImageToIE(img, placeholder)
}
});
} else {
var x = $event.originalEvent.clientX
, y = $event.originalEvent.clientY;
var range = getRangeOfPoint(x, y);
readImageFromEvent($event.originalEvent, function(img) {
if (img && range) { pasteImageToRange(img, range) }
});
}
});
}
/*
* Start
*/
$(function() {
var loremIpsum = 'Sed ut perspiciatis, unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam eaque ipsa, quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt, explicabo. Nemo enim ipsam voluptatem, quia voluptas sit, aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos, qui ratione voluptatem sequi nesciunt, neque porro quisquam est, qui dolorem ipsum, quia dolor sit, amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt, ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit, qui in ea voluptate velit esse, quam nihil molestiae consequatur, vel illum, qui dolorem eum fugiat, quo voluptas nulla pariatur? At vero eos et accusamus et iusto odio dignissimos ducimus, qui blanditiis praesentium voluptatum deleniti atque corrupti, quos dolores et quas molestias excepturi sint, obcaecati cupiditate non provident, similique sunt in culpa, qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio, cumque nihil impedit, quo minus id, quod maxime placeat, facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet, ut et voluptates repudiandae sint et molestiae non recusandae. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.';
var editor = new Editor('.editor');
$('.lorem-ipsum-btn').click(function() {
editor.set(loremIpsum)
});
$('img').on('dragstart', function($event) {
event = $event.originalEvent;
event.dataTransfer.setData('Text', $event.target.src);
});
});
body {
margin: 0;
padding: 0;
background: #333;
}
.editor-container {
margin: 0 auto;
left: 0;
right: 0;
position: fixed;
background: #fafafa;
color: #000;
height: 100%;
width: 800px;
overflow-y: scroll;
}
.editor {
padding: 20px;
position: relative;
min-height: 100%;
font-family: Helvetica, Arial, sans-serif;
font-size: 28px;
text-align: justify;
}
.editor img {
margin: 10px;
text-align: center;
}
.image-container {
text-align: center;
}
.tools {
position: fixed;
background: black;
opacity: 0.8;
padding: 10px;
bottom: 0px;
width: 100%;
height: 70px;
}
.tools img {
height: 70px;
width: 70px
}
.lorem-ipsum-btn {
vertical-align: top;
height: 70px;
background: black;
color: white;
line-height: 10px;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment