返回介绍

Emoticons plugin

发布于 2019-05-06 06:50:30 字数 2678 浏览 1209 评论 0 收藏 0

This plugin adds a dialog to the editor lets users insert emojis into TinyMCE鈥檚 editable area. The dialog can be invoked via a toolbar button - emoticons - or a dedicated menu item added as Insert > Emoticons.

Note: it doesn鈥檛 automatically convert text emoticons into graphical smilies.

Type: String

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

Options

The default database of emojis can be overridden or extended through the options below.

Internally, emoticons is defined by an object mapping emoticon names to additional details, whereby each entry represents a single emoji. The additional details should contain a unicode character representing the emoji, any keywords that can be used to search for the emoji and a category to place the emoji in. Options are expected to be provided in the same format.

{
  robot: {
    keywords: ["computer", "machine", "bot"],
    char: "馃",
    category: "people"
  },
  dog: {
    keywords: ["animal", "friend", "nature", "woof", "puppy", "pet", "faithful"],
    char: "馃惗",
    category: "animals_and_nature"
  }
}

emoticons_append

This option provides a way to append some additional emojis to the default emoji database. This should be an object in the above mentioned format.

Type: Object

Example
tinymce.init({
  selector: "textarea",  // change this value according to your HTML
  plugins: "emoticons",
  toolbar: "emoticons",
  emoticons_append: {
    custom_mind_explode: {
      keywords: ["brain", "mind", "explode", "blown"],
      char: "馃く"
    }
  }
});

emoticons_database_url

This option provides the default location to load the emoji database from. The database should be an external JavaScript file, that assigns an object in the above format, to the window.tinymce.emoticons_plugin_database variable.

Type: String

Default: ${pluginUrl}/js/emojis.js

window.tinymce.emoticons_plugin_database = {
  robot: {
    keywords: ["computer", "machine", "bot"],
    char: "馃",
    category: "people"
  }
}
Example
tinymce.init({
  selector: "textarea",  // change this value according to your HTML
  plugins: "emoticons",
  toolbar: "emoticons",
  emoticons_database_url: '/emojis.js'
});

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

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

发布评论

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