Commit 08322e88 authored by catch's avatar catch
Browse files

Issue #3267258 by Spokje, dww, andregp, Wim Leers, mstrelan, catch: Remove...

Issue #3267258 by Spokje, dww, andregp, Wim Leers, mstrelan, catch: Remove Quick Edit support from editor.module
parent 49011746
Loading
Loading
Loading
Loading
+0 −10
Original line number Diff line number Diff line
@@ -27,13 +27,3 @@ drupal.editor.dialog:
    - core/drupal.dialog
    - core/drupal.ajax
    - core/drupalSettings

quickedit.inPlaceEditor.formattedText:
  version: VERSION
  js:
    js/editor.formattedTextEditor.js: { attributes: { defer: true } }
  dependencies:
    - quickedit/quickedit
    - editor/drupal.editor
    - core/drupal.ajax
    - core/drupalSettings
+0 −12
Original line number Diff line number Diff line
@@ -68,18 +68,6 @@ function editor_element_info_alter(&$types) {
  $types['text_format']['#pre_render'][] = 'element.editor:preRenderTextFormat';
}

/**
 * Implements hook_field_formatter_info_alter().
 *
 * @see quickedit_field_formatter_info_alter()
 */
function editor_field_formatter_info_alter(&$info) {
  // Update \Drupal\text\Plugin\Field\FieldFormatter\TextDefaultFormatter's
  // annotation to indicate that it supports the 'editor' in-place editor
  // provided by this module.
  $info['text_default']['quickedit'] = ['editor' => 'editor'];
}

/**
 * Implements hook_form_FORM_ID_alter().
 */
+0 −12
Original line number Diff line number Diff line
@@ -5,18 +5,6 @@ editor.filter_xss:
  requirements:
    _entity_access: 'filter_format.use'

editor.field_untransformed_text:
  path: '/editor/{entity_type}/{entity}/{field_name}/{langcode}/{view_mode_id}'
  defaults:
    _controller: '\Drupal\editor\EditorController::getUntransformedText'
  options:
    parameters:
      entity:
        type: entity:{entity_type}
  requirements:
    _permission: 'access in-place editing'
    _access_quickedit_entity_field: 'TRUE'

editor.image_dialog:
  path: '/editor/dialog/image/{editor}'
  defaults:
+0 −31
Original line number Diff line number Diff line
@@ -2,11 +2,7 @@

namespace Drupal\editor;

use Drupal\Core\Ajax\AjaxResponse;
use Drupal\Core\Controller\ControllerBase;
use Drupal\Core\Entity\EntityInterface;
use Drupal\editor\Ajax\GetUntransformedTextCommand;
use Drupal\filter\Plugin\FilterInterface;
use Drupal\filter\FilterFormatInterface;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
@@ -17,33 +13,6 @@
 */
class EditorController extends ControllerBase {

  /**
   * Returns an Ajax response to render a text field without transformation filters.
   *
   * @param \Drupal\Core\Entity\EntityInterface $entity
   *   The entity of which a formatted text field is being rerendered.
   * @param string $field_name
   *   The name of the (formatted text) field that is being rerendered
   * @param string $langcode
   *   The name of the language for which the formatted text field is being
   *   rerendered.
   * @param string $view_mode_id
   *   The view mode the formatted text field should be rerendered in.
   *
   * @return \Drupal\Core\Ajax\AjaxResponse
   *   The Ajax response.
   */
  public function getUntransformedText(EntityInterface $entity, $field_name, $langcode, $view_mode_id) {
    $response = new AjaxResponse();

    // Direct text editing is only supported for single-valued fields.
    $field = $entity->getTranslation($langcode)->$field_name;
    $editable_text = check_markup($field->value, $field->format, $langcode, [FilterInterface::TYPE_TRANSFORM_REVERSIBLE, FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE]);
    $response->addCommand(new GetUntransformedTextCommand($editable_text));

    return $response;
  }

  /**
   * Apply the necessary XSS filtering for using a certain text format's editor.
   *
+1 −1
Original line number Diff line number Diff line
@@ -219,7 +219,7 @@
          url: Drupal.quickedit.util.buildUrl(
            fieldID,
            Drupal.url(
              'editor/!entity_type/!id/!field_name/!langcode/!view_mode',
              'quickedit/!entity_type/!id/!field_name/!langcode/!view_mode',
            ),
          ),
          submit: { nocssjs: true },
Loading