返回介绍

快速入门

发布于 2019-04-26 13:14:02 字数 2567 浏览 1412 评论 0 收藏 0

TinyMCE 5.0 is a powerful and flexible rich text editor that can be embedded in the user’s web application.

TinyMCE 5.0 is perfect for developers who want to see how the new version of TinyMCE integrates into their ecosystem.

Step 1: Include the TinyMCE script

Include this line of code in the <head> of the HTML page and link to the tinymce.min.js source file:

<script src="https://cloud.tinymce.com/5/tinymce.min.js?apiKey=your_API_key"></script>

Tip: A complete HTML snippet is provided in Step 2.

Step 2: Initialize TinyMCE as part of a web form

With the script included, initialize TinyMCE 5.0 on any element (or elements) in the web page.

Since TinyMCE enables identifying replaceable elements via a CSS selector, the only requirement is to pass an object that contains a selector to tinymce.init().

In this example, replace <textarea id='mytextarea'> with a TinyMCE 5.0 editor instance by passing the selector '#mytextarea' to tinymce.init().

<!DOCTYPE html>
<html>
<head>
  <script src='https://cloud.tinymce.com/5/tinymce.min.js?apiKey=your_API_key'></script>
  <script>
  tinymce.init({
    selector: '#mytextarea'
  });
  </script>
</head>

<body>
<h1>TinyMCE Quick Start Guide</h1>
  <form method="post">
    <textarea id="mytextarea">Hello, World!</textarea>
  </form>
</body>
</html>

Step 3: Saving content with a form POST

When the <form> is submitted, the TinyMCE 5.0 editor mimics the behavior of a normal HTML <textarea> during the POST. In the user’s form handler, the content submitted can be processed in the same way as the content created from a regular <textarea>.

That is all there is to it!

To download TinyMCE 5.0 and install it locally, the More installation choices page in the Introduction and getting started guide has instructions. This document also provides information about TinyMCE features such as advanced installation options, working with plugins, learning about content filtering, and spell checking.

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

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

发布评论

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