Browse Source

apparently MediumEditor already has a placeholder text mechanism

pull/19/head
Aaron Parecki 9 years ago
parent
commit
d6a2dddc5b
3 changed files with 5 additions and 8 deletions
  1. +2
    -5
      public/editor/editor.js
  2. +1
    -1
      views/editor.php
  3. +2
    -2
      views/partials/appcache.php

+ 2
- 5
public/editor/editor.js View File

@ -1,5 +1,6 @@
var editor = new MediumEditor('.editable', { var editor = new MediumEditor('.editable', {
buttons: ['bold', 'italic', 'anchor', 'header1', 'header2', 'quote', 'unorderedlist', 'pre'], buttons: ['bold', 'italic', 'anchor', 'header1', 'header2', 'quote', 'unorderedlist', 'pre'],
placeholder: 'Write something nice...',
paste: { paste: {
// This example includes the default options for paste, if nothing is passed this is what it used // This example includes the default options for paste, if nothing is passed this is what it used
forcePlainText: false, forcePlainText: false,
@ -10,7 +11,7 @@ var editor = new MediumEditor('.editable', {
} }
}); });
$(function () {
$(function() {
$('.editable').mediumInsert({ $('.editable').mediumInsert({
editor: editor, editor: editor,
beginning: true, beginning: true,
@ -26,9 +27,6 @@ $(function () {
} }
} }
}); });
$('.editable').focus(function(){
$('.placeholder').removeClass('placeholder');
});
$.post('/editor/test-login', {}, function(response) { $.post('/editor/test-login', {}, function(response) {
if(response.logged_in) { if(response.logged_in) {
@ -91,7 +89,6 @@ $(function () {
function reset_page() { function reset_page() {
$("#post-name").val(''); $("#post-name").val('');
$("#content").html('<p class="placeholder">Write something nice...</p>');
$("#draft-status").text("New"); $("#draft-status").text("New");
return localforage.setItem('currentdraft', {}); return localforage.setItem('currentdraft', {});
} }

+ 1
- 1
views/editor.php View File

@ -89,7 +89,7 @@
<div class="container"> <div class="container">
<input id="post-name" type="text" value="" placeholder="Title"> <input id="post-name" type="text" value="" placeholder="Title">
<div id="content" class="editable"><p class="placeholder">Write something nice...</p></div>
<div id="content" class="editable"></div>
</div> </div>
<div id="new_version_available"> <div id="new_version_available">

+ 2
- 2
views/partials/appcache.php View File

@ -1,6 +1,6 @@
CACHE MANIFEST CACHE MANIFEST
# v15
# v17
/editor /editor
/editor/style.css /editor/style.css
@ -18,7 +18,7 @@ CACHE MANIFEST
/editor/medium-editor/js/medium-editor-insert-plugin.min.js /editor/medium-editor/js/medium-editor-insert-plugin.min.js
/editor/localforage/localforage.js /editor/localforage/localforage.js
/editor/quill-logo-36.png /editor/quill-logo-36.png
/editor/editor.js
# /editor/editor.js
/editor/font-awesome/fonts/fontawesome-webfont.woff2?v=4.3.0 /editor/font-awesome/fonts/fontawesome-webfont.woff2?v=4.3.0
/editor/font-awesome/fonts/fontawesome-webfont.woff?v=4.3.0 /editor/font-awesome/fonts/fontawesome-webfont.woff?v=4.3.0
/editor/font-awesome/fonts/fontawesome-webfont.ttf?v=4.3.0 /editor/font-awesome/fonts/fontawesome-webfont.ttf?v=4.3.0

Loading…
Cancel
Save