GithubHelp home page GithubHelp logo

ilyamkin / custom-dropdown-ckeditor4 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from 57u/custom-dropdown-ckeditor4

0.0 2.0 0.0 12 KB

Allows you to create a custom dropdown added to the ckeditor4 toolbar, which outputs a text string (or whatever needed) to the editor.

JavaScript 100.00%

custom-dropdown-ckeditor4's Introduction

StrInsert (String Insert)

Dropdown for CKEditor to insert custom strings.

Allows you to create a custom dropdown added to the ckeditor4 toolbar, which outputs a text string (or whatever needed) to the editor. This is useful for making it easy for people to use tokens or merge tags in the documents they edit.

Original repository name custom-dropdown-ckeditor4.

By Stuart Sillitoe (57u) and Marcus Bointon (Synchro).

##Installation

  1. Place the strinsert folder in the ckeditor/plugins/ directory.
  2. Edit your config.js file so as to add strinsert to the extraPlugins configuration
CKEDITOR.editorConfig = function( config ) {

    // ...

    // Register the strinsert plugin
	config.extraPlugins = 'strinsert';
};

Note: StrInsert is added to the 'insert' toolbar group by default, but you can change this in your toolbarGroups configuration. For more information, see also the developer guide for toolbars and the toolbar sample.

Configuration

Add the strings you are going to insert to your configuration, like this:

CKEDITOR.editorConfig = function( config ) {

    // ...
    config.strinsert_strings = [
			{'name': 'Name', 'value': '*|VALUE|*'},
			{'name': 'Group 1'},
			{'name': 'Another name', 'value': 'totally_different', 'label': 'Good looking'},
		];
};

This list of dicts define the strings to choose from to insert into the editor.

Each insertable string dict is defined by three possible keys:

  • 'value': The value to insert.
  • 'name': The name for the string to use in the dropdown.
  • 'label': The voice label (also used as the tooltip title) for the string.

Only the value to insert is required to define an insertable string, the value will be used as the name (and the name as the label) if other keys are not provided.

If the value key is not defined and the name key is, then a group header with the given name will be provided in the dropdown box. This heading is not clickable and does not insert, it is for organizational purposes only.

###Additional configuration

You can additionally set name shown for the dropdown button with config.strinsert_button_label ('Insert' by default) and the title/tooltip text with config.strinsert_button_title and the voice label text config.strinsert_button_voice (both 'Insert content' by default).

Put all together the strinsert section of your config.js file might look like this:

CKEDITOR.editorConfig = function( config ) {
    // ...
    config.extraPlugins = 'strinsert';
    config.strinsert_strings = [
        {'value': '*|FIRSTNAME|*', 'name': 'First name'},
        {'value': '*|LASTNAME|*', 'name': 'Last name'},
        {'value': '*|INVITEURL|*', 'name': 'Activore invite URL'},
    ];
    config.strinsert_button_label = 'Tokens';
    config.strinsert_button_title = config.strinsert_button_voice = 'Insert token';
};

custom-dropdown-ckeditor4's People

Contributors

57u avatar mlncn avatar synchro avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.