返回介绍

Save plugin

发布于 2019-05-06 06:50:38 字数 2598 浏览 1075 评论 0 收藏 0

This plugin adds a save button to the TinyMCE toolbar, which will submit the form that the editor is within.

Type: String

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

Error messages

The "Error: Form submit field collision." error message will appear if you call the submit button of your form “submit”, which causes a collision with the JS form submit function and makes it impossible to submit the form using code. This can easily be avoided by naming the submit button "submitbtn" or similar.

So replace this:

<form><button name="submit"></button></form>

With this:

<form><button name="submitbtn"></button></form>

Options

These settings affect the execution of the save plugin. Callbacks that will execute after saving the content or canceling saving the content are included in this section. In addition, a setting that will disable the save button when no modifications have been made to the content is available here.

save_enablewhendirty

This option allows you to disable the save button until modifications have been made to the content of the editor. This option is enabled by default.

Type: Boolean

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

save_oncancelcallback

This option allows you to specify the function that will be executed when the cancel button/command is invoked.

Type: String

Example
tinymce.init({
  selector: "textarea",  // change this value according to your HTML
  plugins: "save",
  toolbar: "save",
  save_oncancelcallback: function () { console.log('Save canceled'); }
});

save_onsavecallback

This option allows you to specify the function that will be executed when the save button/command is invoked.

Type: String

Example
tinymce.init({
  selector: "textarea",  // change this value according to your HTML
  plugins: "save",
  toolbar: "save",
  save_onsavecallback: function () { console.log('Saved'); }
});

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

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

发布评论

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