mirror of
https://github.com/JanGross/quicknotes.git
synced 2025-12-01 07:37:18 +01:00
Positioning the modal editor in the position of the original note
This commit is contained in:
@@ -92,7 +92,7 @@
|
|||||||
|
|
||||||
/* The Modal (background) */
|
/* The Modal (background) */
|
||||||
|
|
||||||
.modal-note {
|
.modal-note-background {
|
||||||
position: fixed; /* Stay in place */
|
position: fixed; /* Stay in place */
|
||||||
z-index: 10000; /* Sit on top */
|
z-index: 10000; /* Sit on top */
|
||||||
padding-top: 100px; /* Location of the box */
|
padding-top: 100px; /* Location of the box */
|
||||||
@@ -117,6 +117,7 @@
|
|||||||
#content-editable {
|
#content-editable {
|
||||||
min-height: 20px;
|
min-height: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Modal Content */
|
/* Modal Content */
|
||||||
|
|
||||||
.modal-content {
|
.modal-content {
|
||||||
@@ -125,20 +126,4 @@
|
|||||||
width: 60%;
|
width: 60%;
|
||||||
height: auto;
|
height: auto;
|
||||||
min-height: unset;
|
min-height: unset;
|
||||||
box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2),0 6px 20px 0 rgba(0,0,0,0.19);
|
|
||||||
-webkit-animation-name: animatetop;
|
|
||||||
-webkit-animation-duration: 0.4s;
|
|
||||||
animation-name: animatetop;
|
|
||||||
animation-duration: 0.4s
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Add Animation */
|
|
||||||
@-webkit-keyframes animatetop {
|
|
||||||
from {top:-300px; opacity:0}
|
|
||||||
to {top:0; opacity:1}
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes animatetop {
|
|
||||||
from {top:-300px; opacity:0}
|
|
||||||
to {top:0; opacity:1}
|
|
||||||
}
|
}
|
||||||
|
|||||||
43
js/script.js
43
js/script.js
@@ -153,10 +153,10 @@ View.prototype = {
|
|||||||
$('.notes-grid').isotope({ filter: '*'});
|
$('.notes-grid').isotope({ filter: '*'});
|
||||||
},
|
},
|
||||||
editNote: function (id) {
|
editNote: function (id) {
|
||||||
var modal = $('#modal-note-editable');
|
var modal = $('#modal-note-div');
|
||||||
var modaltitle = $('#modal-note-editable #title-editable');
|
var modaltitle = $('#modal-note-div #title-editable');
|
||||||
var modalcontent = $('#modal-note-editable #content-editable');
|
var modalcontent = $('#modal-note-div #content-editable');
|
||||||
var modalnote = $("#modal-note-editable .quicknote");
|
var modalnote = $("#modal-note-div .quicknote");
|
||||||
|
|
||||||
var note = $('.notes-grid [data-id=' + id + ']').parent();
|
var note = $('.notes-grid [data-id=' + id + ']').parent();
|
||||||
|
|
||||||
@@ -174,15 +174,24 @@ View.prototype = {
|
|||||||
modalcontent.html(content);
|
modalcontent.html(content);
|
||||||
modalnote.css("background-color", color);
|
modalnote.css("background-color", color);
|
||||||
|
|
||||||
|
/* Positioning the modal to the original size */
|
||||||
|
$(".modal-content").css({
|
||||||
|
"position" : "absolute",
|
||||||
|
"left" : note.offset().left,
|
||||||
|
"top" : note.offset().top,
|
||||||
|
"width" : note.width(),
|
||||||
|
"min-height": note.height(),
|
||||||
|
"height:" : "auto"
|
||||||
|
});
|
||||||
modal.removeClass("hide-modal-note");
|
modal.removeClass("hide-modal-note");
|
||||||
modal.addClass("show-modal-note");
|
modal.addClass("show-modal-note");
|
||||||
modalcontent.focus();
|
modalcontent.focus();
|
||||||
},
|
},
|
||||||
cancelEdit: function () {
|
cancelEdit: function () {
|
||||||
var modal = $('#modal-note-editable');
|
var modal = $('#modal-note-div');
|
||||||
var modaltitle = $('#modal-note-editable #title-editable');
|
var modaltitle = $('#modal-note-div #title-editable');
|
||||||
var modalcontent = $('#modal-note-editable #content-editable');
|
var modalcontent = $('#modal-note-dive #content-editable');
|
||||||
var modalnote = $("#modal-note-editable .quicknote");
|
var modalnote = $("#modal-note-div .quicknote");
|
||||||
|
|
||||||
this._notes.unsetActive();
|
this._notes.unsetActive();
|
||||||
this.showAll();
|
this.showAll();
|
||||||
@@ -213,10 +222,10 @@ View.prototype = {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Handle click event to open note.
|
// Handle click event to open note.
|
||||||
var modal = $('#modal-note-editable');
|
var modal = $('#modal-note-div');
|
||||||
var modaltitle = $('#modal-note-editable #title-editable');
|
var modaltitle = $('#modal-note-div #title-editable');
|
||||||
var modalcontent = $('#modal-note-editable #content-editable');
|
var modalcontent = $('#modal-note-div #content-editable');
|
||||||
var modalnote = $("#modal-note-editable .quicknote");
|
var modalnote = $("#modal-note-div .quicknote");
|
||||||
|
|
||||||
// Show delete icon on hover.
|
// Show delete icon on hover.
|
||||||
$(".quicknote").hover(function() {
|
$(".quicknote").hover(function() {
|
||||||
@@ -235,6 +244,11 @@ View.prototype = {
|
|||||||
self.editNote(id);
|
self.editNote(id);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Cancel when click outside the modal.
|
||||||
|
$(".modal-note-background").click(function () {
|
||||||
|
self.cancelEdit();
|
||||||
|
});
|
||||||
|
|
||||||
// Cancel with escape key
|
// Cancel with escape key
|
||||||
$(document).keyup(function(event) {
|
$(document).keyup(function(event) {
|
||||||
if (event.keyCode == 27) {
|
if (event.keyCode == 27) {
|
||||||
@@ -341,16 +355,13 @@ View.prototype = {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// load a note
|
// show a note
|
||||||
$('#app-navigation .note > a').click(function () {
|
$('#app-navigation .note > a').click(function () {
|
||||||
var id = parseInt($(this).parent().data('id'), 10);
|
var id = parseInt($(this).parent().data('id'), 10);
|
||||||
$('.notes-grid').isotope({ filter: function() {
|
$('.notes-grid').isotope({ filter: function() {
|
||||||
var itemId = parseInt($(this).children().data('id'), 10);
|
var itemId = parseInt($(this).children().data('id'), 10);
|
||||||
return id == itemId;
|
return id == itemId;
|
||||||
} });
|
} });
|
||||||
self.editNote(id);
|
|
||||||
|
|
||||||
// self._notes.load(id);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Handle colors.
|
// Handle colors.
|
||||||
|
|||||||
@@ -1,27 +1,27 @@
|
|||||||
<div id="modal-note-editable" class="hide-modal-note modal-note">
|
<div id="modal-note-div" class="hide-modal-note modal-note-background">
|
||||||
|
<div class="modal-content">
|
||||||
<div class="quicknote note-active modal-content" style="background-color: #F7EB96" data-id="-1">
|
<div class="quicknote note-active" style="background-color: #F7EB96" data-id="-1">
|
||||||
<div contenteditable="true" id='title-editable' class='note-title'></div>
|
<div contenteditable="true" id='title-editable' class='note-title'></div>
|
||||||
<div contenteditable="true" id='content-editable' class='note-content'></div>
|
<div contenteditable="true" id='content-editable' class='note-content'></div>
|
||||||
<div>
|
<div>
|
||||||
<div class="save-button">
|
<div class="save-button">
|
||||||
<button id='save-button'><?php p($l->t('Save')); ?></button>
|
<button id='save-button'><?php p($l->t('Save')); ?></button>
|
||||||
</div>
|
</div>
|
||||||
<div class="save-button">
|
<div class="save-button">
|
||||||
<button id='cancel-button'><?php p($l->t('Cancel')); ?></button>
|
<button id='cancel-button'><?php p($l->t('Cancel')); ?></button>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="note-toolbar">
|
||||||
<div class="note-toolbar">
|
<a href="#" class="circle-toolbar" style="background-color: #F7EB96"></a>
|
||||||
<a href="#" class="circle-toolbar" style="background-color: #F7EB96"></a>
|
<a href="#" class="circle-toolbar" style="background-color: #88B7E3"></a>
|
||||||
<a href="#" class="circle-toolbar" style="background-color: #88B7E3"></a>
|
<a href="#" class="circle-toolbar" style="background-color: #C1ECB0"></a>
|
||||||
<a href="#" class="circle-toolbar" style="background-color: #C1ECB0"></a>
|
<a href="#" class="circle-toolbar" style="background-color: #BFA6E9"></a>
|
||||||
<a href="#" class="circle-toolbar" style="background-color: #BFA6E9"></a>
|
<a href="#" class="circle-toolbar" style="background-color: #DAF188"></a>
|
||||||
<a href="#" class="circle-toolbar" style="background-color: #DAF188"></a>
|
<a href="#" class="circle-toolbar" style="background-color: #FF96AC"></a>
|
||||||
<a href="#" class="circle-toolbar" style="background-color: #FF96AC"></a>
|
<a href="#" class="circle-toolbar" style="background-color: #FCF66F"></a>
|
||||||
<a href="#" class="circle-toolbar" style="background-color: #FCF66F"></a>
|
<a href="#" class="circle-toolbar" style="background-color: #F2F1EF"></a>
|
||||||
<a href="#" class="circle-toolbar" style="background-color: #F2F1EF"></a>
|
<a href="#" class="circle-toolbar" style="background-color: #C1D756"></a>
|
||||||
<a href="#" class="circle-toolbar" style="background-color: #C1D756"></a>
|
<a href="#" class="circle-toolbar" style="background-color: #CECECE"></a>
|
||||||
<a href="#" class="circle-toolbar" style="background-color: #CECECE"></a>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user