开发者

CKEditor add more symbols

How can I add more "custom" s开发者_如何学Pythonymbols in the Insert Special Character panel please?

Thank you.


Note this can be done in the config file as well:

http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-specialChars


In your config file => config.js

CKeditor Documentation: http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-specialChars

config.specialChars = [ '"', '’', [ '&custom;', 'Custom label' ] ];
config.specialChars = config.specialChars.concat( [ '"', [ '’', 'Custom label' ] ] );

If you want to add special characters (Greek for example):

config.specialChars = config.specialChars.concat( [ [ 'α', 'alpha' ],
      [ 'β', 'beta' ],
      [ 'γ', 'gamma' ],
      [ 'δ', 'delta' ],
      [ 'ε', 'epsilon' ],
      [ 'ζ', 'zeta' ],
      [ 'η', 'eta' ],
      [ 'θ', 'theta' ],
      [ 'ι', 'iota' ],
      [ 'κ', 'kappa' ],
      [ 'λ', 'lambda' ],
      [ 'μ', 'mu' ],
      [ 'ν', 'nu' ],
      [ 'ξ', 'xi' ],
      [ 'ο', 'omicron' ],
      [ 'π', 'pi' ],
      [ 'ρ', 'rho' ],
      [ 'σ', 'sigma' ],
      [ 'τ', 'tau' ],
      [ 'υ', 'upsilon' ],
      [ 'φ', 'phi' ],
      [ 'χ', 'chi' ],
      [ 'ψ', 'psi' ],
      [ 'ω', 'omega' ] ] );


Adding custom symbols is actually pretty easy. Within the ckeditor folder go to the file:

ckeditor/plugins/specialchar/dialogs/specialchar.js

You'll see a large code block halfway through the file containing a ton of entity codes, the last one is ≈ - after that one, add any new ones you want separated by commas and surrounded in single quotes. ,'new','new'.

I hope that helps!


Open up your config.js file,

If you want to insert male(♂) symbol use the below code in the config file,

config.specialChars = config.specialChars.concat('♂');

If you want to insert male symbol with custom label,

config.specialChars = config.specialChars.concat(['♂', 'Male']);


I have a CKeditor 4 installed, in my case I had to go to root > assets > backend > ckeditor > ckeditor.js

The code looks like this

CKEditor add more symbols

I then added this patch

CKEditor add more symbols

and it works

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜