Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨Introduce API to create text spans #88

Merged
merged 1 commit into from
Oct 5, 2024
Merged

✨Introduce API to create text spans #88

merged 1 commit into from
Oct 5, 2024

Conversation

ralfstx
Copy link
Member

@ralfstx ralfstx commented Oct 5, 2024

This commit introduces the function span() to create text spans more conveniently. Using this function provides better tool support since the tooling can suggest text properties and values. Since the function returns objects with a specific type, less type annotations are required.

For example, the following line of code

let block = { text: ['Hello ', { text: 'World!', fontWeight: 'bold' }] };

can now be replaced with:

let block = { text: ['Hello ', span('World!', { fontWeight: 'bold' })]);

This commit introduces the function `span()` to create text spans more
conveniently. Using this function provides better tool support since the
tooling can suggest text properties and values. Since the function
returns objects with a specific type, less type annotations are
required.

For example, the following line of code

```ts
let block = { text: ['Hello ', { text: 'World!', fontWeight: 'bold' }] };
```

can now be replaced with:

```ts
let block = { text: ['Hello ', span('World!', { fontWeight: 'bold' })]);
```
@ralfstx ralfstx merged commit 189fc3b into main Oct 5, 2024
1 check passed
@ralfstx ralfstx deleted the span branch October 5, 2024 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant