mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-09-20 23:16:15 +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
|
@ -6,6 +6,11 @@
|
||||||
position: relative;
|
position: relative;
|
||||||
width: calc(100% + 16px);
|
width: calc(100% + 16px);
|
||||||
|
|
||||||
|
// TinyMCE table of contents
|
||||||
|
.mce-toc li {
|
||||||
|
list-style-type: none;
|
||||||
|
}
|
||||||
|
|
||||||
.step-element-grip-placeholder {
|
.step-element-grip-placeholder {
|
||||||
flex: 0;
|
flex: 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,6 +110,7 @@
|
||||||
|
|
||||||
.notification-text {
|
.notification-text {
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
|
font-size: 14px;
|
||||||
max-width: 85%;
|
max-width: 85%;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* global tinymce MarvinJsEditor */
|
/* global I18n tinymce MarvinJsEditor */
|
||||||
tinymce.PluginManager.add('custom_image_toolbar', (editor) => {
|
tinymce.PluginManager.add('custom_image_toolbar', (editor) => {
|
||||||
|
|
||||||
editor.ui.registry.addIcon(
|
editor.ui.registry.addIcon(
|
||||||
|
@ -10,6 +10,7 @@ tinymce.PluginManager.add('custom_image_toolbar', (editor) => {
|
||||||
|
|
||||||
editor.ui.registry.addButton('image_download', {
|
editor.ui.registry.addButton('image_download', {
|
||||||
icon: 'download',
|
icon: 'download',
|
||||||
|
tooltip: I18n.t('general.download'),
|
||||||
onAction: () => {
|
onAction: () => {
|
||||||
const editorIframe = $(`#${editor.id}`).next().find('.tox-edit-area iframe');
|
const editorIframe = $(`#${editor.id}`).next().find('.tox-edit-area iframe');
|
||||||
const image = editorIframe.contents().find('img[data-mce-selected="1"]');
|
const image = editorIframe.contents().find('img[data-mce-selected="1"]');
|
||||||
|
|
|
@ -64,6 +64,13 @@ class TinyMceAsset < ApplicationRecord
|
||||||
|
|
||||||
description = Nokogiri::HTML(description)
|
description = Nokogiri::HTML(description)
|
||||||
tm_assets = description.css('img[data-mce-token]')
|
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|
|
tm_assets.each do |tm_asset|
|
||||||
asset_id = tm_asset.attr('data-mce-token')
|
asset_id = tm_asset.attr('data-mce-token')
|
||||||
new_asset = obj.tiny_mce_assets.find_by(id: Base62.decode(asset_id))
|
new_asset = obj.tiny_mce_assets.find_by(id: Base62.decode(asset_id))
|
||||||
|
|
|
@ -335,7 +335,7 @@ class Constants
|
||||||
).freeze
|
).freeze
|
||||||
|
|
||||||
WHITELISTED_ATTRIBUTES = [
|
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',
|
'class', 'name', 'xml:lang', 'abbr', 'style', 'target', :data, 'border', 'contenteditable',
|
||||||
'colspan', 'rowspan'
|
'colspan', 'rowspan'
|
||||||
].freeze
|
].freeze
|
||||||
|
|
Loading…
Reference in a new issue