diff options
Diffstat (limited to 'core/misc/tabledrag-ajax.js')
-rw-r--r-- | core/misc/tabledrag-ajax.js | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/core/misc/tabledrag-ajax.js b/core/misc/tabledrag-ajax.js new file mode 100644 index 00000000000..11df818dd88 --- /dev/null +++ b/core/misc/tabledrag-ajax.js @@ -0,0 +1,36 @@ +/** + * Ajax command for highlighting elements. + * + * @param {Drupal.Ajax} [ajax] + * An Ajax object. + * @param {object} response + * The Ajax response. + * @param {string} response.id + * The row id. + * @param {string} response.tabledrag_instance + * The tabledrag instance identifier. + * @param {number} [status] + * The HTTP status code. + */ +Drupal.AjaxCommands.prototype.tabledragChanged = function ( + ajax, + response, + status, +) { + if (status !== 'success') { + return; + } + + const tableDrag = Drupal.tableDrag[response.tabledrag_instance]; + + // eslint-disable-next-line new-cap + const rowObject = new tableDrag.row( + document.getElementById(response.id), + '', + tableDrag.indentEnabled, + tableDrag.maxDepth, + true, + ); + rowObject.markChanged(); + rowObject.addChangedWarning(); +}; |