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
|
@@ -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
|
|
@@ -1264,6 +1264,16 @@ var OverTypeEditor = (() => {
|
|
|
1264
1264
|
-ms-user-select: none !important;
|
|
1265
1265
|
}
|
|
1266
1266
|
|
|
1267
|
+
/* Prevent external resets (Tailwind, Bootstrap, etc.) from breaking alignment.
|
|
1268
|
+
Any element whose font metrics differ from the textarea causes the CSS "strut"
|
|
1269
|
+
to inflate line boxes, drifting the overlay. Force inheritance so every element
|
|
1270
|
+
inside the preview matches the textarea exactly. */
|
|
1271
|
+
.overtype-wrapper .overtype-preview * {
|
|
1272
|
+
font-family: inherit !important;
|
|
1273
|
+
font-size: inherit !important;
|
|
1274
|
+
line-height: inherit !important;
|
|
1275
|
+
}
|
|
1276
|
+
|
|
1267
1277
|
/* Defensive styles for preview child divs */
|
|
1268
1278
|
.overtype-wrapper .overtype-preview div {
|
|
1269
1279
|
/* Reset any inherited styles */
|
|
@@ -1701,6 +1711,11 @@ var OverTypeEditor = (() => {
|
|
|
1701
1711
|
cursor: text !important;
|
|
1702
1712
|
}
|
|
1703
1713
|
|
|
1714
|
+
.overtype-container.overtype-auto-resize[data-mode="preview"] .overtype-preview {
|
|
1715
|
+
position: static !important;
|
|
1716
|
+
height: auto !important;
|
|
1717
|
+
}
|
|
1718
|
+
|
|
1704
1719
|
/* Hide syntax markers in preview mode */
|
|
1705
1720
|
.overtype-container[data-mode="preview"] .syntax-marker {
|
|
1706
1721
|
display: none !important;
|
|
@@ -4769,6 +4784,7 @@ ${blockSuffix}` : suffix;
|
|
|
4769
4784
|
// Callbacks
|
|
4770
4785
|
onChange: null,
|
|
4771
4786
|
onKeydown: null,
|
|
4787
|
+
onRender: null,
|
|
4772
4788
|
// Features
|
|
4773
4789
|
showActiveLineRaw: false,
|
|
4774
4790
|
showStats: false,
|
|
@@ -5167,6 +5183,9 @@ ${blockSuffix}` : suffix;
|
|
|
5167
5183
|
if (this.options.onChange && this.initialized) {
|
|
5168
5184
|
this.options.onChange(text, this);
|
|
5169
5185
|
}
|
|
5186
|
+
if (this.options.onRender) {
|
|
5187
|
+
this.options.onRender(this.preview, isPreviewMode ? "preview" : "normal", this);
|
|
5188
|
+
}
|
|
5170
5189
|
}
|
|
5171
5190
|
/**
|
|
5172
5191
|
* Apply background styling to code blocks
|
|
@@ -5608,11 +5627,18 @@ ${blockSuffix}` : suffix;
|
|
|
5608
5627
|
const preview = this.preview;
|
|
5609
5628
|
const wrapper = this.wrapper;
|
|
5610
5629
|
const isPreviewMode = this.container.dataset.mode === "preview";
|
|
5611
|
-
|
|
5630
|
+
if (isPreviewMode) {
|
|
5631
|
+
wrapper.style.removeProperty("height");
|
|
5632
|
+
preview.style.removeProperty("height");
|
|
5633
|
+
preview.style.removeProperty("overflow-y");
|
|
5634
|
+
textarea.style.removeProperty("height");
|
|
5635
|
+
textarea.style.removeProperty("overflow-y");
|
|
5636
|
+
return;
|
|
5637
|
+
}
|
|
5638
|
+
const scrollTop = textarea.scrollTop;
|
|
5612
5639
|
wrapper.style.setProperty("height", "auto", "important");
|
|
5613
|
-
preview.style.setProperty("height", "auto", "important");
|
|
5614
5640
|
textarea.style.setProperty("height", "auto", "important");
|
|
5615
|
-
let newHeight =
|
|
5641
|
+
let newHeight = textarea.scrollHeight;
|
|
5616
5642
|
if (this.options.minHeight) {
|
|
5617
5643
|
const minHeight = parseInt(this.options.minHeight);
|
|
5618
5644
|
newHeight = Math.max(newHeight, minHeight);
|
|
@@ -6026,6 +6052,7 @@ ${blockSuffix}` : suffix;
|
|
|
6026
6052
|
this._isConnected = false;
|
|
6027
6053
|
this._handleChange = this._handleChange.bind(this);
|
|
6028
6054
|
this._handleKeydown = this._handleKeydown.bind(this);
|
|
6055
|
+
this._handleRender = this._handleRender.bind(this);
|
|
6029
6056
|
}
|
|
6030
6057
|
/**
|
|
6031
6058
|
* Decode common escape sequences from attribute string values
|
|
@@ -6196,7 +6223,8 @@ ${blockSuffix}` : suffix;
|
|
|
6196
6223
|
smartLists: !this.hasAttribute("smart-lists") || this.getAttribute("smart-lists") !== "false",
|
|
6197
6224
|
spellcheck: this.hasAttribute("spellcheck") && this.getAttribute("spellcheck") !== "false",
|
|
6198
6225
|
onChange: this._handleChange,
|
|
6199
|
-
onKeydown: this._handleKeydown
|
|
6226
|
+
onKeydown: this._handleKeydown,
|
|
6227
|
+
onRender: this._handleRender
|
|
6200
6228
|
};
|
|
6201
6229
|
const fontSize = this.getAttribute("font-size");
|
|
6202
6230
|
if (fontSize)
|
|
@@ -6415,6 +6443,19 @@ ${blockSuffix}` : suffix;
|
|
|
6415
6443
|
editor: this._editor
|
|
6416
6444
|
});
|
|
6417
6445
|
}
|
|
6446
|
+
/**
|
|
6447
|
+
* Handle render events from OverType
|
|
6448
|
+
* @private
|
|
6449
|
+
* @param {HTMLElement} preview - The preview DOM element
|
|
6450
|
+
* @param {string} mode - Current mode ('normal' or 'preview')
|
|
6451
|
+
*/
|
|
6452
|
+
_handleRender(preview, mode) {
|
|
6453
|
+
this._dispatchEvent("render", {
|
|
6454
|
+
preview,
|
|
6455
|
+
mode,
|
|
6456
|
+
editor: this._editor
|
|
6457
|
+
});
|
|
6458
|
+
}
|
|
6418
6459
|
/**
|
|
6419
6460
|
* Update value attribute without triggering observer
|
|
6420
6461
|
* @private
|