overtype 2.3.4 → 2.3.6
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 +1 -1
- package/dist/overtype-webcomponent.esm.js +65 -38
- package/dist/overtype-webcomponent.esm.js.map +2 -2
- package/dist/overtype-webcomponent.js +65 -38
- package/dist/overtype-webcomponent.js.map +2 -2
- package/dist/overtype-webcomponent.min.js +31 -30
- package/dist/overtype.cjs +49 -37
- package/dist/overtype.cjs.map +2 -2
- package/dist/overtype.esm.js +49 -37
- package/dist/overtype.esm.js.map +2 -2
- package/dist/overtype.js +49 -37
- package/dist/overtype.js.map +2 -2
- package/dist/overtype.min.js +25 -24
- package/package.json +3 -2
- package/src/overtype-webcomponent.js +17 -1
- package/src/overtype.js +34 -21
- package/src/styles.js +19 -18
package/dist/overtype.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* OverType v2.3.
|
|
2
|
+
* OverType v2.3.6
|
|
3
3
|
* A lightweight markdown editor library with perfect WYSIWYG alignment
|
|
4
4
|
* @license MIT
|
|
5
5
|
* @author David Miranda
|
|
@@ -1132,9 +1132,9 @@ function generateStyles(options = {}) {
|
|
|
1132
1132
|
left: 0 !important;
|
|
1133
1133
|
width: 100% !important;
|
|
1134
1134
|
height: 100% !important;
|
|
1135
|
-
|
|
1135
|
+
|
|
1136
1136
|
/* Font properties - any difference breaks alignment */
|
|
1137
|
-
font-family: ${fontFamily} !important;
|
|
1137
|
+
font-family: var(--instance-font-family, ${fontFamily}) !important;
|
|
1138
1138
|
font-variant-ligatures: none !important; /* keep metrics stable for code */
|
|
1139
1139
|
font-size: var(--instance-font-size, ${fontSize}) !important;
|
|
1140
1140
|
line-height: var(--instance-line-height, ${lineHeight}) !important;
|
|
@@ -1241,15 +1241,12 @@ function generateStyles(options = {}) {
|
|
|
1241
1241
|
z-index: 0 !important;
|
|
1242
1242
|
pointer-events: none !important;
|
|
1243
1243
|
user-select: none !important;
|
|
1244
|
-
font-family: ${fontFamily} !important;
|
|
1244
|
+
font-family: var(--instance-font-family, ${fontFamily}) !important;
|
|
1245
1245
|
font-size: var(--instance-font-size, ${fontSize}) !important;
|
|
1246
1246
|
line-height: var(--instance-line-height, ${lineHeight}) !important;
|
|
1247
1247
|
padding: var(--instance-padding, ${padding}) !important;
|
|
1248
1248
|
box-sizing: border-box !important;
|
|
1249
1249
|
color: var(--placeholder, #999) !important;
|
|
1250
|
-
overflow: hidden !important;
|
|
1251
|
-
white-space: nowrap !important;
|
|
1252
|
-
text-overflow: ellipsis !important;
|
|
1253
1250
|
}
|
|
1254
1251
|
|
|
1255
1252
|
/* Preview layer styles */
|
|
@@ -1267,6 +1264,16 @@ function generateStyles(options = {}) {
|
|
|
1267
1264
|
-ms-user-select: none !important;
|
|
1268
1265
|
}
|
|
1269
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
|
+
|
|
1270
1277
|
/* Defensive styles for preview child divs */
|
|
1271
1278
|
.overtype-wrapper .overtype-preview div {
|
|
1272
1279
|
/* Reset any inherited styles */
|
|
@@ -1392,7 +1399,7 @@ function generateStyles(options = {}) {
|
|
|
1392
1399
|
.overtype-wrapper .overtype-preview pre code {
|
|
1393
1400
|
background: transparent !important;
|
|
1394
1401
|
color: var(--code, #0d3b66) !important;
|
|
1395
|
-
font-family: ${fontFamily} !important; /* Match textarea font exactly for alignment */
|
|
1402
|
+
font-family: var(--instance-font-family, ${fontFamily}) !important; /* Match textarea font exactly for alignment */
|
|
1396
1403
|
}
|
|
1397
1404
|
|
|
1398
1405
|
/* Blockquotes */
|
|
@@ -1477,26 +1484,20 @@ function generateStyles(options = {}) {
|
|
|
1477
1484
|
.overtype-stats {
|
|
1478
1485
|
height: 40px !important;
|
|
1479
1486
|
padding: 0 20px !important;
|
|
1480
|
-
background: #f8f9fa !important;
|
|
1481
|
-
border-top: 1px solid #e0e0e0 !important;
|
|
1487
|
+
background: var(--bg-secondary, #f8f9fa) !important;
|
|
1488
|
+
border-top: 1px solid var(--border, #e0e0e0) !important;
|
|
1482
1489
|
display: flex !important;
|
|
1483
1490
|
justify-content: space-between !important;
|
|
1484
1491
|
align-items: center !important;
|
|
1485
1492
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
|
|
1486
1493
|
font-size: 0.85rem !important;
|
|
1487
|
-
color: #666 !important;
|
|
1494
|
+
color: var(--text-secondary, #666) !important;
|
|
1488
1495
|
flex-shrink: 0 !important; /* Don't shrink */
|
|
1489
1496
|
z-index: 10001 !important; /* Above link tooltip */
|
|
1490
1497
|
position: relative !important; /* Enable z-index */
|
|
1491
1498
|
}
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
.overtype-container[data-theme="cave"] .overtype-stats {
|
|
1495
|
-
background: var(--bg-secondary, #1D2D3E) !important;
|
|
1496
|
-
border-top: 1px solid rgba(197, 221, 232, 0.1) !important;
|
|
1497
|
-
color: var(--text, #c5dde8) !important;
|
|
1498
|
-
}
|
|
1499
|
-
|
|
1499
|
+
|
|
1500
|
+
|
|
1500
1501
|
.overtype-stats .overtype-stat {
|
|
1501
1502
|
display: flex !important;
|
|
1502
1503
|
align-items: center !important;
|
|
@@ -4777,6 +4778,7 @@ var _OverType = class _OverType {
|
|
|
4777
4778
|
// Callbacks
|
|
4778
4779
|
onChange: null,
|
|
4779
4780
|
onKeydown: null,
|
|
4781
|
+
onRender: null,
|
|
4780
4782
|
// Features
|
|
4781
4783
|
showActiveLineRaw: false,
|
|
4782
4784
|
showStats: false,
|
|
@@ -4840,15 +4842,7 @@ var _OverType = class _OverType {
|
|
|
4840
4842
|
return;
|
|
4841
4843
|
}
|
|
4842
4844
|
this.wrapper._instance = this;
|
|
4843
|
-
|
|
4844
|
-
this.wrapper.style.setProperty("--instance-font-size", this.options.fontSize);
|
|
4845
|
-
}
|
|
4846
|
-
if (this.options.lineHeight) {
|
|
4847
|
-
this.wrapper.style.setProperty("--instance-line-height", String(this.options.lineHeight));
|
|
4848
|
-
}
|
|
4849
|
-
if (this.options.padding) {
|
|
4850
|
-
this.wrapper.style.setProperty("--instance-padding", this.options.padding);
|
|
4851
|
-
}
|
|
4845
|
+
this._applyInstanceCSSVars();
|
|
4852
4846
|
this._configureTextarea();
|
|
4853
4847
|
this._applyOptions();
|
|
4854
4848
|
}
|
|
@@ -4896,15 +4890,7 @@ var _OverType = class _OverType {
|
|
|
4896
4890
|
}
|
|
4897
4891
|
this.wrapper = document.createElement("div");
|
|
4898
4892
|
this.wrapper.className = "overtype-wrapper";
|
|
4899
|
-
|
|
4900
|
-
this.wrapper.style.setProperty("--instance-font-size", this.options.fontSize);
|
|
4901
|
-
}
|
|
4902
|
-
if (this.options.lineHeight) {
|
|
4903
|
-
this.wrapper.style.setProperty("--instance-line-height", String(this.options.lineHeight));
|
|
4904
|
-
}
|
|
4905
|
-
if (this.options.padding) {
|
|
4906
|
-
this.wrapper.style.setProperty("--instance-padding", this.options.padding);
|
|
4907
|
-
}
|
|
4893
|
+
this._applyInstanceCSSVars();
|
|
4908
4894
|
this.wrapper._instance = this;
|
|
4909
4895
|
this.textarea = document.createElement("textarea");
|
|
4910
4896
|
this.textarea.className = "overtype-input";
|
|
@@ -5018,11 +5004,34 @@ var _OverType = class _OverType {
|
|
|
5018
5004
|
Object.assign(this.actionsById, buildActionsMap([toolbarButtons.upload]));
|
|
5019
5005
|
}
|
|
5020
5006
|
}
|
|
5007
|
+
/**
|
|
5008
|
+
* Apply instance-specific styles via CSS custom properties on the wrapper.
|
|
5009
|
+
* Called from init paths and from _applyOptions so reinit() propagates
|
|
5010
|
+
* font/padding changes.
|
|
5011
|
+
* @private
|
|
5012
|
+
*/
|
|
5013
|
+
_applyInstanceCSSVars() {
|
|
5014
|
+
if (!this.wrapper)
|
|
5015
|
+
return;
|
|
5016
|
+
if (this.options.fontSize) {
|
|
5017
|
+
this.wrapper.style.setProperty("--instance-font-size", this.options.fontSize);
|
|
5018
|
+
}
|
|
5019
|
+
if (this.options.lineHeight) {
|
|
5020
|
+
this.wrapper.style.setProperty("--instance-line-height", String(this.options.lineHeight));
|
|
5021
|
+
}
|
|
5022
|
+
if (this.options.padding) {
|
|
5023
|
+
this.wrapper.style.setProperty("--instance-padding", this.options.padding);
|
|
5024
|
+
}
|
|
5025
|
+
if (this.options.fontFamily) {
|
|
5026
|
+
this.wrapper.style.setProperty("--instance-font-family", this.options.fontFamily);
|
|
5027
|
+
}
|
|
5028
|
+
}
|
|
5021
5029
|
/**
|
|
5022
5030
|
* Apply options to the editor
|
|
5023
5031
|
* @private
|
|
5024
5032
|
*/
|
|
5025
5033
|
_applyOptions() {
|
|
5034
|
+
this._applyInstanceCSSVars();
|
|
5026
5035
|
if (this.options.autofocus) {
|
|
5027
5036
|
this.textarea.focus();
|
|
5028
5037
|
}
|
|
@@ -5175,6 +5184,9 @@ var _OverType = class _OverType {
|
|
|
5175
5184
|
if (this.options.onChange && this.initialized) {
|
|
5176
5185
|
this.options.onChange(text, this);
|
|
5177
5186
|
}
|
|
5187
|
+
if (this.options.onRender) {
|
|
5188
|
+
this.options.onRender(this.preview, isPreviewMode ? "preview" : "normal", this);
|
|
5189
|
+
}
|
|
5178
5190
|
}
|
|
5179
5191
|
/**
|
|
5180
5192
|
* Apply background styling to code blocks
|