mirror of
https://github.com/codex-team/editor.js
synced 2024-05-16 21:36:48 +02:00
issue-559: Allow default selection on native inputs (#564)
* issue-559: allow double CMD+A on native inputs * restore commented code
This commit is contained in:
parent
8a61ae0bf0
commit
7c778d511c
10
dist/codex-editor.js
vendored
10
dist/codex-editor.js
vendored
File diff suppressed because one or more lines are too long
|
@ -194,7 +194,7 @@
|
|||
{
|
||||
type : 'paragraph',
|
||||
data : {
|
||||
text : 'Блоки — это структурные элементы, из которых состоит статья. Например <span class="inline-code">Параграф</span>, <span class="inline-code">Заголовок</span>, <span class="inline-code">Изображение</span>, <span class="inline-code">Видео</span> — это все Блоки. В CodeX Editor каждый Блок определяется плагином. Есть много готовых Блоков и простой API для создания новых. Например, вы можете создать Блок для Твиттера, Инстаграма, Опроса, Игры или CTA-кнопки.'
|
||||
text : 'Блоки — это структурные элементы, из которых состоит статья. Например <code class="inline-code">Параграф</code>, <code class="inline-code">Заголовок</code>, <code class="inline-code">Изображение</code>, <code class="inline-code">Видео</code> — это все Блоки. В CodeX Editor каждый Блок определяется плагином. Есть много готовых Блоков и простой API для создания новых. Например, вы можете создать Блок для Твиттера, Инстаграма, Опроса, Игры или CTA-кнопки.'
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "codex.editor",
|
||||
"version": "2.7.10",
|
||||
"version": "2.7.11",
|
||||
"description": "Codex Editor. Native JS, based on API and Open Source",
|
||||
"main": "dist/codex-editor.js",
|
||||
"types": "./types/index.d.ts",
|
||||
|
|
|
@ -51,6 +51,13 @@ export default class BlockSelection extends Module {
|
|||
*/
|
||||
private needToSelectAll: boolean = false;
|
||||
|
||||
/**
|
||||
* Flag used to define native input selection
|
||||
* In this case we allow double CMD+A to select Block
|
||||
* @type {boolean}
|
||||
*/
|
||||
private nativeInputSelected: boolean = false;
|
||||
|
||||
/**
|
||||
* SelectionUtils instance
|
||||
* @type {SelectionUtils}
|
||||
|
@ -119,6 +126,7 @@ export default class BlockSelection extends Module {
|
|||
*/
|
||||
public clearSelection(restoreSelection = false) {
|
||||
this.needToSelectAll = false;
|
||||
this.nativeInputSelected = false;
|
||||
|
||||
if (!this.anyBlockSelected) {
|
||||
return;
|
||||
|
@ -143,6 +151,12 @@ export default class BlockSelection extends Module {
|
|||
* @param {keydown} event
|
||||
*/
|
||||
private handleCommandA(event): void {
|
||||
/** allow default selection on native inputs */
|
||||
if ($.isNativeInput(event.target) && !this.nativeInputSelected) {
|
||||
this.nativeInputSelected = true;
|
||||
return;
|
||||
}
|
||||
|
||||
/** Prevent default selection */
|
||||
event.preventDefault();
|
||||
|
||||
|
|
Loading…
Reference in a new issue