Aloha Editor是否可以配置为仅显示粗体,斜体和下划线按钮,并且整个工具栏不会大于所需的大小?Aloha编辑器自定义
回答
是,自定义工具栏来看看配置设置:
http://aloha-editor.org/guides/ui.html#configuration
如果你检查GitHub上的演示应用程序有一个配置文件开始使用,您可以添加此设置。
https://github.com/alohaeditor/Aloha-Editor/blob/dev/src/demo/demo-app/app/js/demo-app-load.js
还为这一个替代方案,您可以在演示/ 3col的源代码检查:
http://aloha-editor.org/demos/3col/
<script>
var Aloha = window.Aloha || (window.Aloha = {});
Aloha.settings = {
locale: 'en',
plugins: {
format: {
config: [ 'b', 'i', 'p', 'sub', 'sup', 'del', 'title', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'pre', 'removeFormat' ],
editables : {
// no formatting allowed for title
'#title' : [ ]
}
},
link: {
editables : {
// No links in the title.
'#title' : [ ]
}
},
list: {
editables : {
// No lists in the title.
'#title' : [ ]
}
},
abbr: {
editables : {
// No abbr in the title.
'#title' : [ ]
}
},
image: {
'fixedAspectRatio': true,
'maxWidth': 1024,
'minWidth': 10,
'maxHeight': 786,
'minHeight': 10,
'globalselector': '.global',
'ui': {
'oneTab': false
},
editables : {
// No images in the title.
'#title' : [ ]
}
}
},
sidebar: {
disabled: true
},
contentHandler: {
allows: {
elements: [
'a', 'abbr', 'b', 'blockquote', 'br', 'caption', 'cite', 'code', 'col',
'colgroup', 'dd', 'del', 'dl', 'dt', 'em', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6',
'i', 'img', 'li', 'ol', 'p', 'pre', 'q', 'small', 'strike', 'strong',
'sub', 'sup', 'table', 'tbody', 'td', 'tfoot', 'th', 'thead', 'tr', 'u',
'ul', 'span', 'hr', 'object', 'div'
],
attributes: {
'a': ['href', 'title', 'id', 'class', 'target', 'data-gentics-aloha-repository', 'data-gentics-aloha-object-id'],
'div': [ 'id', 'class'],
'abbr': ['title'],
'blockquote': ['cite'],
'br': ['class'],
'col': ['span', 'width'],
'colgroup': ['span', 'width'],
'img': ['align', 'alt', 'height', 'src', 'title', 'width', 'class'],
'ol': ['start', 'type'],
'q': ['cite'],
'p': ['class'],
'table': ['summary', 'width'],
'td': ['abbr', 'axis', 'colspan', 'rowspan', 'width'],
'th': ['abbr', 'axis', 'colspan', 'rowspan', 'scope', 'width'],
'ul': ['type'],
'span': ['class','style','lang','xml:lang']
},
protocols: {
'a': {'href': ['ftp', 'http', 'https', 'mailto', '__relative__']},
'blockquote': {'cite': ['http', 'https', '__relative__']},
'img': {'src' : ['http', 'https', '__relative__']},
'q': {'cite': ['http', 'https', '__relative__']}
}
}
}
};
</script>
<script type="text/javascript" src="http://cdn.aloha-editor.org/latest/lib/aloha.js"
data-aloha-plugins="common/ui,
common/format,
common/table,
common/list,
common/link,
common/highlighteditables,
common/block,
common/undo,
common/image,
common/contenthandler,
common/paste,
common/commands,
common/abbr"></script>
<!-- turn an element into editable Aloha continuous text -->
<script type="text/javascript">
Aloha.ready(function() {
$('#title').aloha();
$('#multicolumnElement').aloha();
});
</script>
因此,它在步骤3中显示的代码是您在aloha.js中更改的代码? –
如果你看看GitHub上的demo-app https://github.com/alohaeditor/Aloha-Editor/blob/dev/src/demo/demo-app/app/js/demo-app-load.js,配置文件,在这个文件中你可以设置这个配置。我也正在更新我的答案,请替换,请chec。 –
谢谢。我们如何得到它不会强制我们不需要的jQuery版本? –
我花了一段时间才能找出即使在阅读这个答案后,如何做同样的事情。
这里是我做过什么:
- Aloha.settings被包括aloha.js
- plugins.format.config前的定义:
<script language="javascript"> Aloha = window.Aloha || {}; Aloha.settings = { plugins: { format: { config: [ 'b', 'i', 'u','del'] } }, toolbar: { exclude: ['formatBlock', '\n','subscript', 'superscript'] }, sidebar: { disabled: true } }; </script> <script src="/src/aloha/lib/aloha.js" data-aloha-plugins="common/ui,common/format"></script>
的关键点,从该代码注意设置按钮可用的格式插件
- toolbar.exclude摆脱我不想要的东西。
- 我的配置包括'删除',这是删除线选项,而不是OP的请求选项的一部分。
我可能不需要删除下标和上标,因为它们不在配置中我不担心,因为这对我有用,我不在乎我是否有一些不需要的配置选项。
- 1. Aloha内联编辑器
- 2. Aloha编辑器集基址
- 3. Aloha编辑器配置
- 4. aloha编辑器映像存储库的自定义存储库浏览器
- 5. 自定义JComboBox编辑器
- 6. 自定义VBA编辑器
- 7. 自定义WordPress编辑器
- 8. MVC自定义编辑器
- 9. Aloha编辑器:在aloha-multisplit-expanded框中添加新样式(aloha-button)
- 10. jQuery的Aloha的编辑器,Aloha.triger
- 11. 在aloha编辑器中删除图像
- 12. Aloha编辑器慢速粘贴
- 13. Aloha编辑器:插入图像/图片
- 14. 禁用Aloha编辑器侧栏
- 15. Aloha编辑器视频/音频插件
- 16. Aloha编辑器的数学插件
- 17. 更改Aloha编辑语言
- 18. 如何编辑用Aloha编辑器动态创建的dom?
- 19. 如何在slickgrid上实现可编辑的自定义列,编辑器是自定义选择编辑器?
- 20. Expression Blend的自定义编辑器
- 21. 使用kineticjs的自定义编辑器
- 22. 开发自定义Javascript html编辑器
- 23. 春季自定义编辑器
- 24. 自定义TinyMCE代码编辑器
- 25. JDev代码编辑器的自定义
- 26. 属性网格自定义编辑器
- 27. QAbstractTableModel中的自定义编辑器
- 28. KendoUI ForeignKey自定义编辑器模板
- 29. Froala编辑器 - 自定义对话框
- 30. Visual Studio自定义编辑器
好的,发现他们的CDN版本导致了问题,因为它强制使用的版本不同于我已经包含在项目中,并且下载链接不起作用:https:// github .COM /下载/ alohaeditor/Aloha的编辑/ alohaeditor-0.22.7.zip。此外,他们的文档中是否需要包含“require.js”文件也存在差异。 –