Problem/Motivation

For #3227033: Remove Quick Edit from core we need to remove all references to quickedit from core. Quickedit provides the permission "access in-place editing". Outside of quickedit this is used in the editor module in editor.routing.yml

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'

Steps to reproduce

Proposed resolution

Move this to quickedit in 9.5.x and remove in 10.0.x

Remaining tasks

  • Determine what this route does
  • Move it, deprecate it, or refactor if appropriate

User interface changes

API changes

The route editor.field_untransformed_text is deprecated and moved to quickedit

Data model changes

Release notes snippet

Issue fork drupal-3267258

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mstrelan created an issue. See original summary.

dww’s picture

Good find, thanks for opening this. More tentacles! 😉

quietone’s picture

Changing parent to the main tracking issue. Might get some more exposure as well.

Wim Leers’s picture

Title: Remove quickedit references in editor.module » Remove Quick Edit support from editor.module

Drupal.quickedit.editors.editor._getUntransformedText() uses this:

      /**
       * Loads untransformed text for this field.
       *
       * More accurately: it re-filters formatted text to exclude transformation
       * filters used by the text format.
       *
       * @param {function} callback
       *   A callback function that will receive the untransformed text.
       *
       * @see \Drupal\editor\Ajax\GetUntransformedTextCommand
       */
       _getUntransformedText(callback) {

The solution is simple IMHO:

  1. move \Drupal\editor\Plugin\InPlaceEditor\Editor (and its route + its JS) out of core/modules/editor and into core/modules/quickedit
  2. make sure both that plugin and the associated route are only available if the editor module is installed
dww’s picture

Status: Active » Needs review
FileSize
10.99 KB

@Wim Leers: Thanks! Very helpful. Here's an untested first attempt. Let's see how badly this blows up the bot. 😅

dww’s picture

Meanwhile, how does one deprecate a route?

dww’s picture

FileSize
10.98 KB
1008 bytes

sh ./core/scripts/dev/commit-code-check.sh is hanging on my local dev box, sorry about that. This should now at least get past the code check phase...

mstrelan’s picture

Meanwhile, how does one deprecate a route?

I believe there is support for this in newer versions of Symfony. Best I can come up with is to deprecate the class and leave the route in tact. I guess the old route could move to quickedit too 🤔

Status: Needs review » Needs work

The last submitted patch, 7: 3267258-7.patch, failed testing. View results

Spokje’s picture

Assigned: Unassigned » Spokje
catch’s picture

Meanwhile, how does one deprecate a route?

We can't yet, see #3159210: Support route aliasing (Symfony 5.4) and allow deprecating the route name. But in this case we don't need to - we don't consider route names part of the API (even though we might not randomly move ones that are referenced a lot).

Wim Leers’s picture

  1. +++ b/core/modules/quickedit/js/editors/formattedTextEditor.es6.js
    @@ -219,7 +219,7 @@
    -              'editor/!entity_type/!id/!field_name/!langcode/!view_mode',
    +              'quickedit/!entity_type/!id/!field_name/!langcode/!view_mode',
    
    +++ b/core/modules/quickedit/quickedit.routing.yml
    @@ -35,3 +35,16 @@ quickedit.entity_save:
    +  path: '/quickedit/{entity_type}/{entity}/{field_name}/{langcode}/{view_mode_id}'
    

    🤓 Note that you could even keep the URL the same, for less disruption — specifically when the JS is still cached on the client, it'll continue to make requests against the old URL.

    So keeping the old URL would reduce disruption.

  2. +++ b/core/modules/quickedit/src/QuickEditController.php
    @@ -356,4 +357,31 @@ public function entitySave(EntityInterface $entity) {
    +    $response->addCommand(new GetUntransformedTextCommand($editable_text));
    

    🤓 This is the only use in Drupal core of GetUntransformedTextCommand. If we move the Quick Edit module to contrib, I think we should A) deprecate the PHP class in core, B) switch the Quick Edit module to use its own copy of this command.

Spokje’s picture

Assigned: Spokje » Unassigned
FileSize
7.49 KB
16.86 KB

This is not going to be a big success, but for now I don't have any more time left.
Let's see if we can bring the number of failures down.

Haven't done _anything with #11 and #12

Spokje’s picture

FileSize
2.1 KB
18.72 KB

Mo' sleep, mo' green?

Spokje’s picture

Since the patch in #14 removes skipping of test in core/modules/quickedit/tests/src/FunctionalJavascript/QuickEditIntegrationTest.php it might fail because of the NewChromeDriverMageddon.

I've got a pretty decent, if I say so myself, fix up for review over in #3268010: Restore/Robustify \Drupal\Tests\quickedit\FunctionalJavascript\QuickEditIntegrationTest::testCustomBlock(), so folks might want to head over there for some reviewing.

Spokje’s picture

Status: Needs work » Needs review

So #14 was indeed hit by Chromageddon.

Still putting it on NR for eyes on it and #3268010: Restore/Robustify \Drupal\Tests\quickedit\FunctionalJavascript\QuickEditIntegrationTest::testCustomBlock().

We have to also look at #12.

1. I don't have enough knowledge to have a solid opinion on _not_ removing the old route, but it feels a bit dirty to me.
At some point it _will_ become disruptive, when D10 lands without quickedit. I rather have stuff "breaking" as soon as possible, to create awareness that quickedit is leaving Core and because brains here are still filled with the knowledge about changes we made.

2. I like it and it makes sense to deprecate the current class and create a new one in (contrib) quickedit.
The class doesn't seem to be "heavily" used in Contrib anyway: http://grep.xnddx.ru/search?text=GetUntransformedTextCommand&filename=
My question is: Should it be done here or in (Yet Another) follow-up issue.

mstrelan’s picture

I think it's fine to do in this issue, that's what I've done in #3265140: Move QuickEditImageController from image to quickedit.

catch’s picture

My question is: Should it be done here or in (Yet Another) follow-up issue.

I think whatever's easiest to manage is fine - the only thing that complicates it is 10.x removal and 9.4.x deprecation, otherwise it's straightforward.

Spokje’s picture

Status: Needs review » Needs work

Thanks @mstrelan and @catch, let's do #12.2 here and make 2 patches, one for 9.4.x-dev and 10.0.x-dev.

Spokje’s picture

Added draft CR.

Unsure if Release note is needed?

Spokje’s picture

FileSize
2.97 KB
21.39 KB
Spokje’s picture

Spokje’s picture

FileSize
19.46 KB
Spokje’s picture

Status: Needs work » Needs review
Spokje’s picture

Status: Needs review » Needs work

The last submitted patch, 25: 3267258-d94-25.patch, failed testing. View results

Spokje’s picture

Used 3267258-d94-25.patch as base for the MR for 9.4.x-dev.

Spokje’s picture

Used 3267258-d10-23.patch as base for the new 10.0.x-dev MR.

xjm’s picture

That looks like a real fail of that test, not a random.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Spokje’s picture

Assigned: Unassigned » Spokje
Spokje’s picture

Issue summary: View changes
Spokje’s picture

Assigned: Spokje » Unassigned
Status: Needs work » Needs review
Wim Leers’s picture

Status: Needs review » Needs work

This looks very close! 👍

andregp made their first commit to this issue’s fork.

andregp’s picture

Status: Needs work » Needs review

Addressed @Wim Leers comments.

Spokje’s picture

Assigned: Unassigned » Spokje
Status: Needs review » Needs work

We've identified (and fixed) the root cause of random failures in \Drupal\Tests\quickedit\FunctionalJavascript\QuickEditIntegrationTest::testCustomBlock(), but haven't looked at ::testArticleNode() yet.

Let's see if there's a fix for that one, we have some QuickEdit test failure trickery in our bag by now, maybe one of those can help.

Spokje’s picture

Assigned: Spokje » Unassigned
Status: Needs work » Needs review
Spokje’s picture

Wim Leers’s picture

Title: Remove Quick Edit support from editor.module » [PP-1] Remove Quick Edit support from editor.module

This needs #3268244: [random test failure] Un-skip and fix QuickEditIntegrationTest::testArticleNode() to land first (it currently incorporates that change directly into the MR — but #3268244 should just land first, that'll simplify this MR!).

catch’s picture

Title: [PP-1] Remove Quick Edit support from editor.module » Remove Quick Edit support from editor.module
Status: Needs review » Needs work
Wim Leers’s picture

Issue tags: +Needs reroll

#3268244: [random test failure] Un-skip and fix QuickEditIntegrationTest::testArticleNode() landed, let's do this!

EDIT: dammit, @catch beat me to it 🤣

Spokje’s picture

Assigned: Unassigned » Spokje
Wim Leers’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll

Only a single question left! 😄

Spokje’s picture

Last question resolved, 2x green TestBot.

Spokje’s picture

Assigned: Spokje » Unassigned
dww’s picture

Status: Needs review » Needs work
Issue tags: +Needs reroll

Per #3268244-49: [random test failure] Un-skip and fix QuickEditIntegrationTest::testArticleNode(), that fix was never pushed to 9.5.x. We need that commit pushed, then to rebase this MR, so the MR isn't duplicating the effort from 3268244.

dww’s picture

Nope, I misread. It should be there. I think this MR just needs a real rebase.

Spokje’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll

Nothing to "proper rebase" here IMHO. The threads you opened were never part of #3268244: [random test failure] Un-skip and fix QuickEditIntegrationTest::testArticleNode().
That one is about ::testArticleNode(), the changes you marked are for ::testCustomBlock().

dww’s picture

Status: Needs review » Reviewed & tested by the community

Yeah, sorry. I've been deep in so many other swamps the last few weeks, I'm struggling to get my head back into the QE quagmire. 😉 I think this is fine. I don't really have anything else to complain about. If it works, ship it!

catch’s picture

Status: Reviewed & tested by the community » Fixed

I think it's OK to unskip the test here - there's lots of other test changes, we won't have the test in 10.0.x once this is in. Absolute worst case we'd have to start skipping it again in 9.5.x.

Committed/pushed the respective MR diffs to 10.0.x and 9.5.x, thanks!

  • catch committed 08322e8 on 10.0.x
    Issue #3267258 by Spokje, dww, andregp, Wim Leers, mstrelan, catch:...
  • catch committed 2566416 on 9.5.x
    Issue #3267258 by Spokje, dww, andregp, Wim Leers, mstrelan, catch:...

Spokje’s picture

Published CR.

Wim Leers’s picture

Yep, agreed that fixing/unskipping the test as part of this issue was fine.

Was hoping to RTBC this morning, but instead I got the notification that it was in already: better still! 👏

Thanks for all the epic work on this and related issues!

Spokje’s picture

Was hoping to RTBC this morning, but instead I got the notification that it was in already: better still!

Well, the module is named Quick Edit...

Me and my buddy Sisyphus are here all week. Try the veal!

Wim Leers’s picture

🤣

Spokje’s picture

Version: 9.5.x-dev » 9.4.x-dev
Assigned: Unassigned » Spokje
Status: Fixed » Patch (to be ported)
Spokje’s picture

Assigned: Spokje » Unassigned
FileSize
26.65 KB

The attached plain diff from MR2020 applies cleanly to 9.4.x-dev.

Spokje’s picture

Spokje’s picture

We also need to update the CR when this gets committed.

Spokje’s picture

Version: 9.4.x-dev » 9.5.x-dev
Status: Patch (to be ported) » Fixed
Related issues: -#3292525: [PP-1] Update deprecation errors made in [#3267258] from 9.5.0 to 9.4.2

Not backporting this any more.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.