How to use the @remirror/core.TextExtension function in @remirror/core

To help you get started, we’ve selected a few @remirror/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ifiokjr / remirror / @remirror / react-renderer / src / __tests__ / react-serializer.spec.tsx View on Github external
test('ReactSerializer.fromExtensionManager', () => {
  expect(serializer).toBeInstanceOf(ReactSerializer);
  expect(serializer.nodes.paragraph).toBeFunction();
  expect(serializer.marks.bold).toBeFunction();

  // fills in for a missing text
  const altExtensions = [
    { extension: new DocExtension(), priority: 2 },
    { extension: new ParagraphExtension(), priority: 2 },
    { extension: new TextExtension(), priority: 2 },
    { extension: new BoldExtension(), priority: 2 },
    { extension: new CodeBlockExtension(), priority: 2 },
  ];
  const altManager = ExtensionManager.create(altExtensions);
  expect(ReactSerializer.fromExtensionManager(altManager).nodes.text).toBeFunction();
});
github ifiokjr / remirror / support / dts-jest / extension-manager.dts.ts View on Github external
type PositionTrackerExtensionHelpers = HelpersFromExtensions;
const trackerHelpers: PositionTrackerExtensionHelpers = Object.create(null);

// @dts-jest:pass:snap
trackerHelpers.addPositionTracker({ id: 'yo' });
// @dts-jest:pass:snap
trackerHelpers.clearPositionTrackers();

// @dts-jest:pass:snap
ExtensionManager.create([
  new HistoryExtension(),
  new ParagraphExtension(),
  new BoldExtension(),
  new CodeBlockExtension(),
  new PositionTrackerExtension(),
  { priority: 1, extension: new TextExtension() },
  { priority: 0, extension: new DocExtension() },
]);

const manager1 = ExtensionManager.create([
  new HistoryExtension(),
  new ParagraphExtension(),
  new BoldExtension(),
  new CodeBlockExtension(),
  new PositionTrackerExtension(),
  { priority: 1, extension: new TextExtension() },
  { priority: 0, extension: new DocExtension() },
]);

// @dts-jest:fail:snap
manager1.nodes.awesome;
// @dts-jest:pass:snap
github ifiokjr / remirror / @remirror / test-fixtures / src / schema-helpers.ts View on Github external
PlaceholderExtension,
  UnderlineExtension,
} from '@remirror/core-extensions';
import { PortalContainer } from '@remirror/react-portals';
import { defaultRemirrorThemeValue } from '@remirror/ui';
import minDocument from 'min-document';

export const helpers = {
  getState: Cast(jest.fn()),
  portalContainer: new PortalContainer(),
  getTheme: () => defaultRemirrorThemeValue,
};

export const baseExtensions = [
  { extension: new DocExtension(), priority: 2 },
  { extension: new TextExtension(), priority: 2 },
  { extension: new ParagraphExtension(), priority: 2 },
];

export const extensions = [
  ...baseExtensions,
  { extension: new HistoryExtension(), priority: 2 },
  { extension: new PlaceholderExtension(), priority: 2 },
  { extension: new BoldExtension(), priority: 3 },
  { extension: new ItalicExtension(), priority: 3 },
  { extension: new UnderlineExtension(), priority: 3 },
  { extension: new BlockquoteExtension(), priority: 3 },
];

/**
 * Useful for testing
 */
github ifiokjr / remirror / @remirror / core-extensions / src / base.ts View on Github external
import { DocExtension, ParagraphExtension, PrioritizedExtension, TextExtension } from '@remirror/core';
import { BaseKeymapExtension, CompositionExtension, HistoryExtension } from './extensions';

export const baseExtensions: PrioritizedExtension[] = [
  { extension: new DocExtension(), priority: 1 },
  { extension: new TextExtension(), priority: 1 },
  { extension: new ParagraphExtension(), priority: 1 },
  { extension: new CompositionExtension(), priority: 3 },
  { extension: new HistoryExtension(), priority: 3 },
  { extension: new BaseKeymapExtension(), priority: 10 },
];
github ifiokjr / remirror / @remirror / core-extensions / src / core-extensions.ts View on Github external
CompositionExtension,
  DropCursorExtension,
  GapCursorExtension,
  HistoryExtension,
} from './extensions';
import { ParagraphExtension } from './nodes';

/**
 * Base extensions are automatically injected into the default RemirrorEditor.
 *
 * To override them, you can either add your own extension with the same extensionName
 * or you can turn off all of the base extensions.
 */
export const baseExtensions = [
  { extension: new DocExtension(), priority: 1 },
  { extension: new TextExtension(), priority: 1 },
  { extension: new ParagraphExtension(), priority: 2 },
  { extension: new HistoryExtension(), priority: 3 },
  { extension: new CompositionExtension(), priority: 4 },
  { extension: new GapCursorExtension(), priority: 10 },
  { extension: new DropCursorExtension(), priority: 11 },
  { extension: new BaseKeymapExtension(), priority: 12 },
];

/**
 * The BaseExtensions union type shows the extension types available as base extensions.
 *
 * This union type is useful when paired with your own types to provide better typechecking
 * throughout your codebase.
 */
export type BaseExtensions = InferFlexibleExtensionList;
github ifiokjr / remirror / @remirror / editor-markdown / src / markdown-editor.tsx View on Github external
() =>
      ExtensionManager.create([
        { priority: 1, extension: new DocExtension({ content: 'block' }) },
        {
          priority: 1,
          extension: new CodeBlockExtension({ defaultLanguage: 'markdown', toggleType: 'codeBlock' }),
        },
        { priority: 1, extension: new TextExtension() },
        { extension: new CompositionExtension(), priority: 3 },
        { extension: new HistoryExtension(), priority: 3 },
        { extension: new GapCursorExtension(), priority: 10 },
        { extension: new BaseKeymapExtension(), priority: 10 },
      ]),
    [],