Skip to content

Commit 44e32ec

Browse files
committed
save intermediate state
- mobile - handlebars - sass
1 parent 4d7d583 commit 44e32ec

40 files changed

Lines changed: 1000 additions & 557 deletions

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,13 @@ The custom equations dialog with categories tree
9797

9898
## Release Notes
9999

100+
### 3.0.0
101+
102+
- Introduced a mobile version of the plug-in (experimental)
103+
- One code base
104+
- Divided HTML code to avoid duplication, introduced Handlebars tool for support
105+
- Resizing of windows is more or less deactivated, Window size adapted to content.
106+
100107
### 2.1.1
101108

102109
- Removed function-less code.

package-lock.json

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

src/assets/dialog-mobile.hbs

Lines changed: 12 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@
1212
<header>
1313
<div id="introduction" class="m-toolbar">
1414
<div class="m-left">
15-
<a id="goWest" class="easyui-linkbutton" data-options="plain:true">&lt;&lt;</a>
15+
<a id="goWest" class="easyui-linkbutton" data-options="plain:true">&#x2770;</a>
1616
</div>
1717
<div class="m-title">Katex Input Helper</div>
1818
<div class="m-right">
1919
<!--
2020
-->
2121
<a href="javascript:void(0)" class="easyui-menubutton invisible" data-options="iconCls:'',menu:'#main-menu',menuAlign:'right',hasDownArrow:false">&#9776;</a>
2222
<a id="goMenu" href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:''">&#9776;</a>
23-
<a id="goEast" href="javascript:void(0)" class="easyui-linkbutton" data-options="plain:true">>></a>
23+
<a id="goEast" href="javascript:void(0)" class="easyui-linkbutton" data-options="plain:true">&#x2771;</a>
2424
</div>
2525
</div>
2626
</header>
@@ -32,14 +32,7 @@
3232
<div id="mathVisualOutput" class="inner-south-mobile" dir="ltr" data-options="region:'south',split:true,noheader:true" ></div>
3333
</div>
3434
</div>
35-
<footer>
36-
<div class="southRegion m-toolbar">
37-
<div class="divInformation">&nbsp;</div>
38-
<div>
39-
<span locate="AUTHOR"></span>
40-
</div>
41-
</div>
42-
</footer>
35+
{{> footer }}
4336
</div>
4437
</div>
4538

@@ -51,21 +44,13 @@
5144
<span locate=FORMULA class=rtl-title-withicon></span>&nbsp;
5245
</div>
5346
<div class="m-left">
54-
<a href="javascript:void(0)" class="easyui-linkbutton m-back" data-options="plain:true,outline:true,back:true"> </a>
47+
<a href="javascript:void(0)" class="easyui-linkbutton back" data-options="plain:true,outline:true,back:true">&#x2770;</a>
5548
</div>
5649
</div>
5750
</header>
5851

59-
{{> accordion-west }}
60-
61-
<footer>
62-
<div class="southRegion" class="m-toolbar">
63-
<div class="divInformation">&nbsp;</div>
64-
<div>
65-
<span locate="AUTHOR"></span>
66-
</div>
67-
</div>
68-
</footer>
52+
{{> accordion-west }}
53+
{{> footer }}
6954
</div>
7055
</div>
7156

@@ -77,21 +62,13 @@
7762
<span locate=FORMULA class=rtl-title-withicon></span>&nbsp;
7863
</div>
7964
<div class="m-right">
80-
<a href="javascript:void(0)" class="easyui-linkbutton m-back" data-options="plain:true,outline:true,back:true"></a>
65+
<a href="javascript:void(0)" class="easyui-linkbutton back" data-options="plain:true,outline:true,back:true">&#x2770;</a>
8166
</div>
8267
</div>
8368
</header>
8469

8570
{{> accordion-east }}
86-
87-
<footer>
88-
<div class="southRegion" class="m-toolbar">
89-
<div class="divInformation">&nbsp;</div>
90-
<div>
91-
<span locate="AUTHOR"></span>
92-
</div>
93-
</div>
94-
</footer>
71+
{{> footer }}
9572
</div>
9673
</div>
9774

@@ -103,20 +80,13 @@
10380
<span locate=DIALOG_PANEL class=rtl-title-withicon></span>&nbsp;
10481
</div>
10582
<div class="m-right">
106-
<a href="javascript:void(0)" class="easyui-linkbutton m-back" data-options="plain:true,outline:true,back:false"></a>
83+
<a href="javascript:void(0)" class="easyui-linkbutton back" data-options="plain:true,outline:true,back:false">&#x2770;</a>
10784
</div>
10885
</div>
10986
</header>
11087
<div id="wrapperBody">
11188
</div>
112-
<footer>
113-
<div class="southRegion" class="m-toolbar">
114-
<div class="divInformation">&nbsp;</div>
115-
<div>
116-
<span locate="AUTHOR"></span>
117-
</div>
118-
</div>
119-
</footer>
89+
{{> footer }}
12090
</div>
12191
</div>
12292

@@ -128,21 +98,14 @@
12898
<span locate=SIDEMENU_PANEL class=rtl-title-withicon></span>&nbsp;
12999
</div>
130100
<div class="m-right">
131-
<a href="javascript:void(0)" class="easyui-linkbutton m-back" data-options="plain:true,outline:true,back:true"></a>
101+
<a href="javascript:void(0)" class="easyui-linkbutton back" data-options="plain:true,outline:true,back:true">&#x2770;</a>
132102
</div>
133103
</div>
134104
</header>
135105
<div id="wrapperBodyMenu">
136106
<div id="sm" class="easyui-sidemenu" data-options="data:[{text:'TEST',state:'open'}]"></div>
137107
</div>
138-
<footer>
139-
<div class="southRegion" class="m-toolbar">
140-
<div class="divInformation">&nbsp;</div>
141-
<div>
142-
<span locate="AUTHOR"></span>
143-
</div>
144-
</div>
145-
</footer>
108+
{{> footer }}
146109
</div>
147110
</div>
148111

src/assets/js/definitions.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ interface JQuery {
2929
tree: any;
3030
resizable: any;
3131
sidemenu: any;
32+
drawer: any;
3233

3334
ColorPicker(p1?: any, p2?: any): any;
3435
ColorPickerHide(p1?: any, p2?: any): any;

src/assets/js/dialog.ts

Lines changed: 29 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
IKatexInputHelper,
1010
ILocalizer, localizerId,
1111
IMessager, messagerId,
12-
IUtilities, utilitiesId,
12+
IUtilities, utilitiesId, State,
1313
parametersId,
1414
IThemes, themesId,
1515
IParser, parserId,
@@ -166,6 +166,8 @@ export class KatexInputHelper implements IKatexInputHelper {
166166
parser: IParser = null;
167167
VKI_show: any = null;
168168
sidemenuData: any = { };
169+
customEquationsToggler = null;
170+
unicodeToggler = null;
169171

170172
/**
171173
* Constructor
@@ -356,13 +358,15 @@ export class KatexInputHelper implements IKatexInputHelper {
356358
vme.initialiseCodeMirror();
357359
this.localizer.subscribe(this.onLocaleChanged.bind(this));
358360
await this.localizer.initialiseLanguageChoice(this.localType); // Progress dialog uses localized text
361+
// NO ACTION on language choice dialog
362+
// await this.parser.parseAsync('#wLANGUAGE_CHOISE');
359363

360364
$.messager.progress({
361365
title: "Katex Input Helper",
362366
text: vme.getLocalText("WAIT_FOR_EDITOR_DOWNLOAD"),
363367
msg: "<center>&copy; " +
364-
"<a href='mailto:juergen@habelt-jena.de?subject=Katex%20Input%20Helper' target='_blank' class='bt' >Jürgen Habelt</a> -" +
365-
"<a href='https://github.com/Mick2nd/Katex-Input-Helper' target='_blank' class='bt' >A Joplin plug-in</a><br/><br/>" +
368+
"<a href='mailto:juergen@habelt-jena.de?subject=Katex%20Input%20Helper' target='_blank' class='bt progress' >Jürgen Habelt</a> -" +
369+
"<a href='https://github.com/Mick2nd/Katex-Input-Helper' target='_blank' class='bt progress' >A Joplin plug-in</a><br/><br/>" +
366370
"</center>",
367371
interval: 300
368372
});
@@ -482,11 +486,11 @@ export class KatexInputHelper implements IKatexInputHelper {
482486
event.preventDefault();
483487
$.mobile.go('#wrapperPanelMenu', 'slide', 'left');
484488
});
485-
$("header:has(+ #wrapperPanel) a.m-back").on('click', function(_) {
489+
$("header:has(+ #wrapperPanel) a.back").on('click', function(_) {
486490
inst.panels.closeOpen();
487491
inst.codeMirrorEditor.activateEditor(); // workaround to re-activate the editor
488492
});
489-
$("header:has(+ #westRegion) a.m-back, header:has(+ #eastRegion) a.m-back, header:has(+ #wrapperPanelMenu) a.m-back").on('click', function(_) {
493+
$("header:has(+ #westRegion) a.back, header:has(+ #eastRegion) a.back, header:has(+ #wrapperPanelMenu) a.back").on('click', function(_) {
490494
inst.codeMirrorEditor.activateEditor(); // workaround to re-activate the editor
491495
});
492496

@@ -613,7 +617,6 @@ export class KatexInputHelper implements IKatexInputHelper {
613617
onSelect: this.onMenuClick.bind(this)
614618
});
615619
$('#sm').sidemenu('expand');
616-
$('#sm').sidemenu('resize', { width: 300 });
617620
}
618621

619622
/**
@@ -668,7 +671,7 @@ export class KatexInputHelper implements IKatexInputHelper {
668671
const codeMirrorEditor = this.codeMirrorEditor;
669672
// Reserved.
670673
const option = vme.platformInfo.isMobile ? 'contenteditable' : 'textarea'; // RESERVED
671-
try { codeMirrorEditor.setOption('inputStyle', 'textarea'); } catch(e) {}
674+
try { codeMirrorEditor.setOption('inputStyle', option); } catch(e) {}
672675
codeMirrorEditor.on("change", function() { vme.autoUpdateOutput(); });
673676

674677
if(vme.platformInfo.isMobile) {
@@ -712,8 +715,8 @@ export class KatexInputHelper implements IKatexInputHelper {
712715
};
713716

714717
this.logProperties(selector);
715-
// this code uses CSS to shift the context menu to the desired location (and its)
716-
// shadow
718+
// this code uses CSS to shift the context menu to the desired location (and its
719+
// shadow)
717720
try {
718721
$(selector).menu('show', { left: event.pageX, top: event.pageY });
719722
$(`${selector}`).css({
@@ -787,21 +790,9 @@ export class KatexInputHelper implements IKatexInputHelper {
787790
}
788791

789792
// Configures Clicks on close buttons and Key handlers, Context menus and others
790-
$('#btSTYLE_CHOISE_CLOSE').on('click', function(event) {
791-
event.preventDefault();
792-
$('#wSTYLE_CHOISE').dialog('close');
793-
vme.setFocus();
794-
});
795-
$('#btLANGUAGE_CHOISE_CLOSE').on('click', function(event) {
796-
event.preventDefault();
797-
$('#wLANGUAGE_CHOISE').dialog('close');
798-
vme.setFocus();
799-
});
800-
$('#btEDITOR_PARAMETERS_CLOSE').on('click', function(event) {
801-
event.preventDefault();
802-
$('#wEDITOR_PARAMETERS').dialog('close');
803-
vme.setFocus();
804-
});
793+
/* Moved to panels : Close button click handler
794+
*/
795+
805796
$('#btRESET_WINDOW_POSITIONS').on('click', function(event) {
806797
event.preventDefault();
807798
vme.parameters.resetWindowPositions();
@@ -844,6 +835,17 @@ export class KatexInputHelper implements IKatexInputHelper {
844835
}
845836
});
846837
*/
838+
839+
this.customEquationsToggler = this.utilities.regionToggler(
840+
'#toggle_btn_1',
841+
'#CUSTOM_EQUATIONS_LAYOUT',
842+
this.platformInfo.isMobile ? State.Second : State.Both
843+
);
844+
this.unicodeToggler = this.utilities.containerToggler(
845+
'#toggle_btn_2',
846+
'#cUNICODES_LIST',
847+
!this.platformInfo.isMobile // true for desktop variant
848+
);
847849

848850
this.math.updateLatexMenu();
849851
}
@@ -857,9 +859,9 @@ export class KatexInputHelper implements IKatexInputHelper {
857859
console.log(`Click with id ${item.target.id} of %O`, item);
858860

859861
const functions = {
860-
"mEDITOR_PARAMETERS": () => vme.openWindow('wEDITOR_PARAMETERS'),
861-
"mSTYLE_CHOISE": () => vme.openWindow('wSTYLE_CHOISE'),
862-
"mLANGUAGE_CHOISE": () => vme.openWindow('wLANGUAGE_CHOISE'),
862+
"mEDITOR_PARAMETERS": () => vme.openDialog('wEDITOR_PARAMETERS'),
863+
"mSTYLE_CHOISE": () => vme.openDialog('wSTYLE_CHOISE'),
864+
"mLANGUAGE_CHOISE": () => vme.openDialog('wLANGUAGE_CHOISE'),
863865
"mMATRIX": () => vme.showMatrixWindow(3, 3),
864866
"mCOMMUTATIVE_DIAGRAM": () => vme.initialiseUImoreDialogs("f_COMMUTATIVE_DIAGRAM"),
865867
"mCHEMICAL_FORMULAE": () => vme.initialiseUImoreDialogs("f_CHEMICAL_FORMULAE"),

0 commit comments

Comments
 (0)