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

Notebook UI - Markdown toolbar - Headings dropdown #11049

Merged
merged 25 commits into from
Jul 3, 2020

Conversation

halerankin
Copy link
Contributor

@halerankin halerankin commented Jun 23, 2020

Adds heading dropdown to markdown toolbar:
image
image

User clicks on a line and selects heading level:
image
image
image

Expected behavior:

  • User selects all content on the line they want the heading level initially set.
  • User selects one of three options: Heading 1, Heading 2, Heading 3.
  • Line now begins with the number of # characters corresponding to the heading level selected.

@coveralls
Copy link

coveralls commented Jun 23, 2020

Coverage Status

Coverage increased (+0.02%) to 36.026% when pulling f039ab4 on main--notebook-ui-markdown-toolbar-headings into fd29e35 on main.

@halerankin halerankin marked this pull request as ready for review June 23, 2020 22:04
…dered list is applied. Multi-line headings can be undone if the multi lines are selected.
@halerankin halerankin marked this pull request as draft June 25, 2020 23:43
…eed to be replaced with a new MarkdownButtonType.
@halerankin halerankin requested a review from chlafreniere June 25, 2020 23:58
@halerankin halerankin marked this pull request as ready for review June 26, 2020 17:16
Copy link
Contributor

@chlafreniere chlafreniere left a comment

Choose a reason for hiding this comment

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

One comment here to look at. Looks like there's a failing test as well.

@Charles-Gagnon
Copy link
Contributor

@halerankin Any more things you need help with? Not sure if the list in the description is up to date

@halerankin
Copy link
Contributor Author

@Charles-Gagnon Thanks for checking on this. The one behavior I could not code for is the act of setting a selected line to style: Paragraph. We would need a way to take a given selection -- current code requires that the user select the entire line, not a single cursor position -- then check for any existing MarkdownLineType: EVERY_LINE and replace it with empty quotes. I worked on it toward the end of last week but could not get something working. In the end, Chis and I had decided to get the heading addition work just like the list items in that when you have a line selected and you apply the heading, you can apply again to remove it. Replacement is trickier.

@Charles-Gagnon Charles-Gagnon merged commit ecfac10 into main Jul 3, 2020
@Charles-Gagnon Charles-Gagnon deleted the main--notebook-ui-markdown-toolbar-headings branch July 3, 2020 00:30
smartguest pushed a commit that referenced this pull request Jul 20, 2020
* Adds heading dropdown to markdown toolbar.

* Added a method specific to headings that places markdown at beginning of line selected.

* Rewrote comment for my new method.

* Revised code to support multi select for headers, similar to how unordered list is applied. Multi-line headings can be undone if the multi lines are selected.

* Modified transformText to make single-line undo operation possible with just the cursor position.

* Added utility methods to help determine if the selection is a line-only or multi-line.

* Building isReplaceOperation to determine when preceeding characters need to be replaced with a new MarkdownButtonType.

* Updated comments.

* Applied changes written by Chris.

* Reverted changes to earlier stage where heading addition works just like list item additions.

* getExtendedSelectedText now returns an actual value in range for MarkdownLineType.EVERY_LINE.

* Added conditional so that Preview element is updated only when Preview is enabled.

* Updated tests for heading toolbar: heading 1, 2 and 3.

* Removed code that could not be reached.

* Corrected tests for headings.

* wip

(cherry picked from commit 43deb96)

* cleanup

* fix error

* Fix tests

* Add more testing

* delete

* re-add

Co-authored-by: chgagnon <chgagnon@microsoft.com>
chlafreniere pushed a commit that referenced this pull request Jul 28, 2020
* Adds heading dropdown to markdown toolbar.

* Added a method specific to headings that places markdown at beginning of line selected.

* Rewrote comment for my new method.

* Revised code to support multi select for headers, similar to how unordered list is applied. Multi-line headings can be undone if the multi lines are selected.

* Modified transformText to make single-line undo operation possible with just the cursor position.

* Added utility methods to help determine if the selection is a line-only or multi-line.

* Building isReplaceOperation to determine when preceeding characters need to be replaced with a new MarkdownButtonType.

* Updated comments.

* Applied changes written by Chris.

* Reverted changes to earlier stage where heading addition works just like list item additions.

* getExtendedSelectedText now returns an actual value in range for MarkdownLineType.EVERY_LINE.

* Added conditional so that Preview element is updated only when Preview is enabled.

* Updated tests for heading toolbar: heading 1, 2 and 3.

* Removed code that could not be reached.

* Corrected tests for headings.

* wip

(cherry picked from commit 43deb96)

* cleanup

* fix error

* Fix tests

* Add more testing

* delete

* re-add

Co-authored-by: chgagnon <chgagnon@microsoft.com>
ktech99 pushed a commit that referenced this pull request Aug 23, 2020
* Adds heading dropdown to markdown toolbar.

* Added a method specific to headings that places markdown at beginning of line selected.

* Rewrote comment for my new method.

* Revised code to support multi select for headers, similar to how unordered list is applied. Multi-line headings can be undone if the multi lines are selected.

* Modified transformText to make single-line undo operation possible with just the cursor position.

* Added utility methods to help determine if the selection is a line-only or multi-line.

* Building isReplaceOperation to determine when preceeding characters need to be replaced with a new MarkdownButtonType.

* Updated comments.

* Applied changes written by Chris.

* Reverted changes to earlier stage where heading addition works just like list item additions.

* getExtendedSelectedText now returns an actual value in range for MarkdownLineType.EVERY_LINE.

* Added conditional so that Preview element is updated only when Preview is enabled.

* Updated tests for heading toolbar: heading 1, 2 and 3.

* Removed code that could not be reached.

* Corrected tests for headings.

* wip

(cherry picked from commit 43deb96)

* cleanup

* fix error

* Fix tests

* Add more testing

* delete

* re-add

Co-authored-by: chgagnon <chgagnon@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants