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