Skip to content
This repository was archived by the owner on Jan 15, 2024. It is now read-only.

Commit 5df10ad

Browse files
committed
Pull request #47: fix(examples) empty input in math-inside-page.html disappears and can't be edited anymore MSIS-3138
Merge in WS/iink-js from MSIS-3138 to master * commit 'b59d7d099ff736fcc1be046546b6b0ec40ac9afd': fix(examples) empty input in math-inside-page.html disappears and can't be edited anymore MSIS-3138
2 parents 7fcca65 + b59d7d0 commit 5df10ad

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

examples/v4/websocket_math_inside_page.html

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@
4545
.mathContent {
4646
background-color: lightgrey;
4747
display: inline-block;
48+
padding: 0px 5px;
49+
min-height: 33px;
4850
}
4951

5052
.katex-display {
@@ -191,7 +193,7 @@ <h3>Other forms of the theorem</h3>
191193
document.querySelector('body').style.setProperty("--animation-duration", animationDelay);
192194
}
193195

194-
const editorELement1 = document.getElementById('editor');
196+
const editorELement = document.getElementById('editor');
195197
const mathContentElements = document.querySelectorAll('.mathContent');
196198
let currentMathElement = undefined;
197199
const undoElement = document.getElementById('undo');
@@ -200,7 +202,7 @@ <h3>Other forms of the theorem</h3>
200202
const closeElement = document.getElementById('close');
201203

202204
convertElement.addEventListener('click', () => {
203-
editorELement1.editor.convert();
205+
editorELement.editor.convert();
204206
});
205207

206208
function toggleView() {
@@ -216,17 +218,17 @@ <h3>Other forms of the theorem</h3>
216218
closeElement.addEventListener('click', () => {
217219
toggleView();
218220
//Recopy the jjix export in the data-jiix attribute
219-
editorELement1.editor.waitForIdle();
220-
const currentExports = editorELement1.editor.exports;
221+
editorELement.editor.waitForIdle();
222+
const currentExports = editorELement.editor.exports;
221223
if (currentExports && currentExports['application/vnd.myscript.jiix']) {
222224
currentMathElement.setAttribute('data-jiix', currentExports['application/vnd.myscript.jiix']);
223-
editorELement1.editor.clear();
225+
editorELement.editor.clear();
224226
currentMathElement.innerHTML = "";
225227
katex.render(currentExports['application/x-latex'], currentMathElement, { displayMode: false })
226228
}
227229
});
228230

229-
editorELement1.addEventListener('changed', (event) => {
231+
editorELement.addEventListener('changed', (event) => {
230232
undoElement.disabled = !event.detail.canUndo;
231233
redoElement.disabled = !event.detail.canRedo;
232234
convertElement.disabled = event.detail.isEmpty;
@@ -267,16 +269,15 @@ <h3>Other forms of the theorem</h3>
267269
//Importing the previous jjix
268270
const currentJiix = currentMathElement.getAttribute('data-jiix');
269271
if (currentJiix) {
270-
editorELement1.editor.import_(currentJiix, 'application/vnd.myscript.jiix');
272+
editorELement.editor.import_(currentJiix, 'application/vnd.myscript.jiix');
271273
}
272274

273275
const srcElementHeight = srcMathContentElement.offsetHeight;
274276
const srcElementWidth = srcMathContentElement.offsetWidth;
275277
const srcElementLeft = srcMathContentElement.offsetLeft;
276278
const srcElementTop = srcMathContentElement.offsetTop;
277279

278-
document.querySelector('#editorContainer').classList.toggle(
279-
'visible');
280+
document.querySelector('#editorContainer').classList.toggle('visible');
280281
document.querySelector('nav').classList.toggle('visible');
281282
document.querySelector('#editor').classList.toggle('visible');
282283

@@ -292,14 +293,14 @@ <h3>Other forms of the theorem</h3>
292293
});
293294

294295
undoElement.addEventListener('click', () => {
295-
editorELement1.editor.undo();
296+
editorELement.editor.undo();
296297
});
297298
redoElement.addEventListener('click', () => {
298-
editorELement1.editor.redo();
299+
editorELement.editor.redo();
299300
});
300301

301302
window.addEventListener('resize', () => {
302-
editorELement1.editor.resize();
303+
editorELement.editor.resize();
303304
});
304305

305306
function getUrlParameter(name) {

0 commit comments

Comments
 (0)