<commit_before>import _ from 'lodash';

export const inlinePropertyTags = {
  EM: {
    startTag: '<em>',
    endTag: '</em>',
  },
  STRONG: {
    startTag: '<strong>',
    endTag: '</strong>',
  },
  LINK: {
    startTag: '<a>',
    endTag: '</a>',
  },
};

export function removeOrMergeOverlappingInlineProperties(
  inlineProperties,
  newInlineProperty,
) {
  /* eslint-disable */
  let i = 0;
  const indicesToDelete = [];

  // iterate over all existing inlineProperties and check for conflicts
  // (Note: we can stop as soon as newInlineProperty.endsAtChar is larger than
  // the current inlineProperty.startsAtChar because there can be no overlap anymore
  // since the inlineProperties array is ordered.)
  while (
    i < inlineProperties.length &&
    newInlineProperty.offSets.end >= inlineProperties[i].offSets.start
  ) {
    // check for overlap
    // first check the selectionOffset.start
    if (newInlineProperty.offSets.start >= inlineProperties[i].offSets.start) {
      // if selection start overlaps this inlineProperty
      if (newInlineProperty.offSets.start < inlineProperties[i].offSets.end) {<commit_msg>fixes links opening in the same tab<commit_after>import _ from 'lodash';

export const inlinePropertyTags = {
  EM: {
    startTag: '<em>',
    endTag: '</em>',
  },
  STRONG: {
    startTag: '<strong>',
    endTag: '</strong>',
  },
  LINK: {
    startTag: '<a target="_blank">',
    endTag: '</a>',
  },
};

export function removeOrMergeOverlappingInlineProperties(
  inlineProperties,
  newInlineProperty,
) {
  /* eslint-disable */
  let i = 0;
  const indicesToDelete = [];

  // iterate over all existing inlineProperties and check for conflicts
  // (Note: we can stop as soon as newInlineProperty.endsAtChar is larger than
  // the current inlineProperty.startsAtChar because there can be no overlap anymore
  // since the inlineProperties array is ordered.)
  while (
    i < inlineProperties.length &&
    newInlineProperty.offSets.end >= inlineProperties[i].offSets.start
  ) {
    // check for overlap
    // first check the selectionOffset.start
    if (newInlineProperty.offSets.start >= inlineProperties[i].offSets.start) {
      // if selection start overlaps this inlineProperty
      if (newInlineProperty.offSets.start < inlineProperties[i].offSets.end) {
{'fraction_non_alphanumeric': 0.11731601731601732, 'fraction_numerical': 0.0008658008658008658, 'mean_word_length': 3.4613899613899615, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5928583', 'n_tokens_mistral': 674, 'n_tokens_neox': 684, 'n_words': 191}