overtype 2.3.2 → 2.3.3

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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * OverType v2.3.2
2
+ * OverType v2.3.3
3
3
  * A lightweight markdown editor library with perfect WYSIWYG alignment
4
4
  * @license MIT
5
5
  * @author David Miranda
@@ -5584,13 +5584,12 @@ var _OverType = class _OverType {
5584
5584
  const textarea = this.textarea;
5585
5585
  const preview = this.preview;
5586
5586
  const wrapper = this.wrapper;
5587
- const computed = window.getComputedStyle(textarea);
5588
- const paddingTop = parseFloat(computed.paddingTop);
5589
- const paddingBottom = parseFloat(computed.paddingBottom);
5590
- const scrollTop = textarea.scrollTop;
5587
+ const isPreviewMode = this.container.dataset.mode === "preview";
5588
+ const scrollTop = isPreviewMode ? preview.scrollTop : textarea.scrollTop;
5591
5589
  wrapper.style.setProperty("height", "auto", "important");
5590
+ preview.style.setProperty("height", "auto", "important");
5592
5591
  textarea.style.setProperty("height", "auto", "important");
5593
- let newHeight = textarea.scrollHeight;
5592
+ let newHeight = isPreviewMode ? preview.scrollHeight : textarea.scrollHeight;
5594
5593
  if (this.options.minHeight) {
5595
5594
  const minHeight = parseInt(this.options.minHeight);
5596
5595
  newHeight = Math.max(newHeight, minHeight);
@@ -5640,6 +5639,7 @@ var _OverType = class _OverType {
5640
5639
  showNormalEditMode() {
5641
5640
  this.container.dataset.mode = "normal";
5642
5641
  this.updatePreview();
5642
+ this._updateAutoHeight();
5643
5643
  requestAnimationFrame(() => {
5644
5644
  this.textarea.scrollTop = this.preview.scrollTop;
5645
5645
  this.textarea.scrollLeft = this.preview.scrollLeft;
@@ -5652,6 +5652,7 @@ var _OverType = class _OverType {
5652
5652
  */
5653
5653
  showPlainTextarea() {
5654
5654
  this.container.dataset.mode = "plain";
5655
+ this._updateAutoHeight();
5655
5656
  if (this.toolbar) {
5656
5657
  const toggleBtn = this.container.querySelector('[data-action="toggle-plain"]');
5657
5658
  if (toggleBtn) {
@@ -5668,6 +5669,7 @@ var _OverType = class _OverType {
5668
5669
  showPreviewMode() {
5669
5670
  this.container.dataset.mode = "preview";
5670
5671
  this.updatePreview();
5672
+ this._updateAutoHeight();
5671
5673
  return this;
5672
5674
  }
5673
5675
  /**