Fix flipper activate/deactivate when conversionToolbarOpened (#1001)

* Fix flipper activate/deactivate when conversionToolbarOpened

* fix bug with flipping inline toolbar

* update changelog

* added comment for new condition

* upd bundle

Co-authored-by: Murod Khaydarov <murod.haydarov@gmail.com>
Co-authored-by: Peter Savchenko <specc.dev@gmail.com>
This commit is contained in:
Andrey Blinov 2020-03-14 19:50:24 +02:00 committed by GitHub
parent bc3e2904f0
commit 3a83a1d12e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 7 deletions

2
dist/editor.js vendored

File diff suppressed because one or more lines are too long

View file

@ -4,7 +4,8 @@
- `Improvements` - Editor's [onchange callback](https://editorjs.io/configuration#editor-modifications-callback) now accepts an API as a parameter
- `Fix` - Some mistakes are fixed in [installation.md](installation.md)
- `Fix` - Fixed multiple paste callback triggering in a case when several editors are instantiated [#1011](https://github.com/codex-team/editor.js/issues/1011)
- `Fix` - Fixed multiple paste callback triggering in a case when several editors are instantiated [#1011](https://github.com/codex-team/editor.js/issues/1011)
- `Fix` - Fixed inline toolbar flipper activation on closing conversion toolbar [#995](https://github.com/codex-team/editor.js/issues/995)
### 2.16.1

View file

@ -98,8 +98,6 @@ export default class ConversionToolbar extends Module {
if (typeof togglingCallback === 'function') {
this.togglingCallback = togglingCallback;
this.togglingCallback(this.opened);
}
}

View file

@ -431,10 +431,19 @@ export default class InlineToolbar extends Module {
this.Editor.Listeners.on(this.nodes.conversionToggler, 'click', () => {
this.Editor.ConversionToolbar.toggle((conversionToolbarOpened) => {
if (conversionToolbarOpened) {
this.flipper.deactivate();
} else {
/**
* When ConversionToolbar is opening on activated InlineToolbar flipper
* Then we need to temporarily deactivate InlineToolbar flipper so that we could flip ConversionToolbar items
*
* Other case when ConversionToolbar is closing (for example, by escape) but we need to continue flipping
* InlineToolbar items, we activate InlineToolbar flipper
*/
const canActivateInlineToolbarFlipper = !conversionToolbarOpened && this.opened;
if (canActivateInlineToolbarFlipper) {
this.flipper.activate();
} else if (this.opened) {
this.flipper.deactivate();
}
});
});