-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathindex.html
182 lines (148 loc) · 7.34 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Easy Editor</title>
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="src/easyeditor.css">
<link rel="stylesheet" href="src/easyeditor-modal.css">
</head>
<body>
<div class="container">
<h1>Easy editor <span>A rich text html / wysiwyg editor</span></h1>
<div id="editor">
<b></b><b>Lorem ipsum</b> dolor sit amet, consectetur adipisicing elit. Eos, porro provident dolorum dolorem magni est quos alias qui! Autem eveniet, asperiores optio. Sequi aperiam, officia nesciunt perspiciatis praesentium ullam labore! <br><br>Lorem ipsum dolor sit amet, consectetur adipisicing elit. A sapiente, ut incidunt officia non, repudiandae rem hic voluptatum nam qui sint velit accusamus iusto doloremque ipsa, dolorum ex eius, nihil recusandae in quasi vitae expedita veniam excepturi! <br><br>
dolor sit amet, consectetur adipisicing elit <br>
adipisicing elit. Eos, porro provident <br>
Sequi aperiam, officia nesciunt perspiciatis <br>
ut incidunt officia non, repudiandae
<br><br>
<figure>
<img src="http://placehold.it/500x300" alt="">
</figure>
<br><br>
Magni natus, animi aliquid unde dolores quaerat totam quia laudantium voluptatem velit ducimus sapiente in nihil laboriosam hic consectetur repellendus odit. Voluptatem reprehenderit sapiente ad eveniet eum voluptas autem ipsam dolorum recusandae facere, similique debitis esse, ea excepturi nulla aliquam ut nesciunt! Vero fugiat obcaecati excepturi molestias, aut veniam aliquam enim sit eligendi ex laborum, repellendus aspernatur, libero dolore quod voluptatibus ea! Aspernatur!
</div>
<p class="p">You can change the entire look and feel, can able to add button / event / can do anything with it. Read <a href="./documentation.html">documentation here</a> or <a href="./examples.html">more example here</a></p>
<p class="p">Usage: </p>
<pre class="code">Go ahead view source or check out <a href="./examples.html">example lists</a></pre>
<p class="p">Most minimal example given below - </p>
<p class="p">HTML:</p>
<pre class="code"><div id="editor" placeholder="Type here ... "></div></pre>
<p class="p">CSS:</p>
<pre class="code"><link rel="stylesheet" href="path_to/easyeditor.css"></pre>
<p class="p">JS:</p>
<pre class="code"><script src="path_to/jquery.min.js"></script>
<script src="path_to/jquery.easyeditor.js"></script>
<script>
jQuery(document).ready(function($) {
new EasyEditor('#editor');
});
</script></pre>
<p class="p">Now this should be very easy!</p>
<footer>
EasyEditor is completely free and open source for educational and commercial purpose. Do whatever you want, i don't give a F!
<br>Github URL - <a href="https://github.com/im4aLL/easyeditor" target="_blank">https://github.com/im4aLL/easyeditor</a> Made with ❤ by <a href="http://habibhadi.com" target="_blank">Habib Hadi</a>
<br>Hadi: I'm not that good in JS, please improve it as the way you want. As it requires hard work & time to accomplish that so i expect a thanks at least :)
</footer>
<!-- comment starts -->
<script src="https://apis.google.com/js/plusone.js"></script>
<div id="comments"></div>
<script>
gapi.comments.render('comments', {
href: window.location,
width: '960',
first_party_property: 'BLOGGER',
view_type: 'FILTERED_POSTMOD'
});
</script>
<!-- comment starts -->
</div>
<div class="easyeditor-modal is-hidden" id="easyeditor-modal-1">
<div class="easyeditor-modal-content">
<div class="easyeditor-modal-content-header">Upload image</div>
<div class="easyeditor-modal-content-body">
<div class="easyeditor-modal-content-body-loader"></div>
<button class="easyeditor-modal-close">x</button>
<form action="uploader_sdk/" method="post" enctype="multipart/form-data">
<input type="file" name="file" id="easyeditor-file">
<button type="submit" name="easyeditor-upload">Upload and insert</button>
</form>
</div>
</div>
</div>
<script src="vendor/jquery.min.js"></script>
<script src="vendor/jquery.form.min.js"></script>
<script src="src/jquery.easyeditor.js"></script>
<script>
EasyEditor.prototype.image = function(){
var _this = this;
var settings = {
buttonIdentifier: 'insert-image',
buttonHtml: 'Insert image',
clickHandler: function(){
_this.openModal('#easyeditor-modal-1');
}
};
_this.injectButton(settings);
};
EasyEditor.prototype.youtube = function(){
var _this = this;
var settings = {
buttonIdentifier: 'insert-youtube-video',
buttonHtml: 'Insert youtube video',
clickHandler: function(){
var youttibeVideoLink = prompt('Insert youtube video link', '');
var videoId = _this.getYoutubeVideoIdFromUrl(youttibeVideoLink);
if(videoId.length > 0) {
var iframe = document.createElement('iframe');
$(iframe).attr({ width: '560', height: '315', frameborder: 0, allowfullscreen: true, src: 'https://www.youtube.com/embed/' + videoId });
_this.insertAtCaret(iframe);
}
else {
alert('Invalid YouTube URL!');
}
}
};
_this.injectButton(settings);
};
jQuery(document).ready(function($) {
var easyEditor = new EasyEditor('#editor', {
buttons: ['bold', 'italic', 'link', 'h2', 'h3', 'h4', 'alignleft', 'aligncenter', 'alignright', 'quote', 'code', 'image', 'youtube', 'list', 'x']
});
// form uploader starts
$loader = $('.easyeditor-modal-content-body-loader');
$('.easyeditor-modal-content-body').find('form').ajaxForm({
beforeSend: function() {
$loader.css('width', '0%');
},
uploadProgress: function(event, position, total, percentComplete) {
$loader.css('width', percentComplete + '%');
},
success: function() {
$loader.css('width', '100%');
},
complete: function(get) {
if(get.responseText != 'null') {
easyEditor.insertHtml('<figure><img src="uploader_sdk/images/'+ get.responseText +'" alt=""></figure>');
easyEditor.closeModal('#easyeditor-modal-1');
}
}
});
// form uploader ends
// sticky toolbar
var $cache = $('.easyeditor-toolbar');
var width = $cache.width();
var vTop = $cache.offset().top - parseFloat($cache.css('marginTop').replace(/auto/, 0));
$(window).scroll(function (event) {
var y = $(this).scrollTop();
if (y >= vTop) {
$cache.addClass('is-fixed').css('width', width + 'px');
} else {
$cache.removeClass('is-fixed').css('width', 'auto');
}
});
});
</script>
</body>
</html>