-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into ck/epic/1944-bookmark
- Loading branch information
Showing
7 changed files
with
240 additions
and
1 deletion.
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
53 changes: 53 additions & 0 deletions
53
packages/ckeditor5-ui/tests/manual/dialog/dialog-body-scroll-lock.html
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,53 @@ | ||
<form> | ||
<fieldset> | ||
<legend>Is document scrollable?</legend> | ||
<div> | ||
<input type="radio" id="isScrollable-yes" name="isScrollable" value="yes" /> | ||
<label for="isScrollable-yes">yes</label> | ||
</div> | ||
<div> | ||
<input type="radio" id="isScrollable-no" name="isScrollable" value="no" checked /> | ||
<label for="isScrollable-no">no</label> | ||
</div> | ||
</fieldset> | ||
<fieldset> | ||
<legend>Has <body> position?</legend> | ||
<div> | ||
<input type="radio" id="hasPosition-yes" name="hasPosition" value="yes" /> | ||
<label for="hasPosition-yes">yes</label> | ||
</div> | ||
<div> | ||
<input type="radio" id="hasPosition-no" name="hasPosition" value="no" checked /> | ||
<label for="hasPosition-no">no</label> | ||
</div> | ||
</fieldset> | ||
</form> | ||
|
||
<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p> | ||
|
||
<div id="editor">Editor content.</div> | ||
|
||
<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p> | ||
|
||
<style> | ||
.ck.ck-editor { | ||
margin-top: 300px; | ||
} | ||
|
||
body { | ||
outline: 2px dashed blue; | ||
outline-offset: -2px; | ||
} | ||
|
||
body::before { | ||
content: "<BODY>"; | ||
position: absolute; | ||
display: block; | ||
top: 10px; | ||
right: 10px; | ||
background: blue; | ||
color: white; | ||
padding: 2px 4px; | ||
font-size: 8px; | ||
} | ||
</style> |
9 changes: 9 additions & 0 deletions
9
packages/ckeditor5-ui/tests/manual/dialog/dialog-body-scroll-lock.md
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,9 @@ | ||
# Locking page scroll when the modal is open | ||
|
||
1. Click the ">>> Open modal <<<" button. | ||
2. Ensure that the entire page underneath does not scroll in different browsers. | ||
3. Ensure the same applies when various test options are turned on. | ||
4. Play with the global scroll of the webpage before opening the modal. | ||
|
||
Known issues: | ||
* In Safari iOS, the page is still scrollable when the modal is visible. |
86 changes: 86 additions & 0 deletions
86
packages/ckeditor5-ui/tests/manual/dialog/dialog-body-scroll-lock.ts
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,86 @@ | ||
/** | ||
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
*/ | ||
|
||
import { Plugin } from '@ckeditor/ckeditor5-core'; | ||
import { ClassicEditor } from '@ckeditor/ckeditor5-editor-classic'; | ||
import { ButtonView, Dialog, TextareaView } from '../../../src/index.js'; | ||
import { Essentials } from '@ckeditor/ckeditor5-essentials'; | ||
import { Heading } from '@ckeditor/ckeditor5-heading'; | ||
import { Bold, Italic } from '@ckeditor/ckeditor5-basic-styles'; | ||
|
||
declare global { | ||
interface Window { editor: any } | ||
} | ||
|
||
interface FormElements extends HTMLFormControlsCollection { | ||
isScrollable: RadioNodeList; | ||
hasPosition: RadioNodeList; | ||
} | ||
|
||
class PluginWithModal extends Plugin { | ||
public static get requires() { | ||
return [ Dialog ] as const; | ||
} | ||
|
||
public init(): void { | ||
this.editor.ui.componentFactory.add( 'modal', locale => { | ||
const button = new ButtonView( locale ); | ||
const dialog = this.editor.plugins.get( 'Dialog' ); | ||
const textareaView = new TextareaView( locale ); | ||
|
||
textareaView.minRows = 5; | ||
textareaView.maxRows = 10; | ||
textareaView.value = | ||
`Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor | ||
quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean | ||
ultricies mi vitae est. Mauris placerat eleifend leo.`.repeat( 10 ); | ||
|
||
button.label = '>>> Open modal <<<'; | ||
button.withText = true; | ||
button.on( 'execute', () => { | ||
dialog.show( { | ||
id: 'modalWithText', | ||
isModal: true, | ||
title: 'A modal', | ||
content: textareaView, | ||
actionButtons: [ | ||
{ | ||
label: 'Close', | ||
class: 'ck-button-action', | ||
withText: true, | ||
onExecute: () => dialog.hide() | ||
} | ||
], | ||
onShow() { | ||
textareaView.element!.style.margin = '10px'; | ||
textareaView.element!.style.width = '400px'; | ||
} | ||
} ); | ||
} ); | ||
|
||
return button; | ||
} ); | ||
} | ||
} | ||
|
||
ClassicEditor.create( document.querySelector( '#editor' ) as HTMLElement, { | ||
extraPlugins: [ Essentials, Heading, Bold, Italic, PluginWithModal ], | ||
toolbar: [ 'heading', '|', 'bold', 'italic', '|', 'modal' ] | ||
} ).then( editor => { | ||
window.editor = editor; | ||
} ); | ||
|
||
const form = document.querySelector( 'form' )!; | ||
|
||
form.addEventListener( 'change', () => { | ||
const elements = form.elements as FormElements; | ||
|
||
document.body.style.height = elements.isScrollable.value === 'yes' ? '3000px' : ''; | ||
document.body.style.width = elements.isScrollable.value === 'yes' ? '3000px' : ''; | ||
|
||
document.body.style.position = elements.hasPosition.value === 'yes' ? 'absolute' : ''; | ||
document.body.style.top = elements.hasPosition.value === 'yes' ? '100px' : ''; | ||
document.body.style.left = elements.hasPosition.value === 'yes' ? '100px' : ''; | ||
} ); |
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