-
Notifications
You must be signed in to change notification settings - Fork 30.6k
Add comments to @ckeditor/ckeditor5-ui binding methods #59643
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
Merged
typescript-bot
merged 1 commit into
DefinitelyTyped:master
from
fedemp:ckeditor-ui-bindings
Apr 2, 2022
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
13 changes: 10 additions & 3 deletions
13
types/ckeditor__ckeditor5-ui/src/bindings/clickoutsidehandler.d.ts
This file contains hidden or 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 |
|---|---|---|
| @@ -1,8 +1,15 @@ | ||
| import { Emitter } from "@ckeditor/ckeditor5-utils/src/emittermixin"; | ||
| import { Emitter } from '@ckeditor/ckeditor5-utils/src/dom/emittermixin'; | ||
|
|
||
| export default function clickOutsideHandler(options?: { | ||
| /** | ||
| * Handles clicking **outside** of a specified set of elements, then fires an action. | ||
| * | ||
| * **Note**: Actually, the action is executed upon `mousedown`, not `click`. It prevents | ||
| * certain issues when the user keeps holding the mouse button and the UI cannot react | ||
| * properly. | ||
| */ | ||
| export default function clickOutsideHandler(options: { | ||
| emitter: Emitter; | ||
| activator: () => boolean; | ||
| contextElements: HTMLElement[]; | ||
| callback: () => void; | ||
| contextElements: HTMLElement[]; | ||
| }): void; |
44 changes: 43 additions & 1 deletion
44
types/ckeditor__ckeditor5-ui/src/bindings/injectcsstransitiondisabler.d.ts
This file contains hidden or 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 |
|---|---|---|
| @@ -1,3 +1,45 @@ | ||
| import View from "../view"; | ||
| import View from '../view'; | ||
|
|
||
| /** | ||
| * A decorator that brings the possibility to temporarily disable CSS transitions using | ||
| * {@link module:ui/view~View} methods. It is helpful when, for instance, the transitions should not happen | ||
| * when the view is first displayed but they should work normal in other cases. | ||
| * | ||
| * The methods to control the CSS transitions are: | ||
| * * `disableCssTransitions()` – Adds the `.ck-transitions-disabled` class to the | ||
| * {@link module:ui/view~View#element view element}. | ||
| * * `enableCssTransitions()` – Removes the `.ck-transitions-disabled` class from the | ||
| * {@link module:ui/view~View#element view element}. | ||
| * | ||
| * **Note**: This helper extends the {@link module:ui/view~View#template template} and must be used **after** | ||
| * {@link module:ui/view~View#setTemplate} is called: | ||
| * | ||
| * import injectCssTransitionDisabler from '@ckeditor/ckeditor5-ui/src/bindings/injectcsstransitiondisabler'; | ||
| * | ||
| * class MyView extends View { | ||
| * constructor() { | ||
| * super(); | ||
| * | ||
| * // ... | ||
| * | ||
| * this.setTemplate( { ... } ); | ||
| * | ||
| * // ... | ||
| * | ||
| * injectCssTransitionDisabler( this ); | ||
| * | ||
| * // ... | ||
| * } | ||
| * } | ||
| * | ||
| * The usage comes down to: | ||
| * | ||
| * const view = new MyView(); | ||
| * | ||
| * // ... | ||
| * | ||
| * view.disableCssTransitions(); | ||
| * view.show(); | ||
| * view.enableCssTransitions(); | ||
| */ | ||
| export default function injectCssTransitionDisabler(view: View): void; |
23 changes: 21 additions & 2 deletions
23
types/ckeditor__ckeditor5-ui/src/bindings/preventdefault.d.ts
This file contains hidden or 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 |
|---|---|---|
| @@ -1,4 +1,23 @@ | ||
| import { TemplateToBinding } from "../template"; | ||
| import View from "../view"; | ||
| import { TemplateToBinding } from '../template'; | ||
| import View from '../view'; | ||
|
|
||
| /** | ||
| * A helper which executes a native `Event.preventDefault()` if the target of an event equals the | ||
| * {@link module:ui/view~View#element element of the view}. It shortens the definition of a | ||
| * {@link module:ui/view~View#template template}. | ||
| * | ||
| * // In a class extending View. | ||
| * import preventDefault from '@ckeditor/ckeditor5-ui/src/bindings/preventdefault'; | ||
| * | ||
| * // ... | ||
| * | ||
| * this.setTemplate( { | ||
| * tag: 'div', | ||
| * | ||
| * on: { | ||
| * // Prevent the default mousedown action on this view. | ||
| * mousedown: preventDefault( this ) | ||
| * } | ||
| * } ); | ||
| */ | ||
| export default function preventDefault(view: View): TemplateToBinding; |
34 changes: 33 additions & 1 deletion
34
types/ckeditor__ckeditor5-ui/src/bindings/submithandler.d.ts
This file contains hidden or 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 |
|---|---|---|
| @@ -1,3 +1,35 @@ | ||
| import View from "../view"; | ||
| import View from '../view'; | ||
|
|
||
| /** | ||
| * A handler useful for {@link module:ui/view~View views} working as HTML forms. It intercepts a native DOM | ||
| * `submit` event, prevents the default web browser behavior (navigation and page reload) and | ||
| * fires the `submit` event on a view instead. Such a custom event can be then used by any | ||
| * {@link module:utils/dom/emittermixin~Emitter emitter}, e.g. to serialize the form data. | ||
| * | ||
| * import submitHandler from '@ckeditor/ckeditor5-ui/src/bindings/submithandler'; | ||
| * | ||
| * // ... | ||
| * | ||
| * class AnyFormView extends View { | ||
| * constructor() { | ||
| * super(); | ||
| * | ||
| * // ... | ||
| * | ||
| * submitHandler( { | ||
| * view: this | ||
| * } ); | ||
| * } | ||
| * } | ||
| * | ||
| * // ... | ||
| * | ||
| * const view = new AnyFormView(); | ||
| * | ||
| * // A sample listener attached by an emitter working with the view. | ||
| * this.listenTo( view, 'submit', () => { | ||
| * saveTheFormData(); | ||
| * hideTheForm(); | ||
| * } ); | ||
| */ | ||
| export default function submitHandler(options: { view: View }): void; |
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be great if I could do
from injectcsstransitiondisabler.d.ts since these methods are only added if this latter is imported.