? ? NPM Resource Changed Pending

User tests: Successful: Unsuccessful:

avatar dgrammatiko
dgrammatiko
30 Jul 2021

Pull Request for Issue #34885 (comment)

Summary of Changes

  • Fixes the reset button

Testing Instructions

Try edit some image and hit the reset button

Actual result BEFORE applying this Pull Request

Expected result AFTER applying this Pull Request

Documentation Changes Required

No

@laoneo

55117f3 30 Jul 2021 avatar dgrammatiko Reset
avatar dgrammatiko dgrammatiko - open - 30 Jul 2021
avatar dgrammatiko dgrammatiko - change - 30 Jul 2021
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 30 Jul 2021
Category JavaScript Repository NPM Change
avatar laoneo
laoneo - comment - 31 Jul 2021

Reset event is triggered, but when I resize first and then do a reset it jumps to the first tab but does not revert the resize.

avatar laoneo
laoneo - comment - 31 Jul 2021

Also when I put the crop plugin on the second position and resize first and open the edit page the canvas from the crop plugin is shown initially.

avatar dgrammatiko
dgrammatiko - comment - 31 Jul 2021

Also when I put the crop plugin on the second position and resize first and open the edit page the canvas from the crop plugin is shown initially.

Yeah, the whole thing is supposed to be asynchronous now but I guess I have to redo the activation/deactivation parts more efficiently. I Will update this PR later

avatar dgrammatiko
dgrammatiko - comment - 31 Jul 2021

Reset event is triggered, but when I resize first and then do a reset it jumps to the first tab but does not revert the resize.

Hmm, weird are the width/height values correct after reset (eg the initial ones)? If so it's just the preview image...

avatar laoneo
laoneo - comment - 31 Jul 2021

Perhaps it has to do with the async, let you do the fix there and then we see if it still is an issue.

28da0e4 31 Jul 2021 avatar dgrammatiko Fixes
avatar dgrammatiko dgrammatiko - change - 31 Jul 2021
Labels Added: NPM Resource Changed ?
avatar dgrammatiko
dgrammatiko - comment - 31 Jul 2021

@laoneo can you check if 28da0e4 solves the issues? Thanks

f60944c 31 Jul 2021 avatar dgrammatiko Meh
avatar RickR2H
RickR2H - comment - 31 Jul 2021

@dgrammatiko I've tested this PR and the fix works. I noticed that after pressing reset, I get redirected to the first tab. Is this intended behavior?


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/34994.

avatar laoneo
laoneo - comment - 31 Jul 2021

It works better and the events are fired. I have the same behavior as @RickR2H that it jumps to the first tab. The form controls are also not reset (not sure if this should be part of this pr). In the following image I rotated and then hit reset, the image is like the original, but the form control angle not:

image

The problem I have is that my plugins depend on the form controls, so reset has basically no effect as on activate I do read them again.

Nice solution would be when the core would reset the form controls to the initial value, not so nice would be when each plugin has to do that by its own.

avatar dgrammatiko
dgrammatiko - comment - 31 Jul 2021

I get redirected to the first tab. Is this intended behavior?
I have the same behavior as @RickR2H that it jumps to the first tab.

This is intended behavior. There is an open PR that adds undo and redo, which will let you stay in the same tab

The form controls are also not reset (not sure if this should be part of this pr)
Nice solution would be when the core would reset the form controls to the initial value

@wilsonge and I had a quick chat on this and we decided to skip the resetting of the forms (it wasn't implemented also before all these changes).
Unfortunately, the Edit class is just orchestrating things so having it to hold the state of the form elements would be a big stretch and it probably fail miserably in many cases (Web Components with shadow DOM, fields that are just an entry point for Vue, React, Svelte, etc). I think the easier solution is to have each plugin register its own initial state and have one more function in the API (eg Reset) that when called it will restore all the initial values to the respected form elements. Automation comes with limitations...
Anyways if George is ok I can add these here or in another PR, it's not much code anyways

avatar richard67
richard67 - comment - 31 Jul 2021

@laoneo @RickR2H With respect to @dgrammatiko 's answer and if everything else was ok, would you say your test was a successful test? If so, please mark your test result in the issue tracker. Thanks in advance.

avatar laoneo
laoneo - comment - 31 Jul 2021

I'm fine with a Reset function in the API. But switching to the first tab should definitely be fixed as it is cleearly a disturbing behavior. @richard67 till then for me no successful test.

avatar richard67
richard67 - comment - 1 Aug 2021

@dgrammatiko The js linter complains about missing semicolon: https://ci.joomla.org/joomla/joomla-cms/46304/1/21

/********/src/build/media_source/com_media/js/edit-images.es6.js
  145:9  error  Missing semicolon  semi
avatar richard67 richard67 - test_item - 8 Aug 2021 - Tested successfully
avatar richard67
richard67 - comment - 8 Aug 2021

I have tested this item successfully on 68c6485

"Reset" button works fine for "rotate" and "resize", and active tab stays the same when using it.

For "crop" the "reset" button does nothing, but I think that's by design because there is nothing really cropped as long as the change is not saved.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/34994.

avatar richard67
richard67 - comment - 8 Aug 2021

@RickR2H Could you test again? Thanks in advance.

@laoneo If you are available, could you spend the time for a test, too, in case if Rick isn't available.

avatar RickR2H RickR2H - test_item - 8 Aug 2021 - Tested successfully
avatar RickR2H
RickR2H - comment - 8 Aug 2021

I have tested this item successfully on 68c6485

Pressing reset button will reset the original preview of the image for rotation and scaling.
Values in the text boxes are not updated as stated before.
Pressing reset will leave you in the current tab.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/34994.

avatar richard67 richard67 - change - 8 Aug 2021
Status Pending Ready to Commit
avatar richard67
richard67 - comment - 8 Aug 2021

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/34994.

avatar laoneo
laoneo - comment - 8 Aug 2021

When I activate my media edit plugins I get now the following error on page load:
image

Not sure if it is related...?

avatar richard67
richard67 - comment - 8 Aug 2021

@laoneo Is your branch up to date? Maybe it is missing this fix: #35058 . Or if you use the complete branch of this PR maybe that branch is not up to date and so is missing the fix?

avatar laoneo
laoneo - comment - 8 Aug 2021

Yes it is up to date...

avatar richard67
richard67 - comment - 8 Aug 2021

@laoneo Does that happen also without the PR?

avatar laoneo
laoneo - comment - 9 Aug 2021

Without the patch, the error is a bit different
image

avatar laoneo
laoneo - comment - 9 Aug 2021

@dgrammatiko are these errors related to the recent changes or something old?

avatar laoneo
laoneo - comment - 9 Aug 2021

@wilsonge I would merge this one and then we can open another issue for the other error.

avatar laoneo
laoneo - comment - 9 Aug 2021

Here we go #35075

avatar wilsonge wilsonge - change - 10 Aug 2021
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2021-08-10 19:38:59
Closed_By wilsonge
Labels Added: ? ?
Removed: ?
avatar wilsonge wilsonge - close - 10 Aug 2021
avatar wilsonge wilsonge - merge - 10 Aug 2021
avatar wilsonge
wilsonge - comment - 10 Aug 2021

Thanks!

Add a Comment

Login with GitHub to post a comment