mjs*_*sen 6 javascript events aloha-editor
根据Aloha Editor文档,您可以听取"aloha-smart-content-changed"事件的帮助,比如将数据保存到您正在使用的任何持久性机制中.这是我想要做的一个例子:
<html>
<head>
<title>Aloha Event Testing</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script src="http://cdn.aloha-editor.org/current/lib/aloha.js" data-aloha-plugins="common/format, common/list, common/link, common/highlighteditables"></script>
<link href="http://cdn.aloha-editor.org/current/css/aloha.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
Aloha.ready( function() {
var $ = Aloha.jQuery;
$('.editable').aloha();
});
$(document).ready(function() {
$('.editable').bind('aloha-smart-content-changed', function() {
console.log('Aloha smart event handled.');
});
});
</script>
</head>
<body>
<div class="editable"></div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
但处理程序永远不会触发.与Aloha合作的任何人都知道如何正确地听取这个事件吗?
哇,关于这方面的文件非常糟糕.但我认为我得到了它的工作.看起来您将Aloha.ready()方法中的事件处理程序绑定到Aloha对象本身.
Aloha.ready( function() {
var $ = Aloha.jQuery;
$('.editable').aloha();
Aloha.bind('aloha-smart-content-changed', function(event, editable) {
console.log('Aloha smart event handled.');
});
});
Run Code Online (Sandbox Code Playgroud)
在这里找到了一些关于它的更多信息,这是我找到一个被绑定事件的例子.
也在这里用jsfiddle进行了测试
希望有所帮助
| 归档时间: |
|
| 查看次数: |
1567 次 |
| 最近记录: |