javascript TinyMCE 的 addButton() 函数中所有可能的设置属性是什么?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14399267/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-26 21:31:55  来源:igfitidea点击:

What are all the possible settings attributes in TinyMCE's addButton() function?

javascriptbuttonuser-interfacetinymcewysiwyg

提问by mae

The documentationis not very clear on this.

文件是不是对这个很清楚。

name - String - Button name to add.

settings - Object - Settings object with title, cmd etc.

name - String - 要添加的按钮名称。

设置 - 对象 - 带有标题、cmd等的设置对象。

"etc"? Really? Where can I see the rest of the possible attributes?

“等等”?真的吗?我在哪里可以看到其余的可能属性?

采纳答案by Jason

  • autofocus: True if the control should be focused when rendered
  • border: Border box values example: 1 1 1 1
  • classes: Space separated list of classes to add
  • disabled: Is the control disabled by default
  • hidden: Is the control hidden by default
  • icon: Icon to use for button
  • image: Image to use for icon
  • margin: Margin box values example: 1 1 1 1
  • minHeight: Minimal height for the control
  • minWidth: Minimal width for the control
  • name: Name of the control instance
  • padding: Padding box values example: 1 1 1 1
  • role: WAI-ARIA role to use for control
  • size: Size of the button small|medium|large
  • style: Style CSS properties to add
  • text: Text to display inside widget
  • tooltip: Tooltip text to display when hovering
  • autofocus: 如果控件在渲染时应该被聚焦,则为真
  • border:边框值示例:1 1 1 1
  • classes:要添加的以空格分隔的类列表
  • disabled: 控件是否默认禁用
  • hidden: 控件是否默认隐藏
  • icon: 用于按钮的图标
  • image: 用于图标的图像
  • margin:边距框值示例:1 1 1 1
  • minHeight: 控件的最小高度
  • minWidth: 控件的最小宽度
  • name: 控件实例的名称
  • padding:填充框值示例:1 1 1 1
  • role: 用于控制的 WAI-ARIA 角色
  • size:按钮的大小小|中|大
  • style:要添加的样式 CSS 属性
  • text: 在小部件内显示的文本
  • tooltip: 悬停时显示的工具提示文本

For a full list of all the settings and methods see the TinyMCE documentation page

有关所有设置和方法的完整列表,请参阅TinyMCE 文档页面

回答by Thariama

What you would like to know is what settings may fit into the settings object (tinymce 3). Here it is:

您想知道的是哪些设置可能适合设置对象(tinymce 3)。这里是:

title       --> title
label       --> label
scope       --> scope
onclick     --> function to be called onclick
menu_button --> flag, defines if the button is a menu button
cmd         --> tinymce command to get executed onClick
ui          --> paramter for the tinymce command cmd
value       --> value for the tinymce command cmd

Those settings get assigned in the function createButtonof the class ControlManager.

这些设置createButton在类的函数中分配ControlManager

回答by Andy

Having had the same issue trying to find the addButtondocs in V4 I found the link, just in case anybody needs it.

在尝试addButton在 V4 中查找文档时遇到了同样的问题,我找到了链接,以防万一有人需要它。

tinymce.ui.Button

tinymce.ui.Button

Hope it helps someone!

希望它可以帮助某人!