Merge pull request #4984 from artoscinote/ma_SCI_7937

Fix table of contents, add image download tooltip [SCI-7937]
This commit is contained in:
artoscinote 2023-02-17 14:59:01 +01:00 committed by GitHub
commit 6400745b0c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 16 additions and 2 deletions

View file

@ -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;
}

View file

@ -110,6 +110,7 @@
.notification-text {
flex-grow: 1;
font-size: 14px;
max-width: 85%;
overflow: hidden;
text-overflow: ellipsis;

View file

@ -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"]');

View file

@ -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))

View file

@ -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