diff --git a/app/assets/stylesheets/steps/components/text.scss b/app/assets/stylesheets/steps/components/text.scss index 2e52e9c70..f6e39487d 100644 --- a/app/assets/stylesheets/steps/components/text.scss +++ b/app/assets/stylesheets/steps/components/text.scss @@ -6,6 +6,11 @@ position: relative; width: calc(100% + 16px); + // TinyMCE table of contents + .mce-toc li { + list-style-type: none; + } + .step-element-grip-placeholder { flex: 0; } diff --git a/app/assets/stylesheets/tiny_mce.scss b/app/assets/stylesheets/tiny_mce.scss index 2643ceb28..13bd54b94 100644 --- a/app/assets/stylesheets/tiny_mce.scss +++ b/app/assets/stylesheets/tiny_mce.scss @@ -110,6 +110,7 @@ .notification-text { flex-grow: 1; + font-size: 14px; max-width: 85%; overflow: hidden; text-overflow: ellipsis; diff --git a/app/javascript/packs/tinymce/image_toolbar/plugin.js b/app/javascript/packs/tinymce/image_toolbar/plugin.js index 3ecad2ae6..2dfa2c5b7 100644 --- a/app/javascript/packs/tinymce/image_toolbar/plugin.js +++ b/app/javascript/packs/tinymce/image_toolbar/plugin.js @@ -1,4 +1,4 @@ -/* global tinymce MarvinJsEditor */ +/* global I18n tinymce MarvinJsEditor */ tinymce.PluginManager.add('custom_image_toolbar', (editor) => { editor.ui.registry.addIcon( @@ -10,6 +10,7 @@ tinymce.PluginManager.add('custom_image_toolbar', (editor) => { editor.ui.registry.addButton('image_download', { icon: 'download', + tooltip: I18n.t('general.download'), onAction: () => { const editorIframe = $(`#${editor.id}`).next().find('.tox-edit-area iframe'); const image = editorIframe.contents().find('img[data-mce-selected="1"]'); diff --git a/app/models/tiny_mce_asset.rb b/app/models/tiny_mce_asset.rb index 9a7300407..054fa2e2b 100644 --- a/app/models/tiny_mce_asset.rb +++ b/app/models/tiny_mce_asset.rb @@ -64,6 +64,13 @@ class TinyMceAsset < ApplicationRecord description = Nokogiri::HTML(description) tm_assets = description.css('img[data-mce-token]') + + # Make same-page anchor links work properly with turbolinks + links = description.css('[href]') + links.each do |link| + link['data-turbolinks'] = false if link['href'].starts_with?('#') + end + tm_assets.each do |tm_asset| asset_id = tm_asset.attr('data-mce-token') new_asset = obj.tiny_mce_assets.find_by(id: Base62.decode(asset_id)) diff --git a/config/initializers/constants.rb b/config/initializers/constants.rb index 04418908e..bb1df7d5a 100644 --- a/config/initializers/constants.rb +++ b/config/initializers/constants.rb @@ -335,7 +335,7 @@ class Constants ).freeze WHITELISTED_ATTRIBUTES = [ - 'href', 'src', 'width', 'height', 'alt', 'cite', 'datetime', 'title', + 'id', 'href', 'src', 'width', 'height', 'alt', 'cite', 'datetime', 'title', 'class', 'name', 'xml:lang', 'abbr', 'style', 'target', :data, 'border', 'contenteditable', 'colspan', 'rowspan' ].freeze