mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-01-19 05:47:53 +08:00
Merge pull request #1743 from mlorb/ml-sci-3386
Fix tiny mce visuals, saving and cursor position [SCI-3386]
This commit is contained in:
commit
110c4ec460
2 changed files with 11 additions and 5 deletions
8
app/assets/javascripts/sitewide/tiny_mce.js
vendored
8
app/assets/javascripts/sitewide/tiny_mce.js
vendored
|
@ -57,6 +57,7 @@ var TinyMCE = (function() {
|
|||
menubar: 'file edit view insert format',
|
||||
toolbar: 'undo redo restoredraft | insert | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link | forecolor backcolor | customimageuploader | codesample',
|
||||
plugins: 'autosave autoresize customimageuploader link advlist codesample autolink lists charmap hr anchor searchreplace wordcount visualblocks visualchars insertdatetime nonbreaking save directionality paste textcolor colorpicker textpattern',
|
||||
autoresize_bottom_margin: 20,
|
||||
codesample_languages: [
|
||||
{ text: 'R', value: 'r' },
|
||||
{ text: 'MATLAB', value: 'matlab' },
|
||||
|
@ -139,6 +140,7 @@ var TinyMCE = (function() {
|
|||
$('.tinymce-placeholder').remove();
|
||||
moveToolbar(editor, editorToolbar, editorToolbaroffset);
|
||||
}, 400);
|
||||
|
||||
// Init saved status label
|
||||
if (editor.getContent() !== '') {
|
||||
editorForm.find('.tinymce-status-badge').removeClass('hidden');
|
||||
|
@ -149,7 +151,6 @@ var TinyMCE = (function() {
|
|||
moveToolbar(editor, editorToolbar, editorToolbaroffset);
|
||||
});
|
||||
|
||||
|
||||
// Update scroll position after exit
|
||||
function updateScrollPosition() {
|
||||
if (editorForm.offset().top < $(window).scrollTop()) {
|
||||
|
@ -202,6 +203,11 @@ var TinyMCE = (function() {
|
|||
})
|
||||
.removeClass('hidden');
|
||||
|
||||
// Set cursor to the end of the content
|
||||
editor.focus();
|
||||
editor.selection.select(editor.getBody(), true);
|
||||
editor.selection.collapse(false);
|
||||
|
||||
SmartAnnotation.init($(editor.contentDocument.activeElement));
|
||||
initHighlightjsIframe($(this.iframeElement).contents());
|
||||
},
|
||||
|
|
|
@ -4,12 +4,12 @@
|
|||
.tinymce-view {
|
||||
border: solid 1px;
|
||||
border-color: $color-white;
|
||||
box-shadow: 1px 0 2px $color-alto;
|
||||
min-height: 200px;
|
||||
border-radius: 3px;
|
||||
min-height: 100px;
|
||||
padding: 3px;
|
||||
|
||||
&:hover {
|
||||
border-color: $color-alto;
|
||||
border-color: $color-gainsboro;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
|
@ -59,4 +59,4 @@
|
|||
.mce-toolbar {
|
||||
background: $color-white !important;
|
||||
}
|
||||
// scss-lint:enable ImportantRule
|
||||
// scss-lint:enable ImportantRule
|
||||
|
|
Loading…
Reference in a new issue