我想改變航向(H1,H2,H3)直接工具欄上(如TinyMCE的第3版),因爲我用它非常多,當我創建新的藝術。我試圖在互聯網上搜索,但我沒有找到任何答案。請幫幫我。非常感謝 如何採取標題(H1,H2,H3)直接在工具欄上TinyMCE的4
18
A
回答
27
這個答案肯定會遲到,但也許它可以幫助像我這樣的人,人們如何尋找同一個問題的答案。我在這裏閱讀:http://blog.ionelmc.ro/2013/10/17/tinymce-formatting-toolbar-buttons/
首先,你必須創建插件:
tinyMCE.PluginManager.add('stylebuttons', function(editor, url) {
['pre', 'p', 'code', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'].forEach(function(name){
editor.addButton("style-" + name, {
tooltip: "Toggle " + name,
text: name.toUpperCase(),
onClick: function() { editor.execCommand('mceToggleFormat', false, name); },
onPostRender: function() {
var self = this, setup = function() {
editor.formatter.formatChanged(name, function(state) {
self.active(state);
});
};
editor.formatter ? setup() : editor.on('init', setup);
}
})
});
});
然後你的工具欄中使用它:
tinyMCE.init({
selector: '#id',
toolbar: "undo redo | style-p style-h1 style-h2 style-h3 style-pre style-code",
plugins: "stylebuttons",
});
11
tinymce.init({
toolbar: 'undo redo | alignleft aligncenter alignright alignjustify | formatselect fontselect fontsizeselect | bullist numlist | outdent indent',
});
這是一個快捷的方法在您的TinyMCE 4的工具欄中添加H1,段落和其他選項。
如需完整列表,請參閱: http://www.tinymce.com/wiki.php/Controls 具體的'核心'部分。這顯示了最常用的工具。
2
指的對TinyMCE的論壇這樣一個問題:
http://www.tinymce.com/forum/viewtopic.php?id=32801
在配置使用這些PARAMS。
style_formats: [
{title: 'Headers', items: [
{title: 'h1', block: 'h1'},
{title: 'h2', block: 'h2'},
{title: 'h3', block: 'h3'},
{title: 'h4', block: 'h4'},
{title: 'h5', block: 'h5'},
{title: 'h6', block: 'h6'}
]},
{title: 'Inline', items: [
{title: 'Bold', inline: 'b', icon: 'bold'},
{title: 'Italic', inline: 'i', icon: 'italic'},
{title: 'Underline', inline: 'span', styles : {textDecoration : 'underline'}, icon: 'underline'},
{title: 'Strikethrough', inline: 'span', styles : {textDecoration : 'line-through'}, icon: 'strikethrough'},
{title: 'Superscript', inline: 'sup', icon: 'superscript'},
{title: 'Subscript', inline: 'sub', icon: 'subscript'},
{title: 'Code', inline: 'code', icon: 'code'},
]},
{title: 'Blocks', items: [
{title: 'Paragraph', block: 'p'},
{title: 'Blockquote', block: 'blockquote'},
{title: 'Div', block: 'div'},
{title: 'Pre', block: 'pre'}
]},
{title: 'Alignment', items: [
{title: 'Left', block: 'div', styles : {textAlign : 'left'}, icon: 'alignleft'},
{title: 'Center', block: 'div', styles : {textAlign : 'center'}, icon: 'aligncenter'},
{title: 'Right', block: 'div', styles : {textAlign : 'right'}, icon: 'alignright'},
{title: 'Justify', block: 'div', styles : {textAlign : 'justify'}, icon: 'alignjustify'}
]}
]
0
使用下面的工作對我來說
tinymce.init({
toolbar: 'formatselect',
block_formats: 'Paragraph=p;Heading 2=h2;Heading 3=h3;Heading 4=h4;',
});
相關問題
- 1. XPath:獲取最接近的標題元素(h1,h2,h3等)
- 2. 添加標題h1,h2,h3(Contempo)
- 3. 如何檢查DOM元素的標題(h1,h2,h3)屬性?
- 4. 如何將h1,h2和h3標題添加到RichText小部件?
- 5. 在h1,h2,h3標題中的粗體字體 - 92590
- 6. 在HTML中正確嵌套標題(H1> H2> H3)?
- 7. 火狐搞砸了標題尺寸H1 H2 H3
- 8. 如何編寫標題(h1,h2,h3)標籤有助於搜索引擎優化?
- 9. CKEditor中的H1,H2,H3等都較小
- 10. 將H1/H2/H3標籤纏繞在多欄設計的標題上是否合適?
- 11. h1,h2,h3 ..元素吃div div邊緣
- 12. 標題標籤的默認CSS樣式是什麼? (H1,h2,h3,h4,h5)
- 13. 如何在JavaScript中將多個h1元素替換爲h1,h2,h3,h4,h5,h6?
- 14. 如何從新聞文章中提取h2和h3標題
- 15. 與TCPDF位置h1,h2,h3和其他標記
- 16. H1,H2,H3,H4標籤是塊還是內聯元素?
- 17. jquery基於h1 h2 h3標籤製作「內容」
- 18. h5 =(h1 + h2 + h3)/ 3是否可以接受?
- 19. tinymce工具欄
- 20. 如何添加標題(h1,h2 ...)按鈕到具有高級主題,簡單佈局的tinyMCE?
- 21. TinyMCE 4字體工具欄未翻譯
- 22. 如何在CSS中設置不同標題(h1,h2,...)的樣式?
- 23. tinymce工具欄浮動工具欄
- 24. H1沒有得到任何風格,但h2,h3,... h6是
- 25. 如何將自定義控件添加到TinyMce 4工具欄
- 26. Wordpress h1標題在靜態家庭和其他網頁上的h2不工作
- 27. 如何將(H1 +(跨度))+(H2)變爲(跨度)+(H1)+(H2)...?
- 28. JQuery UI對話框:我應該使用h1,h2還是h3?
- 29. iPhone設置工具欄上的標題?
- 30. 如何在tinyMCE工具欄上設置z-index?
非常感謝。你讓我的一天 –