Commit ad44453c authored by catch's avatar catch
Browse files

Issue #3248425 by nod_, yogeshmpawar, Wim Leers, lauriii, bnjmnm, marcvangend:...

Issue #3248425 by nod_, yogeshmpawar, Wim Leers, lauriii, bnjmnm, marcvangend: Ensure that all classes and functions in Drupal-specific CKEditor 5 plugins are documented
parent 95273b80
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
/**
 * @file
 * Provides admin UI for the CKEditor 5.
 * Provides the admin UI for CKEditor 5.
 */

((Drupal, drupalSettings, $, JSON, once, Sortable, { tabbable }) => {
@@ -49,14 +49,14 @@
    }

    /**
     * Notifies subscribers about new value.
     * Notifies subscribers about new values.
     */
    notify() {
      this._listeners.forEach((listener) => listener(this._value));
    }

    /**
     * Subscribes to be notified for changes.
     * Subscribes a listener callback to changes.
     *
     * @param {Function} listener
     *   The function to be called when a new value is set.
@@ -862,7 +862,7 @@
   * @return {string}
   *   The selected buttons markup.
   *
   * @internal
   * @private
   */
  Drupal.theme.ckeditor5SelectedButtons = ({ buttons }) => {
    return `
@@ -886,7 +886,7 @@
   * @return {string}
   *   The CKEditor 5 divider buttons markup.
   *
   * @internal
   * @private
   */
  Drupal.theme.ckeditor5DividerButtons = ({ buttons }) => {
    return `
@@ -910,7 +910,7 @@
   * @return {string}
   *   The CKEditor 5 available buttons markup.
   *
   * @internal
   * @private
   */
  Drupal.theme.ckeditor5AvailableButtons = ({ buttons }) => {
    return `
@@ -940,7 +940,7 @@
   * @return {string}
   *   The CKEditor 5 buttons markup.
   *
   * @internal
   * @private
   */
  Drupal.theme.ckeditor5Button = ({ button: { label, id }, listType }) => {
    const buttonInstructions = {
@@ -986,7 +986,7 @@
   * @return {string}
   *   The CKEditor 5 admin UI markup.
   *
   * @internal
   * @private
   */
  Drupal.theme.ckeditor5Admin = ({
    availableButtons,
+3 −1
Original line number Diff line number Diff line
@@ -5,7 +5,9 @@ import { Plugin } from 'ckeditor5/src/core';
import DrupalEmphasisEditing from './drupalemphasisediting';

/**
 * @internal
 * Drupal-specific plugin to alter the CKEditor 5 italic command.
 *
 * @private
 */
class DrupalEmphasis extends Plugin {
  /**
+3 −4
Original line number Diff line number Diff line
@@ -2,10 +2,9 @@
import { Plugin } from 'ckeditor5/src/core';

/**
 * @internal
 */
/**
 * Converts italic text into em.
 * Alters the italic command to output `<em>` instead of `<i>`.
 *
 * @private
 */
class DrupalEmphasisEditing extends Plugin {
  /**
+1 −1
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@
import DrupalEmphasis from './drupalemphasis';

/**
 * @internal
 * @private
 */
export default {
  DrupalEmphasis,
+18 −5
Original line number Diff line number Diff line
@@ -3,7 +3,15 @@
/**
 * HTML builder that converts document fragments into strings.
 *
 * @internal
 * Escapes ampersand characters (`&`) and angle brackets (`<` and `>`) when
 * transforming data to HTML. This is required because
 * \Drupal\Component\Utility\Xss::filter fails to parse element attributes
 * values containing unescaped HTML entities.
 *
 * @see https://www.drupal.org/project/drupal/issues/3227831
 * @see DrupalHtmlBuilder._escapeAttribute
 *
 * @private
 */
export default class DrupalHtmlBuilder {
  /**
@@ -41,7 +49,7 @@ export default class DrupalHtmlBuilder {
  }

  /**
   * Converts document fragment into HTML string and appends to the value.
   * Converts a document fragment into an HTML string appended to the value.
   *
   * @param {DocumentFragment} node
   *   A document fragment to be appended to the value.
@@ -57,7 +65,7 @@ export default class DrupalHtmlBuilder {
  }

  /**
   * Appends element node to the value.
   * Appends an element node to the value.
   *
   * @param {DocumentFragment} node
   *   A document fragment to be appended to the value.
@@ -122,7 +130,9 @@ export default class DrupalHtmlBuilder {
   * @private
   */
  _appendText(node) {
    // Text node doesn't have innerHTML property and textContent doesn't encode
    // Repack the text into another node and extract using innerHTML. This
    // works around text nodes not having an innerHTML property and textContent
    // not encoding entities.
    // entities. That's why the text is repacked into another node and extracted
    // using innerHTML.
    const doc = document.implementation.createHTMLDocument('');
@@ -133,7 +143,7 @@ export default class DrupalHtmlBuilder {
  }

  /**
   * Appends string to the value.
   * Appends a string to the value.
   *
   * @param {string} str
   *  A string to be appended to the value.
@@ -157,6 +167,9 @@ export default class DrupalHtmlBuilder {
   * @param {string} text
   *  A string to be escaped.
   *
   * @return {string}
   *  Escaped string.
   *
   * @see https://www.w3.org/TR/2008/REC-xml-20081126/#NT-AttValue
   * @see https://html.spec.whatwg.org/multipage/parsing.html#attribute-value-(single-quoted)-state
   * @see https://www.drupal.org/project/drupal/issues/3227831
Loading