-
-
Notifications
You must be signed in to change notification settings - Fork 650
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Integrate modal functionality that was originally in Ember Shepherd (#…
…301) * integrate modal functionality that was originally in Ember Shepherd * Fix: stop ontouchstart events on overlay (#302) * fix: stop pull on overlap * fix: selector for overlay * update listener calls to match previous utils * Add modal and highlight tests * Bump some deps
- Loading branch information
1 parent
445a514
commit f1c4eeb
Showing
18 changed files
with
1,187 additions
and
197 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { defer } from 'lodash'; | ||
import { classNames as modalClassNames, preventModalBodyTouch } from './modal'; | ||
import { getElementForStep } from './dom'; | ||
|
||
/** | ||
* Removes svg mask from modal overlay and removes classes for modal being visible | ||
*/ | ||
export function cleanupModal() { | ||
defer(() => { | ||
const element = this._modalOverlayElem; | ||
|
||
if (element && element instanceof SVGElement) { | ||
element.parentNode.removeChild(element); | ||
} | ||
|
||
this._modalOverlayElem = null; | ||
document.body.classList.remove(modalClassNames.isVisible); | ||
}); | ||
} | ||
|
||
/** | ||
* Cleanup the steps and set pointerEvents back to 'auto' | ||
* @param tour The tour object | ||
*/ | ||
export function cleanupSteps(tour) { | ||
if (tour) { | ||
const { steps } = tour; | ||
|
||
steps.forEach((step) => { | ||
if (step.options && step.options.canClickTarget === false && step.options.attachTo) { | ||
const stepElement = getElementForStep(step); | ||
|
||
if (stepElement instanceof HTMLElement) { | ||
stepElement.style.pointerEvents = 'auto'; | ||
} | ||
} | ||
}); | ||
} | ||
} | ||
|
||
/** | ||
* Remove resize and scroll event listeners | ||
*/ | ||
export function cleanupStepEventListeners() { | ||
if (typeof this._onScreenChange === 'function') { | ||
window.removeEventListener('resize', this._onScreenChange, false); | ||
window.removeEventListener('scroll', this._onScreenChange, false); | ||
window.removeEventListener('touchmove', preventModalBodyTouch, false); | ||
|
||
this._onScreenChange = null; | ||
} | ||
} |
Oops, something went wrong.