Skip to content

Instantly share code, notes, and snippets.

@andrewnicols
Created March 14, 2014 06:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrewnicols/9543035 to your computer and use it in GitHub Desktop.
Save andrewnicols/9543035 to your computer and use it in GitHub Desktop.
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/*
* Atto text editor x plugin.
*
* @module moodle-atto_x-button
* @package editor-atto
* @copyright 2014 Andrew Nicols
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
/**
* Atto text editor x plugin.
*
* Inspired by http://www.xkcd.com/1341/.
*
* @namespace M.atto_x
* @class button
*/
Y.namespace('M.atto_x').Button = Y.Base.create('button', Y.M.editor_atto.EditorPlugin, [], {
initializer: function() {
this.get('host').on('change', function() {
if (this.textarea.get('value') === '<em>Hi</em>') {
this.editor
.empty()
.appendChild('The HORSE is a noble animal.');
}
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment