--- title: "Links and Anchors in Vue 3 Editor" description: "Turn on the Vue 3 link dialog and the Insert menu anchor action through :init to create, edit, and unlink safe hyperlinks and generated bookmarks." head: - - meta - name: robots content: 'index, follow, max-image-preview:large, max-snippet:-1, max-video-preview:-1' - - meta - name: googlebot content: 'index, follow, max-image-preview:large, max-snippet:-1, max-video-preview:-1' - - meta - name: bingbot content: 'index, follow, max-image-preview:large, max-snippet:-1, max-video-preview:-1' --- # Links and Anchors in the Vue 3 Editor In Vue 3, link and anchor tools are switched on through the `:init` binding of ``. Adding `link` and `anchor` to `plugins` gives users a dialog for creating, editing, and unlinking hyperlinks, plus an **Insert → Anchor** action that drops a bookmark with a generated ID. The resulting `` markup flows back into your `v-model` value. For video, audio, and iframe URLs, use the separate dialog described in [media and embeds](./media-and-embeds.html). --- ## Toolbar and Menubar Configuration Add `link` and `anchor` controls to your configuration: ```ts const editorConfig: EditorInit = { plugins: ['link', 'anchor'], menubar: ['insert'], toolbar: 'undo redo | blocks | bold italic | link removeformat', }; ``` Inside a single-file component, define the same object in ` ``` --- ## Link Insertion and Edit Dialog Clicking the **Link** icon in the toolbar or navigating to **Insert → Link** opens the Link Modal Dialog with the following options: 1. **URL (`href`)**: Target hyperlink web address or mailto URL. 2. **Text to Display**: Text label inserted inside `Text`. 3. **Title Attribute**: Accessibility tooltip title attribute. 4. **Open in New Tab (`target="_blank"`)**: Adds `target="_blank"` and `rel="noopener noreferrer"` for external links. Links with unsafe protocols are not kept; see [security and sanitization](./security.html) for the full rules. ### Modifying Existing Links Positioning your caret inside an existing link and clicking the **Link** button re-populates the dialog with existing values for quick editing. Click **Unlink** in the dialog or toolbar to strip the `` tag while keeping the text intact. --- ## Anchors (`anchor`) Anchors create an empty bookmark element with a generated ID. `anchor` is an Insert-menu action rather than a toolbar keyword. 1. Place the caret where the bookmark should live. 2. Select **Insert → Anchor** from the menubar. 3. Read the generated `id` from the HTML source when creating a matching `#id` link. ```html ```