Skip to content

Commit cd7122b

Browse files
committed
Work toward Release v2.0.1
- improved web version with cookies - fixed broken "Reset Windows Positions" - fixed broken context menus - localized a few texts - structure of webpack config file improved
1 parent c7d8c2c commit cd7122b

23 files changed

Lines changed: 574 additions & 69 deletions

File tree

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,13 +105,15 @@ The custom equations dialog with categories tree
105105
- The functionality of this plug-in is now also available as [Web app](https://mick2nd.github.io/Katex-Input-Helper/index.html)
106106
hosted on Github. This can be used as Demo or to have a look at pre-published versions.
107107
It's also running on mobile devices.
108+
- The browser version is equipped with cookies to support persistence of settings.
108109
- Made the production version working hereby reducing the size of the plug-in.
109110
- The browser version (see above) is also adapted for mobile devices.
110111

111112
**Bug fixes**
112113

113114
- The context menus crashed on the trial to invoke and click them. A workaround helps here.
114-
But this is not fully satisfying as you might see.
115+
This fact is completely invisible to the user.
116+
- The "Reset Windows Positions" functionality was broken, which is fixed now.
115117

116118
### 2.0.0
117119

package-lock.json

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

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
"@types/node": "^18.7.13",
3232
"babel": "^5.8.38",
3333
"babel-loader": "^10.0.0",
34+
"buffer": "^6.0.3",
3435
"chalk": "^4.1.0",
3536
"codemirror": "^5.65.19",
3637
"copy-webpack-plugin": "^11.0.0",

src/assets/js/categoriesTree.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ export class CategoriesTree {
8989
var keys = ['text', 'state', 'attributes', 'selected', 'haveSamples'];
9090
var to = { };
9191
for (var key of Object.keys(from)) {
92-
if (keys.includes(key)) {
92+
if (keys.some(item => item == key)) {
9393
to[key] = from[key];
9494
}
9595
}
@@ -481,7 +481,7 @@ export class CategoriesTree {
481481
*/
482482
deleteEquations(from, checked) {
483483
from.equations = from.equations.filter( // then delete them from the source (from)
484-
(elem, index) => !checked.includes(index));
484+
(elem, index) => !checked.some(item => item == index));
485485
}
486486

487487
/**

src/assets/js/dialog.js

Lines changed: 33 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ export class KatexInputHelper {
421421
*
422422
* TODO: This is a workaround because of crashs raised otherwise. The hide method
423423
* will be overridden. Left unwanted effect: display of menu at false location,
424-
* if main menu was invoked before.
424+
* this can be handled by shifting the menu via CSS.
425425
*/
426426
onContextMenu(selector, event) {
427427
event.preventDefault();
@@ -443,33 +443,38 @@ export class KatexInputHelper {
443443
return false;
444444
};
445445

446+
this.logProperties(selector);
447+
// this code uses CSS to shift the context menu to the desired location (and its)
448+
// shadow
446449
try {
447-
$(selector).menu('show', { left: event.pageX, top: event.pageY });
450+
$(selector).menu('show', { left: event.pageX, top: event.pageY });
451+
$(`${selector}`).css({
452+
position: 'absolute',
453+
left: `${event.pageX}px`,
454+
top: `${event.pageY}px`,
455+
display: 'block'
456+
});
457+
458+
var next = $(selector).next();
459+
if (next.hasClass('menu-shadow')) {
460+
next.css({
461+
position: 'absolute',
462+
left: `${event.pageX}px`,
463+
top: `${event.pageY}px`,
464+
display: 'block'
465+
});
466+
}
448467
} catch(e) {
449468
}
450-
return false;
469+
return false;
451470
}
452471

453-
// TRIAL to overcome contextmenu problem.
454-
onMainMenu() {
455-
456-
var mbOptions = $('#mbINSERT').menubutton('options');
457-
mbOptions.menu = null;
458-
459-
// There is no reaction on this!
460-
$('#mbINSERT').on('mouseover', function(event) {
461-
event.preventDefault();
462-
$('mINSERT').menu('show', { left: event.pageX, top: event.pageY });
463-
return false;
464-
});
465-
466-
$('#mbINSERT').on('mouseout', function(event) {
467-
event.preventDefault();
468-
$('mINSERT').menu('hide');
469-
return false;
470-
});
471-
472-
return false;
472+
/**
473+
* Logs some properties of the element selected by the selector.
474+
*/
475+
logProperties(selector) {
476+
console.log(`Context-menu display : ${$(selector).css('display')}, ${$(selector).css('position')}`);
477+
console.log(`Context-menu %O`, $(selector)[0]);
473478
}
474479

475480
/**
@@ -531,14 +536,6 @@ export class KatexInputHelper {
531536
}
532537
}
533538
});
534-
// NO ACTION? :
535-
// vme.onMainMenu();
536-
537-
/* SEEMS to have no effect
538-
$("#mFILE, #mINSERT, #mTOOLS, #mVIEW, #mOPTIONS, #mINFORMATIONS")
539-
.addClass('easyui-menu');
540-
await this.parser.parseAsync("#mFILE, #mINSERT, #mTOOLS, #mVIEW, #mOPTIONS, #mINFORMATIONS");
541-
*/
542539

543540
if (!window.opener) {
544541
$("#mQUIT_EDITOR").addClass("menu-item-disabled").click(function(event) { });
@@ -584,7 +581,8 @@ export class KatexInputHelper {
584581
});
585582
$('#btRESET_WINDOW_POSITIONS').click(function(event) {
586583
event.preventDefault();
587-
vme.parameters.resetWindowPositions();
584+
vme.parameters.resetWindowPositions();
585+
vme.messager.show('RESTART', 'RESTART_REQUIRED');
588586
});
589587
$("input[name='codeType']").change(function() {
590588
vme.codeType = $("input[name='codeType']:checked").val();
@@ -1532,10 +1530,10 @@ export class KatexInputHelper {
15321530
.join('/')
15331531
.replace(/ /g, '%20') + '/';
15341532
}
1533+
// TEST CODE to check path OR mobile detection
15351534
// $('h3').text(bundlePath);
1536-
var heading = $('h3').text();
1537-
$('h3').text(`${heading} on ${this.mobile ? 'mobile' : 'desktop'} device`);
1538-
// this.mobile ? 'mobile' : 'desktop'
1535+
// var heading = $('h3').text();
1536+
// $('h3').text(`${heading} on ${this.mobile ? 'mobile' : 'desktop'} device`);
15391537

15401538
$('html > head').append($('<base />'));
15411539
$('html > head > base').attr('href', bundlePath);
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
.rate {
2+
position: relative;
3+
display: inline-block;
4+
vertical-align: middle;
5+
}
6+
.rate-item {
7+
position: relative;
8+
display: inline-block;
9+
}
10+
.rate-item svg {
11+
fill: currentColor;
12+
}
13+
.rate-second {
14+
position: relative;
15+
display: inline-block;
16+
width: 100%;
17+
height: 100%;
18+
}
19+
.rate-first {
20+
position: absolute;
21+
left: 0;
22+
top: 0;
23+
width: 50%;
24+
height: 100%;
25+
z-index: 9;
26+
overflow: hidden;
27+
display: none;
28+
}
29+
.rate-half .rate-first {
30+
display: block;
31+
}
32+
.rate-disabled {
33+
opacity: 0.5;
34+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
.rate {
2+
position: relative;
3+
display: inline-block;
4+
vertical-align: middle;
5+
}
6+
.rate-item {
7+
position: relative;
8+
display: inline-block;
9+
}
10+
.rate-item svg {
11+
fill: currentColor;
12+
}
13+
.rate-second {
14+
position: relative;
15+
display: inline-block;
16+
width: 100%;
17+
height: 100%;
18+
}
19+
.rate-first {
20+
position: absolute;
21+
left: 0;
22+
top: 0;
23+
width: 50%;
24+
height: 100%;
25+
z-index: 9;
26+
overflow: hidden;
27+
display: none;
28+
}
29+
.rate-half .rate-first {
30+
display: block;
31+
}
32+
.rate-disabled {
33+
opacity: 0.5;
34+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
.rate {
2+
position: relative;
3+
display: inline-block;
4+
vertical-align: middle;
5+
}
6+
.rate-item {
7+
position: relative;
8+
display: inline-block;
9+
}
10+
.rate-item svg {
11+
fill: currentColor;
12+
}
13+
.rate-second {
14+
position: relative;
15+
display: inline-block;
16+
width: 100%;
17+
height: 100%;
18+
}
19+
.rate-first {
20+
position: absolute;
21+
left: 0;
22+
top: 0;
23+
width: 50%;
24+
height: 100%;
25+
z-index: 9;
26+
overflow: hidden;
27+
display: none;
28+
}
29+
.rate-half .rate-first {
30+
display: block;
31+
}
32+
.rate-disabled {
33+
opacity: 0.5;
34+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
.rate {
2+
position: relative;
3+
display: inline-block;
4+
vertical-align: middle;
5+
}
6+
.rate-item {
7+
position: relative;
8+
display: inline-block;
9+
}
10+
.rate-item svg {
11+
fill: currentColor;
12+
}
13+
.rate-second {
14+
position: relative;
15+
display: inline-block;
16+
width: 100%;
17+
height: 100%;
18+
}
19+
.rate-first {
20+
position: absolute;
21+
left: 0;
22+
top: 0;
23+
width: 50%;
24+
height: 100%;
25+
z-index: 9;
26+
overflow: hidden;
27+
display: none;
28+
}
29+
.rate-half .rate-first {
30+
display: block;
31+
}
32+
.rate-disabled {
33+
opacity: 0.5;
34+
}

0 commit comments

Comments
 (0)