# Page Editor Link Feature Parity

**Date:** 2026-02-26
**Status:** Approved

## Problem

The page editor's WYSIWYG text editor (LexicalField.tsx) uses `window.prompt()` and `alert()` for link insertion - no URL validation UI, no "open in new tab" option, no way to edit or remove existing links.

The basic editor's WYSIWYG (SimpleWysiwygField.tsx) has a polished link experience with:

- LinkInsertPopover: styled popover with URL input, "open in new tab" checkbox, inline validation
- FloatingLinkEditorPlugin: floating toolbar on existing links with URL preview, target toggle, edit, remove

## Solution

Extract shared link components from SimpleWysiwygField into standalone modules, then import them in both editors.

### New Files

| File                             | Contents                          |
| -------------------------------- | --------------------------------- |
| `lib/cms/link-utils.ts`          | `isValidUrl()`, `$findLinkNode()` |
| `lib/cms/LinkInsertPopover.tsx`  | Link insert popover component     |
| `lib/cms/FloatingLinkEditor.tsx` | Floating link editor plugin       |

### Modified Files

| File                     | Changes                                                             |
| ------------------------ | ------------------------------------------------------------------- |
| `SimpleWysiwygField.tsx` | Remove inline components, import from shared modules                |
| `LexicalField.tsx`       | Replace `window.prompt` with shared components, add floating editor |

### Behavior

- **Insert link (toolbar):** Opens popover with URL input, "Open in new tab" checkbox, Cancel/Apply
- **Edit existing link (click):** Floating editor with URL preview, new tab/same tab toggle, Edit, Remove
- **Validation:** Same `isValidUrl()` function with inline error display instead of `alert()`
- **Security:** `rel="noopener noreferrer"` on `target="_blank"` links
