Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI Prototype: Add indication that there are more blocks available #107

Merged
merged 1 commit into from
Feb 21, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions blocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -521,16 +521,12 @@ function renderBlockMenu() {
insertBlockMenuContent.appendChild( node );
}
} );

var placeholder = document.createElement('div');
placeholder.className = 'insert-block__separator';
placeholder.textContent = 'These don\'t work yet.';
insertBlockMenuContent.appendChild( placeholder );
}

function attachBlockMenuSearch() {
insertBlockMenuSearchInput.addEventListener( 'keyup', filterBlockMenu, false );
insertBlockMenuSearchInput.addEventListener( 'input', filterBlockMenu, false );
insertBlockMenuContent.addEventListener( 'scroll', handleBlockMenuScroll, false );
selectBlockInMenu();
renderBlockMenu();

Expand All @@ -539,6 +535,14 @@ function attachBlockMenuSearch() {
selectBlockInMenu();
renderBlockMenu();
}

function handleBlockMenuScroll( event ) {
if ( insertBlockMenuContent.scrollHeight - insertBlockMenuContent.scrollTop <= insertBlockMenuContent.clientHeight ) {
insertBlockMenuContent.className = 'insert-block__content is-bottom';
} else {
insertBlockMenuContent.className = 'insert-block__content';
}
}
}

/**
Expand Down
5 changes: 5 additions & 0 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,11 @@ img.is-selected {
.insert-block__content {
max-height: 180px;
overflow: auto;
box-shadow: inset 0px -4px 6px -2px rgba(224,229,233,1);
}

.insert-block__content.is-bottom {
box-shadow: none;
}

.insert-block__content:focus {
Expand Down