Ckeditor в Rails: изменяет формат тегов ruby в случае циклов при преобразовании в html - PullRequest
0 голосов
/ 25 марта 2020

? Ckeditor изменяет формат тегов ruby при конвертации в html

✔️ Ожидаемый результат

Ckeditor должен работать правильно, я обновился до последней версии ckeditor и настроен соответственно. Работает нормально, но в случае преобразования из. html .erb в. html искажает форматирование циклов. Для следующих

<tbody>
  <% @acounts.each_with_index do |account, index| %>
    <tr>
      <td><%= index + 1 %></td>
      <td class="<%= fetch_color(account.compnay_name) %>"><span class="h" data-style="<%= fetch_highlight_color(account.compnay_name) %>"><%= fetch_name(account.compnay_name) %></span></td>
      <td class="<%= fetch_color(account.original_account_number) %>"><span class="h" data-style="<%= fetch_highlight_color(account.original_account_number) %>"><%= fetch_name(account.original_account_number) %></span></td>
      <td class="<%= fetch_color(account.new_account_number) %>"><span class="h" data-style="<%= fetch_highlight_color(account.new_account_number) %>"><%= fetch_name(account.new_account_number) %></span></td>
      <td class="<%= fetch_color(account.original_owner) %>"><span class="h" data-style="<%= fetch_highlight_color(account.original_owner) %>"><%= fetch_name(account.original_owner) %></span></td>
      <td class="<%= fetch_color(account.new_owner) %>"><span class="h" data-style="<%= fetch_highlight_color(account.new_owner) %>"><%= fetch_name(account.new_owner) %></span></td>
    </tr>
  <% end %>
</tbody>

❌ Фактический результат

Не обрабатывает l oop. Он изменяет верхний код на следующий:

<% @accounts.each_with_index do |account, index| %> <% end %>
<tbody>
  <tr>
    <td><%= index + 1 %></td>
    <td class="<%= fetch_color(account.compnay_name) %>"><span class="h" data-style="<%= fetch_highlight_color(account.compnay_name) %>"><%= fetch_name(account.compnay_name) %></span></td>
    <td class="<%= fetch_color(account.original_account_number) %>"><span class="h" data-style="<%= fetch_highlight_color(account.original_account_number) %>"><%= fetch_name(account.original_account_number) %></span></td>
    <td class="<%= fetch_color(account.new_account_number) %>"><span class="h" data-style="<%= fetch_highlight_color(account.new_account_number) %>"><%= fetch_name(account.new_account_number) %></span></td>
    <td class="<%= fetch_color(account.original_owner) %>"><span class="h" data-style="<%= fetch_highlight_color(account.original_owner) %>"><%= fetch_name(account.original_owner) %></span></td>
    <td class="<%= fetch_color(account.new_owner) %>"><span class="h" data-style="<%= fetch_highlight_color(account.new_owner) %>"><%= fetch_name(account.new_owner) %></span></td>
  </tr>
</tbody>

Это не то, каким должен быть l oop.

<% @ accounts.each_with_index do | account, index | %> <% end%>

? Прочие сведения

  • Браузер : Chrome
  • OS : Ubuntu 16.04 LTS
  • CKEditor версия: 5.1.0
  • Ruby: 2.6.3
  • Rails версия: 6.0

Есть ли что-то, что я делаю не так? Если у кого-то есть альтернатива, пожалуйста, поделитесь. Спасибо.

...