@quadrats/react 1.1.7 → 1.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -5,6 +5,7 @@ import { Transforms } from '@quadrats/core';
|
|
|
5
5
|
import { createImage, getImageFigureElementCommonProps, getImageElementCommonProps } from '@quadrats/common/image';
|
|
6
6
|
import { createFileUploaderElementByType, FILE_UPLOADER_TYPE, insertFileUploaderElement } from '@quadrats/common/file-uploader';
|
|
7
7
|
import { createRenderElements } from '@quadrats/react';
|
|
8
|
+
import { removePreviousElement } from '@quadrats/react/utils';
|
|
8
9
|
import { defaultRenderImageElements } from './defaultRenderImageElements.js';
|
|
9
10
|
|
|
10
11
|
function createReactImage(options = {}, getUploadOptions) {
|
|
@@ -13,11 +14,21 @@ function createReactImage(options = {}, getUploadOptions) {
|
|
|
13
14
|
const { types } = core;
|
|
14
15
|
return Object.assign(Object.assign({}, core), { createHandlers: () => ({
|
|
15
16
|
onKeyDown(event, editor, next) {
|
|
16
|
-
if (
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
if (event.key === 'Backspace' || event.key === 'Delete') {
|
|
18
|
+
if (core.isCollapsedOnImage(editor)) {
|
|
19
|
+
const [, figurePath] = core.getAboveImageFigure(editor) || [];
|
|
20
|
+
if (figurePath) {
|
|
21
|
+
Transforms.removeNodes(editor, { at: figurePath });
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
removePreviousElement({
|
|
27
|
+
event,
|
|
28
|
+
editor,
|
|
29
|
+
type: types.figure,
|
|
30
|
+
confirmModal: false,
|
|
31
|
+
});
|
|
21
32
|
}
|
|
22
33
|
}
|
|
23
34
|
const [, captionPath] = core.getAboveImageCaption(editor) || [];
|
package/image/index.cjs.js
CHANGED
|
@@ -12,6 +12,7 @@ var isHotkey = require('is-hotkey');
|
|
|
12
12
|
var utils = require('@quadrats/utils');
|
|
13
13
|
var image = require('@quadrats/common/image');
|
|
14
14
|
var fileUploader = require('@quadrats/common/file-uploader');
|
|
15
|
+
var utils$1 = require('@quadrats/react/utils');
|
|
15
16
|
|
|
16
17
|
function ImageFigure(props) {
|
|
17
18
|
const { attributes, children, style } = props;
|
|
@@ -210,11 +211,21 @@ function createReactImage(options = {}, getUploadOptions) {
|
|
|
210
211
|
const { types } = core$1;
|
|
211
212
|
return Object.assign(Object.assign({}, core$1), { createHandlers: () => ({
|
|
212
213
|
onKeyDown(event, editor, next) {
|
|
213
|
-
if (
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
214
|
+
if (event.key === 'Backspace' || event.key === 'Delete') {
|
|
215
|
+
if (core$1.isCollapsedOnImage(editor)) {
|
|
216
|
+
const [, figurePath] = core$1.getAboveImageFigure(editor) || [];
|
|
217
|
+
if (figurePath) {
|
|
218
|
+
core.Transforms.removeNodes(editor, { at: figurePath });
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
else {
|
|
223
|
+
utils$1.removePreviousElement({
|
|
224
|
+
event,
|
|
225
|
+
editor,
|
|
226
|
+
type: types.figure,
|
|
227
|
+
confirmModal: false,
|
|
228
|
+
});
|
|
218
229
|
}
|
|
219
230
|
}
|
|
220
231
|
const [, captionPath] = core$1.getAboveImageCaption(editor) || [];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quadrats/react",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.9",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "Rytass",
|
|
6
6
|
"homepage": "https://github.com/Quadrats/quadrats#readme",
|
|
@@ -20,12 +20,12 @@
|
|
|
20
20
|
"url": "https://github.com/Quadrats/quadrats/issues"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@quadrats/common": "^1.1.
|
|
24
|
-
"@quadrats/core": "^1.1.
|
|
25
|
-
"@quadrats/icons": "^1.1.
|
|
26
|
-
"@quadrats/locales": "^1.
|
|
27
|
-
"@quadrats/theme": "^1.
|
|
28
|
-
"@quadrats/utils": "^1.
|
|
23
|
+
"@quadrats/common": "^1.1.9",
|
|
24
|
+
"@quadrats/core": "^1.1.9",
|
|
25
|
+
"@quadrats/icons": "^1.1.9",
|
|
26
|
+
"@quadrats/locales": "^1.1.9",
|
|
27
|
+
"@quadrats/theme": "^1.1.9",
|
|
28
|
+
"@quadrats/utils": "^1.1.9",
|
|
29
29
|
"@types/is-hotkey": "^0.1.9",
|
|
30
30
|
"@types/react-transition-group": "^4.4.9",
|
|
31
31
|
"clsx": "^2.1.1",
|
package/utils/index.cjs.js
CHANGED