const {
  ClassicEditor,
  Autosave,
  Essentials,
  Paragraph,
  Bold,
  Italic,
  Link,
  AutoLink,
  List,
} = window.CKEDITOR;

const LICENSE_KEY =
  "eyJhbGciOiJFUzI1NiJ9.eyJleHAiOjE4MDAwNTc1OTksImp0aSI6ImQzZDUzMDc5LWZiMjYtNGJlMS05YmVkLWJlYWU2OTVkNDNjYiIsImxpY2Vuc2VkSG9zdHMiOlsiYXJ0cy10aWN1bGUuZnIiXSwidXNhZ2VFbmRwb2ludCI6Imh0dHBzOi8vcHJveHktZXZlbnQuY2tlZGl0b3IuY29tIiwiZGlzdHJpYnV0aW9uQ2hhbm5lbCI6WyJjbG91ZCIsImRydXBhbCJdLCJmZWF0dXJlcyI6WyJEUlVQIiwiRTJQIiwiRTJXIl0sInJlbW92ZUZlYXR1cmVzIjpbIlBCIiwiUkYiLCJTQ0giLCJUQ1AiLCJUTCIsIlRDUiIsIklSIiwiU1VBIiwiQjY0QSIsIkxQIiwiSEUiLCJSRUQiLCJQRk8iLCJXQyIsIkZBUiIsIkJLTSIsIkZQSCIsIk1SRSJdLCJ2YyI6ImQxN2FhMzAzIn0.pAsoHbo93g_1pSRt5EhtiZwUeQHyRzbw3f1X9tFlAbO8FPz2UOeln0mePrTiwyK47q5ISEv4oyF9BCtWcu1N7g";

const editorConfig = {
  toolbar: {
    items: [
      "undo",
      "redo",
      "|",
      "bold",
      "italic",
      "|",
      "link",
      "|",
      "bulletedList",
      "numberedList",
    ],
    shouldNotGroupWhenFull: false,
  },
  plugins: [
    AutoLink,
    Autosave,
    Bold,
    Essentials,
    Italic,
    Link,
    List,
    Paragraph,
  ],
  language: "fr",
  licenseKey: LICENSE_KEY,
  link: {
    addTargetToExternalLinks: true,
    defaultProtocol: "https://",
    decorators: {
      toggleDownloadable: {
        mode: "manual",
        label: "Downloadable",
        attributes: {
          download: "file",
        },
      },
    },
  },
  placeholder: "Saisissez votre article ici",
};

export default class EnhancedEditor extends ClassicEditor {}
EnhancedEditor.builtinPlugins = editorConfig.plugins;
EnhancedEditor.defaultConfig = editorConfig;
