Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion packages/comment-widget/src/comment-editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ import { repeat } from 'lit/directives/repeat.js';
import './emoji-button';
import contentStyles from './styles/content.css?inline';
import './comment-editor-skeleton';
import { consume } from '@lit/context';
import { configMapDataContext } from './context';
import baseStyles from './styles/base';
import type { ConfigMapData } from './types';

interface ActionItem {
name?: string;
Expand Down Expand Up @@ -78,6 +81,10 @@ export class CommentEditor extends LitElement {
@state()
loading = true;

@consume({ context: configMapDataContext })
@state()
configMapData: ConfigMapData | undefined;

protected override firstUpdated(_changedProperties: PropertyValues): void {
super.firstUpdated(_changedProperties);
this.createEditor();
Expand Down Expand Up @@ -106,7 +113,8 @@ export class CommentEditor extends LitElement {
}),

Placeholder.configure({
placeholder: msg('Write a comment'),
placeholder:
this.configMapData?.editor?.placeholder || msg('Write a comment'),
}),

CodeBlockShiki.configure({
Expand Down
5 changes: 5 additions & 0 deletions packages/comment-widget/src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ export interface ConfigMapData {
basic: BasicConfig;
security: SecurityConfig;
avatar: AvatarConfig;
editor?: EditorConfig;
}

interface BasicConfig {
Expand All @@ -26,3 +27,7 @@ interface AvatarConfig {
providerMirror: string;
policy: 'anonymousUser' | 'allUser' | 'noAvatarUser';
}

interface EditorConfig {
placeholder?: string;
}
6 changes: 6 additions & 0 deletions src/main/resources/extensions/settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,9 @@ spec:
- label: "匿名&无头像用户"
value: "noAvatarUser"
value: "anonymousUser"
- group: editor
label: 编辑器
formSchema:
- $formkit: text
name: placeholder
label: 自定义评论框占位符