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

Bold formatting bugs - need jquery.autotype to write a test #307

Closed
jywarren opened this issue Mar 18, 2019 · 10 comments
Closed

Bold formatting bugs - need jquery.autotype to write a test #307

jywarren opened this issue Mar 18, 2019 · 10 comments

Comments

@jywarren
Copy link
Member

jywarren commented Mar 18, 2019

Please note we are preparing to participate in Google Code-in, and have reserved this issue for GCI participants - but we'd love to have your help with another one! Please check out https://code.publiclab.org to see more.

Problem statement by the user Jeffrey: I was typing into an editor, and did the following sequence:

  1. made a newline (new paragraph)
  2. pressed ctrl-b (or used the bold button)
  3. typed Hello, replacing the strong text example text that appeared when i pressed bold
  4. pressed ctrl-b again to /unbold/, saw strong text again but not bolded this time
  5. typed , world replacing the 2nd (not bold) instance of strong text
  6. went back to the start of the line, before Hello and pressed enter to add a line break
  7. started typing (it was bold)
  8. pressed ctrl-b to unbold and got strong text but bold this time
  9. typed world and pressed ctrl-b again, got unbolded strong text.
  10. pressed Markdown mode to see what was going on

I did this a couple times, this was the output in the most recent:


  
****

****Hello**, there**strong text******Hello **world, 

I think really we need to tackle this in smaller parts. I suggest that we install the autotype plugin so that we can simulate typing here: https://github.com/mmonteleone/jquery.autotype

Then we can try to reproduce a subset of the above sequence in a test,

@SidharthBansal
Copy link
Member

PUBLISHED to GCI dashboard

@jywarren
Copy link
Member Author

Hmm. Was this fixed recently, i thought perhaps?

@jywarren
Copy link
Member Author

Maybe linked to this? #220

@keshav234156
Copy link
Member

@jywarren I was just thinking of rough idea of how we can solve this . The problem is occurring because of https://github.com/bevacqua/woofmark/blob/master/src/html/wrapping.js#L19-L21 .Only the HTML mode is using the wrapping function. The Markdown mode is using other function and it works perfectly in Markdown mode(Please check it so that I am confirmed that it's the correct behavior). We can directly make changes to https://github.com/bevacqua/woofmark , but author doesn't seem to be active(as the previous commit was 1 year ago). What we can do is that,to write our own bold and wrapping function similar to https://github.com/publiclab/PublicLab.Editor/blob/master/src/modules/PublicLab.RichTextModule.HorizontalRule.js .Src code would be similar to https://github.com/bevacqua/woofmark but with the desired modification which solves this bug.
What do you think about this Or do you have any other workaround in your mind?

@keshav234156
Copy link
Member

@jywarren We could then also be able to implement the feature of the darkening of the icon when bold is on like we have in google docs.

The basic idea is to introduce woofmark in our src code rather than having a node module So tat we can format it according to our needs.

@keshav234156
Copy link
Member

Italic text also faces similar issue

@jywarren
Copy link
Member Author

jywarren commented Mar 5, 2020

Looks great, good analysis and great noting it affects italics too! Thanks!

@shreyaa-s-zz
Copy link
Collaborator

shreyaa-s-zz commented May 19, 2020

I agree with @keshav234156 , we should write our own wrapping function. I've been tracking down a bug #457 and the implementation of wrapping seems to have a lot of discrepancies. I think we can start with discussing what the wrapping function is supposed to do, making sure that we don't miss out any feature, and then we can look at what it actually does right now. The comparison would make it easier and clear as to what we need to add or implement.

@shreyaa-s-zz
Copy link
Collaborator

From what I've worked with so far, the current implementation includes:

  1. Adding the necessary tags, (opening) before and (closing)after the selected text. Pointing it out that these additions are not made to the selected text but rather to the text before and after the selected text.
  2. Closing any tag that is already opened in selected text and opening a tag that is closed in selected text. These changes are made to the selected text.
    For better understanding have a look at New line added with bold formatting #457 (comment)

@jywarren
Copy link
Member Author

jywarren commented Jul 7, 2020

I believe this is done in #543 -- thank you!

@jywarren jywarren closed this as completed Jul 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants