Sha256: 3ddb2ac3061e68254c131faf90472e89ac04a988df3d8317fd87b080d0478960

Contents?: true

Size: 1.73 KB

Versions: 3

Compression:

Stored size: 1.73 KB

Contents

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

    /**
     * Overrides Zen.Editor.bold.
     *
     * @author Yorick Peterse
     * @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.
     *
     * @author Yorick Peterse
     * @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.
     *
     * @author Yorick Peterse
     * @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.
     *
     * @author Yorick Peterse
     * @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. 
     *
     * @author Yorick Peterse
     * @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.2.7 lib/zen/public/admin/js/zen/editor/markdown.js
zen-0.2.6.1 lib/zen/public/admin/js/zen/editor/markdown.js
zen-0.2.6 lib/zen/public/admin/js/zen/editor/markdown.js