Welcome to mirror list, hosted at ThFree Co, Russian Federation.

render_identifier_paragraph.js « renderers « services « rich_content_editor « components « vue_shared « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: f5b4502ea3c8ecc3e4ea9fe45a5330a95d06948c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import { buildUneditableOpenTokens, buildUneditableCloseToken } from './build_uneditable_token';

const identifierRegex = /(^\[.+\]: .+)/;

const isIdentifier = text => {
  return identifierRegex.test(text);
};

const canRender = (node, context) => {
  return isIdentifier(context.getChildrenText(node));
};

const render = (_, { entering, origin }) =>
  entering ? buildUneditableOpenTokens(origin()) : buildUneditableCloseToken();

export default { canRender, render };