Permalink
Browse files

Added documentation for various events.

  • Loading branch information...
spocke committed Jun 18, 2013
1 parent 90d025d commit 1f07fed6d0e15f5e66519f452bbaf2450d5aca99
View
@@ -1,7 +1,6 @@
bin
obj
tmp
-docs
.settings
.idea
.project
@@ -10,10 +10,17 @@
/*jshint scripturl:true */
+/**
+ * Include the base event class documentation.
+ *
+ * @include ../../../tools/docs/tinymce.Event.js
+ */
+
/**
* This class contains the core logic for a TinyMCE editor.
*
* @class tinymce.Editor
+ * @mixes tinymce.util.Observable
* @example
* // Add a class to all paragraphs in the editor.
* tinymce.activeEditor.dom.addClass(tinymce.activeEditor.dom.select('p'), 'someclass');
@@ -15,6 +15,7 @@
* tinymce.EditorManager.init({});
*
* @class tinymce.EditorManager
+ * @mixes tinymce.util.Observable
* @static
*/
define("tinymce/EditorManager", [
@@ -8,6 +8,11 @@
* Contributing: http://www.tinymce.com/contributing
*/
+/**
+ * This mixin will add event binding logic to classes.
+ *
+ * @mixin tinymce.util.Observable
+ */
define("tinymce/util/Observable", [
"tinymce/util/Tools"
], function(Tools) {
@@ -26,6 +31,17 @@ define("tinymce/util/Observable", [
}
return {
+ /**
+ * Fires the specified event by name.
+ *
+ * @method fire
+ * @param {String} name Name of the event to fire.
+ * @param {tinymce.Event/Object?} args Event arguments.
+ * @param {Boolean?} bubble True/false if the event is to be bubbled.
+ * @return {tinymce.Event} Event instance passed in converted into tinymce.Event instance.
+ * @example
+ * instance.fire('event', {...});
+ */
fire: function(name, args, bubble) {
var self = this, handlers, i, l, callback, parent;
@@ -96,6 +112,18 @@ define("tinymce/util/Observable", [
return args;
},
+ /**
+ * Binds an event listener to a specific event by name.
+ *
+ * @method on
+ * @param {String} name Event name or space separated list of events to bind.
+ * @param {callback} callback Callback to be executed when the event occurs.
+ * @return {Object} Current class instance.
+ * @example
+ * instance.on('event', function(e) {
+ * // Callback logic
+ * });
+ */
on: function(name, callback) {
var self = this, bindings, handlers, names, i;
@@ -131,6 +159,23 @@ define("tinymce/util/Observable", [
return self;
},
+ /**
+ * Unbinds an event listener to a specific event by name.
+ *
+ * @method off
+ * @param {String?} name Name of the event to unbind.
+ * @param {callback?} callback Callback to unbind.
+ * @return {Object} Current class instance.
+ * @example
+ * // Unbind specific callback
+ * instance.off('event', handler);
+ *
+ * // Unbind all listeners by name
+ * instance.off('event');
+ *
+ * // Unbind all events
+ * instance.off();
+ */
off: function(name, callback) {
var self = this, i, bindings = self[bindingsName], handlers, bindingName, names, hi;
@@ -0,0 +1,28 @@
+/**
+ * This class is the event object send when the BeforeExecCommand and ExecCommand event occurs.
+ *
+ * @class tinymce.CommandEvent
+ * @extends tinymce.Event
+ * @example
+ * tinymce.activeEditor.on('ExecCommand', function(e) {
+ * console.log(e.command, e.ui, e.value);
+ * });
+ */
+
+/**
+ * Name of the command to execute.
+ *
+ * @property {String} command
+ */
+
+/**
+ * User interface state. Normally false.
+ *
+ * @property {Boolean} ui User interface state.
+ */
+
+/**
+ * Value object for the execCommand call.
+ *
+ * @property {Object} value
+ */
@@ -0,0 +1,53 @@
+/**
+ * This class is the event object send when the content events occurs such as GetContent/SetContent.
+ *
+ * @class tinymce.ContentEvent
+ * @extends tinymce.Event
+ * @example
+ * tinymce.activeEditor.on('GetContent', function(e) {
+ * console.log(e.content);
+ * });
+ */
+
+/**
+ * Optional state gets added for the load event then it's set to true.
+ *
+ * @property {Boolean} load
+ */
+
+/**
+ * Optional state gets added for the save event then it's set to true.
+ *
+ * @property {Boolean} save
+ */
+
+/**
+ * Optional state gets added for the getContent event then it's set to true.
+ *
+ * @property {Boolean} set
+ */
+
+/**
+ * Optional state gets added for the setContent event then it's set to true.
+ *
+ * @property {Boolean} get
+ */
+
+/**
+ * Optional element that the load/save event is for. This element is the textarea/div element that the
+ * contents gets parsed from or serialized to.
+ *
+ * @property {DOMElement} element
+ */
+
+/**
+ * Editor contents to be set or the content that was returned from the editor.
+ *
+ * @property {String} content HTML contents from the editor or to be put into the editor.
+ */
+
+/**
+ * Format of the contents normally "html".
+ *
+ * @property {String} format Format of the contents normally "html".
+ */
Oops, something went wrong.

0 comments on commit 1f07fed

Please sign in to comment.