Sha256: 7f4ac7b1fb8839d08ea5e2357ecf3491cd00f71295ff3428a60839c9ff1b8881

Contents?: true

Size: 838 Bytes

Versions: 25

Compression:

Stored size: 838 Bytes

Contents

import { CocoComponent } from "@js/coco";

export default CocoComponent("appSeamlessTextarea", () => {
  return {
    height: null,
    observer: null,
    value: null,

    options: ["multiline", "focus"],

    init() {
      this.value = this.$refs.textarea.value;
      this.$nextTick(() => {
        this.onResize();

        if (this.$options.focus) {
          this.$refs.textarea.focus();
          this.$refs.textarea.selectionStart = this.$refs.textarea.value.length;
        }
      });
    },

    onResize() {
      const textarea = this.$refs.textarea;

      if (textarea) {
        textarea.style.height = "4px";
        const newHeight = textarea.scrollHeight;
        textarea.style.height = `${newHeight}px`;

        if (this.height !== newHeight) {
          this.height = newHeight;
        }
      }
    },
  };
});

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
coveragebook_components-0.10.0 app/components/coco/app/elements/seamless_textarea/seamless_textarea.js
coveragebook_components-0.9.1 app/components/coco/app/elements/seamless_textarea/seamless_textarea.js
coveragebook_components-0.9.0 app/components/coco/app/elements/seamless_textarea/seamless_textarea.js
coveragebook_components-0.8.9 app/components/coco/app/elements/seamless_textarea/seamless_textarea.js
coveragebook_components-0.8.8 app/components/coco/app/elements/seamless_textarea/seamless_textarea.js
coveragebook_components-0.8.7 app/components/coco/app/elements/seamless_textarea/seamless_textarea.js
coveragebook_components-0.8.6 app/components/coco/app/elements/seamless_textarea/seamless_textarea.js
coveragebook_components-0.8.5 app/components/coco/app/elements/seamless_textarea/seamless_textarea.js
coveragebook_components-0.8.4 app/components/coco/app/elements/seamless_textarea/seamless_textarea.js
coveragebook_components-0.8.3 app/components/coco/app/elements/seamless_textarea/seamless_textarea.js
coveragebook_components-0.8.2 app/components/coco/app/elements/seamless_textarea/seamless_textarea.js
coveragebook_components-0.8.1 app/components/coco/app/elements/seamless_textarea/seamless_textarea.js
coveragebook_components-0.8.0 app/components/coco/app/elements/seamless_textarea/seamless_textarea.js
coveragebook_components-0.8.0.beta.3 app/components/coco/app/elements/seamless_textarea/seamless_textarea.js
coveragebook_components-0.8.0.beta.2 app/components/coco/app/elements/seamless_textarea/seamless_textarea.js
coveragebook_components-0.8.0.beta.1 app/components/coco/app/elements/seamless_textarea/seamless_textarea.js
coveragebook_components-0.7.10 app/components/coco/app/elements/seamless_textarea/seamless_textarea.js
coveragebook_components-0.7.9 app/components/coco/app/elements/seamless_textarea/seamless_textarea.js
coveragebook_components-0.7.8 app/components/coco/app/elements/seamless_textarea/seamless_textarea.js
coveragebook_components-0.7.7 app/components/coco/app/elements/seamless_textarea/seamless_textarea.js