我最近在chrome的控制台日志中注意到以下消息,同时使用aloha编辑器:
aloha.js:14579 - 不推荐使用Selection.addRange()合并现有Range和指定Range的行为,并将于2017年4月左右在M58中删除.有关详细信息,请参阅https://www.chromestatus.com/features/6680566019653632细节.
在尝试寻找替代品时,除了他们要删除它之外我找不到任何东西,所以我想知道Selection.addRange()的替代方法是什么来摆脱这个消息.
有没有办法以与侧边栏相同的方式禁用Aloha的ExtJS工具栏?
Aloha.settings =
modules: ['aloha', 'aloha/jquery']
editables: '.editable'
jQuery: $
sidebar:
disabled: true
toolbar:
disabled: true # does not work
Run Code Online (Sandbox Code Playgroud)

根据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编辑器固定到特定位置,而不是在整个页面上弹跳.
那有配置选项吗?有一个"附加"选项用于配置Aloha但我无法弄清楚如何申请,或者即使它能解决我的问题......
如果没有配置选项,也可以打开黑客来覆盖该位置.
我有一个DokuWiki的维基设置我的服务器上,我很想能够编辑与行内编辑,一拉阿罗哈编辑器或喂编辑维基.在Aloha编辑主页上,他们提到你可以在传递中使用它作为wiki,但没有更多细节.
我知道我可以通过我的dokuwiki设置完成实现Aloha或Hallo或其他类似编辑器的所有工作,但我想我真正想知道的是,是否有人已经使用任何wiki(dokuwiki或其他)完成此操作.
我正在寻找的最终结果是:你去一个wiki页面,点击内容,用Aloha编辑器等编辑它,然后将新内容保存回服务器.这将允许通过插入链接到尚未创建的页面创建新的wiki页面(通过单击链接按钮或输入,例如:[[新页面链接]].
这是否以某种形式存在于某个地方?
谢谢!
我正在使用Aloha编辑器在由PHP和MySQL支持的网站上编辑内容.它工作正常,但我需要能够插入图像/图片.我找到了一个Aloha编辑器插件.以下是一些链接:
第一个链接中有一个例子.但是,我无法在最新版本的Aloha编辑器和jQuery上运行该插件.它无法加载,Chrome说:
image.js:30 Uncaught TypeError: Cannot read property 'fn' of undefined
Run Code Online (Sandbox Code Playgroud)
我没有血腥的线索这意味着什么.
理想情况下,用户应该能够从服务器上的图像列表中选择图像.它们位于一个目录中,并且还有一个MySQL表.我怀疑这是存储库的用武之地,但我无法理解如何实现它.
有没有人在Aloha编辑器中使用这个插件有运气,或者找到任何其他插入图像的方法?
我想禁用Aloha Editor侧栏.我在各个地方看过以下代码,这对我不起作用:
Aloha.settings = {
sidebar: { disabled: true }
};
Run Code Online (Sandbox Code Playgroud)
如果我在调用后添加它aloha(),没有任何反应,侧边栏仍然存在.如果我在调用aloha()元素之前添加它,我会收到以下错误:
Uncaught TypeError: Cannot read property 'getContents' of undefined
Run Code Online (Sandbox Code Playgroud)
Aloha.ready如果我将代码移到我的调用之上,所有这一切都发生在并且没有修复Aloha.ready.
如果它有用,这里是我正在加载的文件<head>:
<script src="http://cdn.aloha-editor.org/latest/lib/require.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script src="http://cdn.aloha-editor.org/latest/lib/aloha.js" data-aloha-plugins="common/ui, common/format, common/list, common/link, common/highlighteditables, common/horizontalruler, common/undo, common/paste"></script>
<link href="http://cdn.aloha-editor.org/latest/css/aloha.css" rel="stylesheet" type="text/css" />
Run Code Online (Sandbox Code Playgroud)
(我现在正在添加一些CSS,感觉不对.我更喜欢更好的解决方案.)
我正在<select>通过jQuery append()函数创建一个动态元素,但我似乎无法获得正确的选定值.我总是得到第一个选项,即1.我正在尝试配置Aloha编辑器,这可能与问题有关.
这是附加在侧栏中的select元素.
$('.aloha-sidebar-inner').append('<select id="columns"><option value="1">1 Column</option><option value="2">2 Columns</option><option value="3">3 Columns</option><option value="4">4 Columns</option></select>').trigger('create');
Run Code Online (Sandbox Code Playgroud)
如上所述,我使用Aloha Editor,因此jquery看起来像这样:
Aloha.ready(function() {
$('.aloha-sidebar-inner').append('<button id="add-section" class="btn aloha-sidebar-btn sidebar-item" type="button" onclick="addSection(document.getElementById(\'articles\').value);">Add Section</button>');
$('.aloha-sidebar-inner').append('<p>Number of Columns:</p>');
$('.aloha-sidebar-inner').append('<select id="articles" class="sidebar-item"><option>1</option><option>2</option><option>3</option><option>4</option></select>');
});
function addSection() {
var idCounter = 0;
alert($('#articles').val());
};
Run Code Online (Sandbox Code Playgroud)
警报窗口保持返回值1.可能存在问题,因为我动态创建了select元素?
我尝试过使用$( "#columns option:selected" ).val();但仍然没有.我甚至尝试过使用text(),但仍然没有; alert继续返回第一个选项.
我也试过使用$('#add-section').click或$('#articles').change听众,但他们似乎没有回应.
aloha-editor ×9
javascript ×6
jquery ×3
deprecated ×1
editor ×1
events ×1
hallo-js ×1
html ×1
html5 ×1
mysql ×1
php ×1
select ×1
wiki ×1
wysiwyg ×1