@zzish/math-rich-input 0.1.30 → 0.1.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +122 -110
- package/dist/math-rich-input.css +130 -130
- package/package.json +1 -1
- package/src/MathRichInput.jsx +129 -122
- package/src/mathRichInputHelper.js +29 -29
package/dist/index.js
CHANGED
|
@@ -21032,8 +21032,8 @@ function elementToMarkedRawText(element) {
|
|
|
21032
21032
|
var nodeToMark = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
21033
21033
|
var offset = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
21034
21034
|
var useHtmlMath = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
|
21035
|
-
console.log("elementToMarkedRawText")
|
|
21036
|
-
console.log(element.innerHTML)
|
|
21035
|
+
// console.log("elementToMarkedRawText")
|
|
21036
|
+
// console.log(element.innerHTML)
|
|
21037
21037
|
if (element.innerHTML === "<p><br></p>") throw new Error("We are here"); // console.log("Node to mark:")
|
|
21038
21038
|
// console.log(nodeToMark)
|
|
21039
21039
|
|
|
@@ -21351,17 +21351,17 @@ function findNodeAndOffsetForGlobalOffset(node, globalOffset) {
|
|
|
21351
21351
|
|
|
21352
21352
|
if (isTextNode(node)) {
|
|
21353
21353
|
result.node = node;
|
|
21354
|
-
result.lastTextNode = node;
|
|
21355
|
-
console.log("
|
|
21356
|
-
|
|
21354
|
+
result.lastTextNode = node; // console.log("Found text node \'"+node.nodeValue+"\' of length "+node.nodeValue.length)
|
|
21355
|
+
// console.log("result.offset was: "+result.offset)
|
|
21356
|
+
|
|
21357
21357
|
result.offset += node.nodeValue.length;
|
|
21358
21358
|
|
|
21359
21359
|
if (nodeStartsWithSmallSpace(node)) {
|
|
21360
|
-
console.log("Text node starts with small space")
|
|
21360
|
+
// console.log("Text node starts with small space")
|
|
21361
21361
|
result.offset -= 1;
|
|
21362
|
-
}
|
|
21362
|
+
} // console.log("result.offset now: "+result.offset)
|
|
21363
|
+
|
|
21363
21364
|
|
|
21364
|
-
console.log("result.offset now: " + result.offset);
|
|
21365
21365
|
return false;
|
|
21366
21366
|
}
|
|
21367
21367
|
|
|
@@ -21381,10 +21381,9 @@ function findNodeAndOffsetForGlobalOffset(node, globalOffset) {
|
|
|
21381
21381
|
}
|
|
21382
21382
|
|
|
21383
21383
|
if (node.nodeType === 1 && node.tagName === "P") {
|
|
21384
|
-
console.log("Leaving p node")
|
|
21384
|
+
// console.log("Leaving p node")
|
|
21385
21385
|
result.node = null;
|
|
21386
|
-
result.offset++;
|
|
21387
|
-
console.log("result.offset now: " + result.offset);
|
|
21386
|
+
result.offset++; // console.log("result.offset now: "+result.offset)
|
|
21388
21387
|
}
|
|
21389
21388
|
|
|
21390
21389
|
return false;
|
|
@@ -21405,10 +21404,9 @@ function findFirstTextNode(node) {
|
|
|
21405
21404
|
function findNodeAndOffsetForGlobalOffsetInEditableDiv(editableDiv, globalOffset) {
|
|
21406
21405
|
var result = {
|
|
21407
21406
|
offset: 0
|
|
21408
|
-
};
|
|
21409
|
-
|
|
21410
|
-
findNodeAndOffsetForGlobalOffset(editableDiv, globalOffset, result);
|
|
21411
|
-
console.log(result);
|
|
21407
|
+
}; // console.log("Finding node and offset within: "+editableDiv.outerHTML)
|
|
21408
|
+
|
|
21409
|
+
findNodeAndOffsetForGlobalOffset(editableDiv, globalOffset, result); // console.log(result)
|
|
21412
21410
|
|
|
21413
21411
|
if (result.node === null) {
|
|
21414
21412
|
if (globalOffset > 0 && result.lastTextNode !== null) {
|
|
@@ -21441,8 +21439,8 @@ function findNodeAndOffsetForGlobalOffsetInEditableDiv(editableDiv, globalOffset
|
|
|
21441
21439
|
|
|
21442
21440
|
|
|
21443
21441
|
function getRangeParams(editableDiv) {
|
|
21444
|
-
|
|
21445
|
-
|
|
21442
|
+
// console.log ("getRangeParams")
|
|
21443
|
+
// console.log("Inner html: "+editableDiv.innerHTML)
|
|
21446
21444
|
var isSupported = typeof window.getSelection !== "undefined";
|
|
21447
21445
|
|
|
21448
21446
|
if (!isSupported) {
|
|
@@ -21523,12 +21521,11 @@ function setRangeParamsFromGlobalOffsets(editableDiv, params) {
|
|
|
21523
21521
|
var startResult = findNodeAndOffsetForGlobalOffsetInEditableDiv(editableDiv, params.startGlobalOffset);
|
|
21524
21522
|
var endResult = findNodeAndOffsetForGlobalOffsetInEditableDiv(editableDiv, params.endGlobalOffset);
|
|
21525
21523
|
|
|
21526
|
-
if (startResult.node !== null) {
|
|
21527
|
-
console.log("
|
|
21528
|
-
console.log("
|
|
21529
|
-
console.log("
|
|
21530
|
-
console.log("
|
|
21531
|
-
console.log(" offset:" + startResult.offset);
|
|
21524
|
+
if (startResult.node !== null) {// console.log("Setting range to start in node:")
|
|
21525
|
+
// console.log(" node type: "+startResult.node.nodeType)
|
|
21526
|
+
// console.log(" tag name: "+startResult.node.tagName)
|
|
21527
|
+
// console.log(" node value: "+startResult.node.nodeValue)
|
|
21528
|
+
// console.log(" offset:"+startResult.offset)
|
|
21532
21529
|
} else {
|
|
21533
21530
|
console.warn("Can't set range, null start node returned");
|
|
21534
21531
|
return;
|
|
@@ -21561,14 +21558,13 @@ function setRangeParams(editableDiv, params) {
|
|
|
21561
21558
|
|
|
21562
21559
|
|
|
21563
21560
|
if (params.startGlobalOffset !== null && params.startGlobalOffset !== undefined) {
|
|
21564
|
-
console.log("Setting range from global offsets")
|
|
21561
|
+
// console.log("Setting range from global offsets")
|
|
21565
21562
|
setRangeParamsFromGlobalOffsets(editableDiv, params);
|
|
21566
21563
|
return;
|
|
21567
21564
|
} // Otherwise use the old way of doing things
|
|
21565
|
+
// console.log("Setting range from node index and local offset")
|
|
21568
21566
|
|
|
21569
21567
|
|
|
21570
|
-
console.log("Setting range from node index and local offset");
|
|
21571
|
-
|
|
21572
21568
|
if (params.startNodeIndex === null || params.startNodeIndex === undefined) {
|
|
21573
21569
|
console.error("Can't set range params: params.startNodeIndex === " + params.startNodeIndex);
|
|
21574
21570
|
return;
|
|
@@ -21594,17 +21590,17 @@ function setRangeParams(editableDiv, params) {
|
|
|
21594
21590
|
if (params.endNodeIndex === 0 && params.endOffset === 1 && isSmallSpace(nodes[0])) endOffset = 0; // Find the nodes
|
|
21595
21591
|
|
|
21596
21592
|
var startNode = findNodeWithIndex(editableDiv, params.startNodeIndex);
|
|
21597
|
-
var endNode = findNodeWithIndex(editableDiv, params.endNodeIndex);
|
|
21598
|
-
console.log("
|
|
21599
|
-
console.log("
|
|
21600
|
-
console.log("
|
|
21601
|
-
console.log("
|
|
21602
|
-
console.log("
|
|
21603
|
-
console.log("
|
|
21604
|
-
console.log("
|
|
21605
|
-
console.log("
|
|
21606
|
-
console.log("
|
|
21607
|
-
|
|
21593
|
+
var endNode = findNodeWithIndex(editableDiv, params.endNodeIndex); // console.log("Setting range to start in node:")
|
|
21594
|
+
// console.log(" node type: "+startNode.nodeType)
|
|
21595
|
+
// console.log(" tag name: "+startNode.tagName)
|
|
21596
|
+
// console.log(" node value: "+startNode.nodeValue)
|
|
21597
|
+
// console.log(" offset:"+startOffset)
|
|
21598
|
+
// console.log("Setting range to end in node:")
|
|
21599
|
+
// console.log(" node type: "+endNode.nodeType)
|
|
21600
|
+
// console.log(" tag name: "+endNode.tagName)
|
|
21601
|
+
// console.log(" node value: "+endNode.nodeValue)
|
|
21602
|
+
// console.log(" offset:"+endOffset)
|
|
21603
|
+
// Set range in document
|
|
21608
21604
|
|
|
21609
21605
|
if (startNode === null) {
|
|
21610
21606
|
console.warn("Could not set range to start node with index " + params.startNodeIndex);
|
|
@@ -22104,7 +22100,7 @@ var MathRichInput = /*#__PURE__*/function (_React$Component) {
|
|
|
22104
22100
|
}
|
|
22105
22101
|
|
|
22106
22102
|
if (deleteToEmpty) {
|
|
22107
|
-
console.log("deleteToEmpty")
|
|
22103
|
+
// console.log("deleteToEmpty")
|
|
22108
22104
|
var _new_rangeParams = {
|
|
22109
22105
|
startNodeIndex: 0,
|
|
22110
22106
|
startOffset: 1,
|
|
@@ -22201,9 +22197,9 @@ var MathRichInput = /*#__PURE__*/function (_React$Component) {
|
|
|
22201
22197
|
var rangeParams = _this2._getRangeParams();
|
|
22202
22198
|
|
|
22203
22199
|
rangeParams.startNodeIndex;
|
|
22204
|
-
rangeParams.startOffset;
|
|
22205
|
-
console.log(
|
|
22206
|
-
|
|
22200
|
+
rangeParams.startOffset; // console.log("handleKeyDownArrowLeft")
|
|
22201
|
+
// console.log(rangeParams)
|
|
22202
|
+
|
|
22207
22203
|
var new_globalOffset = rangeParams.endGlobalOffset - 1;
|
|
22208
22204
|
var new_rangeParams = null;
|
|
22209
22205
|
|
|
@@ -22217,9 +22213,9 @@ var MathRichInput = /*#__PURE__*/function (_React$Component) {
|
|
|
22217
22213
|
startGlobalOffset: new_globalOffset,
|
|
22218
22214
|
endGlobalOffset: new_globalOffset
|
|
22219
22215
|
};
|
|
22220
|
-
}
|
|
22216
|
+
} // console.log(new_rangeParams)
|
|
22217
|
+
|
|
22221
22218
|
|
|
22222
|
-
console.log(new_rangeParams);
|
|
22223
22219
|
e.preventDefault();
|
|
22224
22220
|
|
|
22225
22221
|
_this2._setRangeParams(new_rangeParams);
|
|
@@ -22371,8 +22367,8 @@ var MathRichInput = /*#__PURE__*/function (_React$Component) {
|
|
|
22371
22367
|
|
|
22372
22368
|
if (new_accent === "") _this2.accent = "";else {
|
|
22373
22369
|
e.preventDefault();
|
|
22374
|
-
_this2.accent = new_accent;
|
|
22375
|
-
|
|
22370
|
+
_this2.accent = new_accent; // console.log("Accent set: " + this.accent);
|
|
22371
|
+
|
|
22376
22372
|
return true;
|
|
22377
22373
|
}
|
|
22378
22374
|
|
|
@@ -22437,41 +22433,43 @@ var MathRichInput = /*#__PURE__*/function (_React$Component) {
|
|
|
22437
22433
|
if (e.key === "i") _this2.styleText(e, "Italic");
|
|
22438
22434
|
if (e.key === "u") _this2.styleText(e, "Underline"); // Don't apply superscript is ctrl ^, this is reserved for creating accents
|
|
22439
22435
|
|
|
22440
|
-
if (/(Win)/i.test(window.navigator.platform) && e.ctrlKey && (e.key === "6" || e.key === "^"))
|
|
22441
|
-
|
|
22442
|
-
|
|
22443
|
-
|
|
22444
|
-
|
|
22445
|
-
|
|
22446
|
-
|
|
22447
|
-
|
|
22448
|
-
|
|
22449
|
-
|
|
22450
|
-
|
|
22451
|
-
|
|
22436
|
+
if (/(Win)/i.test(window.navigator.platform) && e.ctrlKey && (e.key === "6" || e.key === "^")) {// do nothing
|
|
22437
|
+
} else {
|
|
22438
|
+
// otherwise
|
|
22439
|
+
if (e.key === "6" || e.key === "^" || e.key === "+" || e.key === "=") _this2.styleText(e, "Superscript"); // Don't apply subscript if it is the browser command key for "smaller"
|
|
22440
|
+
// if (/(Win)/i.test(window.navigator.platform) && e.ctrlKey && e.key === "-")
|
|
22441
|
+
// return
|
|
22442
|
+
// if (/(Mac)/i.test(window.navigator.platform) && e.metaKey && e.key === "-")
|
|
22443
|
+
// return
|
|
22444
|
+
// otherwise
|
|
22445
|
+
|
|
22446
|
+
if (e.key === "-" || e.key === "_") _this2.styleText(e, "Subscript");
|
|
22447
|
+
e.preventDefault();
|
|
22448
|
+
return;
|
|
22449
|
+
}
|
|
22452
22450
|
}
|
|
22453
22451
|
|
|
22454
22452
|
if ((e.metaKey || e.ctrlKey) && e.key === "v") {
|
|
22455
|
-
console.log("Executing paste");
|
|
22453
|
+
// console.log("Executing paste");
|
|
22456
22454
|
document.execCommand("paste");
|
|
22457
22455
|
return;
|
|
22458
22456
|
}
|
|
22459
22457
|
|
|
22460
22458
|
if ((e.metaKey || e.ctrlKey) && e.key === "c") {
|
|
22461
|
-
console.log("Executing copy");
|
|
22459
|
+
// console.log("Executing copy");
|
|
22462
22460
|
document.execCommand("copy");
|
|
22463
22461
|
return;
|
|
22464
22462
|
}
|
|
22465
22463
|
|
|
22466
22464
|
if ((e.metaKey || e.ctrlKey) && e.key === "x") {
|
|
22467
|
-
console.log("Executing cut");
|
|
22465
|
+
// console.log("Executing cut");
|
|
22468
22466
|
document.execCommand("cut");
|
|
22469
22467
|
return;
|
|
22470
22468
|
} // Ignore automatic key repeat presses on Windows so that we can show an accent bar on
|
|
22471
22469
|
// long key press
|
|
22472
22470
|
|
|
22473
22471
|
|
|
22474
|
-
if (
|
|
22472
|
+
if (/(Win)/i.test(window.navigator.platform)) {
|
|
22475
22473
|
if (e.key === _this2.keyPressed && _this2.keyPressStartTime > 0) {
|
|
22476
22474
|
if (e.key.length === 1 && ("a" <= e.key && e.key <= "z" || "A" <= e.key && e.key <= "Z" || e.key === "!" || e.key === "?")) {
|
|
22477
22475
|
e.preventDefault();
|
|
@@ -22484,15 +22482,20 @@ var MathRichInput = /*#__PURE__*/function (_React$Component) {
|
|
|
22484
22482
|
var key = _this2.fetchAccentLetter();
|
|
22485
22483
|
|
|
22486
22484
|
if (key === "a" || key === "e" || key === "i" || key === "o" || key === "u" || key === "c" || key === "l" || key === "n" || key === "s" || key === "?" || key === "!") {
|
|
22485
|
+
console.log("showing/hiding accent bar");
|
|
22486
|
+
|
|
22487
22487
|
_this2.setState({
|
|
22488
22488
|
showAccentBar: !_this2.state.showAccentBar
|
|
22489
22489
|
});
|
|
22490
22490
|
} else {
|
|
22491
|
+
console.log("hiding accent bar");
|
|
22492
|
+
|
|
22491
22493
|
_this2.setState({
|
|
22492
22494
|
showAccentBar: false
|
|
22493
22495
|
});
|
|
22494
22496
|
}
|
|
22495
22497
|
|
|
22498
|
+
e.preventDefault();
|
|
22496
22499
|
return;
|
|
22497
22500
|
}
|
|
22498
22501
|
|
|
@@ -22507,9 +22510,14 @@ var MathRichInput = /*#__PURE__*/function (_React$Component) {
|
|
|
22507
22510
|
|
|
22508
22511
|
if (_this2.keyPressStartTime < 0) {
|
|
22509
22512
|
_this2.keyPressStartTime = Date.now();
|
|
22510
|
-
|
|
22511
|
-
|
|
22512
|
-
|
|
22513
|
+
|
|
22514
|
+
if (_this2.state.showAccentBar) {
|
|
22515
|
+
console.log("Hiding accent bar 2");
|
|
22516
|
+
|
|
22517
|
+
_this2.setState({
|
|
22518
|
+
showAccentBar: false
|
|
22519
|
+
});
|
|
22520
|
+
}
|
|
22513
22521
|
}
|
|
22514
22522
|
|
|
22515
22523
|
if (e.key === "Backspace") {
|
|
@@ -22603,8 +22611,7 @@ var MathRichInput = /*#__PURE__*/function (_React$Component) {
|
|
|
22603
22611
|
|
|
22604
22612
|
if (e.key.length === 1 && // ie, it's not something like "arrowLeft"
|
|
22605
22613
|
params.startOffset === 0 && _this2.nodeStartsWithSmallSpace(startNode)) {
|
|
22606
|
-
console.log("Handling character input at start of text node with small space")
|
|
22607
|
-
|
|
22614
|
+
// console.log("Handling character input at start of text node with small space")
|
|
22608
22615
|
_this2.insertAfterSmallSpace(e.key, params);
|
|
22609
22616
|
|
|
22610
22617
|
e.preventDefault();
|
|
@@ -22703,9 +22710,8 @@ var MathRichInput = /*#__PURE__*/function (_React$Component) {
|
|
|
22703
22710
|
|
|
22704
22711
|
_defineProperty(_assertThisInitialized(_this2), "handleInput", function (event) {
|
|
22705
22712
|
try {
|
|
22706
|
-
console.log("handleInput")
|
|
22713
|
+
// console.log("handleInput")
|
|
22707
22714
|
var raw_text = elementToMarkedRawText(_this2.editableDiv, null, 0, _this2.enableHtml());
|
|
22708
|
-
console.log("handleInput 2");
|
|
22709
22715
|
|
|
22710
22716
|
var params = _this2._getRangeParams();
|
|
22711
22717
|
|
|
@@ -22727,8 +22733,7 @@ var MathRichInput = /*#__PURE__*/function (_React$Component) {
|
|
|
22727
22733
|
|
|
22728
22734
|
_defineProperty(_assertThisInitialized(_this2), "updateActiveButtons", function () {
|
|
22729
22735
|
try {
|
|
22730
|
-
console.log("updateActiveButtons")
|
|
22731
|
-
|
|
22736
|
+
// console.log("updateActiveButtons")
|
|
22732
22737
|
var rangeParams = _this2._getRangeParams();
|
|
22733
22738
|
|
|
22734
22739
|
if (rangeParams === null || rangeParams === undefined) {
|
|
@@ -22797,20 +22802,21 @@ var MathRichInput = /*#__PURE__*/function (_React$Component) {
|
|
|
22797
22802
|
if (clipboardData === null || clipboardData === undefined) {
|
|
22798
22803
|
console.warn("handlePaste called, but no clipboard data");
|
|
22799
22804
|
return;
|
|
22800
|
-
}
|
|
22805
|
+
} // for (let i = 0; i < clipboardData.types.length; i++)
|
|
22806
|
+
// console.log(
|
|
22807
|
+
// clipboardData.types[i] +
|
|
22808
|
+
// ": " +
|
|
22809
|
+
// clipboardData.getData(clipboardData.types[i])
|
|
22810
|
+
// );
|
|
22801
22811
|
|
|
22802
|
-
for (var i = 0; i < clipboardData.types.length; i++) {
|
|
22803
|
-
console.log(clipboardData.types[i] + ": " + clipboardData.getData(clipboardData.types[i]));
|
|
22804
|
-
}
|
|
22805
22812
|
|
|
22806
22813
|
var pasteHtml = clipboardData.getData("text/html");
|
|
22807
22814
|
|
|
22808
22815
|
if (pasteHtml !== null && pasteHtml.length > 0) {
|
|
22809
|
-
console.log("** Paste html");
|
|
22810
|
-
console.log(pasteHtml);
|
|
22811
|
-
pasteHtml = sanitiseHtml(pasteHtml);
|
|
22812
|
-
console.log(
|
|
22813
|
-
console.log(pasteHtml);
|
|
22816
|
+
// console.log("** Paste html");
|
|
22817
|
+
// console.log(pasteHtml);
|
|
22818
|
+
pasteHtml = sanitiseHtml(pasteHtml); // console.log("** Santised paste html");
|
|
22819
|
+
// console.log(pasteHtml);
|
|
22814
22820
|
|
|
22815
22821
|
_this2.insertHtml(pasteHtml);
|
|
22816
22822
|
|
|
@@ -22866,9 +22872,9 @@ var MathRichInput = /*#__PURE__*/function (_React$Component) {
|
|
|
22866
22872
|
// console.log(node)
|
|
22867
22873
|
|
|
22868
22874
|
if (node === null || node === undefined) {
|
|
22869
|
-
console.error("Could not find node with index: " + rangeParams.startNodeIndex);
|
|
22870
|
-
console.log(
|
|
22871
|
-
|
|
22875
|
+
console.error("Could not find node with index: " + rangeParams.startNodeIndex); // console.log("Child nodes:");
|
|
22876
|
+
// console.log(this.editableDiv.childNodes);
|
|
22877
|
+
|
|
22872
22878
|
node = _this2._findFirstTextNode();
|
|
22873
22879
|
offset = 0;
|
|
22874
22880
|
}
|
|
@@ -23011,10 +23017,10 @@ var MathRichInput = /*#__PURE__*/function (_React$Component) {
|
|
|
23011
23017
|
|
|
23012
23018
|
var end_pos = _this2.markedRawText.indexOf(MARK, start_pos + MARK.length);
|
|
23013
23019
|
|
|
23014
|
-
var oldRangeParams = _this2.getOldRangeParams();
|
|
23020
|
+
var oldRangeParams = _this2.getOldRangeParams(); // console.log("Old range params")
|
|
23021
|
+
// console.log(oldRangeParams)
|
|
23022
|
+
// Handle case of empty string returned
|
|
23015
23023
|
|
|
23016
|
-
console.log("Old range params");
|
|
23017
|
-
console.log(oldRangeParams); // Handle case of empty string returned
|
|
23018
23024
|
|
|
23019
23025
|
if (latex === "") {
|
|
23020
23026
|
// console.log("Empty latex returned from equation editor")
|
|
@@ -23198,21 +23204,25 @@ var MathRichInput = /*#__PURE__*/function (_React$Component) {
|
|
|
23198
23204
|
|
|
23199
23205
|
var new_rangeParams = _objectSpread2({}, rangeParams);
|
|
23200
23206
|
|
|
23201
|
-
new_raw_text = removeMarks(insertCharacterBeforeMarks(raw_text, new_text)); // console.log("
|
|
23202
|
-
// console.log(
|
|
23203
|
-
// if (rangeParams.startNodeIndex === rangeParams.endNodeIndex &&
|
|
23204
|
-
// rangeParams.startOffset === rangeParams.endOffset)
|
|
23205
|
-
// new_rangeParams.startOffset = new_rangeParams.startOffset + new_text.length
|
|
23206
|
-
|
|
23207
|
-
new_rangeParams.endOffset = new_rangeParams.endOffset + new_text.length;
|
|
23207
|
+
new_raw_text = removeMarks(insertCharacterBeforeMarks(raw_text, new_text)); // console.log("Range params before insert")
|
|
23208
|
+
// console.log(rangeParams)
|
|
23208
23209
|
|
|
23209
|
-
if (
|
|
23210
|
-
new_rangeParams.startNodeIndex =
|
|
23211
|
-
new_rangeParams.startOffset =
|
|
23212
|
-
|
|
23210
|
+
if (selectInsertedText) {
|
|
23211
|
+
new_rangeParams.startNodeIndex = rangeParams.endNodeIndex;
|
|
23212
|
+
new_rangeParams.startOffset = rangeParams.endOffset;
|
|
23213
|
+
new_rangeParams.endNodeIndex = rangeParams.endNodeIndex;
|
|
23214
|
+
new_rangeParams.endOffset = rangeParams.endOffset + new_text.length;
|
|
23215
|
+
new_rangeParams.startGlobalOffset = rangeParams.endGlobalOffset;
|
|
23216
|
+
new_rangeParams.endGlobalOffset = rangeParams.endGlobalOffset + new_text.length;
|
|
23217
|
+
} else {
|
|
23218
|
+
new_rangeParams.startNodeIndex = rangeParams.endNodeIndex;
|
|
23219
|
+
new_rangeParams.startOffset = rangeParams.endOffset + new_text.length;
|
|
23220
|
+
new_rangeParams.endNodeIndex = rangeParams.endNodeIndex;
|
|
23221
|
+
new_rangeParams.endOffset = rangeParams.endOffset + new_text.length;
|
|
23222
|
+
new_rangeParams.startGlobalOffset = rangeParams.endGlobalOffset + new_text.length;
|
|
23223
|
+
new_rangeParams.endGlobalOffset = rangeParams.endGlobalOffset + new_text.length;
|
|
23224
|
+
} // console.log("Range params after insert")
|
|
23213
23225
|
// console.log(new_rangeParams)
|
|
23214
|
-
// console.log("Setting new mime-type: ")
|
|
23215
|
-
// console.log(this.props.mimeType)
|
|
23216
23226
|
|
|
23217
23227
|
|
|
23218
23228
|
new_raw_text = removeEncodingIfPlainText(new_raw_text, _this2.props.mimeType, _this2.enableHtml());
|
|
@@ -23400,11 +23410,11 @@ var MathRichInput = /*#__PURE__*/function (_React$Component) {
|
|
|
23400
23410
|
var node = _this2._findNodeWithIndex(rangeParams.endNodeIndex);
|
|
23401
23411
|
|
|
23402
23412
|
var offset = rangeParams.endOffset;
|
|
23403
|
-
var raw_text = elementToMarkedRawText(_this2.editableDiv, node, offset, _this2.enableHtml());
|
|
23404
|
-
console.log(
|
|
23405
|
-
console.log(
|
|
23406
|
-
console.log(
|
|
23407
|
-
|
|
23413
|
+
var raw_text = elementToMarkedRawText(_this2.editableDiv, node, offset, _this2.enableHtml()); // console.log("Raw text before line insert")
|
|
23414
|
+
// console.log(raw_text)
|
|
23415
|
+
// console.log("Range params before line insert")
|
|
23416
|
+
// console.log(rangeParams)
|
|
23417
|
+
|
|
23408
23418
|
var new_raw_text = null;
|
|
23409
23419
|
|
|
23410
23420
|
var new_rangeParams = _objectSpread2({}, rangeParams);
|
|
@@ -23427,11 +23437,10 @@ var MathRichInput = /*#__PURE__*/function (_React$Component) {
|
|
|
23427
23437
|
new_rangeParams.endOffset++;
|
|
23428
23438
|
}
|
|
23429
23439
|
|
|
23430
|
-
new_raw_text = removeEncodingIfPlainText(new_raw_text, _this2.props.mimeType, _this2.enableHtml());
|
|
23431
|
-
console.log(
|
|
23432
|
-
console.log(
|
|
23433
|
-
console.log(
|
|
23434
|
-
console.log(new_rangeParams);
|
|
23440
|
+
new_raw_text = removeEncodingIfPlainText(new_raw_text, _this2.props.mimeType, _this2.enableHtml()); // console.log("New raw text after line insert")
|
|
23441
|
+
// console.log(new_raw_text)
|
|
23442
|
+
// console.log("New range params after line insert")
|
|
23443
|
+
// console.log(new_rangeParams)
|
|
23435
23444
|
|
|
23436
23445
|
_this2.applyChangesToComponent(new_raw_text, _this2.props.mimeType, new_rangeParams, _this2.props.useExpertMode, _this2.props.selectedTab);
|
|
23437
23446
|
} catch (error) {
|
|
@@ -23479,6 +23488,8 @@ var MathRichInput = /*#__PURE__*/function (_React$Component) {
|
|
|
23479
23488
|
try {
|
|
23480
23489
|
_this2.insertAccentLetter(event, oldCharacter, newCharacter);
|
|
23481
23490
|
|
|
23491
|
+
console.log("Hiding accent bar 3");
|
|
23492
|
+
|
|
23482
23493
|
_this2.setState({
|
|
23483
23494
|
showAccentBar: false
|
|
23484
23495
|
});
|
|
@@ -23517,6 +23528,8 @@ var MathRichInput = /*#__PURE__*/function (_React$Component) {
|
|
|
23517
23528
|
}
|
|
23518
23529
|
|
|
23519
23530
|
try {
|
|
23531
|
+
console.log("Hiding accent bar 4");
|
|
23532
|
+
|
|
23520
23533
|
_this2.setState({
|
|
23521
23534
|
hasFocus: false,
|
|
23522
23535
|
showAccentBar: false
|
|
@@ -23695,8 +23708,7 @@ var MathRichInput = /*#__PURE__*/function (_React$Component) {
|
|
|
23695
23708
|
key: "componentDidUpdate",
|
|
23696
23709
|
value: function componentDidUpdate() {
|
|
23697
23710
|
try {
|
|
23698
|
-
console.log("componentDidUpdate")
|
|
23699
|
-
|
|
23711
|
+
// console.log("componentDidUpdate")
|
|
23700
23712
|
if (this.afterComponentUpdateData !== null && this.afterComponentUpdateData !== undefined && this.afterComponentUpdateData.value === this.props.value) {
|
|
23701
23713
|
this._setRangeParams(this.afterComponentUpdateData.rangeParams);
|
|
23702
23714
|
|