返回介绍

Character Map plugin

发布于 2019-05-06 06:50:29 字数 2386 浏览 895 评论 0 收藏 0

This plugin adds a dialog to the editor with a map of special unicode characters, which cannot be added directly from the keyboard. The dialog can be invoked via a toolbar button - charmap - or a dedicated menu item added as Insert > Special character.

Type: String

Example
tinymce.init({
  selector: "textarea",  // change this value according to your HTML
  plugins: "charmap",
  toolbar: "charmap",
  menubar: "insert"
});

Options

The default map of unicode characters can be overridden or extended through the options below.

Internally, character map is defined by the array of arrays, where each sub-array represents a single character. The first item in the sub-array is character code. The second is a title that shows up when mouse hovers over the specified character in the map. Character code can be either decimal, octal or hexadecimal (in the case of octal or hexadecimal format, code should be appropriately prefixed with 0 and 0x). Options are expected to be provided in the same format.

[
  [160, 'no-break space'],
  [173, 'soft hyphen'],
  [34, 'quotation mark'],
  ...
  [8205, 'zero width joiner'],
  [8206, 'left-to-right mark'],
  [8207, 'right-to-left mark']
];

charmap

With this option it is possible to fully override the default character map. This can be an array or a function that returns an array in the above mentioned format.

Type: Array, Function

Example
tinymce.init({
  selector: "textarea",  // change this value according to your HTML
  plugins: "charmap",
  toolbar: "charmap",
  menubar: "insert",
  charmap: [
    [0x2615, 'morning coffee']
  ]
});

charmap_append

This option provides a way to append some additional characters to the default character map. This can be array or a function that returns an array in the above mentioned format.

Type: Array, Function

Example
tinymce.init({
  selector: "textarea",  // change this value according to your HTML
  plugins: "charmap",
  toolbar: "charmap",
  menubar: "insert",
  charmap_append: [
    [0x2600, 'sun'],
    [0x2601, 'cloud']
  ]
});

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文