import { spCode } from '../../configuration/constants';

export default (editor) => {
  const domc = editor.DomComponents;
  const defaultType = domc.getType('textnode');
  const defaultModel = defaultType.model;

  // script 标签
  domc.addType(spCode, {
    model: defaultModel.extend({
      defaults: {
        ...defaultModel.prototype.defaults,
      },

      toHTML: function() {
        return `<script>\n${this.getEl() && this.getEl().innerHTML}\n</script>`;
      }
    })
  });
}
