overtype 2.3.5 → 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/dist/overtype.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * OverType v2.3.5
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 @@ var OverType = (() => {
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 @@ var OverType = (() => {
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 */
@@ -1402,7 +1399,7 @@ var OverType = (() => {
1402
1399
  .overtype-wrapper .overtype-preview pre code {
1403
1400
  background: transparent !important;
1404
1401
  color: var(--code, #0d3b66) !important;
1405
- 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 */
1406
1403
  }
1407
1404
 
1408
1405
  /* Blockquotes */
@@ -1487,26 +1484,20 @@ var OverType = (() => {
1487
1484
  .overtype-stats {
1488
1485
  height: 40px !important;
1489
1486
  padding: 0 20px !important;
1490
- background: #f8f9fa !important;
1491
- border-top: 1px solid #e0e0e0 !important;
1487
+ background: var(--bg-secondary, #f8f9fa) !important;
1488
+ border-top: 1px solid var(--border, #e0e0e0) !important;
1492
1489
  display: flex !important;
1493
1490
  justify-content: space-between !important;
1494
1491
  align-items: center !important;
1495
1492
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
1496
1493
  font-size: 0.85rem !important;
1497
- color: #666 !important;
1494
+ color: var(--text-secondary, #666) !important;
1498
1495
  flex-shrink: 0 !important; /* Don't shrink */
1499
1496
  z-index: 10001 !important; /* Above link tooltip */
1500
1497
  position: relative !important; /* Enable z-index */
1501
1498
  }
1502
-
1503
- /* Dark theme stats bar */
1504
- .overtype-container[data-theme="cave"] .overtype-stats {
1505
- background: var(--bg-secondary, #1D2D3E) !important;
1506
- border-top: 1px solid rgba(197, 221, 232, 0.1) !important;
1507
- color: var(--text, #c5dde8) !important;
1508
- }
1509
-
1499
+
1500
+
1510
1501
  .overtype-stats .overtype-stat {
1511
1502
  display: flex !important;
1512
1503
  align-items: center !important;
@@ -4851,15 +4842,7 @@ ${blockSuffix}` : suffix;
4851
4842
  return;
4852
4843
  }
4853
4844
  this.wrapper._instance = this;
4854
- if (this.options.fontSize) {
4855
- this.wrapper.style.setProperty("--instance-font-size", this.options.fontSize);
4856
- }
4857
- if (this.options.lineHeight) {
4858
- this.wrapper.style.setProperty("--instance-line-height", String(this.options.lineHeight));
4859
- }
4860
- if (this.options.padding) {
4861
- this.wrapper.style.setProperty("--instance-padding", this.options.padding);
4862
- }
4845
+ this._applyInstanceCSSVars();
4863
4846
  this._configureTextarea();
4864
4847
  this._applyOptions();
4865
4848
  }
@@ -4907,15 +4890,7 @@ ${blockSuffix}` : suffix;
4907
4890
  }
4908
4891
  this.wrapper = document.createElement("div");
4909
4892
  this.wrapper.className = "overtype-wrapper";
4910
- if (this.options.fontSize) {
4911
- this.wrapper.style.setProperty("--instance-font-size", this.options.fontSize);
4912
- }
4913
- if (this.options.lineHeight) {
4914
- this.wrapper.style.setProperty("--instance-line-height", String(this.options.lineHeight));
4915
- }
4916
- if (this.options.padding) {
4917
- this.wrapper.style.setProperty("--instance-padding", this.options.padding);
4918
- }
4893
+ this._applyInstanceCSSVars();
4919
4894
  this.wrapper._instance = this;
4920
4895
  this.textarea = document.createElement("textarea");
4921
4896
  this.textarea.className = "overtype-input";
@@ -5029,11 +5004,34 @@ ${blockSuffix}` : suffix;
5029
5004
  Object.assign(this.actionsById, buildActionsMap([toolbarButtons.upload]));
5030
5005
  }
5031
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
+ }
5032
5029
  /**
5033
5030
  * Apply options to the editor
5034
5031
  * @private
5035
5032
  */
5036
5033
  _applyOptions() {
5034
+ this._applyInstanceCSSVars();
5037
5035
  if (this.options.autofocus) {
5038
5036
  this.textarea.focus();
5039
5037
  }