2023-04-28 09:20:28 +00:00
|
|
|
import {allCommands} from 'app/client/components/commands';
|
|
|
|
import {makeT} from 'app/client/lib/localization';
|
|
|
|
import {menuDivider, menuItemCmd} from 'app/client/ui2018/menus';
|
|
|
|
import {dom} from 'grainjs';
|
|
|
|
|
|
|
|
const t = makeT('FieldContextMenu');
|
|
|
|
|
|
|
|
export interface IFieldContextMenu {
|
|
|
|
disableModify: boolean;
|
|
|
|
isReadonly: boolean;
|
|
|
|
}
|
|
|
|
|
2023-11-20 00:46:32 +00:00
|
|
|
export function FieldContextMenu(fieldOptions: IFieldContextMenu) {
|
2023-04-28 09:20:28 +00:00
|
|
|
const {disableModify, isReadonly} = fieldOptions;
|
|
|
|
const disableForReadonlyColumn = dom.cls('disabled', disableModify || isReadonly);
|
|
|
|
return [
|
|
|
|
menuItemCmd(allCommands.contextMenuCut, t('Cut'), disableForReadonlyColumn),
|
|
|
|
menuItemCmd(allCommands.contextMenuCopy, t('Copy')),
|
|
|
|
menuItemCmd(allCommands.contextMenuPaste, t('Paste'), disableForReadonlyColumn),
|
|
|
|
menuDivider(),
|
|
|
|
menuItemCmd(allCommands.clearCardFields, t('Clear field'), disableForReadonlyColumn),
|
|
|
|
menuItemCmd(allCommands.hideCardFields, t('Hide field')),
|
|
|
|
menuDivider(),
|
|
|
|
menuItemCmd(allCommands.copyLink, t('Copy anchor link')),
|
|
|
|
];
|
|
|
|
}
|