Skip to content

Commit

Permalink
move MentionNode style into CSS
Browse files Browse the repository at this point in the history
  • Loading branch information
glowingjade committed Oct 12, 2024
1 parent ad1bba7 commit 710a443
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/components/chat-input/ChatUserInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ const ChatUserInput = forwardRef<ChatUserInputRef, ChatUserInputProps>(
const initialConfig: InitialConfigType = {
namespace: 'ChatUserInput',
theme: {
root: 'smtcmp-chat-input-root',
paragraph: 'smtcmp-chat-input-paragraph',
},
nodes: [MentionNode],
Expand Down
3 changes: 0 additions & 3 deletions src/components/chat-input/plugins/mention/MentionNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ export type SerializedMentionNode = Spread<
// return null
// }

const mentionStyle =
'background-color: var(--tag-background); color: var(--tag-color); padding: var(--size-2-1) calc(var(--size-2-1)); border-radius: var(--radius-s);'
export class MentionNode extends TextNode {
__id: string
__mention: string
Expand Down Expand Up @@ -87,7 +85,6 @@ export class MentionNode extends TextNode {

createDOM(config: EditorConfig): HTMLElement {
const dom = super.createDOM(config)
dom.style.cssText = mentionStyle
dom.className = MENTION_NODE_TYPE
return dom
}
Expand Down
11 changes: 11 additions & 0 deletions styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,17 @@ button:not(.clickable-icon).smtcmp-chat-list-dropdown {
* ChatUserInput
*/

.smtcmp-chat-input-root .mention {
background-color: var(--tag-background);
color: var(--tag-color);
padding: var(--size-2-1) calc(var(--size-2-1));
border-radius: var(--radius-s);
background-color: var(--tag-background);
color: var(--tag-color);
padding: var(--size-2-1) calc(var(--size-2-1));
border-radius: var(--radius-s);
}

.smtcmp-chat-input-paragraph {
margin: 0;
line-height: 1.6;
Expand Down

0 comments on commit 710a443

Please sign in to comment.