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

scroll_into_view operation #102

Merged
merged 3 commits into from
Jan 24, 2021
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
7 changes: 7 additions & 0 deletions javascript/cable_ready.js
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,13 @@ const DOMOperations = {
dispatch(document, 'cable-ready:after-remove-storage-item', operation)
},

scrollIntoView: operation => {
const { element } = operation
dispatch(element, 'cable-ready:before-scroll-into-view', operation)
if (!operation.cancel) element.scrollIntoView(operation)
dispatch(element, 'cable-ready:after-scroll-into-view', operation)
},
leastbad marked this conversation as resolved.
Show resolved Hide resolved

setCookie: operation => {
const { cookie } = operation
dispatch(document, 'cable-ready:before-set-cookie', operation)
Expand Down
1 change: 1 addition & 0 deletions lib/cable_ready/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ def default_operation_names
remove_css_class
remove_storage_item
replace
scroll_into_view
set_attribute
set_cookie
set_dataset_property
Expand Down