@wistia/vhs 4.0.0-beta.71b676f3.95c7760 → 4.0.0-beta.869ba93f.48341e6
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 +31 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +35 -33
- package/dist/index.d.ts +35 -33
- package/dist/index.mjs +44 -30
- package/dist/index.mjs.map +1 -1
- package/package.json +22 -21
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: {
|
|
@@ -547,7 +548,7 @@ type Rect = {
|
|
|
547
548
|
x: number;
|
|
548
549
|
y: number;
|
|
549
550
|
};
|
|
550
|
-
declare const useElementObserver: <T extends HTMLElement>() => [RefObject<T>, Rect];
|
|
551
|
+
declare const useElementObserver: <T extends HTMLElement>() => [RefObject<T | null>, Rect];
|
|
551
552
|
|
|
552
553
|
type AddEventListenerType = (type: string, listener: (evt: Event) => void, options?: AddEventListenerOptions | boolean) => void;
|
|
553
554
|
type RemoveEventListenerType = (type: string, listener: (evt: Event) => void, options?: AddEventListenerOptions | boolean) => void;
|
|
@@ -555,7 +556,7 @@ declare const useEvent: <T extends Event>(eventName: Parameters<AddEventListener
|
|
|
555
556
|
|
|
556
557
|
type UseFocusTrapOptions = {
|
|
557
558
|
disableAriaHider?: boolean;
|
|
558
|
-
focusSelector?: HTMLElement | RefObject<HTMLElement> | string | null | undefined;
|
|
559
|
+
focusSelector?: HTMLElement | RefObject<HTMLElement | null> | string | null | undefined;
|
|
559
560
|
};
|
|
560
561
|
declare const useFocusTrap: (active?: boolean, options?: UseFocusTrapOptions) => (node: HTMLElement | null | undefined) => void;
|
|
561
562
|
|
|
@@ -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";
|
|
@@ -2532,7 +2562,7 @@ type ModalProps = ComponentPropsWithoutRef<'div'> & {
|
|
|
2532
2562
|
/**
|
|
2533
2563
|
* Ref to the element that should receive focus when the modal opens
|
|
2534
2564
|
*/
|
|
2535
|
-
initialFocusRef?: RefObject<HTMLElement>;
|
|
2565
|
+
initialFocusRef?: RefObject<HTMLElement | null>;
|
|
2536
2566
|
/**
|
|
2537
2567
|
* Whether or not the modal is open, and should be rendered
|
|
2538
2568
|
*/
|
|
@@ -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: {
|
|
@@ -547,7 +548,7 @@ type Rect = {
|
|
|
547
548
|
x: number;
|
|
548
549
|
y: number;
|
|
549
550
|
};
|
|
550
|
-
declare const useElementObserver: <T extends HTMLElement>() => [RefObject<T>, Rect];
|
|
551
|
+
declare const useElementObserver: <T extends HTMLElement>() => [RefObject<T | null>, Rect];
|
|
551
552
|
|
|
552
553
|
type AddEventListenerType = (type: string, listener: (evt: Event) => void, options?: AddEventListenerOptions | boolean) => void;
|
|
553
554
|
type RemoveEventListenerType = (type: string, listener: (evt: Event) => void, options?: AddEventListenerOptions | boolean) => void;
|
|
@@ -555,7 +556,7 @@ declare const useEvent: <T extends Event>(eventName: Parameters<AddEventListener
|
|
|
555
556
|
|
|
556
557
|
type UseFocusTrapOptions = {
|
|
557
558
|
disableAriaHider?: boolean;
|
|
558
|
-
focusSelector?: HTMLElement | RefObject<HTMLElement> | string | null | undefined;
|
|
559
|
+
focusSelector?: HTMLElement | RefObject<HTMLElement | null> | string | null | undefined;
|
|
559
560
|
};
|
|
560
561
|
declare const useFocusTrap: (active?: boolean, options?: UseFocusTrapOptions) => (node: HTMLElement | null | undefined) => void;
|
|
561
562
|
|
|
@@ -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";
|
|
@@ -2532,7 +2562,7 @@ type ModalProps = ComponentPropsWithoutRef<'div'> & {
|
|
|
2532
2562
|
/**
|
|
2533
2563
|
* Ref to the element that should receive focus when the modal opens
|
|
2534
2564
|
*/
|
|
2535
|
-
initialFocusRef?: RefObject<HTMLElement>;
|
|
2565
|
+
initialFocusRef?: RefObject<HTMLElement | null>;
|
|
2536
2566
|
/**
|
|
2537
2567
|
* Whether or not the modal is open, and should be rendered
|
|
2538
2568
|
*/
|
|
@@ -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.869ba93f.48341e6
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) 2021-2025, Wistia, Inc. and its affiliates.
|
|
6
6
|
*
|
|
@@ -3937,7 +3937,7 @@ import { useCallback as useCallback5 } from "react";
|
|
|
3937
3937
|
import { useEffect as useEffect2, useRef as useRef2, useState as useState5 } from "react";
|
|
3938
3938
|
var useTimedToggle = (initialValue) => {
|
|
3939
3939
|
const [value, setValue] = useState5(false);
|
|
3940
|
-
const timeoutRef = useRef2();
|
|
3940
|
+
const timeoutRef = useRef2(void 0);
|
|
3941
3941
|
const initialValueRef = useRef2(initialValue);
|
|
3942
3942
|
const toggleValue = (timeout2) => {
|
|
3943
3943
|
clearTimeout(timeoutRef.current);
|
|
@@ -4010,8 +4010,8 @@ var isEventTargetSupported = (eventTarget) => (
|
|
|
4010
4010
|
Boolean(typeof eventTarget === "object" && eventTarget?.addEventListener)
|
|
4011
4011
|
);
|
|
4012
4012
|
var useEvent = (eventName, eventHandler, eventTarget = window, eventOptions = {}) => {
|
|
4013
|
-
const savedEventHandler = useRef4();
|
|
4014
|
-
const savedEventOptions = useRef4();
|
|
4013
|
+
const savedEventHandler = useRef4(void 0);
|
|
4014
|
+
const savedEventOptions = useRef4(void 0);
|
|
4015
4015
|
useEffect3(() => {
|
|
4016
4016
|
savedEventHandler.current = eventHandler;
|
|
4017
4017
|
}, [eventHandler]);
|
|
@@ -4448,7 +4448,7 @@ var usePreventScroll = (locked) => {
|
|
|
4448
4448
|
// src/hooks/usePreviousValue/usePreviousValue.ts
|
|
4449
4449
|
import { useEffect as useEffect7, useRef as useRef7 } from "react";
|
|
4450
4450
|
var usePreviousValue = (value) => {
|
|
4451
|
-
const ref = useRef7();
|
|
4451
|
+
const ref = useRef7(void 0);
|
|
4452
4452
|
useEffect7(() => {
|
|
4453
4453
|
ref.current = value;
|
|
4454
4454
|
});
|
|
@@ -4545,7 +4545,7 @@ var ModalBaseContent = ({
|
|
|
4545
4545
|
const wasJustShown = usePreviousValue(isShown);
|
|
4546
4546
|
const hide = () => setIsShownAttempted(false);
|
|
4547
4547
|
const show = useCallback8(() => setIsShownAttempted(true), []);
|
|
4548
|
-
const toggleButtonRef = useRef8();
|
|
4548
|
+
const toggleButtonRef = useRef8(void 0);
|
|
4549
4549
|
const modalEl = document.createElement("div");
|
|
4550
4550
|
modalEl.classList.add("Modal");
|
|
4551
4551
|
if (isNotUndefined2(className)) {
|
|
@@ -6622,7 +6622,9 @@ var disabledStyle3 = css13`
|
|
|
6622
6622
|
var errorHoverStyle = css13`
|
|
6623
6623
|
border-color: transparent;
|
|
6624
6624
|
`;
|
|
6625
|
-
var errorFocusedStyle = css13
|
|
6625
|
+
var errorFocusedStyle = css13`
|
|
6626
|
+
outline: none;
|
|
6627
|
+
`;
|
|
6626
6628
|
var errorStyle = css13`
|
|
6627
6629
|
background-color: ${({ theme: theme2 }) => theme2.color.error100};
|
|
6628
6630
|
border: 1px solid ${({ theme: theme2 }) => theme2.color.error500};
|
|
@@ -7554,7 +7556,7 @@ import { useEffect as useEffect13 } from "react";
|
|
|
7554
7556
|
import { useCallback as useCallback10, useEffect as useEffect12, useRef as useRef10 } from "react";
|
|
7555
7557
|
var useTimeoutFunc = (func, timeout2 = 0) => {
|
|
7556
7558
|
const readyRef = useRef10(false);
|
|
7557
|
-
const timeoutRef = useRef10();
|
|
7559
|
+
const timeoutRef = useRef10(void 0);
|
|
7558
7560
|
const callbackRef = useRef10(func);
|
|
7559
7561
|
const isReady = useCallback10(() => readyRef.current, []);
|
|
7560
7562
|
const set = useCallback10(() => {
|
|
@@ -7930,7 +7932,7 @@ FormConnectorCheckboxGroup.displayName = "FormConnectorCheckboxGroup";
|
|
|
7930
7932
|
import { isNotUndefined as isNotUndefined6 } from "@wistia/type-guards";
|
|
7931
7933
|
import { jsx as jsx158 } from "react/jsx-runtime";
|
|
7932
7934
|
var FormConnectorCustomField = ({
|
|
7933
|
-
customComponent:
|
|
7935
|
+
customComponent: Element8,
|
|
7934
7936
|
field,
|
|
7935
7937
|
form,
|
|
7936
7938
|
label = "",
|
|
@@ -7949,7 +7951,7 @@ var FormConnectorCustomField = ({
|
|
|
7949
7951
|
labelProps,
|
|
7950
7952
|
name,
|
|
7951
7953
|
children: /* @__PURE__ */ jsx158(
|
|
7952
|
-
|
|
7954
|
+
Element8,
|
|
7953
7955
|
{
|
|
7954
7956
|
field,
|
|
7955
7957
|
form,
|
|
@@ -8919,7 +8921,7 @@ import { isNotUndefined as isNotUndefined11 } from "@wistia/type-guards";
|
|
|
8919
8921
|
import { useCallback as useCallback12, useMemo as useMemo7, useEffect as useEffect18 } from "react";
|
|
8920
8922
|
import { styled as styled41 } from "styled-components";
|
|
8921
8923
|
import { Editable, withReact, Slate, ReactEditor } from "slate-react";
|
|
8922
|
-
import { createEditor, Transforms as Transforms5, Element as
|
|
8924
|
+
import { createEditor, Transforms as Transforms5, Element as Element7, Text as Text4 } from "slate";
|
|
8923
8925
|
import { withHistory } from "slate-history";
|
|
8924
8926
|
import isHotkey from "is-hotkey";
|
|
8925
8927
|
import { isNil as isNil14, isNotNil as isNotNil26, isNonEmptyString as isNonEmptyString11 } from "@wistia/type-guards";
|
|
@@ -9170,7 +9172,10 @@ var deserializeHTMLNode = (el) => {
|
|
|
9170
9172
|
return null;
|
|
9171
9173
|
}
|
|
9172
9174
|
const children = getNodeChildren(el, deserializeHTMLNode);
|
|
9173
|
-
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];
|
|
9174
9179
|
if (el.nodeName === "BODY") {
|
|
9175
9180
|
return jsx168("fragment", {}, safeChildren);
|
|
9176
9181
|
}
|
|
@@ -9357,10 +9362,10 @@ import { Transforms as Transforms2, Element as Element4, Text as Text3 } from "s
|
|
|
9357
9362
|
import { isNotUndefined as isNotUndefined10, isNotNil as isNotNil25 } from "@wistia/type-guards";
|
|
9358
9363
|
|
|
9359
9364
|
// src/components/RichTextEditor/utilities/toggle.ts
|
|
9360
|
-
import { Element as Element3,
|
|
9365
|
+
import { Element as Element3, Transforms, Editor as SlateEditor } from "slate";
|
|
9361
9366
|
import { isNotNil as isNotNil24, isNonEmptyString as isNonEmptyString8 } from "@wistia/type-guards";
|
|
9362
9367
|
var isBlockActive = (editor, format) => {
|
|
9363
|
-
const [match] =
|
|
9368
|
+
const [match] = SlateEditor.nodes(editor, {
|
|
9364
9369
|
match: (node) => Element3.isElement(node) && node.type === format
|
|
9365
9370
|
});
|
|
9366
9371
|
return Boolean(match);
|
|
@@ -9383,15 +9388,15 @@ var toggleBlck = (editor, format) => {
|
|
|
9383
9388
|
}
|
|
9384
9389
|
};
|
|
9385
9390
|
var isMarkActive = (editor, format) => {
|
|
9386
|
-
const valueMarks =
|
|
9391
|
+
const valueMarks = SlateEditor.marks(editor);
|
|
9387
9392
|
return isNonEmptyString8(valueMarks && Object.keys(valueMarks).find((mark) => mark === format));
|
|
9388
9393
|
};
|
|
9389
9394
|
var toggleMark = (editor, format) => {
|
|
9390
9395
|
const isActive = isMarkActive(editor, format);
|
|
9391
9396
|
if (isActive) {
|
|
9392
|
-
|
|
9397
|
+
SlateEditor.removeMark(editor, format);
|
|
9393
9398
|
} else {
|
|
9394
|
-
|
|
9399
|
+
SlateEditor.addMark(editor, format, true);
|
|
9395
9400
|
}
|
|
9396
9401
|
};
|
|
9397
9402
|
|
|
@@ -9448,14 +9453,14 @@ var withImages = (editor) => {
|
|
|
9448
9453
|
};
|
|
9449
9454
|
|
|
9450
9455
|
// src/components/RichTextEditor/utilities/withLinksPlugin.ts
|
|
9451
|
-
import { Transforms as Transforms3, Element as Element5, Node, Editor
|
|
9456
|
+
import { Transforms as Transforms3, Element as Element5, Node, Editor, Range, Path } from "slate";
|
|
9452
9457
|
import { isNonEmptyString as isNonEmptyString9 } from "@wistia/type-guards";
|
|
9453
9458
|
var isHashUrl = (urlString) => {
|
|
9454
9459
|
const urlPattern = /^#.+$/i;
|
|
9455
9460
|
return Boolean(urlPattern.test(urlString));
|
|
9456
9461
|
};
|
|
9457
9462
|
var isLinkActive = (editor) => {
|
|
9458
|
-
const [link] =
|
|
9463
|
+
const [link] = Editor.nodes(editor, {
|
|
9459
9464
|
match: (node) => Element5.isElement(node) && node.type === "link"
|
|
9460
9465
|
});
|
|
9461
9466
|
return Boolean(link);
|
|
@@ -9484,7 +9489,8 @@ var wrapLink = (editor, url) => {
|
|
|
9484
9489
|
}
|
|
9485
9490
|
};
|
|
9486
9491
|
var withLinks = (editor) => {
|
|
9487
|
-
const {
|
|
9492
|
+
const { insertText, isInline, normalizeNode } = editor;
|
|
9493
|
+
const { insertData } = editor;
|
|
9488
9494
|
editor.isInline = (element) => element.type === "link" ? true : isInline(element);
|
|
9489
9495
|
editor.insertText = (text) => {
|
|
9490
9496
|
if (text && isUrl(text)) {
|
|
@@ -9539,10 +9545,10 @@ var insertLink = (editor) => {
|
|
|
9539
9545
|
};
|
|
9540
9546
|
|
|
9541
9547
|
// src/components/RichTextEditor/utilities/handleListEscape.ts
|
|
9542
|
-
import { Transforms as Transforms4, Range as Range2, Editor as
|
|
9548
|
+
import { Transforms as Transforms4, Range as Range2, Editor as Editor2, Element as Element6 } from "slate";
|
|
9543
9549
|
var OverriddenEditor = {
|
|
9544
|
-
...
|
|
9545
|
-
isBlck:
|
|
9550
|
+
...Editor2,
|
|
9551
|
+
isBlck: Editor2.isBlock
|
|
9546
9552
|
};
|
|
9547
9553
|
var newLine = {
|
|
9548
9554
|
type: "paragraph",
|
|
@@ -9566,7 +9572,7 @@ var handleListEscape = (editor) => {
|
|
|
9566
9572
|
const selectedElement = editor.children[selection.anchor.path[0]];
|
|
9567
9573
|
const isList = selectedElement.type === "bulleted-list" || selectedElement.type === "numbered-list";
|
|
9568
9574
|
const blockAbove = OverriddenEditor.above(editor, {
|
|
9569
|
-
match: (node) => OverriddenEditor.isBlck(editor, node)
|
|
9575
|
+
match: (node) => Element6.isElement(node) && OverriddenEditor.isBlck(editor, node)
|
|
9570
9576
|
});
|
|
9571
9577
|
if ((textIsNotSelected ?? false) && isList && isLastChildBlankText(blockAbove[0].children)) {
|
|
9572
9578
|
Transforms4.removeNodes(editor, { hanging: true });
|
|
@@ -10054,17 +10060,19 @@ var RichTextEditor = ({
|
|
|
10054
10060
|
return;
|
|
10055
10061
|
}
|
|
10056
10062
|
const selectedElement = editor.children[selection.anchor.path[0]];
|
|
10057
|
-
if (
|
|
10063
|
+
if (Element7.isElement(selectedElement) && selectedElement.type === "image") {
|
|
10058
10064
|
toggleBlck(editor, "image");
|
|
10059
10065
|
Transforms5.removeNodes(editor, { at: selection });
|
|
10060
10066
|
Transforms5.move(editor, { reverse: true });
|
|
10061
|
-
const spanElement = editor.children.filter(
|
|
10062
|
-
|
|
10067
|
+
const spanElement = editor.children.filter(
|
|
10068
|
+
(child) => Element7.isElement(child) && child.type === "span"
|
|
10069
|
+
)[0];
|
|
10070
|
+
if (Element7.isElement(spanElement) && spanElement.type === "span" && isNotNil26(spanElement.children) && isNotNil26(spanElement.children[0]) && isNotNil26(spanElement.children[0].text) && spanElement.children[0].text.trim() !== "") {
|
|
10063
10071
|
Transforms5.setNodes(
|
|
10064
10072
|
editor,
|
|
10065
10073
|
{ type: "paragraph" },
|
|
10066
10074
|
{
|
|
10067
|
-
match: (node) => node.type === "span" && isNotNil26(node.children) && Text4.isText(node.children[0]) && isNotNil26(node.children[0].text) && node.children[0].text.trim() !== "",
|
|
10075
|
+
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() !== "",
|
|
10068
10076
|
split: true,
|
|
10069
10077
|
mode: "highest"
|
|
10070
10078
|
}
|
|
@@ -10080,7 +10088,13 @@ var RichTextEditor = ({
|
|
|
10080
10088
|
"data-testid": dataTestId,
|
|
10081
10089
|
disabled,
|
|
10082
10090
|
height,
|
|
10083
|
-
onClick: () =>
|
|
10091
|
+
onClick: () => {
|
|
10092
|
+
try {
|
|
10093
|
+
ReactEditor.focus?.(editor);
|
|
10094
|
+
} catch (error) {
|
|
10095
|
+
console.warn("Could not focus editor:", error);
|
|
10096
|
+
}
|
|
10097
|
+
},
|
|
10084
10098
|
children: /* @__PURE__ */ jsxs30(
|
|
10085
10099
|
Slate,
|
|
10086
10100
|
{
|
|
@@ -11306,7 +11320,7 @@ var Menu2 = forwardRef16(
|
|
|
11306
11320
|
onClose,
|
|
11307
11321
|
...otherProps
|
|
11308
11322
|
}, ref) => {
|
|
11309
|
-
const menuRef = useRef12();
|
|
11323
|
+
const menuRef = useRef12(void 0);
|
|
11310
11324
|
const onClickOutsideFn = isNotNil32(onClickOutside) ? onClickOutside : () => {
|
|
11311
11325
|
};
|
|
11312
11326
|
useOnClickOutside(menuRef, onClickOutsideFn);
|