4.9.4 • Published 7 months ago

@yoopta/exports v4.9.4

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

Exports

Exports is core package for exporting/importing yoopta content in different formats The package @yoopta/exports supports exporting/importing in the next formats:

  • HTML
  • Markdown
  • Plain text

Installation

yarn add @yoopta/exports

Usage

HTML exports/imports example

import { html } from '@yoopta/exports';

const Editor = () => {
  const editor = useMemo(() => createYooptaEditor(), []);

  // from html to @yoopta content
  const deserializeHTML = () => {
    const htmlString = '<h1>First title</h1>';
    const content = html.deserialize(editor, htmlString);

    editor.setEditorValue(content);
  };

  // from @yoopta content to html string
  const serializeHTML = () => {
    const data = editor.getEditorValue();
    const htmlString = html.serialize(editor, data);
    console.log('html string', htmlString);
  };

  return (
    <div>
      <button onClick={deserializeHTML}>Deserialize from html to content</button>
      <button onClick={serializeHTML}>Serialize from content to html</button>

      <YooptaEditor editor={editor} plugins={plugins} />
    </div>
  );
};

Markdown exports/imports example

import { markdown } from '@yoopta/exports';

const Editor = () => {
  const editor = useMemo(() => createYooptaEditor(), []);

  // from markdown to @yoopta content
  const deserializeMarkdown = () => {
    const markdownString = '# First title';
    const value = markdown.deserialize(editor, markdownString);

    editor.setEditorValue(value);
  };

  // from @yoopta content to markdown string
  const serializeMarkdown = () => {
    const data = editor.getEditorValue();
    const markdownString = markdown.serialize(editor, data);
    console.log('markdown string', markdownString);
  };

  return (
    <div>
      <button onClick={deserializeMarkdown}>Deserialize from markdown to content</button>
      <button onClick={serializeMarkdown}>Serialize from content to markdown</button>

      <YooptaEditor editor={editor} plugins={plugins} />
    </div>
  );
};

Plain text exports/imports example

import { plainText } from '@yoopta/exports';

const Editor = () => {
  const editor = useMemo(() => createYooptaEditor(), []);

  // from plain text to @yoopta content
  const deserializeText = () => {
    const textString = '# First title';
    const value = plainText.deserialize(editor, textString);

    editor.setEditorValue(value);
  };

  // from @yoopta content to plain text string
  const serializeText = () => {
    const data = editor.getEditorValue();
    const textString = plainText.serialize(editor, data);
    console.log('plain text string', textString);
  };

  return (
    <div>
      <button onClick={deserializeText}>Deserialize from plain text to content</button>
      <button onClick={serializeText}>Serialize from content to plain text</button>

      <YooptaEditor editor={editor} plugins={plugins} />
    </div>
  );
};

Examples

4.9.4

7 months ago

4.9.4-rc.1

7 months ago

4.9.4-rc.0

7 months ago

4.9.3

7 months ago

4.9.3-alpha.0

7 months ago

4.9.2

8 months ago

4.9.2-rc.0

8 months ago

4.9.2-rc.2

8 months ago

4.9.2-rc.1

8 months ago

4.9.0

9 months ago

4.9.1

9 months ago

4.8.5-rc.9

9 months ago

4.8.5-rc.10

9 months ago

4.8.5-rc.11

9 months ago

4.8.5-rc.7

9 months ago

4.8.5-rc.8

9 months ago

4.8.5-rc.6

9 months ago

4.8.5-rc.2

9 months ago

4.8.5-rc.4

9 months ago

4.8.5-rc.5

9 months ago

4.8.3-rc.0

10 months ago

4.8.4-rc.0

9 months ago

4.8.4

9 months ago

4.8.3

10 months ago

4.8.1

10 months ago

4.8.0

10 months ago

4.8.2

10 months ago

4.7.1-rc.8

10 months ago

4.7.1-rc.4

10 months ago

4.7.1-rc.6

10 months ago

4.7.1-rc.7

10 months ago

4.7.1-rc.0

10 months ago

4.7.1-rc.1

10 months ago

4.7.1-rc.3

10 months ago

4.6.10-rc.0

11 months ago

4.7.0

11 months ago

4.6.10-rc.1

11 months ago

4.6.9-rc.1

11 months ago

4.6.9-rc.0

11 months ago

4.6.9

11 months ago

4.6.8

12 months ago

4.6.8-rc.2

12 months ago

4.6.8-rc.1

12 months ago

4.6.8-rc.0

12 months ago

4.6.7

12 months ago

4.6.7-rc.0

12 months ago

4.6.6

12 months ago

4.6.5-rc.3

12 months ago

4.6.5

12 months ago

4.6.5-rc.2

12 months ago

4.5.2-rc.1

1 year ago

4.5.2-rc.2

1 year ago

4.6.3-rc.0

1 year ago

4.5.2-rc.0

1 year ago

4.6.3

1 year ago

4.6.2

1 year ago

4.5.2-rc.3

1 year ago

4.6.4

12 months ago

4.6.4-rc.2

12 months ago

4.6.4-rc.1

12 months ago

4.6.4-rc.0

12 months ago

4.6.1

1 year ago

4.6.0

1 year ago

4.6.5-rc.1

12 months ago

4.6.3-rc.1

1 year ago

4.6.5-rc.0

12 months ago

2.0.1

2 years ago

2.0.0

2 years ago

1.9.17-rc

2 years ago

1.9.16-rc

2 years ago

1.9.14-rc

2 years ago

1.9.15-rc

2 years ago

1.9.13-rc

2 years ago

1.9.10-rc

2 years ago

1.9.11-rc

2 years ago

1.9.12-rc

2 years ago

1.9.9-rc

2 years ago

1.9.7-rc

2 years ago

1.9.6-rc

2 years ago

1.9.8-rc

2 years ago

1.9.5-rc

2 years ago

1.9.4-rc

2 years ago

1.9.3-rc

2 years ago

1.9.2-rc

2 years ago

1.9.1-rc

2 years ago

1.9.0-rc

2 years ago