contex menu
This commit is contained in:
@@ -30,7 +30,6 @@ class Note{
|
||||
let note = getNote(id);
|
||||
note.x = ui.position.left;
|
||||
note.y = ui.position.top;
|
||||
console.log(ui.position);
|
||||
}
|
||||
});
|
||||
this.element.resizable({
|
||||
@@ -48,6 +47,59 @@ class Note{
|
||||
this.element.on( "dblclick", function() {
|
||||
openModalEditNote(parseInt($(this).attr('data-id')));
|
||||
});
|
||||
|
||||
$.contextMenu({
|
||||
selector: '.card[data-id="' + this.id + '"]',
|
||||
callback: function(key, options) {
|
||||
let id = parseInt($(this).attr('data-id'));
|
||||
switch (key){
|
||||
case 'toFront':
|
||||
noteChangeZindex(id, true)
|
||||
break;
|
||||
case 'toBack':
|
||||
noteChangeZindex(id, false)
|
||||
break;
|
||||
case 'edit':
|
||||
openModalEditNote(id);
|
||||
break;
|
||||
case 'delete':
|
||||
deleteNote(id);
|
||||
break;
|
||||
}
|
||||
},
|
||||
items: {
|
||||
"toFront": {
|
||||
icon: function(opt, $itemElement, itemKey, item){
|
||||
$itemElement.html('<i class="fas fa-reply"></i> V odspredje');
|
||||
|
||||
return 'context-menu-icon-updated';
|
||||
}
|
||||
},
|
||||
"toBack": {
|
||||
icon: function(opt, $itemElement, itemKey, item){
|
||||
$itemElement.html('<i class="fas fa-share"></i> V ozadje');
|
||||
|
||||
return 'context-menu-icon-updated';
|
||||
}
|
||||
},
|
||||
|
||||
"edit": {
|
||||
icon: function(opt, $itemElement, itemKey, item){
|
||||
$itemElement.html('<i class="fas fa-edit"></i> Uredi');
|
||||
|
||||
return 'context-menu-icon-updated';
|
||||
}
|
||||
},
|
||||
|
||||
"delete": {
|
||||
icon: function(opt, $itemElement, itemKey, item){
|
||||
$itemElement.html('<i class="fas fa-trash-alt"></i> Izbriši');
|
||||
|
||||
return 'context-menu-icon-updated';
|
||||
}
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
this.divCanvas.append(this.element);
|
||||
this.setPosition();
|
||||
|
||||
Reference in New Issue
Block a user