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
@@ -5607,13 +5607,12 @@ ${blockSuffix}` : suffix;
5607
5607
  const textarea = this.textarea;
5608
5608
  const preview = this.preview;
5609
5609
  const wrapper = this.wrapper;
5610
- const computed = window.getComputedStyle(textarea);
5611
- const paddingTop = parseFloat(computed.paddingTop);
5612
- const paddingBottom = parseFloat(computed.paddingBottom);
5613
- const scrollTop = textarea.scrollTop;
5610
+ const isPreviewMode = this.container.dataset.mode === "preview";
5611
+ const scrollTop = isPreviewMode ? preview.scrollTop : textarea.scrollTop;
5614
5612
  wrapper.style.setProperty("height", "auto", "important");
5613
+ preview.style.setProperty("height", "auto", "important");
5615
5614
  textarea.style.setProperty("height", "auto", "important");
5616
- let newHeight = textarea.scrollHeight;
5615
+ let newHeight = isPreviewMode ? preview.scrollHeight : textarea.scrollHeight;
5617
5616
  if (this.options.minHeight) {
5618
5617
  const minHeight = parseInt(this.options.minHeight);
5619
5618
  newHeight = Math.max(newHeight, minHeight);
@@ -5663,6 +5662,7 @@ ${blockSuffix}` : suffix;
5663
5662
  showNormalEditMode() {
5664
5663
  this.container.dataset.mode = "normal";
5665
5664
  this.updatePreview();
5665
+ this._updateAutoHeight();
5666
5666
  requestAnimationFrame(() => {
5667
5667
  this.textarea.scrollTop = this.preview.scrollTop;
5668
5668
  this.textarea.scrollLeft = this.preview.scrollLeft;
@@ -5675,6 +5675,7 @@ ${blockSuffix}` : suffix;
5675
5675
  */
5676
5676
  showPlainTextarea() {
5677
5677
  this.container.dataset.mode = "plain";
5678
+ this._updateAutoHeight();
5678
5679
  if (this.toolbar) {
5679
5680
  const toggleBtn = this.container.querySelector('[data-action="toggle-plain"]');
5680
5681
  if (toggleBtn) {
@@ -5691,6 +5692,7 @@ ${blockSuffix}` : suffix;
5691
5692
  showPreviewMode() {
5692
5693
  this.container.dataset.mode = "preview";
5693
5694
  this.updatePreview();
5695
+ this._updateAutoHeight();
5694
5696
  return this;
5695
5697
  }
5696
5698
  /**