<commit_before>import { Id, Type, Global } from '@ephox/katamari';
import { Merger } from '@ephox/katamari';
import { Insert } from '@ephox/sugar';
import { Remove } from '@ephox/sugar';
import { Element } from '@ephox/sugar';
import { Attr } from '@ephox/sugar';
import { Selectors } from '@ephox/sugar';
import { Chain } from '@ephox/agar';
import 'tinymce';
import { document, setTimeout } from '@ephox/dom-globals';
import { setTinymceBaseUrl } from '../loader/Urls';

var cFromElement = function (element, settings: Record<string, any>) {
  return Chain.async(function (_, next, die) {
    var randomId = Id.generate('tiny-loader');

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

    const tinymce = Global.tinymce;

    if (settings.base_url) {
      setTinymceBaseUrl(tinymce, settings.base_url);
    }

    tinymce.init(Merger.merge(settings, {
      selector: '#' + randomId,
      setup: function (editor) {
        if (Type.isFunction(settings.setup)) {
          settings.setup(editor);
        }
        editor.on('SkinLoaded', function () {
          setTimeout(function () {
            next(editor);
          }, 0);
        });
      }
    }));
  });
};

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

var cFromSettings = function (settings: Record<string, any>) {
  return cFromHtml(null, settings);
};

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

export default {
  cFromHtml: cFromHtml,
  cFromElement: cFromElement,
  cFromSettings: cFromSettings,
  cCreate: cFromSettings({}),
  cCreateInline: cFromSettings({ inline: true }),
  cRemove: cRemove
};
<commit_msg>TINY-3074: Forgot to restore an 'update base URLs' call in the Editor API<commit_after>import { Id, Type, Global } from '@ephox/katamari';
import { Merger } from '@ephox/katamari';
import { Insert } from '@ephox/sugar';
import { Remove } from '@ephox/sugar';
import { Element } from '@ephox/sugar';
import { Attr } from '@ephox/sugar';
import { Selectors } from '@ephox/sugar';
import { Chain } from '@ephox/agar';
import 'tinymce';
import { document, setTimeout } from '@ephox/dom-globals';
import { setTinymceBaseUrl } from '../loader/Urls';

setTinymceBaseUrl(Global.tinymce, `/project/node_modules/tinymce`);

var cFromElement = function (element, settings: Record<string, any>) {
  return Chain.async(function (_, next, die) {
    var randomId = Id.generate('tiny-loader');

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

    const tinymce = Global.tinymce;

    if (settings.base_url) {
      setTinymceBaseUrl(tinymce, settings.base_url);
    }

    tinymce.init(Merger.merge(settings, {
      selector: '#' + randomId,
      setup: function (editor) {
        if (Type.isFunction(settings.setup)) {
          settings.setup(editor);
        }
        editor.on('SkinLoaded', function () {
          setTimeout(function () {
            next(editor);
          }, 0);
        });
      }
    }));
  });
};

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

var cFromSettings = function (settings: Record<string, any>) {
  return cFromHtml(null, settings);
};

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

export default {
  cFromHtml: cFromHtml,
  cFromElement: cFromElement,
  cFromSettings: cFromSettings,
  cCreate: cFromSettings({}),
  cCreateInline: cFromSettings({ inline: true }),
  cRemove: cRemove
};

{'fraction_non_alphanumeric': 0.15259822560202788, 'fraction_numerical': 0.001520912547528517, 'mean_word_length': 3.7144563918757467, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '5816622', 'n_tokens_mistral': 1297, 'n_tokens_neox': 1298, 'n_words': 292}