Sha256: 88cb7538fbe72716a2056d114830a75c88a47c3f812950e050f539af6c1e5e02

Contents?: true

Size: 1.56 KB

Versions: 4

Compression:

Stored size: 1.56 KB

Contents

"use strict";

namespace('Zen.Editor');

/**
 * 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

4 entries across 4 versions & 1 rubygems

Version Path
zen-0.4.3 lib/zen/public/admin/zen/js/lib/editor/markdown.js
zen-0.4.2 lib/zen/public/admin/zen/js/lib/editor/markdown.js
zen-0.4.1 lib/zen/public/admin/zen/js/lib/editor/markdown.js
zen-0.4 lib/zen/public/admin/zen/js/lib/editor/markdown.js