diff --git a/core/modules/editor/js/editor.admin.js b/core/modules/editor/js/editor.admin.js index 9b591746c20065ecf0920f05bca6c53b0dcf356a..14599d06ce1ec492282d55608e3a4d7117f65801 100644 --- a/core/modules/editor/js/editor.admin.js +++ b/core/modules/editor/js/editor.admin.js @@ -12,6 +12,8 @@ "use strict"; /** + * Editor configuration namespace. + * * @namespace */ Drupal.editorConfiguration = { @@ -132,8 +134,10 @@ * "allowed tag property value" restrictions for this particular tag. * * @param {object} feature + * The feature in question. * * @return {object} + * The universe generated. * * @see findPropertyValueOnTag() * @see filterStatusAllowsFeature() @@ -187,8 +191,10 @@ * values are defined for all properties: attributes, classes and styles. * * @param {object} section + * The section to check. * * @return {bool} + * Returns true if the section has empty properties, false otherwise. */ function emptyProperties(section) { return section.attributes.length === 0 && section.classes.length === 0 && section.styles.length === 0; @@ -200,12 +206,18 @@ * tag. * * @param {object} universe + * The universe to check. * @param {string} tag + * The tag to look for. * @param {string} property + * The property to check. * @param {Array} propertyValues + * Values of the property to check. * @param {bool} allowing + * Whether to update the universe or not. * * @return {bool} + * Returns true if found, false otherwise. */ function findPropertyValuesOnTag(universe, tag, property, propertyValues, allowing) { // Detect the wildcard case. @@ -226,11 +238,16 @@ * Calls findPropertyValuesOnAllTags for all tags in the universe. * * @param {object} universe + * The universe to check. * @param {string} property + * The property to check. * @param {Array} propertyValues + * Values of the property to check. * @param {bool} allowing + * Whether to update the universe or not. * * @return {bool} + * Returns true if found, false otherwise. */ function findPropertyValuesOnAllTags(universe, property, propertyValues, allowing) { var atLeastOneFound = false; @@ -249,12 +266,18 @@ * value exists. Returns true if found, false otherwise. * * @param {object} universe + * The universe to check. * @param {string} tag + * The tag to look for. * @param {string} property + * The property to check. * @param {string} propertyValue + * The property value to check. * @param {bool} allowing + * Whether to update the universe or not. * * @return {bool} + * Returns true if found, false otherwise. */ function findPropertyValueOnTag(universe, tag, property, propertyValue, allowing) { // If the tag does not exist in the universe, then it definitely can't @@ -303,9 +326,12 @@ * properties are marked as allowed. * * @param {object} universe + * The universe to delete from. * @param {string} tag + * The tag to check. * * @return {bool} + * Whether something was deleted from the universe. */ function deleteFromUniverseIfAllowed(universe, tag) { // Detect the wildcard case. @@ -323,8 +349,10 @@ * Calls deleteFromUniverseIfAllowed for all tags in the universe. * * @param {object} universe + * The universe to delete from. * * @return {bool} + * Whether something was deleted from the universe. */ function deleteAllTagsFromUniverseIfAllowed(universe) { var atLeastOneDeleted = false; @@ -341,9 +369,12 @@ * that exists in the universe. * * @param {object} universe + * Universe to check. * @param {object} filterStatus + * Filter status to use for check. * * @return {bool} + * Whether any filter rule forbids something in the universe. */ function anyForbiddenFilterRuleMatches(universe, filterStatus) { var properties = ['attributes', 'styles', 'classes']; @@ -392,7 +423,9 @@ * deleted from the universe. * * @param {object} universe + * Universe to delete from. * @param {object} filterStatus + * The filter status in question. */ function markAllowedTagsAndPropertyValues(universe, filterStatus) { var properties = ['attributes', 'styles', 'classes']; @@ -445,9 +478,12 @@ * that. * * @param {object} filterStatus + * The filter status in question. * @param {object} feature + * The feature requested. * * @return {bool} + * Whether the current status of the filter allows specified feature. * * @see generateUniverseFromFeatureRequirements() */ @@ -768,7 +804,10 @@ * } * } * - * @return {{ + * @return {object} + * An object with the following structure: + * ``` + * { * tags: Array, * allow: null, * restrictedTags: { @@ -776,9 +815,10 @@ * allowed: {attributes: Array, styles: Array, classes: Array}, * forbidden: {attributes: Array, styles: Array, classes: Array} * } - * }} + * } + * ``` * - * @see Drupal.FilterStatus + * @see Drupal.FilterStatus */ Drupal.FilterHTMLRule = function () { return { @@ -853,6 +893,9 @@ * Initializes {@link Drupal.filterConfiguration}. * * @type {Drupal~behavior} + * + * @prop {Drupal~behaviorAttach} attach + * Gets filter configuration from filter form input. */ Drupal.behaviors.initializeFilterConfiguration = { attach: function (context, settings) { diff --git a/core/modules/editor/js/editor.dialog.js b/core/modules/editor/js/editor.dialog.js index 04b94035a0886f2e1899035788a454828b9701c7..5b0ad50a62b14741030d010be94d746b102d58a7 100644 --- a/core/modules/editor/js/editor.dialog.js +++ b/core/modules/editor/js/editor.dialog.js @@ -17,9 +17,13 @@ * interface. * * @param {Drupal.Ajax} [ajax] + * The Drupal.Ajax object. * @param {object} response + * The server response from the ajax request. * @param {Array} response.values + * The values that were saved. * @param {number} [status] + * The status code from the ajax request. * * @fires event:editor:dialogsave */ diff --git a/core/modules/editor/js/editor.formattedTextEditor.js b/core/modules/editor/js/editor.formattedTextEditor.js index 73014e8f907a3fdb590f1e32d509c9b10de35caa..98d79ba21767eac01bd426a32dbafd77e5e72dd5 100644 --- a/core/modules/editor/js/editor.formattedTextEditor.js +++ b/core/modules/editor/js/editor.formattedTextEditor.js @@ -51,6 +51,7 @@ * @augments Drupal.quickedit.EditorView * * @param {object} options + * Options for the editor view. */ initialize: function (options) { Drupal.quickedit.EditorView.prototype.initialize.call(this, options); @@ -70,6 +71,7 @@ * @inheritdoc * * @return {jQuery} + * The text element edited. */ getEditedElement: function () { return this.$textElement; @@ -79,7 +81,9 @@ * @inheritdoc * * @param {object} fieldModel + * The field model. * @param {string} state + * The current state. */ stateChange: function (fieldModel, state) { var editorModel = this.model; @@ -172,6 +176,7 @@ * @inheritdoc * * @return {object} + * The sttings for the quick edit UI. */ getQuickEditUISettings: function () { return {padding: true, unifiedToolbar: true, fullWidthToolbar: true, popup: false}; diff --git a/core/modules/editor/js/editor.js b/core/modules/editor/js/editor.js index d2b9e5b70eff640c095f4099f8620c551bb2d5e3..706673c9c562b0f8649e0a0b7ef9ab18088bd3e3 100644 --- a/core/modules/editor/js/editor.js +++ b/core/modules/editor/js/editor.js @@ -59,6 +59,7 @@ * Handles changes in text format. * * @param {jQuery.Event} event + * The text format change event. */ function onTextFormatChange(event) { var $select = $(event.target); @@ -99,9 +100,10 @@ text: Drupal.t('Cancel'), class: 'button', click: function () { - // Restore the active format ID: cancel changing text format. We cannot - // simply call event.preventDefault() because jQuery's change event is - // only triggered after the change has already been accepted. + // Restore the active format ID: cancel changing text format. We + // cannot simply call event.preventDefault() because jQuery's + // change event is only triggered after the change has already + // been accepted. $select.val(activeFormatID); confirmationDialog.close(); } @@ -138,6 +140,11 @@ * Enables editors on text_format elements. * * @type {Drupal~behavior} + * + * @prop {Drupal~behaviorAttach} attach + * Attaches an editor to an input element. + * @prop {Drupal~behaviorDetach} detach + * Detaches an editor from an input element. */ Drupal.behaviors.editor = { attach: function (context, settings) { @@ -161,13 +168,13 @@ // Directly attach this text editor, if the text format is enabled. if (settings.editor.formats[activeFormatID]) { - // XSS protection for the current text format/editor is performed on the - // server side, so we don't need to do anything special here. + // XSS protection for the current text format/editor is performed on + // the server side, so we don't need to do anything special here. Drupal.editorAttach(field, settings.editor.formats[activeFormatID]); } - // When there is no text editor for this text format, still track changes, - // because the user has the ability to switch to some text editor, other- - // wise this code would not be executed. + // When there is no text editor for this text format, still track + // changes, because the user has the ability to switch to some text + // editor, otherwise this code would not be executed. $(field).on('change.editor keypress.editor', function () { field.setAttribute('data-editor-value-is-changed', 'true'); // Just knowing that the value was changed is enough, stop tracking.