Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ export function CaptionRichTextEditor({
const handlePaste = useCallback(
(e: React.ClipboardEvent<HTMLDivElement>) => {
e.preventDefault();
e.stopPropagation();
const html = e.clipboardData.getData("text/html");
const text = e.clipboardData.getData("text/plain");
const source = html || text;
Expand Down Expand Up @@ -366,6 +367,7 @@ export function CaptionRichTextEditor({
style={toolbarStyle}
role="toolbar"
aria-label="Caption formatting"
onMouseDown={(e) => e.preventDefault()}
>
<ToolbarButton
label="Bold"
Expand Down Expand Up @@ -406,6 +408,10 @@ export function CaptionRichTextEditor({
style={linkStyle}
role="dialog"
aria-label="Edit link"
onMouseDown={(e) => {
const target = e.target as HTMLElement;
if (target.tagName !== "INPUT") e.preventDefault();
}}
>
<Label htmlFor="caption-link-url" className="sr-only">
Link URL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ const RichTextEditor = forwardRef<HTMLDivElement, Props>(
}}
onPaste={(event) => {
event.preventDefault();
event.stopPropagation();
const html = event.clipboardData.getData("text/html");
const text = event.clipboardData.getData("text/plain");
document.execCommand(
Expand Down
Loading