Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
165 additions
and
35 deletions.
There are no files selected for viewing
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
29 changes: 29 additions & 0 deletions
29
packages/ckeditor5-dev-tests/lib/utils/manual-tests/togglesidebar.js
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,29 @@ | ||
/** | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md. | ||
*/ | ||
|
||
/* global document, window */ | ||
|
||
const toggleButton = document.querySelector( '.manual-test-sidebar__toggle' ); | ||
const container = document.body; | ||
const pinnedCSSClass = 'manual-test-container_pinned-sidebar'; | ||
const localStorageKey = 'cke5-manual-test-sidebar-pinned'; | ||
const isSidebarPinned = window.localStorage.getItem( localStorageKey ); | ||
|
||
if ( isSidebarPinned === 'true' ) { | ||
container.classList.add( pinnedCSSClass ); | ||
} | ||
|
||
// The "manual-test-container_no-transitions" class prevents CSS transitions when the page is loaded, | ||
// for instance, seeing the sidebar animate on every refresh is pretty annoying. Once the webpage is loaded, | ||
// the class can be removed and all transitions in the sidebar can work as expected. | ||
document.addEventListener( 'DOMContentLoaded', () => { | ||
container.classList.remove( 'manual-test-container_no-transitions' ); | ||
} ); | ||
|
||
toggleButton.addEventListener( 'click', () => { | ||
container.classList.toggle( pinnedCSSClass ); | ||
|
||
window.localStorage.setItem( localStorageKey, container.classList.contains( pinnedCSSClass ) ); | ||
} ); |
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