Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for thimble.mozilla.org#2508 - Quick Edit UI for box-shadow property #888

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open

Fix for thimble.mozilla.org#2508 - Quick Edit UI for box-shadow property #888

wants to merge 23 commits into from

Conversation

Cryzek
Copy link

@Cryzek Cryzek commented Oct 20, 2017

Related to mozilla/thimble.mozilla.org#2508 for creating an extension to open quick edit UI for box-shadow property( similar to color-picker).
This is a very early version with bugs, and lot of unnecessary comments, logs. So, it's not the most robust one.

It's a work in progress.
capture

@humphd @flukeout I have a lot of doubts on this one -

  1. Color picker - Even when in the box-shadow property, when cursor is over the color value, quick edit opens editor for color-picker instead of box-shadow one. Although it works to my advantage of not integrating an color-picker inside the box-shadow editor.
  2. Multiple box-shadows - I can't get an idea of how to implement an editor for multiple box-shadows. eg. box-shadow: 1px 1px black, -1px -1px grey
  3. Should inputs be replaced with sliders?

@flukeout
Copy link

Hey team - I'll be a bit delayed in checking this out. Just moved to a new machine and my Github stuff seems broken.

@flukeout
Copy link

flukeout commented Oct 20, 2017

Hey this is great! I'll provide some more feedback later. One thing I noticed is that if you are editing a value in one of the input boxes, if you backspace to delete a value like 2 it turns into 0 and then the cursor is placed behind the 0 so you end up typing a new value like 03 when all you wanted was 3. Do you know what I mean? It would be nice to be able to erase the value totally. Maybe if you leave the field blank and move away from the input, we can pick a default value to use.

By the way, great job getting this running! These inline editors are tricky. I'll give some thought to how we can treat overlapping editors. cc @gideonthomas @humphd do you have any thoughts? Maybe the little Icon could indicate the type of editor that it will pop up, so the user knows what to expect in ambiguous cases. Is it possible to set a priority order for the editors?

Copy link

@humphd humphd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll do a more thorough review after you fix the indents throughout this patch. It's looking like you're making it really far into this, nice job.

Question: what does tinycolor-min do? I wonder if we already have this type of code available in Brackets core.

@@ -0,0 +1,268 @@
define(function(require, exports, module) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you fix all new files to use 4-space indents please? There are some other indent issues below as well.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tinycolor-min is used in the InlineColorEditor at a stage for detecting if the color value is valid.
I didn't get the complete hang of it's but I used it anyway.

@Cryzek
Copy link
Author

Cryzek commented Oct 21, 2017

@flukeout Consider that a current value is - box-shadow: 5px 5px 5px 1px black,and the user edit's the blur value in the editor(box-shadow quick edit UI) by pressing backspace(so as to want to remove blur).

Right now this would change the string to box-shadow: 5px 5px 1px black. As a result the spread value would be assigned to the blur value. So, to prevent it, I set it to 0px.

@flukeout
Copy link

Sorry for the delay @Cryzek - am back in action now.

Is it possible to replace the value with 0 when you blur the input field? It's just really cumbersome right now when trying to change a 0 value to something like 3.

We could do this maybe by replacing the value in the CSS with 0 when the input field is blank, and then filling in the field with the 0 when you leave the input field?

However

If we replace the text inputs with sliders, we won't have to deal with this anymore since there will be no text editing of the values. What do you say to that?

@flukeout
Copy link

Another question, is it possible to show the Purple Indicator when we don't have a value for the property yet? Like, when the user types box-shadow:

image

@Cryzek
Copy link
Author

Cryzek commented Nov 14, 2017

@flukeout Thanks for the feeback.
I guess sliders would altogether avoid the current problem.
About sliders, is it ok to limit the range values?
What if the user types in a value larger than the fixed range, and then opens the quick-edit ui?

For the second comment, yes it is.
I changed the code to open the quick edit UI if the line necessarily contains box-shadow since a same value (eg. 2px 2px 2px 2px black) could be used within border property.

@humphd
Copy link

humphd commented Dec 4, 2017

@Cryzek how is this coming?

@Cryzek
Copy link
Author

Cryzek commented Dec 5, 2017

I'm sorry I haven't able to work on this for a while now. I had made a few changes earlier but after that I haven't worked on it further. Can I let you know in 2-3 days?

@humphd
Copy link

humphd commented Dec 6, 2017

@Cryzek yes, that's fine. I just wanted to check in.

Related to thimble.mozilla.org#2508 for creating an extension to open quick edit UI for box-shadow property( similar to color-picker).
This is a very early version with bugs, and lot of unnecessary comments, logs. It's a work in progress.
@Cryzek
Copy link
Author

Cryzek commented Dec 19, 2017

@flukeout I have made this working with input sliders. Can I use your css code from the ongoing work on border-radius quick edit by feihaozi77?

Cryzek and others added 11 commits February 20, 2018 14:51
Related to thimble.mozilla.org#2508 for creating an extension to open quick edit UI for box-shadow property( similar to color-picker).
This is a very early version with bugs, and lot of unnecessary comments, logs. It's a work in progress.
Rewrote most of the code from a huge procedural chunk to objects of type BoxShadowInput viz. BoxShadowLength, BoxShadowColor.

The new responsibilities are - 
+ InlineBoxShadowEditor - It initialises the widget and acts as intermediary for propagating values between text editor and box-shadow editor 

+ BoxShadowEditor - The overall manager for different BoxShadowInputs. Gets values from InlineBoxShadowEditor and passes them to the appropriate BoxShadowInput. 

+BoxShadowLength - BoxShadowInput for length types

+BoxShadowColor - BoxShadowInput for color value
@Cryzek
Copy link
Author

Cryzek commented Mar 8, 2018

@humpd Could you take a look?

Cryzek added 6 commits March 10, 2018 11:35
Earlier, the BoxShadowEditor, BoxShadowLength, BoxShadowColor were importing and using the complete exports objects. Fixed by requiring only the component.
eg. changed `require("BoxShadowInput")` to `require("BoxShadowInput").BoxShadowInput`;
Created BoxShadowInset that responds and provides control over `inset` property in box-shadow
…e box-shadow editor

InlineBoxShadowEditor uses a `orderOfValues` to preseve the user provided order of values while building the boxShadowString when changes are made in widget.
Note: Changes to BoxShadowEditorTemplate.html - renaming `slider-container` to `color-container` for color input
Changes to style.less - translation of toggle by amount of its width
@Cryzek
Copy link
Author

Cryzek commented Mar 10, 2018

Hi @humphd @flukeout. Sorry for the huge delays.
I have finally been able to get this working. The box-shadow editor allows control over the inset property of box-shadow, and the order of values provided by the user are preserved while making changes in the UI editor.
I'll start working on the comments and localization, if the work up to now looks good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants