overtype 2.3.3 → 2.3.5
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/README.md +4 -4
- package/dist/overtype-webcomponent.esm.js +46 -5
- package/dist/overtype-webcomponent.esm.js.map +2 -2
- package/dist/overtype-webcomponent.js +46 -5
- package/dist/overtype-webcomponent.js.map +2 -2
- package/dist/overtype-webcomponent.min.js +25 -10
- package/dist/overtype.cjs +30 -4
- package/dist/overtype.cjs.map +2 -2
- package/dist/overtype.esm.js +30 -4
- package/dist/overtype.esm.js.map +2 -2
- package/dist/overtype.js +30 -4
- package/dist/overtype.js.map +2 -2
- package/dist/overtype.min.js +24 -9
- package/package.json +3 -2
- package/src/overtype-webcomponent.js +17 -1
- package/src/overtype.js +26 -12
- package/src/styles.js +15 -0
package/dist/overtype.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* OverType v2.3.
|
|
2
|
+
* OverType v2.3.5
|
|
3
3
|
* A lightweight markdown editor library with perfect WYSIWYG alignment
|
|
4
4
|
* @license MIT
|
|
5
5
|
* @author David Miranda
|
|
@@ -1267,6 +1267,16 @@ var OverType = (() => {
|
|
|
1267
1267
|
-ms-user-select: none !important;
|
|
1268
1268
|
}
|
|
1269
1269
|
|
|
1270
|
+
/* Prevent external resets (Tailwind, Bootstrap, etc.) from breaking alignment.
|
|
1271
|
+
Any element whose font metrics differ from the textarea causes the CSS "strut"
|
|
1272
|
+
to inflate line boxes, drifting the overlay. Force inheritance so every element
|
|
1273
|
+
inside the preview matches the textarea exactly. */
|
|
1274
|
+
.overtype-wrapper .overtype-preview * {
|
|
1275
|
+
font-family: inherit !important;
|
|
1276
|
+
font-size: inherit !important;
|
|
1277
|
+
line-height: inherit !important;
|
|
1278
|
+
}
|
|
1279
|
+
|
|
1270
1280
|
/* Defensive styles for preview child divs */
|
|
1271
1281
|
.overtype-wrapper .overtype-preview div {
|
|
1272
1282
|
/* Reset any inherited styles */
|
|
@@ -1704,6 +1714,11 @@ var OverType = (() => {
|
|
|
1704
1714
|
cursor: text !important;
|
|
1705
1715
|
}
|
|
1706
1716
|
|
|
1717
|
+
.overtype-container.overtype-auto-resize[data-mode="preview"] .overtype-preview {
|
|
1718
|
+
position: static !important;
|
|
1719
|
+
height: auto !important;
|
|
1720
|
+
}
|
|
1721
|
+
|
|
1707
1722
|
/* Hide syntax markers in preview mode */
|
|
1708
1723
|
.overtype-container[data-mode="preview"] .syntax-marker {
|
|
1709
1724
|
display: none !important;
|
|
@@ -4772,6 +4787,7 @@ ${blockSuffix}` : suffix;
|
|
|
4772
4787
|
// Callbacks
|
|
4773
4788
|
onChange: null,
|
|
4774
4789
|
onKeydown: null,
|
|
4790
|
+
onRender: null,
|
|
4775
4791
|
// Features
|
|
4776
4792
|
showActiveLineRaw: false,
|
|
4777
4793
|
showStats: false,
|
|
@@ -5170,6 +5186,9 @@ ${blockSuffix}` : suffix;
|
|
|
5170
5186
|
if (this.options.onChange && this.initialized) {
|
|
5171
5187
|
this.options.onChange(text, this);
|
|
5172
5188
|
}
|
|
5189
|
+
if (this.options.onRender) {
|
|
5190
|
+
this.options.onRender(this.preview, isPreviewMode ? "preview" : "normal", this);
|
|
5191
|
+
}
|
|
5173
5192
|
}
|
|
5174
5193
|
/**
|
|
5175
5194
|
* Apply background styling to code blocks
|
|
@@ -5611,11 +5630,18 @@ ${blockSuffix}` : suffix;
|
|
|
5611
5630
|
const preview = this.preview;
|
|
5612
5631
|
const wrapper = this.wrapper;
|
|
5613
5632
|
const isPreviewMode = this.container.dataset.mode === "preview";
|
|
5614
|
-
|
|
5633
|
+
if (isPreviewMode) {
|
|
5634
|
+
wrapper.style.removeProperty("height");
|
|
5635
|
+
preview.style.removeProperty("height");
|
|
5636
|
+
preview.style.removeProperty("overflow-y");
|
|
5637
|
+
textarea.style.removeProperty("height");
|
|
5638
|
+
textarea.style.removeProperty("overflow-y");
|
|
5639
|
+
return;
|
|
5640
|
+
}
|
|
5641
|
+
const scrollTop = textarea.scrollTop;
|
|
5615
5642
|
wrapper.style.setProperty("height", "auto", "important");
|
|
5616
|
-
preview.style.setProperty("height", "auto", "important");
|
|
5617
5643
|
textarea.style.setProperty("height", "auto", "important");
|
|
5618
|
-
let newHeight =
|
|
5644
|
+
let newHeight = textarea.scrollHeight;
|
|
5619
5645
|
if (this.options.minHeight) {
|
|
5620
5646
|
const minHeight = parseInt(this.options.minHeight);
|
|
5621
5647
|
newHeight = Math.max(newHeight, minHeight);
|