程序員論壇

 找回密碼
 立即註冊
搜索
熱搜: 活動 交友 discuz
查看: 5664|回復: 0
打印 上一主題 下一主題

TinyMCE 插件

[複製鏈接]

8166

主題

1

好友

2萬

積分

版主

Rank: 7Rank: 7Rank: 7

跳轉到指定樓層
樓主
發表於 2020-8-13 23:41:49 |只看該作者 |倒序瀏覽
此示例包括大多數可用的TinyMCE插件,包括Tiny Cloud高級訂閱中可用的插件。

Javascript :

  1. tinymce.init({
  2.   selector: 'textarea#full-featured',
  3.   plugins: 'print preview powerpaste casechange importcss tinydrive searchreplace autolink autosave save directionality advcode visualblocks visualchars fullscreen image link media mediaembed template codesample table charmap hr pagebreak nonbreaking anchor toc insertdatetime advlist lists checklist wordcount tinymcespellchecker a11ychecker imagetools textpattern noneditable help formatpainter permanentpen pageembed charmap tinycomments mentions quickbars linkchecker emoticons advtable',
  4.   tinydrive_token_provider: 'URL_TO_YOUR_TOKEN_PROVIDER',
  5.   tinydrive_dropbox_app_key: 'YOUR_DROPBOX_APP_KEY',
  6.   tinydrive_google_drive_key: 'YOUR_GOOGLE_DRIVE_KEY',
  7.   tinydrive_google_drive_client_id: 'YOUR_GOOGLE_DRIVE_CLIENT_ID',
  8.   mobile: {
  9.     plugins: 'print preview powerpaste casechange importcss tinydrive searchreplace autolink autosave save directionality advcode visualblocks visualchars fullscreen image link media mediaembed template codesample table charmap hr pagebreak nonbreaking anchor toc insertdatetime advlist lists checklist wordcount tinymcespellchecker a11ychecker textpattern noneditable help formatpainter pageembed charmap mentions quickbars linkchecker emoticons advtable'
  10.   },
  11.   menu: {
  12.     tc: {
  13.       title: 'TinyComments',
  14.       items: 'addcomment showcomments deleteallconversations'
  15.     }
  16.   },
  17.   menubar: 'file edit view insert format tools table tc help',
  18.   toolbar: 'undo redo | bold italic underline strikethrough | fontselect fontsizeselect formatselect | alignleft aligncenter alignright alignjustify | outdent indent |  numlist bullist checklist | forecolor backcolor casechange permanentpen formatpainter removeformat | pagebreak | charmap emoticons | fullscreen  preview save print | insertfile image media pageembed template link anchor codesample | a11ycheck ltr rtl | showcomments addcomment',
  19.   autosave_ask_before_unload: true,
  20.   autosave_interval: "30s",
  21.   autosave_prefix: "{path}{query}-{id}-",
  22.   autosave_restore_when_empty: false,
  23.   autosave_retention: "2m",
  24.   image_advtab: true,
  25.   content_css: '//www.tiny.cloud/css/codepen.min.css',
  26.   link_list: [
  27.     { title: 'My page 1', value: 'http://www.tinymce.com' },
  28.     { title: 'My page 2', value: 'http://www.moxiecode.com' }
  29.   ],
  30.   image_list: [
  31.     { title: 'My page 1', value: 'http://www.tinymce.com' },
  32.     { title: 'My page 2', value: 'http://www.moxiecode.com' }
  33.   ],
  34.   image_class_list: [
  35.     { title: 'None', value: '' },
  36.     { title: 'Some class', value: 'class-name' }
  37.   ],
  38.   importcss_append: true,
  39.   templates: [
  40.         { title: 'New Table', description: 'creates a new table', content: '<div class="mceTmpl"><table width="98%%"  border="0" cellspacing="0" cellpadding="0"><tr><th scope="col"> </th><th scope="col"> </th></tr><tr><td> </td><td> </td></tr></table></div>' },
  41.     { title: 'Starting my story', description: 'A cure for writers block', content: 'Once upon a time...' },
  42.     { title: 'New list with dates', description: 'New List with dates', content: '<div class="mceTmpl"><span class="cdate">cdate</span>
  43. <span class="mdate">mdate</span><h2>My List</h2><ul><li></li><li></li></ul></div>' }
  44.   ],
  45.   template_cdate_format: '[Date Created (CDATE): %m/%d/%Y : %H:%M:%S]',
  46.   template_mdate_format: '[Date Modified (MDATE): %m/%d/%Y : %H:%M:%S]',
  47.   height: 600,
  48.   image_caption: true,
  49.   quickbars_selection_toolbar: 'bold italic | quicklink h2 h3 blockquote quickimage quicktable',
  50.   noneditable_noneditable_class: "mceNonEditable",
  51.   toolbar_mode: 'sliding',
  52.   spellchecker_whitelist: ['Ephox', 'Moxiecode'],
  53.   tinycomments_mode: 'embedded',
  54.   content_style: ".mymention{ color: gray; }",
  55.   contextmenu: "link image imagetools table configurepermanentpen",
  56.   a11y_advanced_options: true,
  57.   /*
  58.   The following settings require more configuration than shown here.
  59.   For information on configuring the mentions plugin, see:
  60.   https://www.tiny.cloud/docs/plugins/mentions/.
  61.   */
  62.   mentions_selector: '.mymention',
  63.   mentions_fetch: mentions_fetch,
  64.   mentions_menu_hover: mentions_menu_hover,
  65.   mentions_menu_complete: mentions_menu_complete,
  66.   mentions_select: mentions_select,
  67. });

複製代碼
CSS :


  1. textarea#mentions {
  2.   height: 350px;
  3. }

  4. div.card,
  5. .tox div.card {
  6.   width: 240px;
  7.   background: white;
  8.   border: 1px solid #ccc;
  9.   border-radius: 3px;
  10.   box-shadow: 0 4px 8px 0 rgba(34, 47, 62, .1);
  11.   padding: 8px;
  12.   font-size: 14px;
  13.   font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;
  14. }

  15. div.card::after,
  16. .tox div.card::after {
  17.   content: "";
  18.   clear: both;
  19.   display: table;
  20. }

  21. div.card h1,
  22. .tox div.card h1 {
  23.   font-size: 14px;
  24.   font-weight: bold;
  25.   margin: 0 0 8px;
  26.   padding: 0;
  27.   line-height: normal;
  28.   font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;
  29. }

  30. div.card p,
  31. .tox div.card p {
  32.   font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;
  33. }

  34. div.card img.avatar,
  35. .tox div.card img.avatar {
  36.   width: 48px;
  37.   height: 48px;
  38.   margin-right: 8px;
  39.   float: left;
  40. }

複製代碼
HTML :

  1. <textarea id="full-featured"><p style="text-align: center; font-size: 15px;"><img title="TinyMCE Logo" src="//www.tiny.cloud/images/glyph-tinymce@2x.png" alt="TinyMCE Logo" width="110" height="97" />
  2.   </p>
  3.   <h2 style="text-align: center;">Welcome to the TinyMCE Cloud demo!</h2>
  4.   <h5 style="text-align: center;">Note, this includes some "enterprise/premium" features.
  5. Visit the <a href="https://www.tiny.cloud/pricing">pricing page</a> to learn more about our premium plugins.</h5>
  6.   <p>Please try out the features provided in this full featured example.</p>

  7.   <h2>Got questions or need help?</h2>
  8.   <ul>
  9.     <li>Our <a class="mceNonEditable" href="//www.tiny.cloud/docs/">documentation</a> is a great resource for learning how to configure TinyMCE.</li>
  10.     <li>Have a specific question? Visit the <a class="mceNonEditable" href="https://community.tiny.cloud/forum/">Community Forum</a>.</li>
  11.     <li>We also offer enterprise grade support as part of <a href="https://www.tiny.cloud/pricing">TinyMCE premium subscriptions</a>.</li>
  12.   </ul>

  13.   <h2>A simple table to play with</h2>
  14.   <table style="text-align: center;border-collapse: collapse; width: 100%;">
  15.     <thead>
  16.       <tr>
  17.         <th>Product</th>
  18.         <th>Cost</th>
  19.         <th>Really?</th>
  20.       </tr>
  21.     </thead>
  22.     <tbody>
  23.       <tr>
  24.         <td>TinyMCE Cloud</td>
  25.         <td>Get started for free</td>
  26.         <td>YES!</td>
  27.       </tr>
  28.       <tr>
  29.         <td>Plupload</td>
  30.         <td>Free</td>
  31.         <td>YES!</td>
  32.       </tr>
  33.     </tbody>
  34.   </table>

  35.   <h2>Found a bug?</h2>
  36.   <p>If you think you have found a bug please create an issue on the <a href="https://github.com/tinymce/tinymce/issues">GitHub repo</a> to report it to the developers.</p>

  37.   <h2>Finally ...</h2>
  38.   <p>Don't forget to check out our other product <a href="http://www.plupload.com" target="_blank">Plupload</a>, your ultimate upload solution featuring HTML5 upload support.</p>
  39.   <p>Thanks for supporting TinyMCE! We hope it helps you and your users create great content.
  40. All the best from the TinyMCE team.</p>
  41. </textarea>


複製代碼
回復

使用道具 舉報

您需要登錄後才可以回帖 登錄 | 立即註冊

程序員論壇

GMT+8, 2024-9-17 04:42 , Processed in 0.032936 second(s), 20 queries .

Powered by Discuz! X2.5

© 2001-2012 Comsenz Inc.

回頂部
HK Piece免費建立你的網上商店
Pocket Money Easy