@wix/patterns-fields 1.29.0 → 1.30.0
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.
- package/dist/cjs/assets/locale/messages_en.json +9 -9
- package/dist/cjs/components/address/input/address-input.st.css.js +3 -3
- package/dist/cjs/components/address/input/address-input.st.css.js.map +1 -1
- package/dist/cjs/components/audio/actions/actions-menu/actions-menu.st.css.js +3 -3
- package/dist/cjs/components/audio/actions/actions-menu/actions-menu.st.css.js.map +1 -1
- package/dist/cjs/components/audio/audio-field/form-audio-field.st.css.js +4 -4
- package/dist/cjs/components/audio/audio-field/form-audio-field.st.css.js.map +1 -1
- package/dist/cjs/components/audio/audio-player/audio-player.st.css.js +2 -2
- package/dist/cjs/components/audio/audio-player/audio-player.st.css.js.map +1 -1
- package/dist/cjs/components/color-view/color-view.st.css.js +4 -4
- package/dist/cjs/components/color-view/color-view.st.css.js.map +1 -1
- package/dist/cjs/components/delete-dialog/delete-dialog.st.css.js +3 -3
- package/dist/cjs/components/delete-dialog/delete-dialog.st.css.js.map +1 -1
- package/dist/cjs/components/document/cell-document-edit.js +302 -0
- package/dist/cjs/components/document/cell-document-edit.js.map +1 -0
- package/dist/cjs/components/document/cell-document-view.js +56 -0
- package/dist/cjs/components/document/cell-document-view.js.map +1 -0
- package/dist/cjs/components/document/form-document-field.st.css.js +7 -7
- package/dist/cjs/components/document/form-document-field.st.css.js.map +1 -1
- package/dist/cjs/components/document/index.js +12 -0
- package/dist/cjs/components/document/index.js.map +1 -1
- package/dist/cjs/components/document/utils.js +1 -0
- package/dist/cjs/components/document/utils.js.map +1 -1
- package/dist/cjs/components/exclamation/exclamation.st.css.js +5 -5
- package/dist/cjs/components/exclamation/exclamation.st.css.js.map +1 -1
- package/dist/cjs/components/highlighted-text/highlighted-text.st.css.js +5 -5
- package/dist/cjs/components/highlighted-text/highlighted-text.st.css.js.map +1 -1
- package/dist/cjs/components/image/cell-image-edit.js +68 -168
- package/dist/cjs/components/image/cell-image-edit.js.map +1 -1
- package/dist/cjs/components/image/thumbnail-replace-overlay.st.css.js +3 -3
- package/dist/cjs/components/image/thumbnail-replace-overlay.st.css.js.map +1 -1
- package/dist/cjs/components/media-control/cell-media-edit-shell.js +101 -0
- package/dist/cjs/components/media-control/cell-media-edit-shell.js.map +1 -0
- package/dist/cjs/components/media-control/cell-media-edit-shell.st.css +4 -0
- package/dist/cjs/components/media-control/cell-media-edit-shell.st.css.js +22 -0
- package/dist/cjs/components/media-control/cell-media-edit-shell.st.css.js.map +1 -0
- package/dist/cjs/components/media-control/index.js +12 -0
- package/dist/cjs/components/media-control/index.js.map +1 -1
- package/dist/cjs/components/media-control/paste-url-button.st.css.js +4 -4
- package/dist/cjs/components/media-control/paste-url-button.st.css.js.map +1 -1
- package/dist/cjs/components/media-control/use-cell-media-edit.js +93 -0
- package/dist/cjs/components/media-control/use-cell-media-edit.js.map +1 -0
- package/dist/cjs/components/media-gallery/form-media-gallery-field.st.css.js +10 -10
- package/dist/cjs/components/media-gallery/form-media-gallery-field.st.css.js.map +1 -1
- package/dist/cjs/components/media-image/media-image.st.css.js +4 -4
- package/dist/cjs/components/media-image/media-image.st.css.js.map +1 -1
- package/dist/cjs/components/media-image/overlays/overlay.st.css.js +4 -4
- package/dist/cjs/components/media-image/overlays/overlay.st.css.js.map +1 -1
- package/dist/cjs/components/media-loader/media-loader.st.css.js +3 -3
- package/dist/cjs/components/media-loader/media-loader.st.css.js.map +1 -1
- package/dist/cjs/components/media-tag/web-media-tag/media-tag.st.css.js +2 -2
- package/dist/cjs/components/media-tag/web-media-tag/media-tag.st.css.js.map +1 -1
- package/dist/cjs/components/multi-document/multi-document-input/form-multi-document.st.css.js +5 -5
- package/dist/cjs/components/multi-document/multi-document-input/form-multi-document.st.css.js.map +1 -1
- package/dist/cjs/components/reference/cell-reference-input.st.css.js +3 -3
- package/dist/cjs/components/reference/cell-reference-input.st.css.js.map +1 -1
- package/dist/cjs/components/rich-content/rich-content-input/default-value-input/rich-content-default-value-input.st.css.js +6 -6
- package/dist/cjs/components/rich-content/rich-content-input/default-value-input/rich-content-default-value-input.st.css.js.map +1 -1
- package/dist/cjs/components/rich-content/rich-content-input/form-input/rich-content-form-input.st.css.js +5 -5
- package/dist/cjs/components/rich-content/rich-content-input/form-input/rich-content-form-input.st.css.js.map +1 -1
- package/dist/cjs/components/rich-content/rich-content-input/form-read-only-input/rich-content-form-read-only-input.st.css.js +2 -2
- package/dist/cjs/components/rich-content/rich-content-input/form-read-only-input/rich-content-form-read-only-input.st.css.js.map +1 -1
- package/dist/cjs/components/rich-content/rich-content-input/rich-content-common/fullscreen-modal/fullscreen-modal.st.css.js +3 -3
- package/dist/cjs/components/rich-content/rich-content-input/rich-content-common/fullscreen-modal/fullscreen-modal.st.css.js.map +1 -1
- package/dist/cjs/components/rich-content/rich-content-input/rich-content-common/publish-loader/publish-loader.st.css.js +3 -3
- package/dist/cjs/components/rich-content/rich-content-input/rich-content-common/publish-loader/publish-loader.st.css.js.map +1 -1
- package/dist/cjs/components/rich-content/rich-content-input/rich-content-common/toggle-fullscreen-button/toggle-fullscreen-button.st.css.js +2 -2
- package/dist/cjs/components/rich-content/rich-content-input/rich-content-common/toggle-fullscreen-button/toggle-fullscreen-button.st.css.js.map +1 -1
- package/dist/cjs/components/rich-content/rich-content-input/rich-content-editor/rich-content-editor.st.css.js +8 -8
- package/dist/cjs/components/rich-content/rich-content-input/rich-content-editor/rich-content-editor.st.css.js.map +1 -1
- package/dist/cjs/components/rich-content/rich-content-input/rich-content-editor/rich-content-toolbar.st.css.js +4 -4
- package/dist/cjs/components/rich-content/rich-content-input/rich-content-editor/rich-content-toolbar.st.css.js.map +1 -1
- package/dist/cjs/components/rich-content/rich-content-input/rich-content-viewer/rich-content-viewer.st.css.js +4 -4
- package/dist/cjs/components/rich-content/rich-content-input/rich-content-viewer/rich-content-viewer.st.css.js.map +1 -1
- package/dist/cjs/components/rich-text/rich-text-input/rich-text-editor/rich-editor.st.css.js +20 -20
- package/dist/cjs/components/rich-text/rich-text-input/rich-text-editor/rich-editor.st.css.js.map +1 -1
- package/dist/cjs/components/rich-text/rich-text-input/rich-text-editor/rich-text-editor.st.css.js +4 -4
- package/dist/cjs/components/rich-text/rich-text-input/rich-text-editor/rich-text-editor.st.css.js.map +1 -1
- package/dist/cjs/components/rich-text/rich-text-input/rich-text-editor/toolbar/toolbar.st.css.js +20 -20
- package/dist/cjs/components/rich-text/rich-text-input/rich-text-editor/toolbar/toolbar.st.css.js.map +1 -1
- package/dist/cjs/components/text/text-view.st.css.js +3 -3
- package/dist/cjs/components/text/text-view.st.css.js.map +1 -1
- package/dist/cjs/styles.global.css +1 -1
- package/dist/esm/assets/locale/messages_en.json +9 -9
- package/dist/esm/components/address/input/address-input.st.css.js +2 -2
- package/dist/esm/components/audio/actions/actions-menu/actions-menu.st.css.js +2 -2
- package/dist/esm/components/audio/audio-field/form-audio-field.st.css.js +2 -2
- package/dist/esm/components/audio/audio-field/form-audio-field.st.css.js.map +1 -1
- package/dist/esm/components/audio/audio-player/audio-player.st.css.js +2 -2
- package/dist/esm/components/color-view/color-view.st.css.js +2 -2
- package/dist/esm/components/color-view/color-view.st.css.js.map +1 -1
- package/dist/esm/components/delete-dialog/delete-dialog.st.css.js +2 -2
- package/dist/esm/components/document/cell-document-edit.js +60 -0
- package/dist/esm/components/document/cell-document-edit.js.map +1 -0
- package/dist/esm/components/document/cell-document-view.js +13 -0
- package/dist/esm/components/document/cell-document-view.js.map +1 -0
- package/dist/esm/components/document/form-document-field.st.css.js +2 -2
- package/dist/esm/components/document/index.js +2 -0
- package/dist/esm/components/document/index.js.map +1 -1
- package/dist/esm/components/document/utils.js +1 -0
- package/dist/esm/components/document/utils.js.map +1 -1
- package/dist/esm/components/exclamation/exclamation.st.css.js +2 -2
- package/dist/esm/components/highlighted-text/highlighted-text.st.css.js +3 -3
- package/dist/esm/components/image/cell-image-edit.js +46 -85
- package/dist/esm/components/image/cell-image-edit.js.map +1 -1
- package/dist/esm/components/image/thumbnail-replace-overlay.st.css.js +2 -2
- package/dist/esm/components/media-control/cell-media-edit-shell.js +23 -0
- package/dist/esm/components/media-control/cell-media-edit-shell.js.map +1 -0
- package/dist/esm/components/media-control/cell-media-edit-shell.st.css +4 -0
- package/dist/esm/components/media-control/cell-media-edit-shell.st.css.js +15 -0
- package/dist/esm/components/media-control/cell-media-edit-shell.st.css.js.map +1 -0
- package/dist/esm/components/media-control/index.js +2 -0
- package/dist/esm/components/media-control/index.js.map +1 -1
- package/dist/esm/components/media-control/paste-url-button.st.css.js +2 -2
- package/dist/esm/components/media-control/use-cell-media-edit.js +63 -0
- package/dist/esm/components/media-control/use-cell-media-edit.js.map +1 -0
- package/dist/esm/components/media-gallery/form-media-gallery-field.st.css.js +2 -2
- package/dist/esm/components/media-image/media-image.st.css.js +3 -3
- package/dist/esm/components/media-image/overlays/overlay.st.css.js +3 -3
- package/dist/esm/components/media-loader/media-loader.st.css.js +2 -2
- package/dist/esm/components/media-tag/web-media-tag/media-tag.st.css.js +2 -2
- package/dist/esm/components/media-tag/web-media-tag/media-tag.st.css.js.map +1 -1
- package/dist/esm/components/multi-document/multi-document-input/form-multi-document.st.css.js +2 -2
- package/dist/esm/components/reference/cell-reference-input.st.css.js +2 -2
- package/dist/esm/components/rich-content/rich-content-input/default-value-input/rich-content-default-value-input.st.css.js +3 -3
- package/dist/esm/components/rich-content/rich-content-input/form-input/rich-content-form-input.st.css.js +3 -3
- package/dist/esm/components/rich-content/rich-content-input/form-input/rich-content-form-input.st.css.js.map +1 -1
- package/dist/esm/components/rich-content/rich-content-input/form-read-only-input/rich-content-form-read-only-input.st.css.js +2 -2
- package/dist/esm/components/rich-content/rich-content-input/rich-content-common/fullscreen-modal/fullscreen-modal.st.css.js +2 -2
- package/dist/esm/components/rich-content/rich-content-input/rich-content-common/publish-loader/publish-loader.st.css.js +2 -2
- package/dist/esm/components/rich-content/rich-content-input/rich-content-common/toggle-fullscreen-button/toggle-fullscreen-button.st.css.js +2 -2
- package/dist/esm/components/rich-content/rich-content-input/rich-content-editor/rich-content-editor.st.css.js +3 -3
- package/dist/esm/components/rich-content/rich-content-input/rich-content-editor/rich-content-toolbar.st.css.js +2 -2
- package/dist/esm/components/rich-content/rich-content-input/rich-content-editor/rich-content-toolbar.st.css.js.map +1 -1
- package/dist/esm/components/rich-content/rich-content-input/rich-content-viewer/rich-content-viewer.st.css.js +2 -2
- package/dist/esm/components/rich-text/rich-text-input/rich-text-editor/rich-editor.st.css.js +3 -3
- package/dist/esm/components/rich-text/rich-text-input/rich-text-editor/rich-text-editor.st.css.js +2 -2
- package/dist/esm/components/rich-text/rich-text-input/rich-text-editor/toolbar/toolbar.st.css.js +3 -3
- package/dist/esm/components/text/text-view.st.css.js +2 -2
- package/dist/esm/styles.global.css +1 -1
- package/dist/types/components/audio/audio-field/form-audio-field.st.css.d.ts.map +1 -1
- package/dist/types/components/color-view/color-view.st.css.d.ts.map +1 -1
- package/dist/types/components/document/cell-document-edit.d.ts +23 -0
- package/dist/types/components/document/cell-document-edit.d.ts.map +1 -0
- package/dist/types/components/document/cell-document-view.d.ts +12 -0
- package/dist/types/components/document/cell-document-view.d.ts.map +1 -0
- package/dist/types/components/document/index.d.ts +2 -0
- package/dist/types/components/document/index.d.ts.map +1 -1
- package/dist/types/components/document/utils.d.ts.map +1 -1
- package/dist/types/components/image/cell-image-edit.d.ts +1 -1
- package/dist/types/components/image/cell-image-edit.d.ts.map +1 -1
- package/dist/types/components/media-control/cell-media-edit-shell.d.ts +29 -0
- package/dist/types/components/media-control/cell-media-edit-shell.d.ts.map +1 -0
- package/dist/types/components/media-control/cell-media-edit-shell.st.css.d.ts +13 -0
- package/dist/types/components/media-control/cell-media-edit-shell.st.css.d.ts.map +1 -0
- package/dist/types/components/media-control/index.d.ts +2 -0
- package/dist/types/components/media-control/index.d.ts.map +1 -1
- package/dist/types/components/media-control/use-cell-media-edit.d.ts +54 -0
- package/dist/types/components/media-control/use-cell-media-edit.d.ts.map +1 -0
- package/dist/types/components/media-tag/web-media-tag/media-tag.st.css.d.ts.map +1 -1
- package/dist/types/components/rich-content/rich-content-input/form-input/rich-content-form-input.st.css.d.ts.map +1 -1
- package/dist/types/components/rich-content/rich-content-input/rich-content-editor/rich-content-toolbar.st.css.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/__tests__/components/document/cell-document-edit.spec.tsx +101 -0
- package/src/__tests__/components/document/cell-document-view.spec.tsx +39 -0
- package/src/__tests__/components/document/utils.spec.ts +28 -0
- package/src/assets/locale/messages_en.json +9 -9
- package/src/components/address/input/address-input.st.css.ts +2 -2
- package/src/components/audio/actions/actions-menu/actions-menu.st.css.ts +2 -2
- package/src/components/audio/audio-field/form-audio-field.st.css.ts +2 -2
- package/src/components/audio/audio-player/audio-player.st.css.ts +2 -2
- package/src/components/color-view/color-view.st.css.ts +2 -2
- package/src/components/delete-dialog/delete-dialog.st.css.ts +2 -2
- package/src/components/document/cell-document-edit.tsx +196 -0
- package/src/components/document/cell-document-view.tsx +49 -0
- package/src/components/document/form-document-field.st.css.ts +2 -2
- package/src/components/document/index.ts +2 -0
- package/src/components/document/utils.ts +1 -0
- package/src/components/exclamation/exclamation.st.css.ts +2 -2
- package/src/components/highlighted-text/highlighted-text.st.css.ts +3 -3
- package/src/components/image/cell-image-edit.tsx +112 -196
- package/src/components/image/thumbnail-replace-overlay.st.css.ts +2 -2
- package/src/components/media-control/cell-media-edit-shell.st.css +4 -0
- package/src/components/media-control/cell-media-edit-shell.st.css.ts +25 -0
- package/src/components/media-control/cell-media-edit-shell.tsx +101 -0
- package/src/components/media-control/index.ts +2 -0
- package/src/components/media-control/paste-url-button.st.css.ts +2 -2
- package/src/components/media-control/use-cell-media-edit.ts +134 -0
- package/src/components/media-gallery/form-media-gallery-field.st.css.ts +2 -2
- package/src/components/media-image/media-image.st.css.ts +3 -3
- package/src/components/media-image/overlays/overlay.st.css.ts +3 -3
- package/src/components/media-loader/media-loader.st.css.ts +2 -2
- package/src/components/media-tag/web-media-tag/media-tag.st.css.ts +2 -2
- package/src/components/multi-document/multi-document-input/form-multi-document.st.css.ts +2 -2
- package/src/components/reference/cell-reference-input.st.css.ts +2 -2
- package/src/components/rich-content/rich-content-input/default-value-input/rich-content-default-value-input.st.css.ts +3 -3
- package/src/components/rich-content/rich-content-input/form-input/rich-content-form-input.st.css.ts +3 -3
- package/src/components/rich-content/rich-content-input/form-read-only-input/rich-content-form-read-only-input.st.css.ts +2 -2
- package/src/components/rich-content/rich-content-input/rich-content-common/fullscreen-modal/fullscreen-modal.st.css.ts +2 -2
- package/src/components/rich-content/rich-content-input/rich-content-common/publish-loader/publish-loader.st.css.ts +2 -2
- package/src/components/rich-content/rich-content-input/rich-content-common/toggle-fullscreen-button/toggle-fullscreen-button.st.css.ts +2 -2
- package/src/components/rich-content/rich-content-input/rich-content-editor/rich-content-editor.st.css.ts +3 -3
- package/src/components/rich-content/rich-content-input/rich-content-editor/rich-content-toolbar.st.css.ts +2 -2
- package/src/components/rich-content/rich-content-input/rich-content-viewer/rich-content-viewer.st.css.ts +2 -2
- package/src/components/rich-text/rich-text-input/rich-text-editor/rich-editor.st.css.ts +3 -3
- package/src/components/rich-text/rich-text-input/rich-text-editor/rich-text-editor.st.css.ts +2 -2
- package/src/components/rich-text/rich-text-input/rich-text-editor/toolbar/toolbar.st.css.ts +3 -3
- package/src/components/text/text-view.st.css.ts +2 -2
- package/src/styles.global.css +1 -1
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export * from './document-view';
|
|
2
|
+
export * from './cell-document-view';
|
|
3
|
+
export * from './cell-document-edit';
|
|
2
4
|
|
|
3
5
|
// NOTE: Heavy exports (FormDocumentField, DocumentControl, etc.) have been moved to './form' to prevent bundle bloat.
|
|
4
6
|
// Import them explicitly: import { FormDocumentField } from '../fields/components/document/form';
|
|
@@ -5,7 +5,7 @@ import { classesRuntime, statesRuntime } from "../../stylable-esm-runtime.js";
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var _namespace_ = "
|
|
8
|
+
var _namespace_ = "exclamation3539476362";
|
|
9
9
|
var _style_ = classesRuntime.bind(null, _namespace_);
|
|
10
10
|
|
|
11
11
|
export var cssStates = statesRuntime.bind(null, _namespace_);
|
|
@@ -13,7 +13,7 @@ export var style: import("@stylable/runtime").STFunction = _style_;
|
|
|
13
13
|
export var st: import("@stylable/runtime").STFunction = _style_;
|
|
14
14
|
|
|
15
15
|
export var namespace = _namespace_;
|
|
16
|
-
export var classes = {"root":"
|
|
16
|
+
export var classes = {"root":"exclamation3539476362__root","exclamation":"exclamation3539476362__exclamation","actions":"exclamation3539476362__actions","action":"exclamation3539476362__action"};
|
|
17
17
|
export var keyframes = {};
|
|
18
18
|
export var layers = {};
|
|
19
19
|
export var containers = {};
|
|
@@ -5,7 +5,7 @@ import { classesRuntime, statesRuntime } from "../../stylable-esm-runtime.js";
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var _namespace_ = "
|
|
8
|
+
var _namespace_ = "highlightedtext3677604336";
|
|
9
9
|
var _style_ = classesRuntime.bind(null, _namespace_);
|
|
10
10
|
|
|
11
11
|
export var cssStates = statesRuntime.bind(null, _namespace_);
|
|
@@ -13,8 +13,8 @@ export var style: import("@stylable/runtime").STFunction = _style_;
|
|
|
13
13
|
export var st: import("@stylable/runtime").STFunction = _style_;
|
|
14
14
|
|
|
15
15
|
export var namespace = _namespace_;
|
|
16
|
-
export var classes = {"root":"
|
|
17
|
-
export var keyframes = {"highlighted":"
|
|
16
|
+
export var classes = {"root":"highlightedtext3677604336__root","substring":"highlightedtext3677604336__substring"};
|
|
17
|
+
export var keyframes = {"highlighted":"highlightedtext3677604336__highlighted","highlighted-match":"highlightedtext3677604336__highlighted-match"};
|
|
18
18
|
export var layers = {};
|
|
19
19
|
export var containers = {};
|
|
20
20
|
export var stVars = {};
|
|
@@ -1,32 +1,25 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import {
|
|
3
|
-
Box,
|
|
4
|
-
IconButton,
|
|
5
|
-
Loader,
|
|
6
|
-
PopoverMenu,
|
|
7
|
-
Tooltip,
|
|
8
|
-
} from '@wix/design-system';
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Box, IconButton, PopoverMenu, Tooltip } from '@wix/design-system';
|
|
9
3
|
import {
|
|
10
4
|
Add,
|
|
5
|
+
Delete,
|
|
6
|
+
Link,
|
|
11
7
|
LinkSmall,
|
|
12
8
|
MoreSmall,
|
|
13
9
|
Replace,
|
|
14
|
-
Link,
|
|
15
|
-
Delete,
|
|
16
10
|
} from '@wix/wix-ui-icons-common';
|
|
17
11
|
import { MEDIA_TYPES } from '../../utils/media-utils';
|
|
18
|
-
import { useTranslations
|
|
12
|
+
import { useTranslations } from '../../hooks';
|
|
19
13
|
import {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
PasteURLForm,
|
|
14
|
+
useCellMediaEdit,
|
|
15
|
+
CellMediaEditShell,
|
|
23
16
|
MediaFieldType,
|
|
24
17
|
} from '../media-control';
|
|
25
18
|
import { ImageThumbnail } from './image-thumbnail';
|
|
26
19
|
import { ThumbnailReplaceOverlay } from './thumbnail-replace-overlay';
|
|
27
20
|
|
|
28
21
|
export interface CellImageEditProps {
|
|
29
|
-
value: string | null
|
|
22
|
+
value: string | null;
|
|
30
23
|
onChange: (value: string | null) => void;
|
|
31
24
|
onCommit: () => void;
|
|
32
25
|
onCancel?: () => void;
|
|
@@ -49,200 +42,123 @@ export const CellImageEdit: React.FC<CellImageEditProps> = ({
|
|
|
49
42
|
dataHook,
|
|
50
43
|
}) => {
|
|
51
44
|
const { t } = useTranslations();
|
|
52
|
-
const containerRef = useRef<HTMLDivElement | null>(null);
|
|
53
|
-
|
|
54
|
-
const onMediaChange = useCallback(
|
|
55
|
-
(uri: string) => {
|
|
56
|
-
onChange(uri);
|
|
57
|
-
onCommit();
|
|
58
|
-
},
|
|
59
|
-
[onChange, onCommit],
|
|
60
|
-
);
|
|
61
45
|
|
|
62
|
-
const
|
|
46
|
+
const mediaEdit = useCellMediaEdit({
|
|
63
47
|
mediaType: MEDIA_TYPES.IMAGE,
|
|
64
|
-
value
|
|
65
|
-
onChange
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
const handleCallMedia = useCallback(async () => {
|
|
69
|
-
onStartEdit?.();
|
|
70
|
-
const committed = await callMedia();
|
|
71
|
-
if (!committed) {
|
|
72
|
-
onCancel?.();
|
|
73
|
-
}
|
|
74
|
-
}, [onStartEdit, callMedia, onCancel]);
|
|
75
|
-
|
|
76
|
-
const pasteUrlTitle = t('CMS.image.replaceWithUrl.title');
|
|
77
|
-
const { isOpen, title, onOpen, onClose, onSave } = usePasteURLForm({
|
|
78
|
-
onChange: onMediaChange,
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
// When the paste-URL form is dismissed without saving, cancel the in-progress
|
|
82
|
-
// edit so isEditing returns to false and useClearFocusOnBlur works normally.
|
|
83
|
-
const handleFormClose = useCallback(() => {
|
|
84
|
-
onClose();
|
|
85
|
-
onCancel?.();
|
|
86
|
-
}, [onClose, onCancel]);
|
|
87
|
-
|
|
88
|
-
const handleOpenPasteUrl = useCallback(
|
|
89
|
-
(params: { title: string; value?: string }) => () => {
|
|
90
|
-
onStartEdit?.();
|
|
91
|
-
onOpen(params)();
|
|
92
|
-
},
|
|
93
|
-
[onStartEdit, onOpen],
|
|
94
|
-
);
|
|
95
|
-
|
|
96
|
-
const handleDelete = useCallback(() => {
|
|
97
|
-
onChange(null);
|
|
98
|
-
onCommit();
|
|
99
|
-
}, [onChange, onCommit]);
|
|
100
|
-
|
|
101
|
-
const { handleContainerFocus, handleContainerBlur } = useCellEditKeyboard({
|
|
102
|
-
containerRef,
|
|
48
|
+
value,
|
|
49
|
+
onChange,
|
|
50
|
+
onCommit,
|
|
103
51
|
onCancel,
|
|
52
|
+
onStartEdit,
|
|
104
53
|
inputRef,
|
|
105
54
|
});
|
|
106
55
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
verticalAlign="middle"
|
|
112
|
-
width="100%"
|
|
113
|
-
height="100%"
|
|
114
|
-
padding="0 8px"
|
|
115
|
-
>
|
|
116
|
-
<Loader size="tiny" />
|
|
117
|
-
</Box>
|
|
118
|
-
);
|
|
119
|
-
}
|
|
56
|
+
const openPasteUrl = mediaEdit.startEditAndOpenPasteUrl({
|
|
57
|
+
title: t('CMS.image.replaceWithUrl.title'),
|
|
58
|
+
value: value ?? undefined,
|
|
59
|
+
});
|
|
120
60
|
|
|
121
61
|
return (
|
|
122
|
-
<
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
onBlur={handleContainerBlur}
|
|
62
|
+
<CellMediaEditShell
|
|
63
|
+
dataHook={dataHook}
|
|
64
|
+
mediaEdit={mediaEdit}
|
|
65
|
+
value={value}
|
|
66
|
+
fieldType={MediaFieldType.image}
|
|
128
67
|
>
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
cursor: 'pointer',
|
|
146
|
-
lineHeight: 0,
|
|
147
|
-
position: 'relative',
|
|
148
|
-
background: 'none',
|
|
149
|
-
border: 'none',
|
|
150
|
-
padding: 0,
|
|
151
|
-
}}
|
|
152
|
-
>
|
|
153
|
-
<ImageThumbnail value={value} />
|
|
154
|
-
<ThumbnailReplaceOverlay />
|
|
155
|
-
</button>
|
|
156
|
-
</Box>
|
|
157
|
-
</Tooltip>
|
|
158
|
-
) : (
|
|
159
|
-
/* Empty: icon button opens media manager */
|
|
160
|
-
<Tooltip content={t('CMS.image.add')} appendTo="window">
|
|
161
|
-
<IconButton
|
|
162
|
-
size="tiny"
|
|
163
|
-
priority="secondary"
|
|
164
|
-
dataHook="image-edit-add-button"
|
|
165
|
-
onClick={handleCallMedia}
|
|
68
|
+
{value ? (
|
|
69
|
+
/* Has value: clickable thumbnail button with replace overlay */
|
|
70
|
+
<Tooltip content={t('CMS.image.replace')} appendTo="window">
|
|
71
|
+
<Box>
|
|
72
|
+
<button
|
|
73
|
+
type="button"
|
|
74
|
+
data-hook="image-edit-thumbnail"
|
|
75
|
+
onClick={mediaEdit.handleCallMedia}
|
|
76
|
+
style={{
|
|
77
|
+
cursor: 'pointer',
|
|
78
|
+
lineHeight: 0,
|
|
79
|
+
position: 'relative',
|
|
80
|
+
background: 'none',
|
|
81
|
+
border: 'none',
|
|
82
|
+
padding: 0,
|
|
83
|
+
}}
|
|
166
84
|
>
|
|
167
|
-
<
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
85
|
+
<ImageThumbnail value={value} />
|
|
86
|
+
<ThumbnailReplaceOverlay />
|
|
87
|
+
</button>
|
|
88
|
+
</Box>
|
|
89
|
+
</Tooltip>
|
|
90
|
+
) : (
|
|
91
|
+
/* Empty: icon button opens media manager */
|
|
92
|
+
<Tooltip content={t('CMS.image.add')} appendTo="window">
|
|
93
|
+
<IconButton
|
|
94
|
+
size="tiny"
|
|
95
|
+
priority="secondary"
|
|
96
|
+
dataHook="image-edit-add-button"
|
|
97
|
+
onClick={mediaEdit.handleCallMedia}
|
|
98
|
+
>
|
|
99
|
+
<Add />
|
|
100
|
+
</IconButton>
|
|
101
|
+
</Tooltip>
|
|
102
|
+
)}
|
|
171
103
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
104
|
+
{value ? (
|
|
105
|
+
/* Has value: "..." menu with Replace / Replace with URL / Delete */
|
|
106
|
+
<PopoverMenu
|
|
107
|
+
textSize="small"
|
|
108
|
+
appendTo="window"
|
|
109
|
+
triggerElement={
|
|
110
|
+
<Tooltip
|
|
111
|
+
content={t('auto-patterns.fields.more_actions_tooltip')}
|
|
112
|
+
appendTo="window"
|
|
113
|
+
>
|
|
114
|
+
<IconButton
|
|
115
|
+
size="tiny"
|
|
116
|
+
priority="tertiary"
|
|
117
|
+
dataHook="image-edit-more-button"
|
|
181
118
|
>
|
|
182
|
-
<
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
}
|
|
119
|
+
<MoreSmall />
|
|
120
|
+
</IconButton>
|
|
121
|
+
</Tooltip>
|
|
122
|
+
}
|
|
123
|
+
>
|
|
124
|
+
<PopoverMenu.MenuItem
|
|
125
|
+
dataHook="image-edit-action-replace"
|
|
126
|
+
text={t('CMS.image.replace')}
|
|
127
|
+
prefixIcon={<Replace />}
|
|
128
|
+
onClick={mediaEdit.handleCallMedia}
|
|
129
|
+
/>
|
|
130
|
+
<PopoverMenu.MenuItem
|
|
131
|
+
dataHook="image-edit-action-replace-url"
|
|
132
|
+
text={t('CMS.image.replaceWithUrl.button')}
|
|
133
|
+
prefixIcon={<Link />}
|
|
134
|
+
onClick={openPasteUrl}
|
|
135
|
+
/>
|
|
136
|
+
<PopoverMenu.Divider />
|
|
137
|
+
<PopoverMenu.MenuItem
|
|
138
|
+
dataHook="image-edit-action-delete"
|
|
139
|
+
text={t('CMS.image.clear')}
|
|
140
|
+
skin="destructive"
|
|
141
|
+
prefixIcon={<Delete />}
|
|
142
|
+
onClick={mediaEdit.handleDelete}
|
|
143
|
+
/>
|
|
144
|
+
</PopoverMenu>
|
|
145
|
+
) : (
|
|
146
|
+
/* Empty: icon button opens paste-URL form */
|
|
147
|
+
<Tooltip
|
|
148
|
+
content={t('CMS.image.replaceWithUrl.button')}
|
|
149
|
+
appendTo="window"
|
|
150
|
+
>
|
|
151
|
+
<IconButton
|
|
152
|
+
size="tiny"
|
|
153
|
+
priority="tertiary"
|
|
154
|
+
dataHook="image-edit-paste-url-button"
|
|
155
|
+
onClick={openPasteUrl}
|
|
191
156
|
>
|
|
192
|
-
<
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
/>
|
|
198
|
-
<PopoverMenu.MenuItem
|
|
199
|
-
dataHook="image-edit-action-replace-url"
|
|
200
|
-
text={t('CMS.image.replaceWithUrl.button')}
|
|
201
|
-
prefixIcon={<Link />}
|
|
202
|
-
onClick={handleOpenPasteUrl({
|
|
203
|
-
title: pasteUrlTitle,
|
|
204
|
-
value: value ?? undefined,
|
|
205
|
-
})}
|
|
206
|
-
/>
|
|
207
|
-
<PopoverMenu.Divider />
|
|
208
|
-
<PopoverMenu.MenuItem
|
|
209
|
-
dataHook="image-edit-action-delete"
|
|
210
|
-
text={t('CMS.image.clear')}
|
|
211
|
-
skin="destructive"
|
|
212
|
-
prefixIcon={<Delete />}
|
|
213
|
-
onClick={handleDelete}
|
|
214
|
-
/>
|
|
215
|
-
</PopoverMenu>
|
|
216
|
-
) : (
|
|
217
|
-
/* Empty: icon button opens paste-URL form */
|
|
218
|
-
<Tooltip
|
|
219
|
-
content={t('CMS.image.replaceWithUrl.button')}
|
|
220
|
-
appendTo="window"
|
|
221
|
-
>
|
|
222
|
-
<IconButton
|
|
223
|
-
size="tiny"
|
|
224
|
-
priority="tertiary"
|
|
225
|
-
dataHook="image-edit-paste-url-button"
|
|
226
|
-
onClick={handleOpenPasteUrl({
|
|
227
|
-
title: pasteUrlTitle,
|
|
228
|
-
value: value ?? undefined,
|
|
229
|
-
})}
|
|
230
|
-
>
|
|
231
|
-
<LinkSmall />
|
|
232
|
-
</IconButton>
|
|
233
|
-
</Tooltip>
|
|
234
|
-
)}
|
|
235
|
-
</Box>
|
|
236
|
-
|
|
237
|
-
<PasteURLForm
|
|
238
|
-
title={title}
|
|
239
|
-
value={value ?? undefined}
|
|
240
|
-
show={isOpen}
|
|
241
|
-
closeModal={handleFormClose}
|
|
242
|
-
onSave={onSave}
|
|
243
|
-
fieldType={MediaFieldType.image}
|
|
244
|
-
/>
|
|
245
|
-
</div>
|
|
157
|
+
<LinkSmall />
|
|
158
|
+
</IconButton>
|
|
159
|
+
</Tooltip>
|
|
160
|
+
)}
|
|
161
|
+
</CellMediaEditShell>
|
|
246
162
|
);
|
|
247
163
|
};
|
|
248
164
|
|
|
@@ -5,7 +5,7 @@ import { classesRuntime, statesRuntime } from "../../stylable-esm-runtime.js";
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var _namespace_ = "
|
|
8
|
+
var _namespace_ = "thumbnailreplaceoverlay4132621481";
|
|
9
9
|
var _style_ = classesRuntime.bind(null, _namespace_);
|
|
10
10
|
|
|
11
11
|
export var cssStates = statesRuntime.bind(null, _namespace_);
|
|
@@ -13,7 +13,7 @@ export var style: import("@stylable/runtime").STFunction = _style_;
|
|
|
13
13
|
export var st: import("@stylable/runtime").STFunction = _style_;
|
|
14
14
|
|
|
15
15
|
export var namespace = _namespace_;
|
|
16
|
-
export var classes = {"root":"
|
|
16
|
+
export var classes = {"root":"thumbnailreplaceoverlay4132621481__root","icon":"thumbnailreplaceoverlay4132621481__icon"};
|
|
17
17
|
export var keyframes = {};
|
|
18
18
|
export var layers = {};
|
|
19
19
|
export var containers = {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
import { classesRuntime, statesRuntime } from "../../stylable-esm-runtime.js";
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
var _namespace_ = "cellmediaeditshell3249443726";
|
|
9
|
+
var _style_ = classesRuntime.bind(null, _namespace_);
|
|
10
|
+
|
|
11
|
+
export var cssStates = statesRuntime.bind(null, _namespace_);
|
|
12
|
+
export var style: import("@stylable/runtime").STFunction = _style_;
|
|
13
|
+
export var st: import("@stylable/runtime").STFunction = _style_;
|
|
14
|
+
|
|
15
|
+
export var namespace = _namespace_;
|
|
16
|
+
export var classes = {"root":"cellmediaeditshell3249443726__root"};
|
|
17
|
+
export var keyframes = {};
|
|
18
|
+
export var layers = {};
|
|
19
|
+
export var containers = {};
|
|
20
|
+
export var stVars = {};
|
|
21
|
+
export var vars = {};
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Box, Loader } from '@wix/design-system';
|
|
3
|
+
import type { BoxCssSizingProperty } from '@wix/design-system/dist/types/Box/Box.types';
|
|
4
|
+
|
|
5
|
+
import { PasteURLForm, MediaFieldType } from './paste-url-form';
|
|
6
|
+
import { classes } from './cell-media-edit-shell.st.css.js';
|
|
7
|
+
import type { UseCellMediaEditResult } from './use-cell-media-edit';
|
|
8
|
+
|
|
9
|
+
export interface CellMediaEditShellProps {
|
|
10
|
+
dataHook?: string;
|
|
11
|
+
/**
|
|
12
|
+
* The result of `useCellMediaEdit`; the shell reads containerRef, loading,
|
|
13
|
+
* the focus/blur handlers, and the pasteUrlForm props from it.
|
|
14
|
+
*/
|
|
15
|
+
mediaEdit: Pick<
|
|
16
|
+
UseCellMediaEditResult,
|
|
17
|
+
| 'containerRef'
|
|
18
|
+
| 'loading'
|
|
19
|
+
| 'handleContainerFocus'
|
|
20
|
+
| 'handleContainerBlur'
|
|
21
|
+
| 'pasteUrlForm'
|
|
22
|
+
>;
|
|
23
|
+
/** Current cell value — forwarded to PasteURLForm as the pre-filled value. */
|
|
24
|
+
value: string | null;
|
|
25
|
+
/** Which validator/placeholder strings the PasteURLForm should use. */
|
|
26
|
+
fieldType: MediaFieldType;
|
|
27
|
+
/** Optional gap between the primary slot and the secondary actions. */
|
|
28
|
+
gap?: BoxCssSizingProperty;
|
|
29
|
+
/** Inner content — typically two slots: primary cell content + secondary actions. */
|
|
30
|
+
children: React.ReactNode;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Outer scaffolding shared by single-value media cell edit components.
|
|
35
|
+
*
|
|
36
|
+
* Renders the loading state, the focus-managed container (wired for
|
|
37
|
+
* `useCellEditKeyboard`), the inner flex Box, and the PasteURLForm modal at the
|
|
38
|
+
* end. Consumers supply only the inner primary/secondary controls via children.
|
|
39
|
+
*/
|
|
40
|
+
export const CellMediaEditShell: React.FC<CellMediaEditShellProps> = ({
|
|
41
|
+
dataHook,
|
|
42
|
+
mediaEdit,
|
|
43
|
+
value,
|
|
44
|
+
fieldType,
|
|
45
|
+
gap,
|
|
46
|
+
children,
|
|
47
|
+
}) => {
|
|
48
|
+
const {
|
|
49
|
+
containerRef,
|
|
50
|
+
loading,
|
|
51
|
+
handleContainerFocus,
|
|
52
|
+
handleContainerBlur,
|
|
53
|
+
pasteUrlForm,
|
|
54
|
+
} = mediaEdit;
|
|
55
|
+
|
|
56
|
+
if (loading) {
|
|
57
|
+
return (
|
|
58
|
+
<Box
|
|
59
|
+
dataHook={dataHook}
|
|
60
|
+
verticalAlign="middle"
|
|
61
|
+
width="100%"
|
|
62
|
+
height="100%"
|
|
63
|
+
padding="0 8px"
|
|
64
|
+
>
|
|
65
|
+
<Loader dataHook="loader" size="tiny" />
|
|
66
|
+
</Box>
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return (
|
|
71
|
+
<div
|
|
72
|
+
ref={containerRef}
|
|
73
|
+
data-hook={dataHook}
|
|
74
|
+
className={classes.root}
|
|
75
|
+
onFocus={handleContainerFocus}
|
|
76
|
+
onBlur={handleContainerBlur}
|
|
77
|
+
>
|
|
78
|
+
<Box
|
|
79
|
+
align="space-between"
|
|
80
|
+
verticalAlign="middle"
|
|
81
|
+
height="100%"
|
|
82
|
+
padding="0 8px"
|
|
83
|
+
gap={gap}
|
|
84
|
+
style={{ boxSizing: 'border-box' }}
|
|
85
|
+
>
|
|
86
|
+
{children}
|
|
87
|
+
</Box>
|
|
88
|
+
|
|
89
|
+
<PasteURLForm
|
|
90
|
+
title={pasteUrlForm.title}
|
|
91
|
+
value={value ?? undefined}
|
|
92
|
+
show={pasteUrlForm.isOpen}
|
|
93
|
+
closeModal={pasteUrlForm.handleClose}
|
|
94
|
+
onSave={pasteUrlForm.onSave}
|
|
95
|
+
fieldType={fieldType}
|
|
96
|
+
/>
|
|
97
|
+
</div>
|
|
98
|
+
);
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
CellMediaEditShell.displayName = 'CellMediaEditShell';
|
|
@@ -5,7 +5,7 @@ import { classesRuntime, statesRuntime } from "../../stylable-esm-runtime.js";
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var _namespace_ = "
|
|
8
|
+
var _namespace_ = "pasteurlbutton625213010";
|
|
9
9
|
var _style_ = classesRuntime.bind(null, _namespace_);
|
|
10
10
|
|
|
11
11
|
export var cssStates = statesRuntime.bind(null, _namespace_);
|
|
@@ -13,7 +13,7 @@ export var style: import("@stylable/runtime").STFunction = _style_;
|
|
|
13
13
|
export var st: import("@stylable/runtime").STFunction = _style_;
|
|
14
14
|
|
|
15
15
|
export var namespace = _namespace_;
|
|
16
|
-
export var classes = {"root":"
|
|
16
|
+
export var classes = {"root":"pasteurlbutton625213010__root","iconButtonTooltip":"pasteurlbutton625213010__iconButtonTooltip","iconButton":"pasteurlbutton625213010__iconButton"};
|
|
17
17
|
export var keyframes = {};
|
|
18
18
|
export var layers = {};
|
|
19
19
|
export var containers = {};
|