mirror of
https://github.com/suitenumerique/docs.git
synced 2026-04-25 17:15:01 +02:00
Compare commits
2 Commits
improvemen
...
fix/link-p
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1115fe3546 | ||
|
|
598a6adc02 |
@@ -11,17 +11,18 @@ and this project adheres to
|
||||
- 🚸(frontend) redirect on current url tab after 401 #2197
|
||||
- 🐛(frontend) abort check media status unmount #2194
|
||||
- ✨(backend) order pinned documents by last updated at #2028
|
||||
- 🐛(frontend) sanitize pasted toolbar links #2214
|
||||
|
||||
### Changed
|
||||
|
||||
- ♿️(frontend) structure correctly 5xx error alerts #2128
|
||||
- ♿️(frontend) structure correctly 5xx error alerts #2128
|
||||
|
||||
## [v4.8.6] - 2026-04-08
|
||||
|
||||
### Added
|
||||
|
||||
- 🚸(frontend) allow opening "@page" links with
|
||||
ctrl/command/middle-mouse click #2170
|
||||
- 🚸(frontend) allow opening "@page" links with
|
||||
ctrl/command/middle-mouse click #2170
|
||||
- ✅ E2E - Any instance friendly #2142
|
||||
|
||||
### Changed
|
||||
|
||||
@@ -88,6 +88,32 @@ interface BlockNoteEditorProps {
|
||||
provider: HocuspocusProvider;
|
||||
}
|
||||
|
||||
/**
|
||||
* Strips angle brackets wrapping URLs (e.g. `<https://example.com>` → `https://example.com`).
|
||||
* BlockNote copies links in Markdown autolink format; pasting into the link
|
||||
* toolbar input keeps the brackets, producing broken hrefs.
|
||||
*/
|
||||
|
||||
const handlePasteUrlBrackets = (e: React.ClipboardEvent<HTMLDivElement>) => {
|
||||
const target = e.target;
|
||||
if (
|
||||
!(target instanceof HTMLInputElement) &&
|
||||
!(target instanceof HTMLTextAreaElement)
|
||||
) {
|
||||
return;
|
||||
}
|
||||
const text = e.clipboardData?.getData('text/plain') ?? '';
|
||||
const cleaned = text.replace(/^\s*<([^<>]+)>\s*$/, '$1');
|
||||
if (cleaned === text) {
|
||||
return;
|
||||
}
|
||||
e.preventDefault();
|
||||
const start = target.selectionStart ?? target.value.length;
|
||||
const end = target.selectionEnd ?? target.value.length;
|
||||
target.setRangeText(cleaned, start, end, 'end');
|
||||
target.dispatchEvent(new Event('input', { bubbles: true }));
|
||||
};
|
||||
|
||||
export const BlockNoteEditor = ({ doc, provider }: BlockNoteEditorProps) => {
|
||||
const { user } = useAuth();
|
||||
const { setEditor } = useEditorStore();
|
||||
@@ -267,6 +293,7 @@ export const BlockNoteEditor = ({ doc, provider }: BlockNoteEditorProps) => {
|
||||
return (
|
||||
<Box
|
||||
ref={refEditorContainer}
|
||||
onPasteCapture={handlePasteUrlBrackets}
|
||||
$css={css`
|
||||
${cssEditor};
|
||||
${cssComments(showComments, currentUserAvatarUrl)}
|
||||
|
||||
Reference in New Issue
Block a user