JSPM

@remirror/extension-bold

1.0.0-next.10
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 46472
  • Score
    100M100P100Q159831F
  • License MIT

Make your text bold. Make it courageous.

Package Exports

  • @remirror/extension-bold

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@remirror/extension-bold) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

@remirror/extension-bold

Make your text bold. Make it courageous.

Version Weekly Downloads Bundled size Typed Codebase MIT License


Installation

yarn add @remirror/extension-bold@next @remirror/pm@next # yarn
pnpm add @remirror/extension-bold@next @remirror/pm@next # pnpm
npm install @remirror/extension-bold@next @remirror/pm@next # npm

Usage

When added to your editor it will provide the toggleBold command which makes the text under the cursor / or at the provided position range bold.

import { RemirrorManager, ExtensionPriority } from '@remirror/core';
import { CorePreset } from '@remirror/preset-core';
import { BoldExtension } from '@remirror/extension-bold';

// Create the bold extension
const boldExtension = new BoldExtension({ weight: '500' });
const corePreset = new CorePreset();

// Create the Editor Manager with the bold extension passed through.
const manager = RemirrorManager.create([boldExtension, corePreset]);

// Pass the dom element to the editor. If you are using `@remirror/react` this is done for you.
const element = document.createElement('div');
document.body.appendChild(element);

// Add the view to the editor manager.
manager.addView(element);

// Access the commands and toggleBoldness
manager.commands.toggleBold();

// Toggle at the provided range
manager.commands.toggleBold({ from: 1, to: 7 });

Alternatives

There are presets which contain this extension and can help make setup process for you editor less verbose.

  • @remirror/preset-formatting

Credits

This package was bootstrapped with monots.