FrameworkJavaScript
Link tool: insert and edit inline links
Wraps selected text in `<a href="...">`. Activated with Cmd/Ctrl+K. Clicking the button on existing linked text opens the URL input allowing the link to be edited or removed. `target` and `rel` are always written alongside `href` and come from `BlokConfig.link` — defaults `_blank` and `nofollow`, with `target="_self"` forced for same-page hrefs (a `#anchor`, or a URL resolving to the current origin and pathname). A `link.transform` can override any of href, target and rel.
Import
TypeScript
import { Link } from '@bloklabs/core/tools';Save Data
TypeScript
// Stored as HTML inside the block's text field.
// target and rel are always present — these are the defaults:
// '<a href="https://example.com" target="_blank" rel="nofollow">Example</a>'JSON
{
"type": "paragraph",
"data": {
"text": "Visit <a href=\"https://example.com\" target=\"_blank\" rel=\"nofollow\">Example</a>"
}
}Usage Example
TypeScript
import { Blok } from '@bloklabs/core';
import { Link, Paragraph } from '@bloklabs/core/tools';
const editor = new Blok({
holder: 'editor',
tools: {
// Paragraph is the default block and is not bundled with the core —
// without it the editor starts with an "unsupported block" stub.
paragraph: Paragraph,
link: Link,
},
});