Skip to content

想問一下 在rails 專案當中可以使用嗎? #7

@z25525000

Description

@z25525000

Simditor 版本2.3.6

我把rails專案

在public 資料夾 新增 一個資料夾 assets 然後將simditor-emoji 裡面的檔案全部丟進去

接著

首頁layout

  <title>test</title>
  <%= stylesheet_link_tag    'application', media: 'all', 'data-turbolinks-track' => true %>
  <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
  <link rel="stylesheet" type="text/css" href="/assets/styles/simditor-prettyemoji.css" />
  <script src ="/assets/lib/simditor-prettyemoji.js"></script>

text_area使用

<%= f.text_area :body, :rows =>7, :cols => 50, :id => "editor",message:'內容不可以為空白以及少於20個字', placeholder: "填寫內文" %>

<script type="text/javascript">
      $(function() {
     Simditor.locale = 'en-US';

      var editor = new Simditor({
        textarea: $('#editor'),
        markdown: true,
        toolbar: ['emoji', 'title', 'bold', 'italic', 'underline', 'strikethrough', 'color', '|', 'ol', 'ul', 'blockquote', 'code', 'table', '|', 'link', 'image', 'hr', '|', 'indent', 'outdent', 'alignment', '|', 'markdown'],
        emoji: {
                    autoClose: true,
                    imagePath: 'images/emoji/',                    
                    categories: ["face","fashion","animal","food","travel","time","work","font","tool","other"]
                }   

      });
    });
</script>

如果刪掉 toolbar: ['emoji', ....] 當中的 'emoji' 原本的Simditor是正常

不知道有沒有人試過該如何使用??

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions