Merge branch 'next' into fix/caret-after-convert

This commit is contained in:
Peter Savchenko 2024-04-27 21:13:53 +03:00
commit 1a7d0cf704
5 changed files with 23 additions and 7 deletions

View file

@ -1,18 +1,17 @@
# Changelog # Changelog
### 2.30.1 ### 2.30.0
`New` Block Tunes now supports nesting items `New` Block Tunes now supports nesting items
`New` Block Tunes now supports separator items `New` Block Tunes now supports separator items
`New` "Convert to" control is now also available in Block Tunes `New` "Convert to" control is now also available in Block Tunes
### 2.30.0
- `Improvement` — The ability to merge blocks of different types (if both tools provide the conversionConfig) - `Improvement` — The ability to merge blocks of different types (if both tools provide the conversionConfig)
- `Fix``onChange` will be called when removing the entire text within a descendant element of a block. - `Fix``onChange` will be called when removing the entire text within a descendant element of a block.
- `Fix` - Unexpected new line on Enter press with selected block without caret - `Fix` - Unexpected new line on Enter press with selected block without caret
- `Fix` - Search input autofocus loosing after Block Tunes opening - `Fix` - Search input autofocus loosing after Block Tunes opening
- `Fix` - Block removing while Enter press on Block Tunes - `Fix` - Block removing while Enter press on Block Tunes
`Fix` Unwanted scroll on first typing on iOS devices
- `Fix` - Unwanted soft line break on Enter press after period and space (". |") on iOS devices
- `Fix` - Caret lost after block conversion on mobile devices. - `Fix` - Caret lost after block conversion on mobile devices.
### 2.29.1 ### 2.29.1

View file

@ -1,6 +1,6 @@
{ {
"name": "@editorjs/editorjs", "name": "@editorjs/editorjs",
"version": "2.30.0-rc.5", "version": "2.30.0-rc.6",
"description": "Editor.js — Native JS, based on API and Open Source", "description": "Editor.js — Native JS, based on API and Open Source",
"main": "dist/editorjs.umd.js", "main": "dist/editorjs.umd.js",
"module": "dist/editorjs.mjs", "module": "dist/editorjs.mjs",

View file

@ -279,8 +279,12 @@ export default class BlockEvents extends Module {
/** /**
* Allow to create line breaks by Shift+Enter * Allow to create line breaks by Shift+Enter
*
* Note. On iOS devices, Safari automatically treats enter after a period+space (". |") as Shift+Enter
* (it used for capitalizing of the first letter of the next sentence)
* We don't need to lead soft line break in this case new block should be created
*/ */
if (event.shiftKey) { if (event.shiftKey && !_.isIosDevice) {
return; return;
} }

View file

@ -30,6 +30,11 @@ export class PopoverMobile extends PopoverAbstract<PopoverMobileNodes> {
*/ */
private history = new PopoverStatesHistory(); private history = new PopoverStatesHistory();
/**
* Flag that indicates if popover is hidden
*/
private isHidden = true;
/** /**
* Construct the instance * Construct the instance
* *
@ -58,18 +63,26 @@ export class PopoverMobile extends PopoverAbstract<PopoverMobileNodes> {
super.show(); super.show();
this.scrollLocker.lock(); this.scrollLocker.lock();
this.isHidden = false;
} }
/** /**
* Closes popover * Closes popover
*/ */
public hide(): void { public hide(): void {
if (this.isHidden) {
return;
}
super.hide(); super.hide();
this.nodes.overlay.classList.add(css.overlayHidden); this.nodes.overlay.classList.add(css.overlayHidden);
this.scrollLocker.unlock(); this.scrollLocker.unlock();
this.history.reset(); this.history.reset();
this.isHidden = true;
} }
/** /**

View file

@ -15,7 +15,7 @@ export default class ScrollLocker {
/** /**
* Stores scroll position, used for hard scroll lock * Stores scroll position, used for hard scroll lock
*/ */
private scrollPosition: null|number; private scrollPosition: null | number = null;
/** /**
* Locks body element scroll * Locks body element scroll