TinyMCE 中的 `prependToContext` [英] `prependToContext` in TinyMCE
本文介绍了TinyMCE 中的 `prependToContext`的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是来自 TinyMCE 的一段代码链接插件:
Here is a piece of code from TinyMCE Link plugin:
editor.addMenuItem('link', {
icon: 'link',
text: 'Insert/edit link',
shortcut: 'Meta+K',
onclick: createLinkList(showDialog),
stateSelector: 'a[href]',
context: 'insert',
prependToContext: true
});
prependToContext: true
是什么意思?我在文档中找不到.
What does prependToContext: true
mean? I can't find it in the documentation.
推荐答案
摘自 tinymce 核心 (theme.js
):
Taken from the tinymce core (theme.js
):
// Added though context
if (!isUserDefined) {
each(editor.menuItems, function(menuItem) {
if (menuItem.context == context) {
...
if (menuItem.prependToContext) {
menuItems.unshift(menuItem);
} else {
menuItems.push(menuItem);
}
...
}
});
}
因此,您的 MenuItem 被重新插入到内部 MenuItems 数组的开头.
So, your MenuItem gets reinserted at the beginning of the internal MenuItems array.
这篇关于TinyMCE 中的 `prependToContext`的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文