Skip to content

Commit 66044be

Browse files
Add field to add new notes (#43)
1 parent c126df5 commit 66044be

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

src/index.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@ <h3>PowerNote</h3>
4747
<!-- <button id="deselect-notes-button" type="button" class="btn btn-primary btn-block" data-toggle="tooltip" data-placement="right" title="Redo the last undone action">Redo</button> -->
4848
<button id="number-notes-button" type="button" class="btn btn-primary btn-block" data-toggle="tooltip" data-placement="right" title="Convert selected notes into a numbered list">Number</button>
4949
</div>
50+
<div class="input-group mb-3">
51+
<div class="input-group-prepend">
52+
<span class="input-group-text" id="basic-addon3">Add</span>
53+
</div>
54+
<input id="add-note-field" class="form-control" aria-describedby="basic-addon3" type="text" data-toggle="tooltip" data-placement="right" title="Quick add a new note" placeholder="New"></input>
55+
</div>
5056
<!-- </div> -->
5157
</div>
5258
<div class="container">

src/script.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,21 @@ function update_buttons() {
153153
// }
154154
}
155155

156+
function add_note(content) {
157+
notes.push(content);
158+
}
159+
160+
$('#add-note-field').keyup(function(event) {
161+
if (event.keyCode === 13) {
162+
var note_text = $('#add-note-field').val();
163+
console.log(note_text)
164+
add_note(note_text);
165+
$('#notes-panel').append(load_note(note_text));
166+
sync();
167+
$('#add-note-field').val('');
168+
}
169+
});
170+
156171
// Delete selection
157172
$('#delete-notes-button').click(() => {
158173
record_event({

src/stylesheet.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ li {
1414
border-color: #00c84a;
1515
}
1616

17+
div.input-group {
18+
width: 80% !important;
19+
}
20+
1721
/* #content>* {
1822
display: inline-block !important;
1923
} */

0 commit comments

Comments
 (0)