Expose role=dialog and a stable aria-label so save can be scoped without changing the modal's visuals or save behavior. Co-authored-by: Cursor <cursoragent@cursor.com>
18 lines
621 B
TypeScript
18 lines
621 B
TypeScript
/** 块编辑弹窗的稳定可访问名称与保存按钮文案(禁止全页模糊 /保存/)。 */
|
|
export const BLOCK_EDITOR_DIALOG_LABEL = '编辑受控块';
|
|
export const BLOCK_EDITOR_SAVE_NAME = '保存修改';
|
|
|
|
export function blockEditorDialogPolicy(): {
|
|
role: 'dialog';
|
|
name: typeof BLOCK_EDITOR_DIALOG_LABEL;
|
|
saveButton: { name: typeof BLOCK_EDITOR_SAVE_NAME; exact: true };
|
|
forbidPageWideSaveRegex: RegExp;
|
|
} {
|
|
return {
|
|
role: 'dialog',
|
|
name: BLOCK_EDITOR_DIALOG_LABEL,
|
|
saveButton: { name: BLOCK_EDITOR_SAVE_NAME, exact: true },
|
|
forbidPageWideSaveRegex: /保存修改|保存/,
|
|
};
|
|
}
|