export default (editor, options) => {
  editor.TraitManager.addType('link', {
    getInputEl() {
      if (!this.input) {
        const { model, ppfx } = this;
        const href = model.get('href') || '#';
        const className = `${ppfx}link`;
        const input = `<a class="${className}" href="${href}" target="_blank" style="white-space: nowrap; width: 200px; display: inline-block; text-overflow: ellipsis; overflow: hidden;">
          ${href}</a>`;
        this.input = input;
      }
  
      return this.input;
    },
    renderField() {
      if (!this.$input) {
        const el = this.getInputEl();
        this.$el.find('.' + this.ppfx + 'field').parent().html(el)
      }
    },
  })
}