Skip to content

Commit 1d68446

Browse files
committed
converted the project assets to webpack bundles
left 4 minor problems: - cannot load certain theme css files : MathEditorExtend - Latex menu empty - Screen Keyboard not activated - Buttons from Accordion to collapse / expand panels are overridden
1 parent ebe903d commit 1d68446

50 files changed

Lines changed: 30451 additions & 3088 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

package-lock.json

Lines changed: 9961 additions & 2955 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@
22
"name": "joplin-plugin-katex-input-helper",
33
"version": "1.0.10",
44
"scripts": {
5-
"dist": "webpack --env joplin-plugin-config=buildMain && webpack --env joplin-plugin-config=buildExtraScripts && webpack --env joplin-plugin-config=createArchive",
5+
"dist": "webpack --env joplin-plugin-config=buildMain && webpack --env joplin-plugin-config=buildExtraScripts && npm run build-assets && webpack --env joplin-plugin-config=createArchive",
66
"prepare": "npm run dist",
77
"updateVersion": "webpack --env joplin-plugin-config=updateVersion",
88
"update": "npm install -g generator-joplin && yo joplin --node-package-manager npm --update --force",
99
"build-docs": "typedoc --options typedoc.json && npm exec --package=@atao60/fse-cli fse copy ./img ./docs/img",
1010
"test": "vitest --root './tests' --run --reporter verbose",
11-
"jtest": "jest"
11+
"jtest": "jest",
12+
"build-assets": "webpack --config webpack.assets.config.js --mode development",
13+
"serve": "webpack serve --config webpack.assets.config.js"
1214
},
1315
"license": "MIT",
1416
"keywords": [
@@ -19,25 +21,35 @@
1921
],
2022
"devDependencies": {
2123
"@atao60/fse-cli": "^0.1.9",
24+
"@babel/core": "^7.27.1",
25+
"@babel/preset-env": "^7.27.2",
2226
"@joplin/lib": "^2.6.3",
2327
"@types/jquery": "^3.5.32",
2428
"@types/node": "^18.7.13",
29+
"babel": "^5.8.38",
30+
"babel-loader": "^10.0.0",
2531
"chalk": "^4.1.0",
2632
"copy-webpack-plugin": "^11.0.0",
33+
"css-loader": "^7.1.2",
2734
"easyui": "^8.0.0",
35+
"file-loader": "^6.2.0",
2836
"fs-extra": "^10.1.0",
2937
"glob": "^8.0.3",
3038
"inversify": "^7.5.1",
3139
"jest": "^29.7.0",
40+
"mini-css-extract-plugin": "^2.9.2",
3241
"path": "^0.12.7",
3342
"tar": "^6.1.11",
43+
"terser-webpack-plugin": "^5.3.14",
3444
"ts-loader": "^9.3.1",
3545
"typedoc": "^0.26.10",
3646
"typedoc-umlclass": "^0.10.0",
3747
"typescript": "^4.8.2",
48+
"url-loader": "^4.1.1",
3849
"vitest": "^3.1.3",
3950
"webpack": "^5.74.0",
40-
"webpack-cli": "^4.10.0"
51+
"webpack-cli": "^5.1.4",
52+
"webpack-dev-server": "^5.2.1"
4153
},
4254
"eslintConfig": {
4355
"plugins": [

plugin.config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"extraScripts": [
33
"./plugins/codeMirror.ts",
4-
"./plugins/markdownIt.ts"
4+
"./plugins/markdownIt.ts"
55
]
66
}

src/assets/dialog2.html

Lines changed: 616 additions & 0 deletions
Large diffs are not rendered by default.

src/assets/js/bootLoader.js

Lines changed: 37 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,30 @@
11

2+
import jquery from './jquery-plugin/jquery.min';
3+
import './jquery-easyui/jquery.easyui.min';
4+
import './jquery-easyui/datagrid-dnd';
5+
import './jquery-easyui/datagrid-filter';
6+
import './jquery-easyui/datagrid-cellediting';
7+
import katex from './katex/katex.min';
8+
import './katex/mhchem';
9+
import CodeMirror from './codemirror/lib/codemirror';
10+
11+
import { Observable } from './patterns/observable';
12+
import { Localizer } from './localization';
13+
import { Themes } from './themes';
14+
import { ParserExtension } from './parserExtension';
15+
import { KIHParameters } from './parameters';
16+
import { MathFormulae } from './math';
17+
import { KatexInputHelper } from './dialog';
18+
import { FileHandler } from './fileHandling';
19+
import { CategoriesTree } from './categoriesTree';
20+
import { DynamicPanel } from './panels';
21+
222
/**
323
* @abstract The boot loader of the Katex Input Helper.
424
*
525
* This is capable of supporting 2 different scenarios, one using *easyloader*, one not.
626
*/
7-
class BootLoader {
27+
export class BootLoader {
828

929
baseLocation = null;
1030
vme = null;
@@ -285,9 +305,10 @@ class BootLoader {
285305
checkOther(typeof $.fn.datagrid.defaults.defaultFilterOptions, 'object', 'datagrid-filter') &&
286306
// can we independantly check dnd and cellediting?
287307
checkOther(typeof katex, 'object', 'Katex') &&
308+
checkOther(typeof katex.renderToString, 'function', 'Katex') &&
288309
mhchemCheck() &&
289310
//checkOther(typeof ($.fn.ColorPicker), 'function', 'ColorPicker') &&
290-
checkTypeByName(CodeMirror, 'Object', 'CodeMirror') &&
311+
checkTypeByName(CodeMirror, 'CodeMirror', 'CodeMirror') &&
291312

292313
checkTypeByName(Observable, 'Observable') &&
293314
checkTypeByName(Localizer, 'Localizer') &&
@@ -338,17 +359,22 @@ class BootLoader {
338359
}
339360
}
340361

341-
var kihBootLoader = new BootLoader();
342-
kihBootLoader.init1()
343-
.then(() => {
344-
kihBootLoader.check();
345-
})
346-
.catch(err => {
347-
console.error(`Error ${err} `, err);
348-
kihBootLoader.fatal(err);
349-
});
362+
if (!window.bootLoaderLoaded) {
363+
window.bootLoaderLoaded = true;
364+
var kihBootLoader = new BootLoader();
365+
kihBootLoader.init1()
366+
.then(() => {
367+
kihBootLoader.check();
368+
})
369+
.catch(err => {
370+
console.error(`Error ${err} `, err);
371+
kihBootLoader.fatal(err);
372+
});
373+
}
350374

375+
/*
351376
// This helps to import symbols in test suite
352377
try {
353378
module.exports = BootLoader;
354379
} catch(e) { }
380+
*/

src/assets/js/categoriesTree.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1+
import { Observable } from "./patterns/observable";
12

23
/**
34
* @abstract Manages the Categories Tree.
45
*
56
* The Leafs of the tree refer to a set of equations and constitute the categories.
67
* The Folders constitute super categories.
78
*/
8-
class CategoriesTree {
9+
export class CategoriesTree {
910

1011
data = null;
1112
treeSelector = "";
@@ -829,5 +830,5 @@ class CategoriesTree {
829830

830831
// This helps to import symbols in test suite
831832
try {
832-
module.exports = CategoriesTree;
833+
module.exports = { CategoriesTree };
833834
} catch(e) { }

0 commit comments

Comments
 (0)