Sha256: d0eb731f976cb5bbfb0ad52f50f0985b7773aa525f41594c7634db725bf6d572

Contents?: true

Size: 1.52 KB

Versions: 3

Compression:

Stored size: 1.52 KB

Contents

/**
 * Markdown driver for the text editor that ships with Zen.
 *
 * @since  0.2.6
 */
Zen.Editor.Markdown = new Class(
{
    Extends: Zen.Editor,

    /**
     * Overrides Zen.Editor.bold.
     *
     * @since  0.2.6
     * @param  {element} editor The textarea to insert the tags into.
     */
    bold: function(editor)
    {
        editor.insertAroundCursor({before: '**', after: '**'});
    },

    /**
     * Overrides Zen.Editor.italic.
     *
     * @since  0.2.6
     * @param  {element} editor The textarea to insert the tags into.
     */
    italic: function(editor)
    {
        editor.insertAroundCursor({before: '*', after: '*'});
    },

    /**
     * Overrides Zen.Editor.link.
     *
     * @since  0.2.6
     * @param  {element} editor The textarea to insert the tags into.
     */
    link: function(editor)
    {
        var link = prompt('URL', 'http://');

        editor.insertAroundCursor(
        {
            before: '[',
            after:  '](' + link + ')'
        });
    },

    /**
     * Overrides Zen.Editor.ul.
     *
     * @since  0.2.6
     * @param  {element} editor The textarea to insert the tags into.
     */
    ul: function(editor)
    {
        editor.insertAroundCursor(
        {
            before: "\n* "
        });
    },

    /**
     * Overrides Zen.Editor.ol. 
     *
     * @since  0.2.6
     * @param  {element} editor The textarea to insert the tags into.
     */
    ol: function(editor)
    {
        editor.insertAroundCursor(
        {
            before: "\n1. "
        });
    }
});

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
zen-0.3 lib/zen/public/admin/js/zen/lib/editor/markdown.js
zen-0.3b1 lib/zen/public/admin/js/zen/lib/editor/markdown.js
zen-0.3b lib/zen/public/admin/js/zen/lib/editor/markdown.js