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

ADDS: Feature to decenter text in wysiwyg and markdown mode #521

Merged
merged 7 commits into from
Jul 21, 2020

Conversation

shreyaa-s-zz
Copy link
Collaborator

@shreyaa-s-zz shreyaa-s-zz commented Jun 1, 2020

  • FIXES: Decentering of a centered text #489

  • Enables decentering in both modes

  • Re-aligning center aligned text left aligns it

  • Selecting center aligned text as a substring and re-aligning the string center aligns the complete string

  • tests pass -- look for a green checkbox ✔️ a few minutes after opening your PR -- or run tests locally with grunt jasmine

  • code is in uniquely-named feature branch and has no merge conflicts

  • PR is descriptively titled

  • PR body includes fixes #0000-style reference to original issue #

  • ask @publiclab/reviewers for help, in a comment below

@shreyaa-s-zz
Copy link
Collaborator Author

shreyaa-s-zz commented Jun 2, 2020

The local tests are running fine but ci tests are still on hold, any idea what might be wrong? @jywarren @Shulammite-Aso @keshav234156 @NitinBhasneria ?

@keshav234156
Copy link
Member

I have made a PR in this regard

@shreyaa-s-zz
Copy link
Collaborator Author

#520 ? Let's wait for it to get merged then. Thanks!

@shreyaa-s-zz
Copy link
Collaborator Author

Copy link
Contributor

@VladimirMikulic VladimirMikulic left a comment

Choose a reason for hiding this comment

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

If you could fix formatting and have a consistent style, that would be great...

@Shulammite-Aso
Copy link
Collaborator

code looks great @Shreyaa-s do you mind making a GIF??
That would be cool too!

@keshav234156
Copy link
Member

@Shreyaa-s Where are the changes made in? in dist/* folder directly?

@shreyaa-s-zz
Copy link
Collaborator Author

simplescreenrecorder-2020-06-04_18 16 29
No changes to the folder. I mentioned the function that I changed.

@shreyaa-s-zz
Copy link
Collaborator Author

Some issues related to centering I found while testing #524 #525. Please have a look.

Copy link
Collaborator

@NitinBhasneria NitinBhasneria left a comment

Choose a reason for hiding this comment

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

@Shreyaa-s as @keshav234156 said, you have made changes in dist folder this is not a good practice as dist folder will build every time we run grunt due to which the changes will be lost.

@VladimirMikulic
Copy link
Contributor

@NitinBhasneria yes, you are right committing dist folder is highly discouraged, but PublicLab folks do it for some reason :(

@Shreyaa-s please run build and commit changes in the dist.

@shreyaa-s-zz
Copy link
Collaborator Author

Done. Thank you everyone!

@keshav234156
Copy link
Member

Hi @Shreyaa-s, I was reviewing this PR. If we at the start press center button it doesn't do anything. I think it should start writing at the center if no text is selected at the beginning.

@cypherean
Copy link
Contributor

Okay @keshav234156 . I'll make another PR for this.

@Shulammite-Aso
Copy link
Collaborator

This looks great!!🎉

@jywarren jywarren changed the base branch from master to main June 16, 2020 22:19
@jywarren
Copy link
Member

Hi all, great collaboration! Thank you for being so constructive and supportive in your feedback on this PR. You can never use enough emoji 😍 🎉 💯

just noting:

it should start writing at the center if no text is selected at the beginning.

I believe @Shulammite-Aso has suggested this (i may be mixed up) as a kind of state management way of managing formatting for this scenario. Would this be at woofmark or in this repo? Can someone help connect the dots to where that discussion was happening? Just want to be sure we stay coordinated. Thanks!

Copy link
Member

@jywarren jywarren left a comment

Choose a reason for hiding this comment

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

Wow this looks good. @shreyaa-sharmaa what do you think about writing a test to demonstrate this working? In general this is a best practice to secure functionality against future changes and I think at this point we should all start to do this.

It also makes reviewing much easier as we can read the test to confirm what the code is doing!

@cypherean
Copy link
Contributor

Hi all, great collaboration! Thank you for being so constructive and supportive in your feedback on this PR. You can never use enough emoji 😍 🎉 💯

just noting:

it should start writing at the center if no text is selected at the beginning.

I believe @Shulammite-Aso has suggested this (i may be mixed up) as a kind of state management way of managing formatting for this scenario. Would this be at woofmark or in this repo? Can someone help connect the dots to where that discussion was happening? Just want to be sure we stay coordinated. Thanks!

I'm not sure if I have come across this discussion before, @Shulammite-Aso would be able to guide us better here. I believe this should be done in this repo. We can add a condition if(!chunks.selection) before this piece of code.

@Shulammite-Aso
Copy link
Collaborator

@shreyaa-sharmaa I think this is the comment here #490 (comment) maybe some code inside an if(!chunks.selection) can give us similar behavior, I don't know. You should give it a try. I'm going to try digging into this myself too.

Thanks🎉

@cypherean
Copy link
Contributor

@jywarren there's an issue about integrating jest-puppeteer in Editor project like it is in image sequencer #503 which aims to create unit tests for the formatting options. Meanwhile, I'll add a test in a ...spec.js file for this.

@cypherean
Copy link
Contributor

The test flow I though of was:

  1. Enter ->Test <- in md textarea
  2. select the text b/w -> and <-
  3. click on center align button
  4. check that the resultant text is Test

Is that right? And feasible?

@jywarren
Copy link
Member

That sequence for tests sounds GREAT. Thank you!!! 🎉

@jywarren
Copy link
Member

Hi! I think we are ready for this to get a Jest test now! After #541 is now complete!

@cypherean
Copy link
Contributor

I'm working on that test now.

@cypherean
Copy link
Contributor

Added the test here. I believe it is failing for the same reason as that mentioned here #543 (comment). Local results for the tests:
After the first click:
screen
At the end:
screen1
The local tests:
Screenshot from 2020-07-02 17-34-55

@cypherean
Copy link
Contributor

cypherean commented Jul 6, 2020

Travis should pass after merging of #543

@jywarren
Copy link
Member

jywarren commented Jul 7, 2020

Resyncing! If it doesn't pass, perhaps it may need a rebase. Thanks, and great work!

@jywarren
Copy link
Member

Hi @shreyaa-sharmaa -- can you try rebasing this and hopefully it'll pass? Thanks! 🎉

@gitpod-io
Copy link

gitpod-io bot commented Jul 14, 2020

@cypherean
Copy link
Contributor

@jywarren this is ready to be merged.

Copy link
Contributor

@sagarpreet-chadha sagarpreet-chadha left a comment

Choose a reason for hiding this comment

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

excellent!

Just some changes required, also it is good practice to use const instead of var.
Also test is written beautifully! 🎉

src/modules/PublicLab.RichTextModule.AutoCenter.js Outdated Show resolved Hide resolved
src/modules/PublicLab.RichTextModule.AutoCenter.js Outdated Show resolved Hide resolved
src/modules/PublicLab.RichTextModule.AutoCenter.js Outdated Show resolved Hide resolved
src/modules/PublicLab.RichTextModule.AutoCenter.js Outdated Show resolved Hide resolved
@cypherean
Copy link
Contributor

Made the required changes. Please have a look @sagarpreet-chadha. Thanks! 😄

@cypherean
Copy link
Contributor

excellent!

Just some changes required, also it is good practice to use const instead of var.
Also test is written beautifully!

I used var to maintain consistency in the code since var is used in almost every other module. I can change it to const if that's better?

Copy link
Contributor

@sagarpreet-chadha sagarpreet-chadha left a comment

Choose a reason for hiding this comment

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

Awesome, looks good 👍

Yes we can use const going forward

@jywarren
Copy link
Member

Updating branch to then merge! Thanks!

Copy link
Member

@jywarren jywarren left a comment

Choose a reason for hiding this comment

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

Very nice, and love the tests. Thank you!

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.

Decentering of a centered text
8 participants