/** You can use "dialog" and "component", "fileManager", "resizing" modules */ /** An example of using the module can be seen in the 4.dialog sample. */ // import dialog from '/src/plugins/modules/[dialog, resizing]'; // <script src="https://cdn.jsdelivr.net/npm/suneditor@latest/src/plugins/modules/[dialog, resizing].js"></script> // SUNEDITOR_MODULES['dialog', 'resizing'] /** ----------------------------------------------------------------------- */ /** These are the free icon sites you can use */ // --svg // https://icons8.com/ // https://icon-icons.com // https://materialdesignicons.com // https://material.io/resources/icons/?style=baseline // https://www.freepik.com/ // --icon class // https://fontawesome.com/, https://www.jsdelivr.com/package/npm/@fortawesome/fontawesome-free // <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.8.2/css/all.min.css"> /** ----------------------------------------------------------------------- */ // Define custom plugin // Common properties var customPlugin = { // @Required @Unique name: 'custom_example', // @Required display: ('container' || 'command' || 'submenu' || 'dialog'), // @options // * You can also set from the button list // HTML title attribute (tooltip) - default: plugin's name title: 'Custom tooltip', // HTML to be append to button (icon) // Recommend using the inline svg icon. - default: "<span class="se-icon-text">!</span>" innerHTML: '<svg />, <i class="" />, <span class="se-icon-text">C</span>', // The class of the button. - default: "se-btn" // "se-code-view-enabled": It is not disable when on code view mode. // "se-resizing-enabled": It is not disable when on using resizing module. buttonClass: '', // @Required add: (core, targetElement) { // How to set language when setting button properties of plugin directly in plugin const titleList = { en: 'Custom', ko: '사용자 정의', } this.title = titleList[core.lang.code] }, ... } SUNEDITOR.create(document.getElementById('ex_custom'), { // ------ When using CDN plugins: [customPlugin], // ------ When using node.js plugins: [custom_container, plugins.blockquote, plugins.link], // --- all plguins plugins: { ...plugins, custom_container }, // ------ Add button list // --- Add the name of the plugin to the button list. // --- Button settings use the contents defined in the plugin. buttonList: [ [ 'custom_example' ] ] // --- You can set the button's properties directly. buttonList: [ [ { // plugin's name attribute // It must be the same as the name attribute of the plugin  name: 'custom_example', // Enter the "display" attribute value of your custom plugin. dataDisplay: ('container' || 'command' || 'submenu' || 'dialog'), // @options // HTML title attribute title: 'Custom plugin', // button's class ("se-btn" class is registered, basic button click css is applied.) buttonClass:'', // ------ HTML to be append to button // --- Inline svg (The default size of the svg file is 16px.(suneditor.css:54L)) innerHTML:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" style="width:24px;height:24px;"><path d="M6 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm12 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm-6 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"/></svg>' // --- Icon class (This icon uses Font Awesome) innerHTML:'<i class="fas fa-font"></i>' } ] ] })

1. Plugins container

2. Command

3. Submenu

4. Dialog

5. Dialog & component & fileManager