Closed (fixed)
Project:
Drupal core
Version:
8.3.x-dev
Component:
quickedit.module
Priority:
Major
Category:
Feature request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
6 Feb 2015 at 12:31 UTC
Updated:
17 Jul 2017 at 15:54 UTC
Jump to comment: Most recent, Most recent file

Comments
Comment #1
wim leersComment #2
wim leersI tried to find the corresponding module, but can't find it. Can you find it, Lewis? Or do you perhaps know the creator of that video?
Comment #3
lewisnymanYep it's still a sandbox - https://www.drupal.org/sandbox/avitslv/2413017
Ah there's no code pushed. I'll ask the maintainer
Comment #4
manjit.singhAmazing module!! it would become so easy to change images if it published :)
Comment #5
chris_h commentedThis is really nice. Would be good to get a similar function in for edit forms - for multivalue uploads especially drag and drop is a massive timesaver. https://www.drupal.org/project/dragndrop_upload is pretty good on D7
Comment #6
avitslv commentedI have pushed the code to the sandbox project https://www.drupal.org/sandbox/avitslv/2413017 :)
And I have created a PA issue here https://www.drupal.org/node/2451563
For now it works with D7 and using only image formatter.
Comment #8
yoroy commentedWould be nice to see this in a prototype.
Comment #9
wim leers#8++
Comment #10
gábor hojtsyComment #11
samuel.mortensonI had no idea this issue existed, but I pushed up an experimental module to Github recently that has a similar feature set for Drupal 8/Quickedit: https://github.com/mortenson/quickedit_image
Comment #12
samuel.mortensonHere's how the basic flow works.
Comment #13
wim leersThat looks great! Would love to get that into core :)
Comment #14
samuel.mortenson@wim-leers Thanks! I should clean up the documentation and add tests before pulling any patches - but would this be appropriate as its own module (i.e. as it is now), or should it live in Quickedit?
Comment #15
wim leersIt should live in
image.module. It'd just be anotherInPlaceEditorplugin. See the structure:\Drupal\quickedit\Plugin\InPlaceEditor\FormEditoreditor.moduleprovides\Drupal\editor\Plugin\InPlaceEditor\Editorimage.moduleprovides\Drupal\image\Plugin\InPlaceEditor\Imagei.e. it's for
imagefields, whose Field Widget is provided by\Drupal\image\Plugin\Field\FieldWidget\ImageWidget, so it's also up to that module to provide a specialized in-place editor.Comment #16
wim leersPer #12, this obviously already has design! Would be so great to have this in 8.2 :)
Comment #17
wim leersEmbedded the GIF in #12 in the IS. The IS will need to be updated further though, to reflect the new direction.
Comment #18
wim leersAnd #12 already exists (at https://github.com/mortenson/quickedit_image), but this would definitely still need tests.
Comment #19
gábor hojtsyFix to the correct media tag.
Comment #20
samuel.mortensonWorking on a patch without tests to get the issue started, since it seems like there's a lot of interest.
Comment #21
wim leersAwesome! :)
Comment #22
samuel.mortensonHere's a first-shot patch, I can work on tests too but it seems like other people were interested in taking a crack at that. If no one claims that task by tomorrow I can start writing something.
Comment #23
webchickYay!!
Comment #25
wim leers<3 samuel.mortenson <3
I'll review tomorrow.
Comment #26
wim leersThis will definitely need review from a JS maintainer like @nod_.
In the mean time, here's my high-level feedback. There is room for making things more robust, and complying with all the nitpicky things that core complies with, but overall, this already looks great!
I think it'd make sense to merge these in a single
/quickedit/image/{entity_type}/…route, with GET used for reading the info, and POST for changing it.s/Quickedit/Quick Edit/
Where is this element (and its event handlers) being removed?
These global selectors make me nervous. We should do scoped searching, i.e. within the
this.$el. In other words, this should usethis.$el.find(SELECTOR)instead. That'd remove all risk of potentially changing other elements (outside of a Quick Edit context) that happen to use the same classes.Why provide a new utility instead of using
Drupal.ajax? I'm sure you have a good reason, but let's document that in the docblock for this function then.So, like this :)
s/Ajax/JSON/
Since this is modifying metadata, you'll need to provide an empty update hook in
image.install, to clear caches, to ensure that existing sites start using this new default in-place editor :)Let's use strict equality here.
Also, you can just return this condition. So rather than
if (CONDITION==TRUE) { return TRUE} return FALSE, you can just doreturn CONDITIONComment #27
samuel.mortenson#26.1 My only hesitation with this is that you would be GET'ing field settings, and POST'ing the new file upload, so from an API perspective it's a bit confusing. If you'd like, I could try to come up with a generic object that could be passed both ways, containing the file and its metadata (alt/title/etc).
#26.2 Done, I make this mistake all the time.
#26.3 I believe that
Drupal.quickedit.EditorView.save()replaces the contents of the entire View with the new field, which would remove the dropzone element. That said, event handlers are not explicitly removed. Should I be doing this beforeDrupal.quickedit.EditorView.save()is called?#26.4 Done.
#26.5 Drupal.ajax is, for the most part, intended to be used in correlation with the Form API. Since this editor doesn't use the Form API and the routes return JSON objects that don't include things like Drupal.AjaxCommands, Drupal.ajax isn't the best fit. The reason I architected the editor this way is so that, at some point, the routes could be made more generic and used by non-Drupal/Quickedit specific components. An example of this is CKEditor, which supports drag+drop file uploads. Drupal 8 doesn't allow this yet in its WYSIWYG implementation, but it could easily be added in a follow up issue, given the logic being worked on here. Tying these routes to the Form API and Drupal's AJAX system would make that integration more difficult.
#26.6 Noted!
#26.7 Done.
#26.8 Done, I only added an update to image.install since responsive_image is dependent on image, and wouldn't need its own cache flush.
#26.9/#26.10 Done.
Comment #29
wim leers#26.1: having looked at the code closer, you're absolutely right. Never mind me :)
#26.3: I'd have to dive deeper into the code to make a firm recommendation. But I think it'd be at least great to document where these are being removed.
#26.5: Great! Can you move that explanation into the code as a comment, so that future readers/maintainers of the code know this too? :)
#26.8: Yep, perfect!
Comment #30
samuel.mortensonAdded clearer documentation per #29.
Comment #32
samuel.mortensonRan into case insensitivity issues with Git, re-created #30 with the correct file name.
Comment #34
samuel.mortensonAdded library override in the stable theme, which should pass tests.
Edit: Some permission changes got thrown into the patch by accident, but as we still need to write tests for this I'm not too worried. Please ignore this when reviewing the patch. Sorry!
Comment #35
Bojhan commentedLooking great, hope we can get this in!
Comment #36
wim leersDoes this mean we already have usability sign-off?
Comment #37
Bojhan commentedI guess I could have stated it more official :P. Yes!
Comment #38
wim leersAlright, in excitement, here's another review, this time with lots of nitpicks!
The key thing that we still need, is tests. You could quite easily test the two new routes using classic tests. But we should also test the JS in at least a superficial way (requiring perfect test coverage for that is unreasonable, since Quick Edit itself has zero JS test coverage, because JS tests didn't exist yet back then). You can find a bunch of examples in core by searching for
JavascriptTestBase.This needs to be split in functional styles and theme styles.
And then the theme styles should be moved into Classy perhaps? Not sure about that, but I'm certain about the splitting.
Flexbox! First time we are getting that into core!
Why a hover class? Why not the pseudoclass?
Woah. That's a scary selector. Wouldn't be using
> *be better?8201, since this is for 8.2.x
Let's add a newline to satisfy git
The
@lendscomment is wrongc/p remnant
The "the" fits on the previous line
I think these must use
Drupal.theme(), so that themes can override these JS templates. With Backbone/Underscore templates, that's not possible.Unless you can justify this, of course.
Violates Drupal core's
eslint.Calling
this.save()for validation looks stranges/editor/in-place editor/
These mode changes need to be removed :)
Comment #39
samuel.mortenson#38.1: Done. Both stylesheets are duplicated in stable, which should trickle down to most themes.
#38.2: I don't dare attempt vertical+horizontal centering without it. ;)
#38.3: The "hover" class is unique to ":hover" in that it only is added if a user is hovering a file over the dropzone area. This allows us to indicate that an area is "droppable" in a unique way to just hovering over the dropzone with a mouse.
#38.4: It is scary, but it is necessary to avoid a host of issues with drag+drop. Without a fix like this, if a user drops a file onto the icon or text inside the dropzone, the *drop events will be triggered on those elements and not the dropzone, which is what we have events bound to. This usually results in the browser redirecting to the file, which is not good. See http://stackoverflow.com/questions/10867506/dragleave-of-parent-element-... for more info.
#38.5/#38.6: Done!
#38.7: I'm not sure what's wrong with it exactly, but I'm copying what Quickedit is doing for all of its Backbone Views and Models. See http://cgit.drupalcode.org/drupal/tree/core/modules/quickedit/js/views/A... for what I based this off of.
#38.8: Done.
#38.9: If I put "the" on the previous line, it will be 81 characters long.
#38.10: Why not both? I went ahead and moved all the templates to the Drupal.theme namespace, but kept the Underscore template style. Users can choose to override these with raw functions if they wish.
#38.11: Done, and I fixed a few other ESLint errors.
#38.12: The comment was outdated, the save method is not overridden.
#38.13: Done!
#38.14: Sorry about that, I did mention it in my comment but knew it would come up.
Sadly I'm going offline for the weekend so I won't be able to write tests just yet, but I'm dedicated to doing this next week. If anyone wants to take the reigns on this, I won't mind.
Comment #40
wim leersAwesome :) I'm hoping @nod_ will have time to also review this. Ideally, I should be able to provide a more thorough review of the JS, but I haven't touched Quick Edit's JS in well over a year (if not two). So I'm personally actually already okay with this code, it's sufficiently maintainable already. The only thing that is an absolute must-have still is test coverage.
Comment #41
samuel.mortensonAdded tests!
Comment #42
dawehnerGiven that this is a JS based feature we should also have a JS based testing, see #2469713: Step 2: Create a JavaScriptTestBase using PhantomJs Driver/Binary
Comment #43
wim leersAgreed. The most relevant example to look at is probably
\Drupal\Tests\toolbar\FunctionalJavascript\ToolbarIntegrationTest.Comment #44
samuel.mortensonI agree, but with Quick Edit already having no Javascript test coverage I'm wondering if that should be a follow up issue.
Comment #45
dawehnerWell, we are talking about a feature request, aren't we :)
Comment #46
wim leersI hear you. But the rule is: "nothing new that uses JS gets added without tests". Otherwise the "lack of tests" problem just becomes bigger.
You don't need to test every possible edge case. Just test the common case. It'd be unreasonable to require you to have test coverage for every Quick Edit edge case, that'd indeed be out of scope.
Comment #47
samuel.mortensonGot it, I'll start re-writing the test.
Edit: I actually like the test I already have, it makes sure the controller works without taking the editor into account. I'll write a new Javascript test for the most basic drag+drop upload behavior.
Comment #48
wim leersYes! Keep the current test — it tests the endpoints, which is great. Just add one to test the JS code too.
Comment #49
samuel.mortensonHere's a basic Javascript test which covers the standard upload flow that this feature provides. To accomplish this I had to move some code around and create new traits, as well as researching a way to mock the drag and drop behavior since we're using a headless browser and not something like Selenium. Hopefully the Quick Edit bits inspire a base class and larger test coverage for Quick Edit in the future!
Comment #51
samuel.mortensonLooks like the pesky GastonJS bug I found while working on this popped up again. Here's a small change that might fix it (locally the test passes for me with or without this).
Comment #53
samuel.mortensonSo after some troubleshooting and screenshot-ing, I found that the inconsistent part of the tests was Quick Edit itself. Debugging the HTML output of the session right before failure showed either "Your changes to Test Node could not be saved" or "Could not load the form for ..." messages coming from Quick Edit after the "Save" button was pressed. Everything up to that point worked consistently without errors.
Now the test as it stands now will cover everything up to the point of saving, but will not actually save the Node. This shows that the Javascript and Controller works, but of course doesn't prove that the new Image is really set on the Node. Unless someone knows a path forward, I would suggest troubleshooting the Quick Edit weirdness when we actually add Javascript test coverage for that module.
Comment #55
wim leersSounds tricky but great!
+1 :) I'm certain this will help!
#53: +1 for that scope of testing. This tests this in-place editor, nothing more. That's fine.
However, what I'd still like to see this testing, is entering a value for alt text, and then verifying that it's there. Clicking the image again, to modify its alt text, then verify that the modified alt text is present. Then I think this is testing everything of this in-place editor.
This will always be true. Let's move this
$this->drupalCreateContentType()call into asetUp()method.These can also be moved into a
setUp()method.Elegant :)
Woah, clever!
I think these selectors include the Quick Edit entity + field selectors, to ensure these have appeared in the expected place.
Comment #56
wim leersI also just manually tested this and MAN THIS IS AWESOME!!!!!!!!!!
Comment #57
wim leersReally the only remark I have on the UX is that the label says instead of . The image widget says . I think this should too. For consistency, but also understandability: sounds too tech-y, too programmer-y for a content author.
Comment #58
wim leers#55 is a review of just the JS test coverage.
Here's a review of the entire patch. Basically only nits. This patch looks very close to ready to me :) I think this is looking very likely to still land in 8.2!
Must fit in 80 cols.
I'd omit the word "module's". Just "the Image in-place editor" is fine, and actually is even more accurate.
Shouldn't be here?
A single small eslint error here :)
This is creating an
<input type=file>without putting it in the DOM, right? Perhaps a brief comment here would be valuable.Nit: these are 3 points, should be an ellipsis:
…, not....This can be reformatted a bit to put more on the same line.
Super nit: s/editor agnostic/editor-agnostic/
Must fit in 80 cols.
Suggestion: s/a JSON object/JSON/
This message looks a bit weird to me. It's not really a requested image, is it? It's an uploaded image. It's really just an image. So what about
The image failed validation.?Comment #59
Bojhan commented@Wim I also never understood why its "Alternative". Its the only text :D, but anyway guess we should just follow the spec.
Comment #60
wim leersHeh :) We can open a separate issue to rename to in a separate issue for all places in drupal core where it is used if you want :)
Comment #61
samuel.mortensonAll review comments addressed, and tests fixed (with the Quick Edit save added back in!) locally.
Comment #62
wim leersDon't we also need the
mozandmsones? And perhaps also the unprefixed (yet unofficial) one?Great! But there's no test coverage for this in
QuickEditImageControllerTest. A simple check with an anonymous user to verify that they get 403 responses is sufficient.Nit: s/Stores the/The/
s/Ajax/JSON/
This should be
\Drupal\Core\Cache\CacheableJsonResponse, and needs the appropriate cache tags.Wrong comment.
Nit: We need an empty line between the last
@paramand the@return.Nit: s/Login/Log in/
Let's put these all below each other.
Also, let's rename this from
$this->adminUserto$this->contentAuthorUseror something like that, and remove all the administrative permissions?Comment #64
samuel.mortensonAll notes addressed, again. :-)
#62.9 Was really helpful since it uncovered that QuickEditImageControllerTest didn't need to extend ImageFieldTestBase, as it wasn't testing any Drupal forms. Now the setUp method of both tests are in sync.
For the test failure - I can't replicate it locally, but it could be that the wait time isn't long enough for the upload. I bumped it up, but if this fails for the same reason I'll probably need to debug the TestBot.
Comment #66
samuel.mortensonI have a new theory - in
Drupal.quickedit.editors.image.uploadImage, an AJAX POST is made, then when it finishes successfully the dropzone element is removed. So really, we need to do two waits - one for AJAX, one for the dropzone element to be removed.Comment #68
samuel.mortensonWell that theory was wrong - let's remove what's failing now and go back to a normal AJAX wait. From there we can debug the next failure.
Comment #70
dawehnerThis is a patch triggered by my daily dealing with APCU
Comment #71
wim leersReproduced locally (with APC enabled or disabled, doesn't matter):
Trying to figure out a fix.
Comment #73
wim leersI'm pretty certain that I've found the reason it is not working for testbot nor me, but is for @samuel.mortenson. Phantomjs.
By including #2702661: Make it simple to take screenshots whilst using JavascriptTestBase's patch and taking a screenshot, you'll see that the
input[type=file]continues to say "Choose file". (This patch/test uses that just to simulate a dragged-and-dropped file.)So I started searching, and found http://stackoverflow.com/questions/29916779/file-upload-with-behat-mink-..., which points to https://github.com/ariya/phantomjs/issues/12506. It was fixed in phantomjs 2.1 (https://github.com/ariya/phantomjs/milestone/14?closed=1), released on Feb 3, 2016.
On my machine, I have this version:
… which says "stable 2.1.1", but then later it says "2.0.0", but really it's been compiled in February 2015, and the fix only landed in December 2015. (Oh, I guess "stable 2.1.1" means that that is the current stable version.)
After updating (to 2.1.1), this is what happens:
So, testbot must be running Phantomjs 2.0.x, instead of Phantomjs 2.1.x.
EDIT: samuel.mortenson confirmed: he's running PhantomJS 2.1.1
Comment #74
wim leersTalked to testbot maintainer @Mixologic. He confirms testbot is currently on PhantomJS 2.0. So that's definitely the explanation then. He says updating PhantomJS may be possible in the next few days.
See #2773637: Update PhantomJS to 2.1.1.
Comment #75
wim leersThe only possible work-around is to create a
Fileobject ourselves. See https://www.w3.org/TR/file-upload/#dfn-filelist. Concrete example at the bottom of http://thinkmoult.com/using-sahi-mink-behat-test-html5-drag-drop-file-up.... This works in Chrome for example:But in PhantomJS 2.0, and 2.1, and HEAD, this is what you get:
PhantomJS issue: https://github.com/ariya/phantomjs/issues/14247.
So, alas, there's no work-around possible.
Comment #76
samuel.mortensonFiled #2773791: Clicking elements with children in Javascript tests throws a GastonJS exception to add my triggerClick() fix to core.
Comment #77
samuel.mortensonI know the TestBot hasn't been updated yet, but I wanted to re-post my patch from #64 since the last three patches were just debugging the TestBot.
Comment #81
droplet commentedFixing tests
Comment #82
samuel.mortenson@droplet Awesome work! Your debugging on the triggerClick() problem has been great, and seeing the hack removed here with tests passing is very validating.
Now I'm just waiting for more review. :-)
Comment #83
MixologicYep. I see you see that the testbot is now updated. Carry on.
Comment #84
wim leersWOOT! GREEN!
This feature is perfectly isolated: it's a new Quick Edit in-place editor, plus supporting files. It can therefore be easily reverted during beta or RC if problems are uncovered.
IMO:
Comment #85
droplet commentedLet's vote for REALTIME debugging.
#2775653: JavascriptTests with webDriver
and make Drupal Tests compatible with Psysh, then we able to do live code & testing Tests.
(Just a note, I didn't review any of this patch. I'm fixing the tests only.)
Comment #86
phenaproximaFor what my opinion is worth, which is probably nothing...+1 to what Wim said in #84. This is a valuable, low-risk feature and would be a big win for 8.2.
Comment #87
slashrsm commented+1 for RTBC. Great improvement and isolated enough to be a save thing to add.
Great work @Samuel.mortenson!
Comment #88
alexpottThis can occur in a blocking patch. At 60k this patch is big enough and these changes distract from the context.
IN #26 @Wim Leers asks for a review from a JS maintianer like @_nod that still does not appear to have occurred. @droplet notes in #85 that they have not reviewed any of the patch,
Comment #89
alexpottIt would also be great to get a CSS maintainer's eyes on the issue - maybe @Cottser?
Comment #90
webchickWim is on honeymoon for the next 3 weeks, so if someone else is able to re-roll per @alexpott's comments, that'd be awesome.
Comment #92
samuel.mortensonHere's a shot at the refactor suggested in #88. I filed #2782309: Refactor File and Image related image field creation logic into a new trait for the new traits, and re-rolled the patch from #81 to not include any of the trait changes.
Keeping the issue in Needs Work as it will fail tests until the new issue is committed.
Comment #93
samuel.mortensonComment #94
xjm@samuel.mortenson, only committers should add the beta target tag. (We have some disagreement about whether this issue can be one.) Thanks!
Comment #95
xjmTriggering testbot.
Comment #96
xjm@samuel.mortenson, one strategy we can use is to combine "-do-not-test" patches containing only the changes for this issue with full patches that include the blockers, to prove tests pass. Otherwise we should postpone this issue on the other.
Comment #98
samuel.mortenson@xjm Here's the full patch from #81 and a do-not-test patch without the trait refactoring.
Sorry for adding the "beta target" tag prematurely, I inferred from @wim-leers and @webchick's feedback that there was consensus among core committers. Won't happen again!
Comment #100
nod_Reviewing
Comment #101
nod_Lost my comment mid way so a quick version and i'll finish later.
there is a native function for this. If it's trimmed, it's not really the original value no?
I'd rather keep things explicit and have preventDefault and stopPropagation everywhere.
It's better do to the preventDefault and stopPropagation after any handling code. In case the code breaks.
Always use .on(), not the jquery event aliases
This is not available on IE9/10, I'm fine with it but that might be a problem.
Might need a Drupal.attachBehaviors no?
Why not make it like the jquery ajax function and let it accept an object. that would prevent the need to pass in null later on.
$.extends() can be use to merge the default and provided values.
We're supposed to use it like Drupal.theme('quickeditImageDropzone', {}) but it's not a big problem
Comment #102
nod_Yep, does look much better.
Addressed all my issues, Need an descision from core comitters on the IE10 not supporting FormData.
underscore templates are not necessary, it doesn't take much more code to do it in JS and we don't introduce a depencency on underscore templates. If js templating (as in using dedicated templating language) happens in D8 it need to be a dedicated decision, not sneaked in in an unrelated patch.
Comment #103
samuel.mortensonAny word from core maintainers about whether or not this is going to be targeted for the 8.2.x beta cycle?
Comment #104
gábor hojtsy@samuel.mortenson: the last beta was released for Drupal 8.2, so no chance there. RC1 is coming out next week, see https://groups.drupal.org/node/513529. Improvements are already committed to 8.3, eg. the views listing page is already significantly different in 8.3 from 8.2, so this has a good chance to land early in 8.3 and get released next April.
Comment #105
samuel.mortensonThanks! Updating the issue to reflect that.
Comment #106
wim leersSad to see this didn't make it in 8.2. Of course, we need to stop somewhere. Glad to see this is extremely likely to be in 8.3!
Comment #107
wim leersActually, IE10 does support
FormData. It's just buggy, and the bugs are only being fixed in Edge (not even in IE11). IE10 currently has 0.57% global market share — even less than IE9! And it's unsupported since January 12, 2016.I'll be bold.
Comment #109
samuel.mortensonFixed minor patch conflict.
Comment #110
samuel.mortensonComment #112
wim leersThanks for the reroll!
Comment #113
xjmNice, glad to see this RTBC again.
Looks like @alexpott asked for @Cottser's feedback on the CSS, so assigning.
Comment #114
samuel.mortensonThere is some movement in other issues around doing similar File/Image test refactors as this issue - so we should try to incorporate #2738567: Add test trait for drupalGetTestFiles and drupalCompareFile when eventually committing this issue.
Comment #115
wim leersIf this issue would just land, then that issue can just update the tests added by this patch. :)
Comment #116
star-szrThanks for the bumps, hoping to get to this soon.
Comment #118
wim leersComment #119
wim leersAs of #2235977-68: JS Client-side file validation is broken (because ajaxPageState is broken?), that major bug's patch is now also depending on the JS test trait that this issue adds.
Also, this issue is a very big usability win.
For both of those reasons, bumping this to .
Comment #120
samuel.mortensonRe-rolled the patch assuming that #2782309: Refactor File and Image related image field creation logic into a new trait is going to get committed. This patch is smaller than #110 as #2738567: Add test trait for drupalGetTestFiles and drupalCompareFile was already committed.
Comment #121
wim leersComment #122
wim leersWell, actually, based on #120, this is now blocked on #2782309: Refactor File and Image related image field creation logic into a new trait.
Comment #123
naveenvalechaUnpostponing it after #2782309: Refactor File and Image related image field creation logic into a new trait
Comment #124
naveenvalechaBack to RTBC per #121
Comment #125
samuel.mortensonAs to not confuse reviewers, I've re-named the no-traits patch and re-uploaded it.
Comment #126
wim leersPerfect :)
Comment #127
dawehnerOne thing I'm wondering is: is it okay to add a route which requires another module to be installed.
Nitpick: its always better to use string mode when dealing with strings.
Just a personal style: IMHO its just way nicer to use
->get($field_name). Note: get(0) is the same asfirst()Comment #128
wim leers#127: RE: route requiring another module. That's a very good point actually. Perhaps we should conditionally add those routes, only if the
quickeditmodule is installed?#127.1 s/string/strict/ :D
Comment #129
star-szrSorry for the delayed review, folks. I'm not sure if the routing point brought up in #127 needs addressing before commit or not.
I think these need
/* LTR */comments and relevant RTL code added (see screenshots below). https://www.drupal.org/docs/develop/standards/css/css-formatting-guideli...LTR:
RTL:
Comment #130
tim.plunkettThis isn't necessarily a security issue, since anyone hitting this route should get a ServiceNotFoundException. But yes, these should be added dynamically.
Comment #131
wim leersNW for #127.1 (it's already safe as #130 explains, but it's clearer) + #129.
Comment #132
samuel.mortensonI based my route definition on the editor module's in-place editor route, which is not added dynamically:
I'll re-roll today and address #129 and #127, but if we need to address the route issue we should do it for editor as well.
Comment #133
wim leersExcellent point. Let's defer that to a follow-up then.
Comment #134
samuel.mortensonThis patch addresses the notes in #129 and #127.
Comment #135
wim leersThanks!
Comment #136
star-szrThanks! Only minor things left I think. :)
CSS
One more minor CSS point:
We should also include the non-prefixed version. Chrome 54 and higher even support it :)
http://caniuse.com/#search=user-select
PHP
Minor: PHPCS wants this to be int, not integer.
Minor: Missing blank line before the class' closing brace per PHPCS.
JavaScript
There are also some eslint errors. The
'use strict'ones seem wrong, maybe something is wrong on my end or we need to update our estlintrc again? The rest seem legitimate though.Comment #137
samuel.mortensonAddressed the notes in #136, except the "use strict" warning, which would also apply to many other Drupal JS files. Guessing that's just a quirk.
I also updated the stable theme's copy of image.theme.css to reflect the changes I made in #134, I missed that last time.
Comment #138
samuel.mortensonComment #139
wim leersThe strict thing is indeed a known problem, being fixed at #2821113: eslint 'use strict' rule wrong.
Comment #140
droplet commentedIs it really working?
Could anyone teach me how to use it? I remember that's no config when I tested and patched in #81. Now, I can't drag-n-drop.
Tested with simplytest.me also.
Comment #141
samuel.mortenson@droplet Yes, the patch still works. To test it, you can install the standard profile, create a new Article with only* the Title and Image fields filled in, then Quick Edit that Article from the front-end. Once Quick Edit is initiated, clicking on the Article's image should prompt you to either click to upload or drag and drop.
* The Bartik theme floats Article images the left, which puts them below the body field, which has 100% width. As a result you cannot Quick Edit Article images in Bartik if the body field is filled in.
Comment #142
droplet commentedAhh. I found the problem.
It doesn't work if I ALSO upload another an image via IMAGE ICON in CKEditor.
EDITED: even only TEXT in body field, it doesn't work
Comment #143
samuel.mortensonThis patch does not add any functionality to CKEditor, it only adds a new inline editor to single-value Image fields. You should not be using the body field for testing.
Comment #144
wim leers#142: for that, there is #2560457: Support drag-and-drop image uploads in CKEditor. This issue applies only to Quick Edit. You're referring to CKEditor.
Updated the issue title to make that as explicit as possible.
Comment #145
droplet commentedUmm.... any issues for overlay conflicts between 2 fields?
There's a hidden bug in CORE (or this patch)
1. applied patch & update.php & clear caches.
2. GIT reset --hard, clear caches.
3.
ERROR 500
drupal8x/quickedit/attachments?_wrapper_format=drupal_ajax
Looks like doesn't clear the router caching correctly
Comment #146
samuel.mortensonQuick Edit has problems when fields are :
Themes can do lots of things to make Quick Edit inaccessible, and while we could patch Bartik to not use floats for image fields, that is out of scope for this issue and may cause problems for users with Bartik sub-themes.
I haven't seen the bug you pointed out, can this be replicated consistently by installing Drupal, applying the patch, then running update.php?
Comment #147
star-szrI don't think I'll have time to re-review this myself in the near future, but another committer can pick it up. I was happy with it overall last I looked :) thanks all!
Comment #148
tstoecklerAre we OK with image module providing a library that depends on quickedit? The alternative would be to add this library in
hook_library_info_build()(or what it's called) conditionally if quickedit module is installed. Not sure ...Comment #149
wim leers#148: that
quickedit.inPlaceEditor.imageasset library will only be attached by Quick Edit the module. Just like it's okay to define a service that will only be conditionally picked up by some module, this is a library that will only be conditionally picked up by some module.So even if we want to move this to
hook_library_info_build(), that can absolutely be done in a follow-up.This patch has been RTBC for >2 months, since #112. Everything since than has been nitpicks. We can keep nitpicking it to death, or we can land it and then just keep improving the Quick Edit module. At this rate, nobody will ever again want to contribute new features to Quick Edit. :(
Comment #150
ipwa commentedI completely agree, I really wanted to see this on Drupal 8.2
Comment #151
tstoecklerAhh I missed, that the library is conceptually attached to the plugin.
In that case, there's no reason for any additional logic, in my opinion.
Thanks for setting me straight!
Comment #152
wim leersnp, and thanks for looking out :) I totally do appreciate the constructive criticism!
Comment #154
webchickReviewed this on UX meeting today, since Cottser handed it over for another committer to look at.
While testing, we ran into the same issue as @droplet, where if you upload an image via CKEditor, as well as an image via a regular image field, the Quick Edit target will fail to allow you to target the Image field (only Body). However, this seems to be a pre-existing condition, according to comments by Wim and others.
We walked through the patch together and looks good to us. Nice test coverage (including JS tests! :)). Code all seems to be conforming to coding standards (or at least https://github.com/alexpott/d8githooks wasn't triggering anything), and error handling seems to be working well, so we should be good to go here.
Committed and pushed to 8.3.x. Thanks!
Comment #155
xjmYay!
Comment #156
xjmComment #157
dmsmidtThis is so awesome, just tested it, thank you for this!
Happy that this has landed, thus I won't reopen this, but create some follow up issues:
#2827997: Quick Editing single images is impossible when they are floated
#2827996: Drag and drop UX for Quick Editing small images is difficult
Comment #158
rajab natshahNice, at last this issue is committed!!!
Comment #159
wim leers#157: thanks!
Comment #160
star-szrI definitely played a part in delaying this (#149). Sorry to be a bottleneck, but happy to see this in :)
Comment #161
dmsmidtJust for reference, another two follow ups:
#2829790: Unexpected behavior when switching from one changed Quick Edit field to another
#2829792: Improve the "Image" InPlaceEditor plugin's "alt" attribute UI
Comment #162
wim leers#161: Thanks! Updated/clarified both of those issues. Thanks so much for digging deep and finding edge cases :)
Comment #164
wim leersAlso updated https://www.drupal.org/docs/8/core/modules/quick-edit/overview to mention this now!
Comment #165
lewisnyman