Skip to content

Instantly share code, notes, and snippets.

@Hajto
Forked from Pan-Maciek/editor.js
Last active June 10, 2016 10:44
Show Gist options
  • Save Hajto/58200e676426f6b00535827daac388cf to your computer and use it in GitHub Desktop.
Save Hajto/58200e676426f6b00535827daac388cf to your computer and use it in GitHub Desktop.
var Editor = function(el){
this.element = el
this.cursors = []
this.lines = []
}
Editor.prototype.creatLine = function (linenum){
var that = this
var el = document.createElement("p")
el.addEventListener("click",function(){
that.lines.push(el)
console.log(that.lines)
},true);
this.element.appendChild(el)
}
var edit
window.onload = function(){
edit = new Editor(document.getElementsByClassName("editor")[0])
}
<!DOCTYPE html>
<html>
<head>
<title>edytor</title>
<link rel="stylesheet" href="style.css">
<meta charset="utf-8">
<script src="editor.js"></script>
</head>
<body>
<div class="editor">
<p>abc</p>
</div>
</body>
</html>
.editor {
background-color: #1f1f1f;
font-size: 25px;
color: #f1f1f1
}
.editor p{
min-height: 25px;
padding:0 2rem;
margin: 0;
}
body {
font-family: "consolas"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment