Plugins

Writing a plugin

Use

You take many arguments by Leylim after register your plugin

Leylim.nodes Leylim HTML nodes, check node list

Leylim.editorButtons Right of the screen, you can put button or costumize that buttons, Button List

Leylim.forceUpdate Some cases you need call forceUpdate. This methods says to Leylim update all components.

Example

const plugin = {
  install(Leylim, options) {
    // options #= { changeSomeThing: true }
    Leylim.proptotype.$yourPluginMethod;
  }
};

const options = {
  changeSomeThing: true
};

Leylim.use(plugin, options);

Plugin list

Modal plugins helps you for while writing a plugin

Use

import Modal from 'leylim/dist/plugins/modal.js';
import 'leylim/dist/plugins/modal.css';

Leylim.use(Modal);

const AwesomePlugin = {
  install(Leylim) {
    const modal = Leylim.$getModal({
      title: 'Awesome Plugin Title',
    });
    modal.setContent(`<div>Awesome Content</div>`)
    modal.open();
  }
};

Leylim.use(AwesomePlugin);

new Leylim({
  // Options
});

API

setContent open close onClose onSave

See modal plugin;

Edit Image

Use

import EditImage from 'leylim/dist/plugins/modal.js';
import 'leylim/dist/plugins/modal.css';

Leylim.use(EditImage);

new Leylim({
  // Options
});

With upload options

import EditImage from 'leylim/dist/plugins/edit-image.js';
import 'leylim/dist/plugins/edit-image.css';

Leylim.use(EditImage,
  {
    onUploadFile: function(image, cb) {
      var file = image[0];
      var reader = new FileReader();
      reader.onloadend = function() {
        cb(reader.result)
      }
      reader.readAsDataURL(file);
    }
  }
);

new Leylim({
  // Options
});

Change Font

Use

import ChangeFont from 'leylim/dist/plugins/change-font.js';

Leylim.use(changeFont);

new Leylim({
  // Options
});

Use

import Link from 'leylim/dist/plugins/link.js';

Leylim.use(Link);

new Leylim({
  // Options
});

results matching ""

    No results matching ""