-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove
disable-editing
attribute from the mention view element (#1731)
# Pull Request ## 🤨 Rationale <!--- Provide some background and a description of your work. What problem does this change solve? Include links to issues, work items, or other discussions. --> Previously, we used `nimble-rich-text-mention-users-view` for two states one is at the time of triggering the mention (Edit mode) and the other one is after committing the mention (View mode) in the editor. However, due to #1716, we wanted to remove the decoration tag (which is configured in Tiptap to render the same element in edit mode) here: #1721. Also, during editing for all mentions we can have the same styling so we decided not to use this element for both edit and view mode. Only after committing in the editor and for viewing in the viewer, this view element can be used. During editing mention node, the styles can be explicitly mentioned in the editor styles. Relevant discussion: #1721 (comment) Will close the following issues upon merging this PR: 1. fixes #1659 2. fixes #1716 ## 👩💻 Implementation <!--- Describe how the change addresses the problem. Consider factors such as complexity, alternative solutions, performance impact, etc. Consider listing files with important changes or comment on them directly in the pull request. --> - Removed `disable-editing` attribute from the view element base class - Removed styles related to `disable-editing` and other CSS cleanups in view element - Added [`decorationClass`](https://tiptap.dev/docs/editor/api/utilities/suggestion#decoration-class) in the editor to style the default suggestion `span` in the editor and added necessary styles to it. ## 🧪 Testing <!--- Detail the testing done to ensure this submission meets requirements. Include automated/manual test additions or modifications, testing done on a local build, private CI run results, and additional testing not covered by automatic pull request validation. If any functionality is not covered by automated testing, provide justification. --> - Removed the view element edit mode test case from the Chromatic matrix test - Manually tested the mention view element in editor and viewer ## ✅ Checklist <!--- Review the list and put an x in the boxes that apply or ~~strike through~~ around items that don't (along with an explanation). --> - [x] I have updated the project documentation to reflect my changes or determined no changes are needed. --------- Co-authored-by: Milan Raj <[email protected]>
- Loading branch information
1 parent
e7362ab
commit 98c97d4
Showing
10 changed files
with
44 additions
and
103 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
change/@ni-nimble-components-42ffbdab-86c2-4075-a77e-a24e14afc857.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"type": "patch", | ||
"comment": "Removed disable-editing attribute from the rich text mention users view component for rendering @mention in editor and viewer", | ||
"packageName": "@ni/nimble-components", | ||
"email": "[email protected]", | ||
"dependentChangeType": "patch" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 2 additions & 6 deletions
8
packages/nimble-components/src/rich-text-mention/users/view/template.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,6 @@ | ||
import { html } from '@microsoft/fast-element'; | ||
import type { RichTextMentionUsersView } from '.'; | ||
|
||
// Setting `contenteditable="true"` on the slot serves as a workaround to address the issue in the Chrome browser | ||
// that arises when the mention user view is activated at the end of a line in the rich text editor while in edit mode. | ||
// This can be removed when the below issue is resolved | ||
// See: https://github.com/ni/nimble/issues/1659 | ||
export const template = html<RichTextMentionUsersView>`<span class="control" | ||
>@${x => x.mentionLabel}</span | ||
><slot contenteditable="true"></slot>`; | ||
>@${x => x.mentionLabel}</span | ||
>`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters