我已经构建了一个 Word 插件,现在想添加一个选项,以便在用户突出显示某个单词并右键单击它时从中调用函数。我在这里找到了有关如何修改manifest.xml 文件的文档,但它似乎没有显示如何添加到上下文菜单的完整示例,仅显示了如何添加按钮和下拉菜单。
该文档还向我指出了一个github页面显示示例,但同样缺少上下文菜单。它还指向这个视频,它似乎在 1:20 左右展示了我想要的内容,但也没有展示如何实现它。
到目前为止我有这个(添加在下面<FunctionFile>):
<ExtensionPoint xsi:type="ContextMenu">
<OfficeMenu id="ContextMenuText">
<Control xsi:type="Menu" id="TestMenu">
<Label resid="ContextMenuLabel" />
<Supertip>
<Title resid="ContextualMenuTitle" />
<Description resid="ContextualMenuTitleDesc" />
</Supertip>
</Control>
</OfficeMenu>
</ExtensionPoint>
Run Code Online (Sandbox Code Playgroud)
当我尝试使用此工具验证清单文件时,它告诉我缺少一个Icon元素,但我不需要上下文菜单的图像?
我想做的事情是否可能,如果可以,有人可以给我举个例子吗?
我已经更新了我的代码以反映 @Mavi Domates 所写的内容
<ExtensionPoint xsi:type="ContextMenu">
<OfficeMenu id="ContextMenuText">
<Control xsi:type="Button" id="openSearchButton">
<Label resid="openSearchButtonLabel" />
<Supertip>
<Title resid="openSearchButtonTitle" />
<Description resid="openSearchButtonDescription" />
</Supertip>
<Icon>
<bt:Image size="16" resid="Contoso.tpicon_16x16" />
<bt:Image size="32" resid="Contoso.tpicon_32x32" />
<bt:Image size="80" resid="Contoso.tpicon_80x80" />
</Icon>
<Action …Run Code Online (Sandbox Code Playgroud) 我想知道如何在 FieldArray 内的 Field 组件上触发异步验证。我有类似的东西:
class MyForm extends Component {
constructor(props) {
super(props)
}
render() {
const { handleSubmit } = this.props
return (
<form onSubmit={handleSubmit}>
<Field
name="name"
type="text"
component={RenderInputField}
/>
<FieldArray
name="hobbies"
component={RenderHobbies}
/>
</form>
)
}
}
MyFormBase = reduxForm ({
form: 'MyForm',
validate,
asyncValidate,
asyncBlurFields: ['name', 'hobbies.hobby']
})(MyFormBase)
Run Code Online (Sandbox Code Playgroud)
使用 RenderHobbies 作为:
const RenderHobbies = ({fields}) => (
<div>
{fields.map((hobby, index) => ({
<Field
name={`${hobby}.hobby`}
component={RenderInputField}
/>
}))}
</div>
)
export default RenderHobbies
Run Code Online (Sandbox Code Playgroud)
这不起作用。异步验证将针对模糊上的“名称”而不是“hobbies.hobby”触发。正确的语法是什么?