3bf6120c7af638d0d61670d609b1c54193c0f064
[yaffs-website] / web / core / modules / editor / js / editor.dialog.js
1 /**
2  * @file
3  * AJAX commands used by Editor module.
4  */
5
6 (function ($, Drupal) {
7
8   'use strict';
9
10   /**
11    * Command to save the contents of an editor-provided modal.
12    *
13    * This command does not close the open modal. It should be followed by a
14    * call to `Drupal.AjaxCommands.prototype.closeDialog`. Editors that are
15    * integrated with dialogs must independently listen for an
16    * `editor:dialogsave` event to save the changes into the contents of their
17    * interface.
18    *
19    * @param {Drupal.Ajax} [ajax]
20    *   The Drupal.Ajax object.
21    * @param {object} response
22    *   The server response from the ajax request.
23    * @param {Array} response.values
24    *   The values that were saved.
25    * @param {number} [status]
26    *   The status code from the ajax request.
27    *
28    * @fires event:editor:dialogsave
29    */
30   Drupal.AjaxCommands.prototype.editorDialogSave = function (ajax, response, status) {
31     $(window).trigger('editor:dialogsave', [response.values]);
32   };
33
34 })(jQuery, Drupal);