File tree Expand file tree Collapse file tree
src/main/resources/extensions Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6,7 +6,10 @@ import { repeat } from 'lit/directives/repeat.js';
66import './emoji-button' ;
77import contentStyles from './styles/content.css?inline' ;
88import './comment-editor-skeleton' ;
9+ import { consume } from '@lit/context' ;
10+ import { configMapDataContext } from './context' ;
911import baseStyles from './styles/base' ;
12+ import type { ConfigMapData } from './types' ;
1013
1114interface ActionItem {
1215 name ?: string ;
@@ -78,6 +81,10 @@ export class CommentEditor extends LitElement {
7881 @state ( )
7982 loading = true ;
8083
84+ @consume ( { context : configMapDataContext } )
85+ @state ( )
86+ configMapData : ConfigMapData | undefined ;
87+
8188 protected override firstUpdated ( _changedProperties : PropertyValues ) : void {
8289 super . firstUpdated ( _changedProperties ) ;
8390 this . createEditor ( ) ;
@@ -106,7 +113,8 @@ export class CommentEditor extends LitElement {
106113 } ) ,
107114
108115 Placeholder . configure ( {
109- placeholder : msg ( 'Write a comment' ) ,
116+ placeholder :
117+ this . configMapData ?. editor ?. placeholder || msg ( 'Write a comment' ) ,
110118 } ) ,
111119
112120 CodeBlockShiki . configure ( {
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ export interface ConfigMapData {
22 basic : BasicConfig ;
33 security : SecurityConfig ;
44 avatar : AvatarConfig ;
5+ editor ?: EditorConfig ;
56}
67
78interface BasicConfig {
@@ -26,3 +27,7 @@ interface AvatarConfig {
2627 providerMirror : string ;
2728 policy : 'anonymousUser' | 'allUser' | 'noAvatarUser' ;
2829}
30+
31+ interface EditorConfig {
32+ placeholder ?: string ;
33+ }
Original file line number Diff line number Diff line change @@ -122,3 +122,9 @@ spec:
122122 - label : " 匿名&无头像用户"
123123 value : " noAvatarUser"
124124 value : " anonymousUser"
125+ - group : editor
126+ label : 编辑器
127+ formSchema :
128+ - $formkit : text
129+ name : placeholder
130+ label : 自定义评论框占位符
You can’t perform that action at this time.
0 commit comments