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