0
私はGarlic.jsとtinyMCEをRailsアプリで一緒に使えるようにしようとしています。私は私のアセットパイプラインにGarlicを統合しました。私はtinymce-rails gemを使っています。tinyMCEとGarlic.jsを連携させる
両方とも素晴らしいですが、私はそれらを一緒に置くと、ニンニクは動作を停止します。
私は最近micschkの潜在的な解決策は、次のコードでTinyMCEのを初期化する必要ニンニクのgithubのリポジトリ https://github.com/guillaumepotier/Garlic.js/issues/87に掲載しようとしました:
ビュー/レイアウト/ application.html(headタグ内のスクリプト以下)
<script>
tinyMCE.init({
selector: 'textarea.tinymce',
setup : function(editor) {
editor.on("change keyup", function(e){
console.log('saving');
tinyMCE.triggerSave(); // updates all instances
// editor.save(); // updates this instance's textarea
$(editor.getElement()).trigger('change'); // for garlic to detect change
});
}
});
</script>
コードはtinymceを初期化し、 'setup'の後にコードを実行しますが、Garlicの機能を果たさないようです。
ここに私のビューコードは、誰かが適切なソリューションに私を指すことができれば、私は本当に感謝
<%= simple_form_for(@open_ender, remote: true, html: {"data-persist" => 'garlic', id:'open_ender_form' }) do |f| %>
<%= f.error_notification %>
<div class="form-inputs">
<%= f.input :answer_id, :required => true, :as => :hidden, :autofocus => true, input_html: {value: @answer.id } %>
<%= f.input :content, :input_html => { :class => 'tinymce' }, :label => false, :required => true, :autofocus => true %>
<%= button_tag(type: 'submit', id: "save-btn", style:'background:transparent') do %>
<i class="fa fa-floppy-o" aria-hidden="true" title="save"; data-toggle="tooltip"; data-placement="right"></i>
<% end %>
</div>
<% end %>
参照のためです。