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.
package/dist/overtype.js CHANGED
@@ -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
@@ -5610,13 +5610,12 @@ ${blockSuffix}` : suffix;
5610
5610
  const textarea = this.textarea;
5611
5611
  const preview = this.preview;
5612
5612
  const wrapper = this.wrapper;
5613
- const computed = window.getComputedStyle(textarea);
5614
- const paddingTop = parseFloat(computed.paddingTop);
5615
- const paddingBottom = parseFloat(computed.paddingBottom);
5616
- const scrollTop = textarea.scrollTop;
5613
+ const isPreviewMode = this.container.dataset.mode === "preview";
5614
+ const scrollTop = isPreviewMode ? preview.scrollTop : textarea.scrollTop;
5617
5615
  wrapper.style.setProperty("height", "auto", "important");
5616
+ preview.style.setProperty("height", "auto", "important");
5618
5617
  textarea.style.setProperty("height", "auto", "important");
5619
- let newHeight = textarea.scrollHeight;
5618
+ let newHeight = isPreviewMode ? preview.scrollHeight : textarea.scrollHeight;
5620
5619
  if (this.options.minHeight) {
5621
5620
  const minHeight = parseInt(this.options.minHeight);
5622
5621
  newHeight = Math.max(newHeight, minHeight);
@@ -5666,6 +5665,7 @@ ${blockSuffix}` : suffix;
5666
5665
  showNormalEditMode() {
5667
5666
  this.container.dataset.mode = "normal";
5668
5667
  this.updatePreview();
5668
+ this._updateAutoHeight();
5669
5669
  requestAnimationFrame(() => {
5670
5670
  this.textarea.scrollTop = this.preview.scrollTop;
5671
5671
  this.textarea.scrollLeft = this.preview.scrollLeft;
@@ -5678,6 +5678,7 @@ ${blockSuffix}` : suffix;
5678
5678
  */
5679
5679
  showPlainTextarea() {
5680
5680
  this.container.dataset.mode = "plain";
5681
+ this._updateAutoHeight();
5681
5682
  if (this.toolbar) {
5682
5683
  const toggleBtn = this.container.querySelector('[data-action="toggle-plain"]');
5683
5684
  if (toggleBtn) {
@@ -5694,6 +5695,7 @@ ${blockSuffix}` : suffix;
5694
5695
  showPreviewMode() {
5695
5696
  this.container.dataset.mode = "preview";
5696
5697
  this.updatePreview();
5698
+ this._updateAutoHeight();
5697
5699
  return this;
5698
5700
  }
5699
5701
  /**