diff --git a/www/css/editor.css b/www/css/editor.css
new file mode 100644
index 0000000..f23ac0e
--- /dev/null
+++ b/www/css/editor.css
@@ -0,0 +1,13 @@
+/*
+This Source Code Form is subject to the terms of the Mozilla Public
+License, v. 2.0. If a copy of the MPL was not distributed with this
+file, You can obtain one at http://mozilla.org/MPL/2.0/.
+*/
+/*
+ Created on : Jan 7, 2019, 9:30:35 PM
+ Author : Skylar Ittner
+*/
+
+.CodeMirror {
+ border-bottom: none;
+}
\ No newline at end of file
diff --git a/www/index.html b/www/index.html
index 5f86239..5b3900b 100644
--- a/www/index.html
+++ b/www/index.html
@@ -10,6 +10,8 @@
+
+
NotePost
@@ -26,6 +28,7 @@
+
diff --git a/www/js/Notes.class.js b/www/js/Notes.class.js
index b470bb8..2e354e4 100644
--- a/www/js/Notes.class.js
+++ b/www/js/Notes.class.js
@@ -40,7 +40,6 @@ Notes.prototype.add = function (note, callback) {
}
Notes.prototype.fix = function (note) {
- console.log("Fixing note " + note.id);
// Set background color
if (typeof note.color !== 'string') {
note.color = "FFF59D";
@@ -50,9 +49,6 @@ Notes.prototype.fix = function (note) {
var r = parseInt(note.color.substring(0, 2), 16);
var g = parseInt(note.color.substring(2, 4), 16);
var b = parseInt(note.color.substring(4, 6), 16);
- console.log(r);
- console.log(g);
- console.log(b);
var contrast = Math.sqrt(
r * r * 0.241 +
@@ -66,6 +62,14 @@ Notes.prototype.fix = function (note) {
note.textcolor = "FFFFFF";
}
}
+ // Just in case
+ if (typeof note.content !== 'string') {
+ note.content = "";
+ }
+ // Set title
+ if (typeof note.title !== 'string') {
+ note.title = note.content.split('\n')[0].replace(/[#\-]+/gi, "").trim();
+ }
// Render Markdown to HTML
if (typeof note.html !== 'string') {
note.html = marked(note.content);
diff --git a/www/js/home.js b/www/js/home.js
index 3be6264..7b5cdba 100644
--- a/www/js/home.js
+++ b/www/js/home.js
@@ -29,6 +29,14 @@ $(".view-main").on("ptr:refresh", ".ptr-content", function () {
});
function editNote(id) {
+ var note = notes.get(id);
+ router.navigate("/editnote", {
+ context: {
+ noteid: id,
+ content: note.content,
+ notetitle: note.title,
+ }
+ });
console.log("Editing " + id);
}
@@ -46,18 +54,22 @@ function deleteNote(id) {
$("#app").on("click", ".edit-note-btn", function () {
editNote($(this).data("note"));
+ app.popover.close();
});
$("#app").on("click", ".favorite-note-btn", function () {
favoriteNote($(this).data("note"));
+ app.popover.close();
});
$("#app").on("click", ".listify-note-btn", function () {
makeList($(this).data("note"));
+ app.popover.close();
});
$("#app").on("click", ".delete-note-btn", function () {
deleteNote($(this).data("note"));
+ app.popover.close();
});
function openNoteActionMenu(notecard) {
diff --git a/www/package.json b/www/package.json
index 40e4aaa..768d010 100644
--- a/www/package.json
+++ b/www/package.json
@@ -7,6 +7,7 @@
"license": "MPL-2.0",
"dependencies": {
"@fortawesome/fontawesome-free": "^5.6.3",
+ "easymde": "^2.4.2",
"framework7": "^3.6.5",
"jquery": "^3.3.1",
"marked": "^0.6.0"
diff --git a/www/pages/editnote.html b/www/pages/editnote.html
new file mode 100644
index 0000000..b4f6efa
--- /dev/null
+++ b/www/pages/editnote.html
@@ -0,0 +1,58 @@
+
+