Skip to content
This repository has been archived by the owner on Sep 11, 2020. It is now read-only.

v0.3 Configuration

Pavel Linkesch edited this page Jan 18, 2015 · 1 revision

Options

  • editor: (MediumEditor) instance of MediumEditor
  • beginning: (boolean) whether inserting at the very beginning of the editor should be possible (in other words, if the first placeholder for instering should be placed as the first element of the editor, or after the first parahraph). Default: false
  • addons: (object) keys are names of used addons and values are objects of addons options. (NOTICE: Remember to use medium-editor-insert-plugin.all.min.js, which includes all addons, or separately load medium-editor-insert-plugin.min.js and medium-editor-insert-{ADDON-NAME}.min.js).
    • images:
      • imagesUploadScript: (string) relative path to a script that handles file uploads. Default: upload.php
      • imagesDeleteScript: (string) relative path to a script that handles file deleting. Default: delete.php
      • useDragAndDrop: (boolean) active or inactive image's drag and drop. Default: true
      • formatData: (function (file)) function that formats data before sending them to server while uploading an image
      • uploadFile: (function ($placeholder, file, that)) function uploading an image to a server
      • deleteFile: (function (file, that)) function deleting an image from a server
    • embeds:
      • urlPlaceholder: (string) placeholder displayed when entering URL to embed. Default: Paste or type a link
      • oembedProxy: (string) URL to oEmbed proxy endpoint, such as Iframely, Embedly or your own. You are welcome to use "http://medium.iframe.ly/api/oembed?iframe=1" for your dev and testing needs, courtesy of Iframely. Default: none, which will make the plugin use pre-defined set of embed rules without making server calls.
    • tables:
      • defaultRows: (integer) default number of rows. Default: 2
      • defaultCols: (integer) default number of columns. Default: 2
  • enabled: (boolean) plugin's state: Default true.

Methods

  • enable: enables the plugin. It's connected to Medium Editor's own activate function, so if the editor is activated, so is the plugin. (The plugin is enabled automatically. Use it only if you previously disabled the plugin.)
  • disable: disables the plugin. It's connected to Medium Editor's own deactivate function, so if the editor is deactivated, so is the plugin.
  • registerAddon: create new addon, like images or maps or embeds. Your addon object should contain init(options) method to initialize your addon and insertButton method that contains code of button in list of available addons.
  • getAddon: simple getter for available addons.

Use example:

$('.editable').mediumInsert('disable');