<commit_before>define(
  'ephox.mcagar.api.chainy.Editor',

  [
    'ephox.katamari.api.Id',
    'ephox.katamari.api.Merger',
    'ephox.sugar.api.dom.Insert',
    'ephox.sugar.api.dom.Remove',
    'ephox.sugar.api.node.Element',
    'ephox.sugar.api.properties.Attr',
    'ephox.sugar.api.search.Selectors',
    'ephox.agar.api.Chain',
    'global!document',
    'tinymce.core.EditorManager'
  ],

  function (Id, Merger, Insert, Remove, Element, Attr, Selectors, Chain, document, EditorManager) {

    var cFromElement = function (element, settings) {
      return Chain.on(function (_, next, die) {
        var randomId = Id.generate('tiny-loader');

        Attr.set(element, 'id', randomId);
        Insert.append(Element.fromDom(document.body), element);

        EditorManager.init(Merger.merge(settings, {
          selector: '#' + randomId,
          setup: function (editor) {
            editor.on('SkinLoaded', function () {
              setTimeout(function () {
                next(Chain.wrap(editor));
              }, 0);
            });
          }
        }));
      });
    };

    var cFromHtml = function (html, settings) {
      var element = html ? Element.fromHtml(html) : Element.fromTag(settings.inline ? 'div' : 'textarea')
      return cFromElement(element, settings);
    };

    var cFromSettings = function (settings) {
      return cFromHtml(null, settings);
    };

    var cRemove = Chain.op(function (editor) {
      var id = editor.id;
      editor.remove();
      Selectors.one('#' + id).bind(Remove.remove);
    });

    return {
      cFromHtml: cFromHtml,
      cFromElement: cFromElement,
      cFromSettings: cFromSettings,
      cCreate: cFromSettings({}),
      cCreateInline: cFromSettings({ inline: true }),
      cRemove: cRemove
    };
  }
);<commit_msg>TINY-1376: use each() instead of bind() in Editor.cRemove<commit_after>define(
  'ephox.mcagar.api.chainy.Editor',

  [
    'ephox.katamari.api.Id',
    'ephox.katamari.api.Merger',
    'ephox.sugar.api.dom.Insert',
    'ephox.sugar.api.dom.Remove',
    'ephox.sugar.api.node.Element',
    'ephox.sugar.api.properties.Attr',
    'ephox.sugar.api.search.Selectors',
    'ephox.agar.api.Chain',
    'global!document',
    'tinymce.core.EditorManager'
  ],

  function (Id, Merger, Insert, Remove, Element, Attr, Selectors, Chain, document, EditorManager) {

    var cFromElement = function (element, settings) {
      return Chain.on(function (_, next, die) {
        var randomId = Id.generate('tiny-loader');

        Attr.set(element, 'id', randomId);
        Insert.append(Element.fromDom(document.body), element);

        EditorManager.init(Merger.merge(settings, {
          selector: '#' + randomId,
          setup: function (editor) {
            editor.on('SkinLoaded', function () {
              setTimeout(function () {
                next(Chain.wrap(editor));
              }, 0);
            });
          }
        }));
      });
    };

    var cFromHtml = function (html, settings) {
      var element = html ? Element.fromHtml(html) : Element.fromTag(settings.inline ? 'div' : 'textarea')
      return cFromElement(element, settings);
    };

    var cFromSettings = function (settings) {
      return cFromHtml(null, settings);
    };

    var cRemove = Chain.op(function (editor) {
      var id = editor.id;
      editor.remove();
      Selectors.one('#' + id).each(Remove.remove);
    });

    return {
      cFromHtml: cFromHtml,
      cFromElement: cFromElement,
      cFromSettings: cFromSettings,
      cCreate: cFromSettings({}),
      cCreateInline: cFromSettings({ inline: true }),
      cRemove: cRemove
    };
  }
);
{'fraction_non_alphanumeric': 0.14767123287671233, 'fraction_numerical': 0.0016438356164383563, 'mean_word_length': 2.5038387715930903, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4930416', 'n_tokens_mistral': 1179, 'n_tokens_neox': 1170, 'n_words': 203}