Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public componentDidMount() {
- this.modalVisibilityHandler('image');
- this.modalVisibilityHandler('emoji');
- this.modalVisibilityHandler('colorpicker');
- this.modalVisibilityHandler('link');
- this.modalVisibilityHandler('embedded');
- }
- public modalVisibilityHandler = (selector: string) => {
- const modalWrapper = document.getElementsByClassName(`rdw-${selector}-wrapper`)[0];
- if (modalWrapper) {
- modalWrapper.addEventListener('mouseup', () => {
- setTimeout(() => {
- const modal = document.getElementsByClassName(`rdw-${selector}-modal`)[0];
- if (modal) {
- if (modal.getBoundingClientRect().right > window.innerWidth) {
- (modal as HTMLElement).style.left = `${window.innerWidth -
- modal.getBoundingClientRect().right}px`;
- }
- }
- }, 50);
- });
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement