mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-26 09:42:46 +08:00
Merge pull request #4984 from artoscinote/ma_SCI_7937
Fix table of contents, add image download tooltip [SCI-7937]
This commit is contained in:
commit
6400745b0c
5 changed files with 16 additions and 2 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -110,6 +110,7 @@
|
|||
|
||||
.notification-text {
|
||||
flex-grow: 1;
|
||||
font-size: 14px;
|
||||
max-width: 85%;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
|
|
|
@ -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"]');
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue