Skip to content

Commit

Permalink
Merge pull request '[main] fix for IE' (#167) from fix/main-for-ie in…
Browse files Browse the repository at this point in the history
…to release/v8.3.0
  • Loading branch information
maxkadushkin committed Dec 10, 2024
2 parents f1b9b3f + ed74daa commit 8d61d5c
Show file tree
Hide file tree
Showing 16 changed files with 117 additions and 18 deletions.
2 changes: 1 addition & 1 deletion apps/common/main/lib/util/docserviceworker.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
})
.then(function (registrations) {
//delete stale service workers
//for (const registration of registrations) {
// for (const registration of registrations) {
for (let r in registrations) {
const registration = registrations[r];
if (registration !== reg && registration.active && registration.active.scriptURL.endsWith(serviceWorkerName)) {
Expand Down
7 changes: 3 additions & 4 deletions apps/common/main/lib/util/htmlutils.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
const isIE = /msie|trident/i.test(navigator.userAgent);

var checkLocalStorage = (function () {
try {
Expand Down Expand Up @@ -61,7 +60,7 @@ if ( window.nativeprocvars && window.nativeprocvars.rtl !== undefined ) {
else ui_rtl = true;
}

if ( ui_rtl && !isIE ) {
if ( ui_rtl && isIEBrowser !== true ) {
document.body.setAttribute('dir', 'rtl');
document.body.classList.add('rtl');
}
Expand All @@ -87,7 +86,7 @@ function checkScaling() {
}
}

if ( !isIE ) {
if ( isIEBrowser !== true ) {
matches = {
'pixel-ratio__2_5': 'screen and (-webkit-min-device-pixel-ratio: 2.25), screen and (min-resolution: 2.25dppx)',
};
Expand All @@ -107,7 +106,7 @@ let svg_icons = ['./resources/img/[email protected]',
window.Common = {
Utils: {
injectSvgIcons: function () {
if ( isIE ) return;
if ( isIEBrowser === true ) return;

let runonce;
// const el = document.querySelector('div.inlined-svg');
Expand Down
8 changes: 7 additions & 1 deletion apps/documenteditor/main/index.html.deploy
Original file line number Diff line number Diff line change
Expand Up @@ -366,9 +366,15 @@
<inline src="resources/img/form-points.svg" />
<div class="inlined-svg"></div>
<script src="../../../../../../sdkjs/common/device_scale.js?__inline=true"></script>

<script>
isIEBrowser === true &&
(document.write('<script src="../../common/main/lib/util/fix-ie-compat.js"><\/script>'),
document.write('<script src="../../../../sdkjs/vendor/string.js"><\/script>'));
</script>
<script src="../../../vendor/requirejs/require.js"></script>
<script>
isIE === true ? require(['ie/app']) : require(['app']);
isIEBrowser === true ? require(['ie/app']) : require(['app']);
</script>

<link rel="stylesheet" href="../../../apps/documenteditor/main/resources/css/app.css" media="print" onload="this.media='all'">
Expand Down
14 changes: 13 additions & 1 deletion apps/documenteditor/main/index_loader.html.deploy
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,19 @@
<div id="viewport"></div>
<div class="inlined-svg"></div>
<script src="../../../../../../sdkjs/common/device_scale.js?__inline=true"></script>
<script data-main="app" src="../../../vendor/requirejs/require.js"></script>

<script>
var userAgent = navigator.userAgent.toLowerCase(),
check = function(regex){ return regex.test(userAgent); },
isIEBrowser = !check(/opera/) && (check(/msie/) || check(/trident/));
isIEBrowser === true &&
(document.write('<script src="../../common/main/lib/util/fix-ie-compat.js"><\/script>'),
document.write('<script src="../../../../sdkjs/vendor/string.js"><\/script>'));
</script>
<script src="../../../vendor/requirejs/require.js"></script>
<script>
isIEBrowser === true ? require(['ie/app']) : require(['app']);
</script>

<link rel="stylesheet" type="text/css" href="../../../apps/documenteditor/main/resources/css/app.css" media="print" onload="this.media='all'">
</body>
Expand Down
7 changes: 6 additions & 1 deletion apps/pdfeditor/main/index.html.deploy
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,12 @@
<script>
function startApp() {
var script = document.createElement("script");
script.setAttribute("data-main", isIE === true ? "ie/app" : "app");

isIEBrowser === true &&
(document.write('<script src="../../common/main/lib/util/fix-ie-compat.js"><\/script>'),
document.write('<script src="../../../../sdkjs/vendor/string.js"><\/script>'));

script.setAttribute("data-main", isIEBrowser === true ? "ie/app" : "app");
script.src = "../../../vendor/requirejs/require.js";
document.body.appendChild(script);
}
Expand Down
7 changes: 6 additions & 1 deletion apps/pdfeditor/main/index_loader.html.deploy
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,12 @@
<script>
function startApp() {
var script = document.createElement("script");
script.setAttribute("data-main", "app");

isIEBrowser === true &&
(document.write('<script src="../../common/main/lib/util/fix-ie-compat.js"><\/script>'),
document.write('<script src="../../../../sdkjs/vendor/string.js"><\/script>'));

script.setAttribute("data-main", isIEBrowser === true ? "ie/app" : "app");
script.src = "../../../vendor/requirejs/require.js";
document.body.appendChild(script);
}
Expand Down
11 changes: 10 additions & 1 deletion apps/presentationeditor/main/index.html.deploy
Original file line number Diff line number Diff line change
Expand Up @@ -385,9 +385,18 @@
<inline src="../../common/main/resources/img/combo-border-size/BorderSize.svg" />
<div class="inlined-svg"></div>
<script src="../../../../../../sdkjs/common/device_scale.js?__inline=true"></script>

<script>
var userAgent = navigator.userAgent.toLowerCase(),
check = function(regex){ return regex.test(userAgent); },
isIEBrowser = !check(/opera/) && (check(/msie/) || check(/trident/));
isIEBrowser === true &&
(document.write('<script src="../../common/main/lib/util/fix-ie-compat.js"><\/script>'),
document.write('<script src="../../../../sdkjs/vendor/string.js"><\/script>'));
</script>
<script src="../../../vendor/requirejs/require.js"></script>
<script>
isIE === true ? require(['ie/app']) : require(['app']);
isIEBrowser === true ? require(['ie/app']) : require(['app']);
</script>

<link rel="stylesheet" href="../../../apps/presentationeditor/main/resources/css/app.css" media="print" onload="this.media='all'">
Expand Down
11 changes: 10 additions & 1 deletion apps/presentationeditor/main/index_loader.html.deploy
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,16 @@
<div class="inlined-svg"></div>

<script src="../../../../../../sdkjs/common/device_scale.js?__inline=true"></script>
<script data-main="app" src="../../../vendor/requirejs/require.js"></script>

<script>
isIEBrowser === true &&
(document.write('<script src="../../common/main/lib/util/fix-ie-compat.js"><\/script>'),
document.write('<script src="../../../../sdkjs/vendor/string.js"><\/script>'));
</script>
<script src="../../../vendor/requirejs/require.js"></script>
<script>
isIEBrowser === true ? require(['ie/app']) : require(['app']);
</script>

<link rel="stylesheet" href="../../../apps/presentationeditor/main/resources/css/app.css" media="print" onload="this.media='all'">
</body>
Expand Down
8 changes: 7 additions & 1 deletion apps/spreadsheeteditor/main/index.html.deploy
Original file line number Diff line number Diff line change
Expand Up @@ -407,9 +407,15 @@
<inline src="resources/img/cf-icons.svg" />
<div class="inlined-svg"></div>
<script src="../../../../../../sdkjs/common/device_scale.js?__inline=true"></script>

<script>
isIEBrowser === true &&
(document.write('<script src="../../common/main/lib/util/fix-ie-compat.js"><\/script>'),
document.write('<script src="../../../../sdkjs/vendor/string.js"><\/script>'));
</script>
<script src="../../../vendor/requirejs/require.js"></script>
<script>
isIE === true ? require(['ie/app']) : require(['app']);
isIEBrowser === true ? require(['ie/app']) : require(['app']);
</script>
<link rel="stylesheet" href="../../../apps/spreadsheeteditor/main/resources/css/app.css" media="print" onload="this.media='all'">
</body>
Expand Down
14 changes: 13 additions & 1 deletion apps/spreadsheeteditor/main/index_internal.html.deploy
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,19 @@
<div class="inlined-svg"></div>

<script src="../../../../../../sdkjs/common/device_scale.js?__inline=true"></script>
<script data-main="app" src="../../../vendor/requirejs/require.js"></script>

<script>
const userAgent = navigator.userAgent.toLowerCase(),
check = function(regex){ return regex.test(userAgent); },
isIEBrowser = !check(/opera/) && (check(/msie/) || check(/trident/));
isIEBrowser === true &&
(document.write('<script src="../../common/main/lib/util/fix-ie-compat.js"><\/script>'),
document.write('<script src="../../../../sdkjs/vendor/string.js"><\/script>'));
</script>
<script src="../../../vendor/requirejs/require.js"></script>
<script>
isIEBrowser === true ? require(['ie/app']) : require(['app']);
</script>

<link rel="stylesheet" href="../../../apps/spreadsheeteditor/main/resources/css/app.css" media="print" onload="this.media='all'">
</body>
Expand Down
13 changes: 12 additions & 1 deletion apps/spreadsheeteditor/main/index_loader.html.deploy
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,18 @@
<div class="inlined-svg"></div>

<script src="../../../../../../sdkjs/common/device_scale.js?__inline=true"></script>
<script data-main="app" src="../../../vendor/requirejs/require.js"></script>
<script>
const userAgent = navigator.userAgent.toLowerCase(),
check = function(regex){ return regex.test(userAgent); },
isIEBrowser = !check(/opera/) && (check(/msie/) || check(/trident/));
isIEBrowser === true &&
(document.write('<script src="../../common/main/lib/util/fix-ie-compat.js"><\/script>'),
document.write('<script src="../../../../sdkjs/vendor/string.js"><\/script>'));
</script>
<script src="../../../vendor/requirejs/require.js"></script>
<script>
isIEBrowser === true ? require(['ie/app']) : require(['app']);
</script>

<link rel="stylesheet" href="../../../apps/spreadsheeteditor/main/resources/css/app.css" media="print" onload="this.media='all'">
</body>
Expand Down
2 changes: 1 addition & 1 deletion apps/visioeditor/main/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ var reqerr;
require.config({
// The shim config allows us to configure dependencies for
// scripts that do not call define() to register a module
baseUrl: '../../',
baseUrl: window.customBaseUrl || '../../',
paths: {
jquery : '../vendor/jquery/jquery',
underscore : '../vendor/underscore/underscore',
Expand Down
11 changes: 10 additions & 1 deletion apps/visioeditor/main/index.html.deploy
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,16 @@
<inline src="../../common/main/resources/img/header/icons.svg" />
<div class="inlined-svg"></div>
<script src="../../../../../../sdkjs/common/device_scale.js?__inline=true"></script>
<script data-main="app" src="../../../vendor/requirejs/require.js"></script>
<script src="../../../vendor/requirejs/require.js"></script>

<script>
isIEBrowser === true &&
(document.write('<script src="../../common/main/lib/util/fix-ie-compat.js"><\/script>'),
document.write('<script src="../../../../sdkjs/vendor/string.js"><\/script>'));
</script>
<script>
isIEBrowser === true ? require(['ie/app']) : require(['app']);
</script>

<link rel="stylesheet" href="../../../apps/visioeditor/main/resources/css/app.css" media="print" onload="this.media='all'">
</body>
Expand Down
14 changes: 13 additions & 1 deletion apps/visioeditor/main/index_loader.html.deploy
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,19 @@
<div class="inlined-svg"></div>

<script src="../../../../../../sdkjs/common/device_scale.js?__inline=true"></script>
<script data-main="app" src="../../../vendor/requirejs/require.js"></script>

<script>
const userAgent = navigator.userAgent.toLowerCase(),
check = function(regex){ return regex.test(userAgent); },
isIEBrowser = !check(/opera/) && (check(/msie/) || check(/trident/));
isIEBrowser === true &&
(document.write('<script src="../../common/main/lib/util/fix-ie-compat.js"><\/script>'),
document.write('<script src="../../../../sdkjs/vendor/string.js"><\/script>'));
</script>
<script src="../../../vendor/requirejs/require.js"></script>
<script>
isIEBrowser === true ? require(['ie/app']) : require(['app']);
</script>

<link rel="stylesheet" href="../../../apps/visioeditor/main/resources/css/app.css" media="print" onload="this.media='all'">
</body>
Expand Down
2 changes: 1 addition & 1 deletion build/Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ module.exports = function(grunt) {
babel: {
options: {
sourceMap: false,
presets: ['@babel/preset-env']
presets: [['@babel/preset-env', {modules: false}]]
},
dist: {
files: packageFile.main.js.babel.files
Expand Down
4 changes: 4 additions & 0 deletions build/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@
"src": "../apps/common/main/resources/themes/themes.json",
"dest": "../deploy/web-apps/apps/common/main/resources/themes/themes.json"
},
"iecompat": {
"src": "../apps/common/main/lib/util/fix-ie-compat.js",
"dest": "../deploy/web-apps/apps/common/main/lib/util/fix-ie-compat.js"
},
"help": {
"expand": true,
"cwd": "../apps/common/main/resources/help/",
Expand Down

0 comments on commit 8d61d5c

Please sign in to comment.