MOBILE-3645 build: Add script to copy some files to www
parent
e44212bf19
commit
5edc8de380
|
@ -28,6 +28,7 @@ npm-debug.log*
|
|||
/platforms
|
||||
/plugins
|
||||
/www
|
||||
/src/assets/lib
|
||||
|
||||
/moodle.*.config.json
|
||||
!/moodle.example.config.json
|
||||
|
|
|
@ -3,5 +3,9 @@
|
|||
"integrations": {
|
||||
"cordova": {}
|
||||
},
|
||||
"type": "angular"
|
||||
"type": "angular",
|
||||
"hooks": {
|
||||
"build:before": "./scripts/copy-assets.js",
|
||||
"serve:before": "./scripts/copy-assets.js"
|
||||
}
|
||||
}
|
|
@ -10531,14 +10531,14 @@
|
|||
"optional": true
|
||||
},
|
||||
"fs-extra": {
|
||||
"version": "9.0.1",
|
||||
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.0.1.tgz",
|
||||
"integrity": "sha512-h2iAoN838FqAFJY2/qVpzFXy+EBxfVE220PalAqQLDVsFOHLJrZvut5puAbCdNv6WJk+B8ihI+k0c7JK5erwqQ==",
|
||||
"version": "9.1.0",
|
||||
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz",
|
||||
"integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==",
|
||||
"requires": {
|
||||
"at-least-node": "^1.0.0",
|
||||
"graceful-fs": "^4.2.0",
|
||||
"jsonfile": "^6.0.1",
|
||||
"universalify": "^1.0.0"
|
||||
"universalify": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"fs-minipass": {
|
||||
|
@ -14192,12 +14192,12 @@
|
|||
"dev": true
|
||||
},
|
||||
"jsonfile": {
|
||||
"version": "6.0.1",
|
||||
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.0.1.tgz",
|
||||
"integrity": "sha512-jR2b5v7d2vIOust+w3wtFKZIfpC2pnRmFAhAC/BuweZFQR8qZzxH1OyrQ10HmdVYiXWkYUqPVsz91cG7EL2FBg==",
|
||||
"version": "6.1.0",
|
||||
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz",
|
||||
"integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==",
|
||||
"requires": {
|
||||
"graceful-fs": "^4.1.6",
|
||||
"universalify": "^1.0.0"
|
||||
"universalify": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"jsonparse": {
|
||||
|
@ -15061,6 +15061,11 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"mathjax": {
|
||||
"version": "2.7.7",
|
||||
"resolved": "https://registry.npmjs.org/mathjax/-/mathjax-2.7.7.tgz",
|
||||
"integrity": "sha512-OOl0B2/0tSJAtAZarXnQuLDBLgTNRqiI9VqHTQzPsxf4okT2iIpDrvaklK9x2QEMD1sDj4yRn11Ygci41DxMAQ=="
|
||||
},
|
||||
"md5-file": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/md5-file/-/md5-file-5.0.0.tgz",
|
||||
|
@ -21796,9 +21801,9 @@
|
|||
}
|
||||
},
|
||||
"universalify": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/universalify/-/universalify-1.0.0.tgz",
|
||||
"integrity": "sha512-rb6X1W158d7pRQBg5gkR8uPaSfiids68LTJQYOtEUhoJUWBdaQHsuT/EUduxXYxcrt4r5PJ4fuHW1MHT6p0qug=="
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz",
|
||||
"integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ=="
|
||||
},
|
||||
"unorm": {
|
||||
"version": "1.6.0",
|
||||
|
|
|
@ -110,6 +110,7 @@
|
|||
"core-js": "^3.9.1",
|
||||
"es6-promise-plugin": "^4.2.2",
|
||||
"jszip": "^3.5.0",
|
||||
"mathjax": "2.7.7",
|
||||
"moment": "^2.29.0",
|
||||
"nl.kingsquare.cordova.background-audio": "^1.0.1",
|
||||
"phonegap-plugin-multidex": "^1.0.0",
|
||||
|
@ -149,6 +150,7 @@
|
|||
"eslint-plugin-prefer-arrow": "^1.2.2",
|
||||
"eslint-plugin-promise": "^4.2.1",
|
||||
"faker": "^5.1.0",
|
||||
"fs-extra": "^9.1.0",
|
||||
"gulp": "4.0.2",
|
||||
"gulp-clip-empty-files": "^0.1.2",
|
||||
"gulp-concat": "^2.6.1",
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
// (C) Copyright 2015 Moodle Pty Ltd.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
/**
|
||||
* Script to copy some files to the www folder.
|
||||
*/
|
||||
const fse = require('fs-extra');
|
||||
const path = require('path');
|
||||
|
||||
// Assets to copy.
|
||||
const ASSETS = {
|
||||
'/node_modules/mathjax/MathJax.js': '/lib/mathjax/MathJax.js',
|
||||
'/node_modules/mathjax/extensions': '/lib/mathjax/extensions',
|
||||
'/node_modules/mathjax/jax/element': '/lib/mathjax/jax/element',
|
||||
'/node_modules/mathjax/jax/input': '/lib/mathjax/jax/input',
|
||||
'/node_modules/mathjax/jax/output/SVG': '/lib/mathjax/jax/output/SVG',
|
||||
'/node_modules/mathjax/jax/output/PreviewHTML': '/lib/mathjax/jax/output/PreviewHTML',
|
||||
'/node_modules/mathjax/localization': '/lib/mathjax/localization',
|
||||
'/src/core/features/h5p/assets': '/lib/h5p',
|
||||
};
|
||||
|
||||
module.exports = function(ctx) {
|
||||
const assetsPath = ctx.project.srcDir + '/assets';
|
||||
|
||||
for (const src in ASSETS) {
|
||||
fse.copySync(ctx.project.dir + src, assetsPath + ASSETS[src], { overwrite: true });
|
||||
}
|
||||
};
|
|
@ -245,7 +245,7 @@ export class AddonFilterMathJaxLoaderHandlerService extends CoreFilterDefaultHan
|
|||
|
||||
const equations = Array.from(container.querySelectorAll('.filter_mathjaxloader_equation'));
|
||||
equations.forEach((node) => {
|
||||
that.window.MathJax.Hub.Queue(['Typeset', that.window.MathJax.Hub, node]);
|
||||
that.window.MathJax.Hub.Queue(['Typeset', that.window.MathJax.Hub, node], [that.fixUseUrls, node]);
|
||||
});
|
||||
|
||||
// Set the delay back to normal after processing.
|
||||
|
@ -255,6 +255,20 @@ export class AddonFilterMathJaxLoaderHandlerService extends CoreFilterDefaultHan
|
|||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Fix URLs in <use> elements.
|
||||
* This is needed because MathJax stores the location.href when it's loaded, and then sets that URL to all the <use>
|
||||
* elements href. Since the app URL changes when navigating, the SVGs can use a URL that isn't the current page.
|
||||
* When that happens, the request returns a 404 error and the SVG isn't displayed.
|
||||
*
|
||||
* @param node Element that can contain equations.
|
||||
*/
|
||||
protected fixUseUrls(node: Element): void {
|
||||
Array.from(node.querySelectorAll('use')).forEach((useElem) => {
|
||||
useElem.setAttribute('href', useElem.href.baseVal.substr(useElem.href.baseVal.indexOf('#')));
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform a mapping of the app language code to the equivalent for MathJax.
|
||||
*
|
||||
|
|
|
@ -376,7 +376,7 @@ export class CoreH5PFileStorage {
|
|||
* @return Folder path.
|
||||
*/
|
||||
getCoreH5PPath(): string {
|
||||
return CoreTextUtils.concatenatePaths(CoreFile.getWWWPath(), '/h5p/');
|
||||
return CoreTextUtils.concatenatePaths(CoreFile.getWWWPath(), '/assets/lib/h5p/');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -48,7 +48,7 @@ export class CoreUpdateManagerProvider {
|
|||
|
||||
const versionApplied = await CoreConfig.get<number>(VERSION_APPLIED, 0);
|
||||
|
||||
if (versionCode >= 3900 && versionApplied < 3900 && versionApplied > 0) {
|
||||
if (versionCode >= 3950 && versionApplied < 3950 && versionApplied > 0) {
|
||||
promises.push(CoreH5P.h5pPlayer.deleteAllContentIndexes());
|
||||
}
|
||||
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
<!-- add to homescreen for ios -->
|
||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
|
||||
|
||||
<script src="assets/lib/mathjax/MathJax.js?delayStartupUntil=configured"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
|
Loading…
Reference in New Issue