mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-02-02 21:20:08 +08:00
Toolbar position fix for Safari
This commit is contained in:
parent
db399864f8
commit
3d3c6d5350
2 changed files with 10 additions and 2 deletions
4
app/assets/javascripts/sitewide/constants.js.erb
Normal file
4
app/assets/javascripts/sitewide/constants.js.erb
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
const globalConstants = {
|
||||||
|
name_truncation_length: <%= Constants::NAME_TRUNCATION_LENGTH %>,
|
||||||
|
is_safari: /^((?!chrome|android).)*safari/i.test(navigator.userAgent)
|
||||||
|
}
|
8
app/assets/javascripts/sitewide/tiny_mce.js
vendored
8
app/assets/javascripts/sitewide/tiny_mce.js
vendored
|
@ -1,4 +1,4 @@
|
||||||
/* global _ hljs tinyMCE SmartAnnotation I18n */
|
/* global _ hljs tinyMCE SmartAnnotation I18n globalConstants */
|
||||||
/* eslint-disable no-unused-vars */
|
/* eslint-disable no-unused-vars */
|
||||||
|
|
||||||
var TinyMCE = (function() {
|
var TinyMCE = (function() {
|
||||||
|
@ -132,7 +132,11 @@ var TinyMCE = (function() {
|
||||||
editorToolbaroffset = 0;
|
editorToolbaroffset = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
editorToolbar.css('position', 'sticky');
|
if (globalConstants.is_safari) {
|
||||||
|
editorToolbar.css('position', '-webkit-sticky');
|
||||||
|
} else {
|
||||||
|
editorToolbar.css('position', 'sticky');
|
||||||
|
}
|
||||||
editorToolbar.css('top', editorToolbaroffset + 'px');
|
editorToolbar.css('top', editorToolbaroffset + 'px');
|
||||||
|
|
||||||
// Update scroll position after exit
|
// Update scroll position after exit
|
||||||
|
|
Loading…
Reference in a new issue