Skip to content

Commit f13104a

Browse files
committed
Add stripStega prop to ContentLink component
Allow users to control stega stripping behavior through the stripStega prop instead of hardcoding it to true, providing more flexibility for different use cases.
1 parent 31131f7 commit f13104a

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

src/ContentLink/index.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ export type ContentLinkProps = Omit<UseContentLinkOptions, 'enabled'> & {
1111
currentPath?: string;
1212
/** Enable click-to-edit on mount. Pass true for default behavior or an object with scrollToNearestTarget. If undefined, click-to-edit is disabled. */
1313
enableClickToEdit?: true | { scrollToNearestTarget: true };
14+
/** Whether to strip stega encoding from text nodes after stamping. */
15+
stripStega?: boolean;
1416
};
1517

1618
/**
@@ -81,13 +83,13 @@ export function ContentLink(props: ContentLinkProps): null {
8183
const {
8284
currentPath,
8385
enableClickToEdit: enableClickToEditOptions,
86+
stripStega,
8487
...useContentLinkOptions
8588
} = props;
8689

8790
const { enableClickToEdit, setCurrentPath } = useContentLink({
8891
...useContentLinkOptions,
89-
// Always strip stega encoding in the component for clean DOM
90-
enabled: { stripStega: true },
92+
enabled: stripStega !== undefined ? { stripStega } : true,
9193
});
9294

9395
// Sync current path when it changes
@@ -101,7 +103,9 @@ export function ContentLink(props: ContentLinkProps): null {
101103
useEffect(() => {
102104
if (enableClickToEditOptions !== undefined) {
103105
enableClickToEdit(
104-
enableClickToEditOptions === true ? undefined : enableClickToEditOptions
106+
enableClickToEditOptions === true
107+
? undefined
108+
: enableClickToEditOptions,
105109
);
106110
}
107111
}, [enableClickToEditOptions, enableClickToEdit]);

0 commit comments

Comments
 (0)