mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-02-01 04:32:16 +08:00
Fix table overflow for TinyMCE [SCI-7782]
This commit is contained in:
parent
1ac86b8188
commit
a39058ffe5
3 changed files with 18 additions and 5 deletions
|
@ -18,6 +18,10 @@ function initEditMyModuleDescription() {
|
|||
if ($(this).hasClass('record-info-link')) return;
|
||||
e.stopPropagation();
|
||||
});
|
||||
|
||||
setTimeout(function() {
|
||||
TinyMCE.wrapTables(viewObject);
|
||||
}, 100);
|
||||
}
|
||||
|
||||
function initEditProtocolDescription() {
|
||||
|
|
14
app/javascript/packs/tiny_mce.js
vendored
14
app/javascript/packs/tiny_mce.js
vendored
|
@ -1,4 +1,4 @@
|
|||
/* global I18n hljs GLOBAL_CONSTANTS HelperModule SmartAnnotation */
|
||||
/* global I18n hljs GLOBAL_CONSTANTS HelperModule SmartAnnotation TinyMCE */
|
||||
|
||||
import tinyMCE from 'tinymce/tinymce';
|
||||
import 'tinymce/models/dom';
|
||||
|
@ -329,6 +329,7 @@ window.TinyMCE = (() => {
|
|||
editorForm.find('.tinymce-status-badge').removeClass('hidden');
|
||||
editor.remove();
|
||||
editorForm.find('.tinymce-view').html(data.html).removeClass('hidden');
|
||||
TinyMCE.wrapTables(editorForm.find('.tinymce-view'));
|
||||
editor.plugins.autosave.removeDraft();
|
||||
removeDraft(editor, textAreaObject);
|
||||
if (options.onSaveCallback) { options.onSaveCallback(data); }
|
||||
|
@ -455,7 +456,16 @@ window.TinyMCE = (() => {
|
|||
makeItDirty: (editor) => {
|
||||
makeItDirty(editor);
|
||||
},
|
||||
highlight: initHighlightjs
|
||||
highlight: initHighlightjs,
|
||||
wrapTables: (container) => {
|
||||
container.find('table').toArray().forEach((table) => {
|
||||
if ($(table).parent().hasClass('table-wrapper')) return;
|
||||
|
||||
$(table).css('float', 'none').wrapAll(`
|
||||
<div class="table-wrapper" style="overflow: auto; width: ${container.width()}px"></div>
|
||||
`);
|
||||
});
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
|
|
|
@ -136,6 +136,7 @@
|
|||
this.$emit('update', data.data)
|
||||
}
|
||||
this.$emit('editingDisabled');
|
||||
this.wrapTables();
|
||||
},
|
||||
afterInitCallback: () => {
|
||||
this.active = true;
|
||||
|
@ -151,9 +152,7 @@
|
|||
},
|
||||
wrapTables() {
|
||||
this.$nextTick(() => {
|
||||
$(this.$el).find('.tinymce-view table').toArray().forEach((table) => {
|
||||
$(table).css('float', 'none').wrapAll('<div style="overflow: auto"></div>');
|
||||
})
|
||||
TinyMCE.wrapTables($(this.$el).find('.tinymce-view'));
|
||||
});
|
||||
},
|
||||
initCharacterCount() {
|
||||
|
|
Loading…
Reference in a new issue