@wistia/vhs 4.0.0-beta.c3470991.bde9434 → 4.0.0-beta.cfb66734.5d7766b
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/index.cjs +17 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +32 -30
- package/dist/index.d.ts +32 -30
- package/dist/index.mjs +29 -22
- package/dist/index.mjs.map +1 -1
- package/package.json +20 -19
package/dist/index.d.mts
CHANGED
|
@@ -5,11 +5,12 @@ import * as react from 'react';
|
|
|
5
5
|
import { JSX, ReactNode, ComponentPropsWithoutRef, Dispatch, SetStateAction, RefObject, MutableRefObject, MouseEvent, ComponentPropsWithRef, ChangeEvent, ElementType, Ref, ComponentClass, ComponentProps, FocusEvent, HTMLInputTypeAttribute, KeyboardEvent as KeyboardEvent$1, ReactElement, ComponentType, PropsWithChildren } from 'react';
|
|
6
6
|
import { FormikProps, FormikHelpers, FormikErrors, Field } from 'formik';
|
|
7
7
|
export { useFormikContext } from 'formik';
|
|
8
|
+
import { BaseEditor, Descendant } from 'slate';
|
|
9
|
+
import { ReactEditor } from 'slate-react';
|
|
10
|
+
import { HistoryEditor } from 'slate-history';
|
|
8
11
|
import { DropdownMenuProps, DropdownMenuContentProps, DropdownMenuItemProps, DropdownMenuCheckboxItemProps, DropdownMenuRadioItemProps } from '@radix-ui/react-dropdown-menu';
|
|
9
12
|
export { DropdownMenuRadioGroup as MenuRadioGroup } from '@radix-ui/react-dropdown-menu';
|
|
10
13
|
import * as styled_components_dist_types from 'styled-components/dist/types';
|
|
11
|
-
import { Descendant } from 'slate';
|
|
12
|
-
import { ReactEditor } from 'slate-react';
|
|
13
14
|
|
|
14
15
|
interface VHSTheme {
|
|
15
16
|
readonly breakpoint: {
|
|
@@ -1868,6 +1869,35 @@ type CustomComponentClass = {
|
|
|
1868
1869
|
};
|
|
1869
1870
|
};
|
|
1870
1871
|
|
|
1872
|
+
type NodeElementObject = {
|
|
1873
|
+
attributes?: Record<string, string>;
|
|
1874
|
+
children?: NodeLeafObject[];
|
|
1875
|
+
type?: string;
|
|
1876
|
+
url?: string;
|
|
1877
|
+
};
|
|
1878
|
+
type NodeObject = NodeElementObject | NodeLeafObject;
|
|
1879
|
+
type NodeLeafObject = {
|
|
1880
|
+
attributes?: Record<string, string>;
|
|
1881
|
+
bold?: boolean;
|
|
1882
|
+
code?: boolean;
|
|
1883
|
+
italic?: boolean;
|
|
1884
|
+
parent?: NodeObject;
|
|
1885
|
+
children?: NodeLeafObject[];
|
|
1886
|
+
strikethrough?: boolean;
|
|
1887
|
+
text?: string;
|
|
1888
|
+
type?: string;
|
|
1889
|
+
url?: string;
|
|
1890
|
+
underline?: boolean;
|
|
1891
|
+
};
|
|
1892
|
+
type CustomEditor = BaseEditor & HistoryEditor & ReactEditor;
|
|
1893
|
+
declare module 'slate' {
|
|
1894
|
+
interface CustomTypes {
|
|
1895
|
+
Editor: CustomEditor;
|
|
1896
|
+
Element: NodeElementObject;
|
|
1897
|
+
Text: NodeLeafObject;
|
|
1898
|
+
}
|
|
1899
|
+
}
|
|
1900
|
+
|
|
1871
1901
|
declare const rteFormatTypes: Readonly<{
|
|
1872
1902
|
BOLD: "BOLD";
|
|
1873
1903
|
ITALIC: "ITALIC";
|
|
@@ -2837,34 +2867,6 @@ declare const RangeSelector: {
|
|
|
2837
2867
|
displayName: string;
|
|
2838
2868
|
};
|
|
2839
2869
|
|
|
2840
|
-
type NodeElementObject = {
|
|
2841
|
-
attributes?: Record<string, string>;
|
|
2842
|
-
children?: NodeLeafObject[];
|
|
2843
|
-
type?: string;
|
|
2844
|
-
url?: string;
|
|
2845
|
-
};
|
|
2846
|
-
type NodeObject = NodeElementObject | NodeLeafObject;
|
|
2847
|
-
type NodeLeafObject = {
|
|
2848
|
-
attributes?: Record<string, string>;
|
|
2849
|
-
bold?: boolean;
|
|
2850
|
-
code?: boolean;
|
|
2851
|
-
italic?: boolean;
|
|
2852
|
-
parent?: NodeObject;
|
|
2853
|
-
children?: NodeLeafObject[];
|
|
2854
|
-
strikethrough?: boolean;
|
|
2855
|
-
text?: string;
|
|
2856
|
-
type?: string;
|
|
2857
|
-
url?: string;
|
|
2858
|
-
underline?: boolean;
|
|
2859
|
-
};
|
|
2860
|
-
declare module 'slate' {
|
|
2861
|
-
interface CustomTypes {
|
|
2862
|
-
Editor: ReactEditor;
|
|
2863
|
-
Element: NodeElementObject;
|
|
2864
|
-
Text: NodeLeafObject;
|
|
2865
|
-
}
|
|
2866
|
-
}
|
|
2867
|
-
|
|
2868
2870
|
type RichTextEditorProps = {
|
|
2869
2871
|
/**
|
|
2870
2872
|
* Optional id to set aria-labelledby
|
package/dist/index.d.ts
CHANGED
|
@@ -5,11 +5,12 @@ import * as react from 'react';
|
|
|
5
5
|
import { JSX, ReactNode, ComponentPropsWithoutRef, Dispatch, SetStateAction, RefObject, MutableRefObject, MouseEvent, ComponentPropsWithRef, ChangeEvent, ElementType, Ref, ComponentClass, ComponentProps, FocusEvent, HTMLInputTypeAttribute, KeyboardEvent as KeyboardEvent$1, ReactElement, ComponentType, PropsWithChildren } from 'react';
|
|
6
6
|
import { FormikProps, FormikHelpers, FormikErrors, Field } from 'formik';
|
|
7
7
|
export { useFormikContext } from 'formik';
|
|
8
|
+
import { BaseEditor, Descendant } from 'slate';
|
|
9
|
+
import { ReactEditor } from 'slate-react';
|
|
10
|
+
import { HistoryEditor } from 'slate-history';
|
|
8
11
|
import { DropdownMenuProps, DropdownMenuContentProps, DropdownMenuItemProps, DropdownMenuCheckboxItemProps, DropdownMenuRadioItemProps } from '@radix-ui/react-dropdown-menu';
|
|
9
12
|
export { DropdownMenuRadioGroup as MenuRadioGroup } from '@radix-ui/react-dropdown-menu';
|
|
10
13
|
import * as styled_components_dist_types from 'styled-components/dist/types';
|
|
11
|
-
import { Descendant } from 'slate';
|
|
12
|
-
import { ReactEditor } from 'slate-react';
|
|
13
14
|
|
|
14
15
|
interface VHSTheme {
|
|
15
16
|
readonly breakpoint: {
|
|
@@ -1868,6 +1869,35 @@ type CustomComponentClass = {
|
|
|
1868
1869
|
};
|
|
1869
1870
|
};
|
|
1870
1871
|
|
|
1872
|
+
type NodeElementObject = {
|
|
1873
|
+
attributes?: Record<string, string>;
|
|
1874
|
+
children?: NodeLeafObject[];
|
|
1875
|
+
type?: string;
|
|
1876
|
+
url?: string;
|
|
1877
|
+
};
|
|
1878
|
+
type NodeObject = NodeElementObject | NodeLeafObject;
|
|
1879
|
+
type NodeLeafObject = {
|
|
1880
|
+
attributes?: Record<string, string>;
|
|
1881
|
+
bold?: boolean;
|
|
1882
|
+
code?: boolean;
|
|
1883
|
+
italic?: boolean;
|
|
1884
|
+
parent?: NodeObject;
|
|
1885
|
+
children?: NodeLeafObject[];
|
|
1886
|
+
strikethrough?: boolean;
|
|
1887
|
+
text?: string;
|
|
1888
|
+
type?: string;
|
|
1889
|
+
url?: string;
|
|
1890
|
+
underline?: boolean;
|
|
1891
|
+
};
|
|
1892
|
+
type CustomEditor = BaseEditor & HistoryEditor & ReactEditor;
|
|
1893
|
+
declare module 'slate' {
|
|
1894
|
+
interface CustomTypes {
|
|
1895
|
+
Editor: CustomEditor;
|
|
1896
|
+
Element: NodeElementObject;
|
|
1897
|
+
Text: NodeLeafObject;
|
|
1898
|
+
}
|
|
1899
|
+
}
|
|
1900
|
+
|
|
1871
1901
|
declare const rteFormatTypes: Readonly<{
|
|
1872
1902
|
BOLD: "BOLD";
|
|
1873
1903
|
ITALIC: "ITALIC";
|
|
@@ -2837,34 +2867,6 @@ declare const RangeSelector: {
|
|
|
2837
2867
|
displayName: string;
|
|
2838
2868
|
};
|
|
2839
2869
|
|
|
2840
|
-
type NodeElementObject = {
|
|
2841
|
-
attributes?: Record<string, string>;
|
|
2842
|
-
children?: NodeLeafObject[];
|
|
2843
|
-
type?: string;
|
|
2844
|
-
url?: string;
|
|
2845
|
-
};
|
|
2846
|
-
type NodeObject = NodeElementObject | NodeLeafObject;
|
|
2847
|
-
type NodeLeafObject = {
|
|
2848
|
-
attributes?: Record<string, string>;
|
|
2849
|
-
bold?: boolean;
|
|
2850
|
-
code?: boolean;
|
|
2851
|
-
italic?: boolean;
|
|
2852
|
-
parent?: NodeObject;
|
|
2853
|
-
children?: NodeLeafObject[];
|
|
2854
|
-
strikethrough?: boolean;
|
|
2855
|
-
text?: string;
|
|
2856
|
-
type?: string;
|
|
2857
|
-
url?: string;
|
|
2858
|
-
underline?: boolean;
|
|
2859
|
-
};
|
|
2860
|
-
declare module 'slate' {
|
|
2861
|
-
interface CustomTypes {
|
|
2862
|
-
Editor: ReactEditor;
|
|
2863
|
-
Element: NodeElementObject;
|
|
2864
|
-
Text: NodeLeafObject;
|
|
2865
|
-
}
|
|
2866
|
-
}
|
|
2867
|
-
|
|
2868
2870
|
type RichTextEditorProps = {
|
|
2869
2871
|
/**
|
|
2870
2872
|
* Optional id to set aria-labelledby
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
/*
|
|
3
|
-
* @license @wistia/vhs v4.0.0-beta.
|
|
3
|
+
* @license @wistia/vhs v4.0.0-beta.cfb66734.5d7766b
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) 2021-2025, Wistia, Inc. and its affiliates.
|
|
6
6
|
*
|
|
@@ -7932,7 +7932,7 @@ FormConnectorCheckboxGroup.displayName = "FormConnectorCheckboxGroup";
|
|
|
7932
7932
|
import { isNotUndefined as isNotUndefined6 } from "@wistia/type-guards";
|
|
7933
7933
|
import { jsx as jsx158 } from "react/jsx-runtime";
|
|
7934
7934
|
var FormConnectorCustomField = ({
|
|
7935
|
-
customComponent:
|
|
7935
|
+
customComponent: Element8,
|
|
7936
7936
|
field,
|
|
7937
7937
|
form,
|
|
7938
7938
|
label = "",
|
|
@@ -7951,7 +7951,7 @@ var FormConnectorCustomField = ({
|
|
|
7951
7951
|
labelProps,
|
|
7952
7952
|
name,
|
|
7953
7953
|
children: /* @__PURE__ */ jsx158(
|
|
7954
|
-
|
|
7954
|
+
Element8,
|
|
7955
7955
|
{
|
|
7956
7956
|
field,
|
|
7957
7957
|
form,
|
|
@@ -8921,9 +8921,9 @@ import { isNotUndefined as isNotUndefined11 } from "@wistia/type-guards";
|
|
|
8921
8921
|
import { useCallback as useCallback12, useMemo as useMemo7, useEffect as useEffect18 } from "react";
|
|
8922
8922
|
import { styled as styled41 } from "styled-components";
|
|
8923
8923
|
import { Editable, withReact, Slate, ReactEditor } from "slate-react";
|
|
8924
|
-
import { createEditor, Transforms as Transforms5, Element as
|
|
8924
|
+
import { createEditor, Transforms as Transforms5, Element as Element7, Text as Text4 } from "slate";
|
|
8925
8925
|
import { withHistory } from "slate-history";
|
|
8926
|
-
import isHotkey from "is-hotkey";
|
|
8926
|
+
import { isHotkey } from "is-hotkey";
|
|
8927
8927
|
import { isNil as isNil14, isNotNil as isNotNil26, isNonEmptyString as isNonEmptyString11 } from "@wistia/type-guards";
|
|
8928
8928
|
import isEqual2 from "react-fast-compare";
|
|
8929
8929
|
|
|
@@ -9172,7 +9172,10 @@ var deserializeHTMLNode = (el) => {
|
|
|
9172
9172
|
return null;
|
|
9173
9173
|
}
|
|
9174
9174
|
const children = getNodeChildren(el, deserializeHTMLNode);
|
|
9175
|
-
const
|
|
9175
|
+
const filteredChildren = children.filter(
|
|
9176
|
+
(child) => child === null || typeof child === "string" || typeof child === "object" && ("text" in child || "type" in child)
|
|
9177
|
+
);
|
|
9178
|
+
const safeChildren = filteredChildren.length > 0 && filteredChildren[0] != null ? filteredChildren : [emptyTextNode];
|
|
9176
9179
|
if (el.nodeName === "BODY") {
|
|
9177
9180
|
return jsx168("fragment", {}, safeChildren);
|
|
9178
9181
|
}
|
|
@@ -9359,10 +9362,10 @@ import { Transforms as Transforms2, Element as Element4, Text as Text3 } from "s
|
|
|
9359
9362
|
import { isNotUndefined as isNotUndefined10, isNotNil as isNotNil25 } from "@wistia/type-guards";
|
|
9360
9363
|
|
|
9361
9364
|
// src/components/RichTextEditor/utilities/toggle.ts
|
|
9362
|
-
import { Element as Element3,
|
|
9365
|
+
import { Element as Element3, Transforms, Editor as SlateEditor } from "slate";
|
|
9363
9366
|
import { isNotNil as isNotNil24, isNonEmptyString as isNonEmptyString8 } from "@wistia/type-guards";
|
|
9364
9367
|
var isBlockActive = (editor, format) => {
|
|
9365
|
-
const [match] =
|
|
9368
|
+
const [match] = SlateEditor.nodes(editor, {
|
|
9366
9369
|
match: (node) => Element3.isElement(node) && node.type === format
|
|
9367
9370
|
});
|
|
9368
9371
|
return Boolean(match);
|
|
@@ -9385,15 +9388,15 @@ var toggleBlck = (editor, format) => {
|
|
|
9385
9388
|
}
|
|
9386
9389
|
};
|
|
9387
9390
|
var isMarkActive = (editor, format) => {
|
|
9388
|
-
const valueMarks =
|
|
9391
|
+
const valueMarks = SlateEditor.marks(editor);
|
|
9389
9392
|
return isNonEmptyString8(valueMarks && Object.keys(valueMarks).find((mark) => mark === format));
|
|
9390
9393
|
};
|
|
9391
9394
|
var toggleMark = (editor, format) => {
|
|
9392
9395
|
const isActive = isMarkActive(editor, format);
|
|
9393
9396
|
if (isActive) {
|
|
9394
|
-
|
|
9397
|
+
SlateEditor.removeMark(editor, format);
|
|
9395
9398
|
} else {
|
|
9396
|
-
|
|
9399
|
+
SlateEditor.addMark(editor, format, true);
|
|
9397
9400
|
}
|
|
9398
9401
|
};
|
|
9399
9402
|
|
|
@@ -9450,14 +9453,14 @@ var withImages = (editor) => {
|
|
|
9450
9453
|
};
|
|
9451
9454
|
|
|
9452
9455
|
// src/components/RichTextEditor/utilities/withLinksPlugin.ts
|
|
9453
|
-
import { Transforms as Transforms3, Element as Element5, Node, Editor
|
|
9456
|
+
import { Transforms as Transforms3, Element as Element5, Node, Editor, Range, Path } from "slate";
|
|
9454
9457
|
import { isNonEmptyString as isNonEmptyString9 } from "@wistia/type-guards";
|
|
9455
9458
|
var isHashUrl = (urlString) => {
|
|
9456
9459
|
const urlPattern = /^#.+$/i;
|
|
9457
9460
|
return Boolean(urlPattern.test(urlString));
|
|
9458
9461
|
};
|
|
9459
9462
|
var isLinkActive = (editor) => {
|
|
9460
|
-
const [link] =
|
|
9463
|
+
const [link] = Editor.nodes(editor, {
|
|
9461
9464
|
match: (node) => Element5.isElement(node) && node.type === "link"
|
|
9462
9465
|
});
|
|
9463
9466
|
return Boolean(link);
|
|
@@ -9541,10 +9544,10 @@ var insertLink = (editor) => {
|
|
|
9541
9544
|
};
|
|
9542
9545
|
|
|
9543
9546
|
// src/components/RichTextEditor/utilities/handleListEscape.ts
|
|
9544
|
-
import { Transforms as Transforms4, Range as Range2, Editor as
|
|
9547
|
+
import { Transforms as Transforms4, Range as Range2, Editor as Editor2, Element as Element6 } from "slate";
|
|
9545
9548
|
var OverriddenEditor = {
|
|
9546
|
-
...
|
|
9547
|
-
isBlck:
|
|
9549
|
+
...Editor2,
|
|
9550
|
+
isBlck: Editor2.isBlock
|
|
9548
9551
|
};
|
|
9549
9552
|
var newLine = {
|
|
9550
9553
|
type: "paragraph",
|
|
@@ -9568,7 +9571,7 @@ var handleListEscape = (editor) => {
|
|
|
9568
9571
|
const selectedElement = editor.children[selection.anchor.path[0]];
|
|
9569
9572
|
const isList = selectedElement.type === "bulleted-list" || selectedElement.type === "numbered-list";
|
|
9570
9573
|
const blockAbove = OverriddenEditor.above(editor, {
|
|
9571
|
-
match: (node) => OverriddenEditor.isBlck(editor, node)
|
|
9574
|
+
match: (node) => Element6.isElement(node) && OverriddenEditor.isBlck(editor, node)
|
|
9572
9575
|
});
|
|
9573
9576
|
if ((textIsNotSelected ?? false) && isList && isLastChildBlankText(blockAbove[0].children)) {
|
|
9574
9577
|
Transforms4.removeNodes(editor, { hanging: true });
|
|
@@ -10056,17 +10059,19 @@ var RichTextEditor = ({
|
|
|
10056
10059
|
return;
|
|
10057
10060
|
}
|
|
10058
10061
|
const selectedElement = editor.children[selection.anchor.path[0]];
|
|
10059
|
-
if (
|
|
10062
|
+
if (Element7.isElement(selectedElement) && selectedElement.type === "image") {
|
|
10060
10063
|
toggleBlck(editor, "image");
|
|
10061
10064
|
Transforms5.removeNodes(editor, { at: selection });
|
|
10062
10065
|
Transforms5.move(editor, { reverse: true });
|
|
10063
|
-
const spanElement = editor.children.filter(
|
|
10064
|
-
|
|
10066
|
+
const spanElement = editor.children.filter(
|
|
10067
|
+
(child) => Element7.isElement(child) && child.type === "span"
|
|
10068
|
+
)[0];
|
|
10069
|
+
if (Element7.isElement(spanElement) && spanElement.type === "span" && isNotNil26(spanElement.children) && isNotNil26(spanElement.children[0]) && isNotNil26(spanElement.children[0].text) && spanElement.children[0].text.trim() !== "") {
|
|
10065
10070
|
Transforms5.setNodes(
|
|
10066
10071
|
editor,
|
|
10067
10072
|
{ type: "paragraph" },
|
|
10068
10073
|
{
|
|
10069
|
-
match: (node) => node.type === "span" && isNotNil26(node.children) && Text4.isText(node.children[0]) && isNotNil26(node.children[0].text) && node.children[0].text.trim() !== "",
|
|
10074
|
+
match: (node) => Element7.isElement(node) && node.type === "span" && isNotNil26(node.children) && Text4.isText(node.children[0]) && isNotNil26(node.children[0].text) && node.children[0].text.trim() !== "",
|
|
10070
10075
|
split: true,
|
|
10071
10076
|
mode: "highest"
|
|
10072
10077
|
}
|
|
@@ -10082,7 +10087,9 @@ var RichTextEditor = ({
|
|
|
10082
10087
|
"data-testid": dataTestId,
|
|
10083
10088
|
disabled,
|
|
10084
10089
|
height,
|
|
10085
|
-
onClick: () =>
|
|
10090
|
+
onClick: () => {
|
|
10091
|
+
ReactEditor.focus(editor);
|
|
10092
|
+
},
|
|
10086
10093
|
children: /* @__PURE__ */ jsxs30(
|
|
10087
10094
|
Slate,
|
|
10088
10095
|
{
|