@pushwoosh/dumb-components 4.12.1 → 4.12.3
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.
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Transforms } from 'slate';
|
|
2
|
+
import { Node as SlateNode, Transforms } from 'slate';
|
|
3
3
|
import { useSelected, useSlateStatic } from 'slate-react';
|
|
4
|
-
import { findPath } from './helpers';
|
|
5
4
|
import { Chip } from '../../Chip';
|
|
6
5
|
import { isResolvableDc } from '../../shared/dynamicContent';
|
|
7
6
|
const DynamicContentElementComponent = ({
|
|
@@ -25,7 +24,9 @@ const DynamicContentElementComponent = ({
|
|
|
25
24
|
"$onClose": event => {
|
|
26
25
|
event.preventDefault();
|
|
27
26
|
event.stopPropagation();
|
|
28
|
-
const
|
|
27
|
+
const path = SlateNode.findPath(editor, element);
|
|
28
|
+
if (!path) return;
|
|
29
|
+
const [paragraphIndex, elementIndex] = path;
|
|
29
30
|
Transforms.delete(editor, {
|
|
30
31
|
at: [paragraphIndex, elementIndex]
|
|
31
32
|
});
|
|
@@ -20,13 +20,6 @@ export declare function getDcByPath(value: SlateEditorContent, path: number[]):
|
|
|
20
20
|
* @returns Array of all dynamic content elements
|
|
21
21
|
*/
|
|
22
22
|
export declare function findAllDc(value: SlateEditorContent): DynamicContentElement[];
|
|
23
|
-
/**
|
|
24
|
-
* Finds the path to a specific element in the Slate document
|
|
25
|
-
* @param value - The Slate editor content
|
|
26
|
-
* @param elToFind - The element to find
|
|
27
|
-
* @returns Array of indices representing the path to the element, empty if not found
|
|
28
|
-
*/
|
|
29
|
-
export declare function findPath(value: SlateEditorContent, elToFind: Descendant): number[];
|
|
30
23
|
export { parseDc, stringifyDc };
|
|
31
24
|
/**
|
|
32
25
|
* Converts a string to Slate editor content, parsing dynamic content tags
|
|
@@ -48,27 +48,6 @@ export function findAllDc(value) {
|
|
|
48
48
|
walkDeep(value);
|
|
49
49
|
return dces;
|
|
50
50
|
}
|
|
51
|
-
/**
|
|
52
|
-
* Finds the path to a specific element in the Slate document
|
|
53
|
-
* @param value - The Slate editor content
|
|
54
|
-
* @param elToFind - The element to find
|
|
55
|
-
* @returns Array of indices representing the path to the element, empty if not found
|
|
56
|
-
*/
|
|
57
|
-
export function findPath(value, elToFind) {
|
|
58
|
-
for (let i = 0; i < value.length; i++) {
|
|
59
|
-
const el = value[i];
|
|
60
|
-
if (el === elToFind) {
|
|
61
|
-
return [i];
|
|
62
|
-
}
|
|
63
|
-
if (isElement(el)) {
|
|
64
|
-
const path = findPath(el.children, elToFind);
|
|
65
|
-
if (path.length > 0) {
|
|
66
|
-
return [i, ...path];
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
return [];
|
|
71
|
-
}
|
|
72
51
|
// Re-exported so existing import paths keep working; the token format itself
|
|
73
52
|
// now lives in shared/dynamicContent, shared with the read-only renderers.
|
|
74
53
|
export { parseDc, stringifyDc };
|
|
@@ -11,9 +11,9 @@ export declare const EditableStyled: import("styled-components/dist/types").ISty
|
|
|
11
11
|
renderText?: ((props: import("slate-react").RenderTextProps) => React.JSX.Element) | undefined;
|
|
12
12
|
renderPlaceholder?: ((props: import("slate-react").RenderPlaceholderProps) => React.JSX.Element) | undefined;
|
|
13
13
|
scrollSelectionIntoView?: ((editor: import("slate-react").ReactEditor, domRange: Range) => void) | undefined;
|
|
14
|
-
as?: React.ElementType
|
|
14
|
+
as?: React.ElementType | undefined;
|
|
15
15
|
disableDefaultStyles?: boolean | undefined;
|
|
16
|
-
} & import("react").
|
|
16
|
+
} & import("react").HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>, "style"> & {
|
|
17
17
|
style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
|
|
18
18
|
}, {
|
|
19
19
|
$isErrored?: boolean;
|
|
@@ -31,6 +31,6 @@ export declare const EditableStyled: import("styled-components/dist/types").ISty
|
|
|
31
31
|
renderText?: ((props: import("slate-react").RenderTextProps) => React.JSX.Element) | undefined;
|
|
32
32
|
renderPlaceholder?: ((props: import("slate-react").RenderPlaceholderProps) => React.JSX.Element) | undefined;
|
|
33
33
|
scrollSelectionIntoView?: ((editor: import("slate-react").ReactEditor, domRange: Range) => void) | undefined;
|
|
34
|
-
as?: React.ElementType
|
|
34
|
+
as?: React.ElementType | undefined;
|
|
35
35
|
disableDefaultStyles?: boolean | undefined;
|
|
36
|
-
} & import("react").
|
|
36
|
+
} & import("react").HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>, keyof import("react").Component<any, {}, any>>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pushwoosh/dumb-components",
|
|
3
|
-
"version": "4.12.
|
|
3
|
+
"version": "4.12.3",
|
|
4
4
|
"description": "React components to build Pushwoosh products",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "index.js",
|
|
@@ -49,9 +49,10 @@
|
|
|
49
49
|
"polished": "^4.3.1",
|
|
50
50
|
"react-select": "^5.10.0",
|
|
51
51
|
"react-transition-group": "^4.4.5",
|
|
52
|
-
"slate": "^0.
|
|
53
|
-
"slate-
|
|
54
|
-
"slate-
|
|
52
|
+
"slate": "^0.147.4",
|
|
53
|
+
"slate-dom": "^0.147.3",
|
|
54
|
+
"slate-history": "^0.144.0",
|
|
55
|
+
"slate-react": "^0.147.5",
|
|
55
56
|
"tippy.js": "^6.3.7"
|
|
56
57
|
},
|
|
57
58
|
"peerDependencies": {
|