Commit cf47c295 authored by Enrique Alcantara's avatar Enrique Alcantara

Remove markdown-it from js bundles

Remove markdown-it library from JS bundle
by replacing a prosemirror-markdown import
statement with an import statement that
only references the Markdown serializer module
in this library.

This change allows us to reduce the amount
of JavaScript required to deliver the
copy to gfm feature
parent 571fcbff
/* eslint-disable class-methods-use-this */ /* eslint-disable class-methods-use-this */
import { defaultMarkdownSerializer } from 'prosemirror-markdown';
import { Bold as BaseBold } from 'tiptap-extensions'; import { Bold as BaseBold } from 'tiptap-extensions';
import { defaultMarkdownSerializer } from '~/lib/prosemirror_markdown_serializer';
// Transforms generated HTML back to GFM for Banzai::Filter::MarkdownFilter // Transforms generated HTML back to GFM for Banzai::Filter::MarkdownFilter
export default class Bold extends BaseBold { export default class Bold extends BaseBold {
......
/* eslint-disable class-methods-use-this */ /* eslint-disable class-methods-use-this */
import { defaultMarkdownSerializer } from 'prosemirror-markdown';
import { Code as BaseCode } from 'tiptap-extensions'; import { Code as BaseCode } from 'tiptap-extensions';
import { defaultMarkdownSerializer } from '~/lib/prosemirror_markdown_serializer';
// Transforms generated HTML back to GFM for Banzai::Filter::MarkdownFilter // Transforms generated HTML back to GFM for Banzai::Filter::MarkdownFilter
export default class Code extends BaseCode { export default class Code extends BaseCode {
......
/* eslint-disable class-methods-use-this */ /* eslint-disable class-methods-use-this */
import { defaultMarkdownSerializer } from 'prosemirror-markdown';
import { Italic as BaseItalic } from 'tiptap-extensions'; import { Italic as BaseItalic } from 'tiptap-extensions';
import { defaultMarkdownSerializer } from '~/lib/prosemirror_markdown_serializer';
// Transforms generated HTML back to GFM for Banzai::Filter::MarkdownFilter // Transforms generated HTML back to GFM for Banzai::Filter::MarkdownFilter
export default class Italic extends BaseItalic { export default class Italic extends BaseItalic {
......
/* eslint-disable class-methods-use-this */ /* eslint-disable class-methods-use-this */
import { defaultMarkdownSerializer } from 'prosemirror-markdown';
import { Link as BaseLink } from 'tiptap-extensions'; import { Link as BaseLink } from 'tiptap-extensions';
import { defaultMarkdownSerializer } from '~/lib/prosemirror_markdown_serializer';
// Transforms generated HTML back to GFM for Banzai::Filter::MarkdownFilter // Transforms generated HTML back to GFM for Banzai::Filter::MarkdownFilter
export default class Link extends BaseLink { export default class Link extends BaseLink {
......
/* eslint-disable class-methods-use-this */ /* eslint-disable class-methods-use-this */
import { defaultMarkdownSerializer } from 'prosemirror-markdown';
import { Mark } from 'tiptap'; import { Mark } from 'tiptap';
import { defaultMarkdownSerializer } from '~/lib/prosemirror_markdown_serializer';
import { HIGHER_PARSE_RULE_PRIORITY } from '../constants'; import { HIGHER_PARSE_RULE_PRIORITY } from '../constants';
// Transforms generated HTML back to GFM for Banzai::Filter::MathFilter // Transforms generated HTML back to GFM for Banzai::Filter::MathFilter
......
/* eslint-disable class-methods-use-this */ /* eslint-disable class-methods-use-this */
import { defaultMarkdownSerializer } from 'prosemirror-markdown';
import { Blockquote as BaseBlockquote } from 'tiptap-extensions'; import { Blockquote as BaseBlockquote } from 'tiptap-extensions';
import { defaultMarkdownSerializer } from '~/lib/prosemirror_markdown_serializer';
// Transforms generated HTML back to GFM for Banzai::Filter::MarkdownFilter // Transforms generated HTML back to GFM for Banzai::Filter::MarkdownFilter
export default class Blockquote extends BaseBlockquote { export default class Blockquote extends BaseBlockquote {
......
/* eslint-disable class-methods-use-this */ /* eslint-disable class-methods-use-this */
import { defaultMarkdownSerializer } from 'prosemirror-markdown';
import { BulletList as BaseBulletList } from 'tiptap-extensions'; import { BulletList as BaseBulletList } from 'tiptap-extensions';
import { defaultMarkdownSerializer } from '~/lib/prosemirror_markdown_serializer';
// Transforms generated HTML back to GFM for Banzai::Filter::MarkdownFilter // Transforms generated HTML back to GFM for Banzai::Filter::MarkdownFilter
export default class BulletList extends BaseBulletList { export default class BulletList extends BaseBulletList {
......
/* eslint-disable class-methods-use-this */ /* eslint-disable class-methods-use-this */
import { defaultMarkdownSerializer } from 'prosemirror-markdown';
import { Heading as BaseHeading } from 'tiptap-extensions'; import { Heading as BaseHeading } from 'tiptap-extensions';
import { defaultMarkdownSerializer } from '~/lib/prosemirror_markdown_serializer';
// Transforms generated HTML back to GFM for Banzai::Filter::MarkdownFilter // Transforms generated HTML back to GFM for Banzai::Filter::MarkdownFilter
export default class Heading extends BaseHeading { export default class Heading extends BaseHeading {
......
/* eslint-disable class-methods-use-this */ /* eslint-disable class-methods-use-this */
import { defaultMarkdownSerializer } from 'prosemirror-markdown';
import { HorizontalRule as BaseHorizontalRule } from 'tiptap-extensions'; import { HorizontalRule as BaseHorizontalRule } from 'tiptap-extensions';
import { defaultMarkdownSerializer } from '~/lib/prosemirror_markdown_serializer';
// Transforms generated HTML back to GFM for Banzai::Filter::MarkdownFilter // Transforms generated HTML back to GFM for Banzai::Filter::MarkdownFilter
export default class HorizontalRule extends BaseHorizontalRule { export default class HorizontalRule extends BaseHorizontalRule {
......
/* eslint-disable class-methods-use-this */ /* eslint-disable class-methods-use-this */
import { defaultMarkdownSerializer } from 'prosemirror-markdown';
import { Image as BaseImage } from 'tiptap-extensions'; import { Image as BaseImage } from 'tiptap-extensions';
import { placeholderImage } from '~/lazy_loader'; import { placeholderImage } from '~/lazy_loader';
import { defaultMarkdownSerializer } from '~/lib/prosemirror_markdown_serializer';
import { HIGHER_PARSE_RULE_PRIORITY } from '../constants'; import { HIGHER_PARSE_RULE_PRIORITY } from '../constants';
export default class Image extends BaseImage { export default class Image extends BaseImage {
......
/* eslint-disable class-methods-use-this */ /* eslint-disable class-methods-use-this */
import { defaultMarkdownSerializer } from 'prosemirror-markdown';
import { ListItem as BaseListItem } from 'tiptap-extensions'; import { ListItem as BaseListItem } from 'tiptap-extensions';
import { defaultMarkdownSerializer } from '~/lib/prosemirror_markdown_serializer';
// Transforms generated HTML back to GFM for Banzai::Filter::MarkdownFilter // Transforms generated HTML back to GFM for Banzai::Filter::MarkdownFilter
export default class ListItem extends BaseListItem { export default class ListItem extends BaseListItem {
......
/* eslint-disable class-methods-use-this */ /* eslint-disable class-methods-use-this */
import { defaultMarkdownSerializer } from 'prosemirror-markdown';
import { Node } from 'tiptap'; import { Node } from 'tiptap';
import { defaultMarkdownSerializer } from '~/lib/prosemirror_markdown_serializer';
// Transforms generated HTML back to GFM for Banzai::Filter::MarkdownFilter // Transforms generated HTML back to GFM for Banzai::Filter::MarkdownFilter
export default class Paragraph extends Node { export default class Paragraph extends Node {
......
/* eslint-disable class-methods-use-this */ /* eslint-disable class-methods-use-this */
/* eslint-disable @gitlab/require-i18n-strings */ /* eslint-disable @gitlab/require-i18n-strings */
import { defaultMarkdownSerializer } from 'prosemirror-markdown';
import { Node } from 'tiptap'; import { Node } from 'tiptap';
import { defaultMarkdownSerializer } from '~/lib/prosemirror_markdown_serializer';
/** /**
* Abstract base class for playable media, like video and audio. * Abstract base class for playable media, like video and audio.
......
/* eslint-disable class-methods-use-this */ /* eslint-disable class-methods-use-this */
import { defaultMarkdownSerializer } from 'prosemirror-markdown';
import { Node } from 'tiptap'; import { Node } from 'tiptap';
import { defaultMarkdownSerializer } from '~/lib/prosemirror_markdown_serializer';
export default class Text extends Node { export default class Text extends Node {
get name() { get name() {
......
import { MarkdownSerializer } from 'prosemirror-markdown'; import { MarkdownSerializer } from '~/lib/prosemirror_markdown_serializer';
import editorExtensions from './editor_extensions'; import editorExtensions from './editor_extensions';
const nodes = editorExtensions const nodes = editorExtensions
......
import { DOMParser as ProseMirrorDOMParser } from 'prosemirror-model';
import { import {
MarkdownSerializer as ProseMirrorMarkdownSerializer, MarkdownSerializer as ProseMirrorMarkdownSerializer,
defaultMarkdownSerializer, defaultMarkdownSerializer,
} from 'prosemirror-markdown/src/to_markdown'; } from '~/lib/prosemirror_markdown_serializer';
import { DOMParser as ProseMirrorDOMParser } from 'prosemirror-model';
import Audio from '../extensions/audio'; import Audio from '../extensions/audio';
import Blockquote from '../extensions/blockquote'; import Blockquote from '../extensions/blockquote';
import Bold from '../extensions/bold'; import Bold from '../extensions/bold';
......
export * from 'prosemirror-markdown/src/to_markdown';
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment