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.esm.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
|
|
@@ -1241,6 +1241,16 @@ function generateStyles(options = {}) {
|
|
|
1241
1241
|
-ms-user-select: none !important;
|
|
1242
1242
|
}
|
|
1243
1243
|
|
|
1244
|
+
/* Prevent external resets (Tailwind, Bootstrap, etc.) from breaking alignment.
|
|
1245
|
+
Any element whose font metrics differ from the textarea causes the CSS "strut"
|
|
1246
|
+
to inflate line boxes, drifting the overlay. Force inheritance so every element
|
|
1247
|
+
inside the preview matches the textarea exactly. */
|
|
1248
|
+
.overtype-wrapper .overtype-preview * {
|
|
1249
|
+
font-family: inherit !important;
|
|
1250
|
+
font-size: inherit !important;
|
|
1251
|
+
line-height: inherit !important;
|
|
1252
|
+
}
|
|
1253
|
+
|
|
1244
1254
|
/* Defensive styles for preview child divs */
|
|
1245
1255
|
.overtype-wrapper .overtype-preview div {
|
|
1246
1256
|
/* Reset any inherited styles */
|
|
@@ -1678,6 +1688,11 @@ function generateStyles(options = {}) {
|
|
|
1678
1688
|
cursor: text !important;
|
|
1679
1689
|
}
|
|
1680
1690
|
|
|
1691
|
+
.overtype-container.overtype-auto-resize[data-mode="preview"] .overtype-preview {
|
|
1692
|
+
position: static !important;
|
|
1693
|
+
height: auto !important;
|
|
1694
|
+
}
|
|
1695
|
+
|
|
1681
1696
|
/* Hide syntax markers in preview mode */
|
|
1682
1697
|
.overtype-container[data-mode="preview"] .syntax-marker {
|
|
1683
1698
|
display: none !important;
|
|
@@ -4746,6 +4761,7 @@ var _OverType = class _OverType {
|
|
|
4746
4761
|
// Callbacks
|
|
4747
4762
|
onChange: null,
|
|
4748
4763
|
onKeydown: null,
|
|
4764
|
+
onRender: null,
|
|
4749
4765
|
// Features
|
|
4750
4766
|
showActiveLineRaw: false,
|
|
4751
4767
|
showStats: false,
|
|
@@ -5144,6 +5160,9 @@ var _OverType = class _OverType {
|
|
|
5144
5160
|
if (this.options.onChange && this.initialized) {
|
|
5145
5161
|
this.options.onChange(text, this);
|
|
5146
5162
|
}
|
|
5163
|
+
if (this.options.onRender) {
|
|
5164
|
+
this.options.onRender(this.preview, isPreviewMode ? "preview" : "normal", this);
|
|
5165
|
+
}
|
|
5147
5166
|
}
|
|
5148
5167
|
/**
|
|
5149
5168
|
* Apply background styling to code blocks
|
|
@@ -5585,11 +5604,18 @@ var _OverType = class _OverType {
|
|
|
5585
5604
|
const preview = this.preview;
|
|
5586
5605
|
const wrapper = this.wrapper;
|
|
5587
5606
|
const isPreviewMode = this.container.dataset.mode === "preview";
|
|
5588
|
-
|
|
5607
|
+
if (isPreviewMode) {
|
|
5608
|
+
wrapper.style.removeProperty("height");
|
|
5609
|
+
preview.style.removeProperty("height");
|
|
5610
|
+
preview.style.removeProperty("overflow-y");
|
|
5611
|
+
textarea.style.removeProperty("height");
|
|
5612
|
+
textarea.style.removeProperty("overflow-y");
|
|
5613
|
+
return;
|
|
5614
|
+
}
|
|
5615
|
+
const scrollTop = textarea.scrollTop;
|
|
5589
5616
|
wrapper.style.setProperty("height", "auto", "important");
|
|
5590
|
-
preview.style.setProperty("height", "auto", "important");
|
|
5591
5617
|
textarea.style.setProperty("height", "auto", "important");
|
|
5592
|
-
let newHeight =
|
|
5618
|
+
let newHeight = textarea.scrollHeight;
|
|
5593
5619
|
if (this.options.minHeight) {
|
|
5594
5620
|
const minHeight = parseInt(this.options.minHeight);
|
|
5595
5621
|
newHeight = Math.max(newHeight, minHeight);
|