added basic remove...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2023-08-12 00:31:21 +03:00
parent ef53686e0a
commit fd460e0920
3 changed files with 22 additions and 3 deletions

View File

@ -20,6 +20,7 @@
--gallery-padding-right: var(--gallery-padding-horizontal); --gallery-padding-right: var(--gallery-padding-horizontal);
--gallery-image-scroll-margin: calc(2 * var(--gallery-current-image-border)); --gallery-image-scroll-margin: calc(2 * var(--gallery-current-image-border));
--gallery-scrollbar-width: 0.5em; --gallery-scrollbar-width: 0.5em;
--gallery-empty-height: 20em;
--lightbox-frame: 5vmin; --lightbox-frame: 5vmin;
--lightbox-image-margin-top: 0.75; --lightbox-image-margin-top: 0.75;
@ -95,6 +96,19 @@ body {
align-content: flex-start; align-content: flex-start;
flex-flow: row wrap; flex-flow: row wrap;
} }
.gallery .images:empty {
height: var(--gallery-empty-height);
border: dashed 1px black;
}
.gallery .images:empty:after {
content: "Empty...";
position: absolute;
width: 100%;
left: 0;
top: 0;
padding: calc((var(--gallery-empty-height) - 1em) / 2) 0;
text-align: center;
}
.gallery .images img { .gallery .images img {
height: 300px; height: 300px;
width: auto; width: auto;

View File

@ -96,8 +96,11 @@ var restoreScroll = function(){
- <s>Gallery: drag-n-drop</s> - <s>Gallery: drag-n-drop</s>
- <s>drop files/images</s> -- add loading indicator - <s>drop files/images</s> -- add loading indicator
- <s>drag to sort</s> - <s>drag to sort</s>
- <b>drag marked</b>
- styling... - styling...
- <s>Gallery: remove image</s> - <s>Gallery: remove image</s>
- <s>basic delete</s>
- <b>delete marked</b>
- UI: mark images for deletion + delete marked - UI: mark images for deletion + delete marked
- <s>Gallery: serialize / deserialize</s> - <s>Gallery: serialize / deserialize</s>
- <s>Lightbox: navigation (keyboard / mouse)</s> - <s>Lightbox: navigation (keyboard / mouse)</s>

View File

@ -171,14 +171,15 @@ var keyboard = {
: gallery.unmark_current ? : gallery.unmark_current ?
(gallery.current = null) (gallery.current = null)
: null }, : null },
// XXX change to mark -> delete workflow...
Delete: function(evt){ Delete: function(evt){
if(gallery.current){ if(gallery.current){
var remove = gallery.current var to_remove = gallery.current
gallery.next() gallery.next()
// XXX this is a bit crude... // XXX this is a bit crude...
gallery.current === remove gallery.current === to_remove
&& gallery.prev() && gallery.prev()
gallery.remove(remove) } }, gallery.remove(to_remove) } },
// selection... // selection...
' ': function(evt){ ' ': function(evt){
gallery.current gallery.current
@ -740,6 +741,7 @@ var Gallery = {
&& img.remove()) && img.remove())
: null } : null }
return this return this
.updateMarkers()
.update() }, .update() },
clear: function(){ clear: function(){
this.dom.querySelector('.images').innerHTML = '' this.dom.querySelector('.images').innerHTML = ''