簡體   English   中英

將字體菜單添加到EpiM的tinyMCE上的Styleselect,Episerver 11,tinyMCE 2.5.0

[英]Add font menu to Styleselect on tinyMCE for Episerver, Episerver 11, tinyMCE 2.5.0

我試圖添加一個菜單,用於在Episerver的tinyMCE中選擇不同的字體。 它適用於帶有以下代碼的p標簽,但我希望能夠為所有標簽(p,h1,h2等)選擇字體。

var styleItemsFonts = new object[]
            {
                new { title = "Garant", selector = "p", styles = new { fontFamily = "Garant" } },
                new { title = "Clarendon Cn", selector = "p", styles = new { fontFamily = "Clarendon Cn" } },
                new { title = "Grand Hotel", selector = "p", styles = new { fontFamily = "Grand Hotel" } },
                new { title = "Gotham Bold", selector = "p", styles = new { fontFamily = "Gotham Bold" } }
            };

            var styleFormats = ( new { title = "Font", items = styleItemsFonts });

            config.Default()
                .AddPlugin(plugins)
                .Toolbar(toolbar1, toolbar2)
                .AddSetting("paste_as_text", true)
                .StyleFormats(styleFormats.Item1);

如果刪除'selector =“ p”,則會出現以下控制台錯誤:

Uncaught TypeError: Cannot read property 'toLowerCase' of undefined
at Object.isValidChild (tinymce.min.js:2)
at Object.isValid (tinymce.min.js:2)
at Array.u (tinymce.min.js:2)
at Rt (tinymce.min.js:2)
at tinymce.min.js:2
at Bv (tinymce.min.js:2)
at a (tinymce.min.js:2)
at Object.oy [as applyFormat] (tinymce.min.js:2)
at gy (tinymce.min.js:2)
at Object.toggle (tinymce.min.js:2)

將選擇器設置為*應該可以。 像這樣:

new { title = "Garant", selector = "*", styles = new { fontFamily = "Garant" } }

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM