0
A
回答
0
我建议使用事件来捕获工具应用时,然后应用你以后的具体行为。
目前没有很好的方式来访问这些事件(我将在未来的版本中看到),但同时这里有一个解决方法,它给你你以后的行为,并且应用到任何工具都应该相对简单:
// Override the behaviour of the `ToolboxUI.tools` method so that we can
// bind to the applied event for the tools of interest.
var superTools = ContentTools.ToolboxUI.prototype.tools;
ContentTools.ToolboxUI.prototype.tools = function (tools) {
superTools.call(this, tools);
function _followWithP(ev) {
var element = ev.detail().element;
// Find the top level element
if (element.parent().type() !== 'Region') {
element = element.closest(function(node) {
return node.parent().type() === 'Region';
});
}
// Find the newely insert element
var newElement = element.nextSibling();
// Check if this is the last item in the region
var siblings = newElement.parent().children;
if (newElement === siblings[siblings.length - 1]) {
// This is the last child so apply add a paragraph
var p = new ContentEdit.Text('p', {}, '');
newElement.parent().attach(p);
p.focus();
}
}
// Modify the applied behaviour of the image, table and video tools to use
// `_followWithP`.
this._toolUIs['image'].addEventListener('applied', _followWithP);
this._toolUIs['table'].addEventListener('applied', _followWithP);
this._toolUIs['video'].addEventListener('applied', _followWithP);
}
相关问题
- 1. Swift:如何添加和动画图像视图内嵌标签?
- 2. jQuery UI标签动态添加标签和内容不工作
- 3. 添加视图到标签Vs添加活动标签android
- 4. PHP:将视频标签添加到youtube链接fron内容
- 5. 添加自定义视图到标签
- 6. 将抖动图标添加到视频
- 7. 添加标签视图android
- 8. 将标签和图像动态添加到Android中的自定义视图中
- 9. 在标签中添加附加内容
- 10. 自动添加标签
- 11. 自动添加工具栏
- 12. iOS UITableViewCell添加标签和图像
- 13. 在html body标签内添加内容
- 14. 在视频上添加标签iOS
- 15. 添加HTML标签的CSS内容
- 16. 视频图像:无法动态添加视频
- 17. TinyMCE的添加BR代码后Li和p标签
- 18. 添加内容标签布局
- 19. 添加标签来asp.net页面内容
- 20. Dyanamically标签内容添加问题
- 21. 添加标签到图例后标绘
- 22. ASP.Net - AJAX控件工具包 - 动态添加和删除标签
- 23. 将图像添加到视频
- 24. Infobubble仅显示来自通过PHP/Mysql添加的标签添加的最后一个标记的内容
- 25. 的onclick添加到图像标签
- 26. Jquery - 为活动Carousel图像的图像标签添加类
- 27. 为fancybox图片添加标题/视频
- 28. 如何添加自定义图标stimulsoft工具,工具栏
- 29. 你在Subversion和CVS中调用添加自动内容的标签是什么?
- 30. 添加视频