mirror of
https://github.com/chinchang/web-maker.git
synced 2025-07-10 00:16:18 +02:00
add ctrl+o and ask confirmation before removing.
This commit is contained in:
@ -374,7 +374,7 @@
|
||||
transform: translateX(100%);
|
||||
}
|
||||
.saved-items-pane.is-open {
|
||||
transition-duration: 0.45s;
|
||||
transition-duration: 0.4s;
|
||||
transform: translateX(0);
|
||||
}
|
||||
.is-modal-visible ~ .modal-overlay,
|
||||
@ -448,6 +448,7 @@
|
||||
position: absolute;
|
||||
right: 8px;
|
||||
top: 6px;
|
||||
z-index: 1;
|
||||
color: rgba(255,255,255,0.3);
|
||||
border-radius: 50%;
|
||||
background: rgba(255,255,255,0.05);
|
||||
@ -646,7 +647,7 @@
|
||||
</svg>Open
|
||||
</a>
|
||||
</div>
|
||||
<input type="text" id="js-title-input" class="item-title-input" value="Untitled Work">
|
||||
<input type="text" id="js-title-input" title="Click to edit" class="item-title-input" value="Untitled Work">
|
||||
</div>
|
||||
<div class="content-wrap flex flex-grow">
|
||||
<div class="code-side" id="js-code-side">
|
||||
|
@ -318,6 +318,9 @@
|
||||
}
|
||||
function removeItem(itemId) {
|
||||
var itemTile = document.querySelector('.js-saved-item-tile[data-item-id="' + itemId + '"]');
|
||||
var answer = confirm(`Are you sure you want to delete "${savedItems[itemId].title}"?`);
|
||||
if (!answer) { return; }
|
||||
|
||||
itemTile.remove();
|
||||
// Remove from items list
|
||||
chrome.storage.local.get({
|
||||
@ -774,20 +777,34 @@
|
||||
});
|
||||
|
||||
|
||||
function closeAllOverlays() {
|
||||
helpModal.classList.remove('is-modal-visible');
|
||||
notificationsModal.classList.remove('is-modal-visible');
|
||||
addLibraryModal.classList.remove('is-modal-visible');
|
||||
toggleSavedItemsPane(false);
|
||||
}
|
||||
|
||||
window.addEventListener('keydown', function (event) {
|
||||
if ((event.ctrlKey || event.metaKey) && (event.keyCode === 83)){
|
||||
// Implement Ctrl + S
|
||||
if ((event.ctrlKey || event.metaKey) && (event.keyCode === 83)) {
|
||||
event.preventDefault();
|
||||
saveFile();
|
||||
trackEvent('ui', 'saveFileKeyboardShortcut');
|
||||
}
|
||||
// Implement Ctrl + O
|
||||
else if ((event.ctrlKey || event.metaKey) && (event.keyCode === 79)) {
|
||||
event.preventDefault();
|
||||
openSavedItemsPane();
|
||||
trackEvent('ui', 'openCreationKeyboardShortcut');
|
||||
}
|
||||
else if (event.keyCode === 27) {
|
||||
closeAllOverlays();
|
||||
}
|
||||
});
|
||||
|
||||
window.addEventListener('click', function(e) {
|
||||
if (typeof e.target.className === 'string' && e.target.className.indexOf('modal-overlay') !== -1) {
|
||||
helpModal.classList.remove('is-modal-visible');
|
||||
notificationsModal.classList.remove('is-modal-visible');
|
||||
addLibraryModal.classList.remove('is-modal-visible');
|
||||
toggleSavedItemsPane(false);
|
||||
closeAllOverlays();
|
||||
}
|
||||
});
|
||||
window.addEventListener('dblclick', function(e) {
|
||||
|
Reference in New Issue
Block a user