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

include things from a new module that we have. #1463

Open
github-actions bot opened this issue Aug 19, 2022 · 0 comments
Open

include things from a new module that we have. #1463

github-actions bot opened this issue Aug 19, 2022 · 0 comments
Labels

Comments

@github-actions
Copy link

we need to pass all constants somewhere, but not to the replaceWrapper

Replacer.replaceMDBindedPreviewText = replaceMarkdownPreviewText.bind(state);

this.replaceMDBindedPreviewText = () => {};

// @TODO include things from a new module that we have.

// @TODO include things from a new module that we have.
// we need to pass all constants somewhere, but not to the replaceWrapper
import { replaceMarkdown } from '../../../../domain/replace-markdown/html/replace-md';

class Replace {
  constructor() {
    this.replaceMDBinded = () => {};

    // I think this version isnt working well
    // Replacer.replaceMDBindedPreviewText = replaceMarkdownPreviewText.bind(state);
    // this.replaceMDBindedPreviewText = () => {};

    this.previewText = () => this.replaceMDBinded('previewText');

    this.strong = () => this.replaceMDBinded('strong');
    this.em = () => this.replaceMDBinded('italic');
    // TODO finish this case
    this.italicAsterix = () => this.replaceMDBinded('italic_asterix');
    // TODO working not ideally, because we have headings & subtitles,
    // so it's confusing a little bit
    this.header = () => this.replaceMDBinded('header');
    this.subtitle = () => this.replaceMDBinded('header');
    this.title = () => this.replaceMDBinded('header');
    this.image = () => this.replaceMDBinded('image');
    this.link = () => this.replaceMDBinded('link');
    this.del = () => this.replaceMDBinded('del');
    this.q = () => this.replaceMDBinded('q');
    this.code = () => this.replaceMDBinded('code');
    this.ul = () => this.replaceMDBinded('ulList');
    this.ol = () => this.replaceMDBinded('olList');
    this.blockquote = () => this.replaceMDBinded('blockquote');
    this.hr = () => this.replaceMDBinded('hr');
    this.paragraph = () => this.replaceMDBinded('paragraph');
    this.br = () => this.replaceMDBinded('br');
    this.sponsorship = () => this.replaceMDBinded('sponsorship');
    // here we have a different name
    this.memes = () => this.replaceMDBinded('memes');
    this.separator = () => this.replaceMDBinded('separator');

    // TODO hiding for now, let's fix it after our release
    // this.emptyUl = () => this.replaceMDBinded('REGEXP_EMPTY_UL');
    // this.emptyOl = () => this.replaceMDBinded('REGEXP_EMPTY_OL');
    // this.comments = () => this.replaceMDBinded('');
    // this.emptyBlockquote = () =>
    //   this.replaceMDBinded('REGEXP_EMPTY_BLOCKQUOTE');
  }

  configure(state) {
    this.replaceMDBinded = replaceMarkdown.bind(state);

    // TODO crashed when here in FULL mode, needs to be fixed
    this.previewText();

    // Replacer.comments();
    this.typography();
    this.template();
    this.miscellaneous();
  }

  template() {
    this.header();
  }

  // TODO I think we need to upgrade this class,
  // in order to match it with our updated logic of organizing components

  // test this part
  miscellaneous() {
    // this line is generating an error
    // TODO fix this
    // this.emptyBlockquote();
    this.br();

    if (!process.env.PARSE === 'noAdv' || process.env.PARSE === 'full') {
      this.sponsorship();
    }

    this.memes();
    this.separator();
  }

  typography() {
    this.strong();

    this.em();
    this.italicAsterix();

    this.subtitle();
    this.title();
    // this.header();

    this.image();
    this.link();
    this.del();
    this.q();
    this.code();

    this.ul();
    this.ol();

    this.blockquote();
    this.hr();

    this.paragraph();

    // TODO fix this
    // this.emptyUl();
    // this.emptyOl();
  }

  // runConfigure () {

  // }
}

export default new Replace();
@github-actions github-actions bot added the todo label Aug 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

0 participants