overtype 2.3.4 → 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 +3 -3
- package/dist/overtype-webcomponent.esm.js +31 -2
- package/dist/overtype-webcomponent.esm.js.map +2 -2
- package/dist/overtype-webcomponent.js +31 -2
- package/dist/overtype-webcomponent.js.map +2 -2
- package/dist/overtype-webcomponent.min.js +20 -10
- package/dist/overtype.cjs +15 -1
- package/dist/overtype.cjs.map +2 -2
- package/dist/overtype.esm.js +15 -1
- package/dist/overtype.esm.js.map +2 -2
- package/dist/overtype.js +15 -1
- package/dist/overtype.js.map +2 -2
- package/dist/overtype.min.js +16 -6
- package/package.json +3 -2
- package/src/overtype-webcomponent.js +17 -1
- package/src/overtype.js +6 -0
- package/src/styles.js +10 -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 */
|
|
@@ -4774,6 +4784,7 @@ ${blockSuffix}` : suffix;
|
|
|
4774
4784
|
// Callbacks
|
|
4775
4785
|
onChange: null,
|
|
4776
4786
|
onKeydown: null,
|
|
4787
|
+
onRender: null,
|
|
4777
4788
|
// Features
|
|
4778
4789
|
showActiveLineRaw: false,
|
|
4779
4790
|
showStats: false,
|
|
@@ -5172,6 +5183,9 @@ ${blockSuffix}` : suffix;
|
|
|
5172
5183
|
if (this.options.onChange && this.initialized) {
|
|
5173
5184
|
this.options.onChange(text, this);
|
|
5174
5185
|
}
|
|
5186
|
+
if (this.options.onRender) {
|
|
5187
|
+
this.options.onRender(this.preview, isPreviewMode ? "preview" : "normal", this);
|
|
5188
|
+
}
|
|
5175
5189
|
}
|
|
5176
5190
|
/**
|
|
5177
5191
|
* Apply background styling to code blocks
|
|
@@ -6038,6 +6052,7 @@ ${blockSuffix}` : suffix;
|
|
|
6038
6052
|
this._isConnected = false;
|
|
6039
6053
|
this._handleChange = this._handleChange.bind(this);
|
|
6040
6054
|
this._handleKeydown = this._handleKeydown.bind(this);
|
|
6055
|
+
this._handleRender = this._handleRender.bind(this);
|
|
6041
6056
|
}
|
|
6042
6057
|
/**
|
|
6043
6058
|
* Decode common escape sequences from attribute string values
|
|
@@ -6208,7 +6223,8 @@ ${blockSuffix}` : suffix;
|
|
|
6208
6223
|
smartLists: !this.hasAttribute("smart-lists") || this.getAttribute("smart-lists") !== "false",
|
|
6209
6224
|
spellcheck: this.hasAttribute("spellcheck") && this.getAttribute("spellcheck") !== "false",
|
|
6210
6225
|
onChange: this._handleChange,
|
|
6211
|
-
onKeydown: this._handleKeydown
|
|
6226
|
+
onKeydown: this._handleKeydown,
|
|
6227
|
+
onRender: this._handleRender
|
|
6212
6228
|
};
|
|
6213
6229
|
const fontSize = this.getAttribute("font-size");
|
|
6214
6230
|
if (fontSize)
|
|
@@ -6427,6 +6443,19 @@ ${blockSuffix}` : suffix;
|
|
|
6427
6443
|
editor: this._editor
|
|
6428
6444
|
});
|
|
6429
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
|
+
}
|
|
6430
6459
|
/**
|
|
6431
6460
|
* Update value attribute without triggering observer
|
|
6432
6461
|
* @private
|