@duskmoon-dev/el-markdown-input 1.8.0 → 1.8.2

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.
@@ -267,7 +267,17 @@ var elementStyles = css`
267
267
  color: var(--md-text);
268
268
  overflow: hidden;
269
269
  height: inherit;
270
- min-height: 12rem;
270
+ min-height: var(--md-editor-min-height, 12rem);
271
+ }
272
+
273
+ :host([auto-grow]) .editor {
274
+ height: auto;
275
+ max-height: var(--md-editor-max-height, 24rem);
276
+ }
277
+
278
+ :host([auto-grow]) .write-area {
279
+ flex: 0 1 auto;
280
+ grid-template-columns: minmax(0, 1fr);
271
281
  }
272
282
 
273
283
  .editor:focus-within {
@@ -360,6 +370,11 @@ var elementStyles = css`
360
370
  color: var(--md-text);
361
371
  }
362
372
 
373
+ :host([auto-grow]) .render-layer,
374
+ :host([auto-grow]) textarea {
375
+ overflow-wrap: anywhere;
376
+ }
377
+
363
378
  /*
364
379
  * Textarea: grid overlay on top of the render layer. Transparent text
365
380
  * lets highlighted content show through; caret-color keeps cursor visible.
@@ -1140,7 +1155,8 @@ class ElDmMarkdownInput extends BaseElement {
1140
1155
  katexCssUrl: { type: String, reflect: true, attribute: "katex-css-url" },
1141
1156
  mermaidSrc: { type: String, reflect: true, attribute: "mermaid-src" },
1142
1157
  resize: { type: String, reflect: true, default: "none" },
1143
- noPreview: { type: Boolean, reflect: true, attribute: "no-preview" }
1158
+ noPreview: { type: Boolean, reflect: true, attribute: "no-preview" },
1159
+ autoGrow: { type: Boolean, reflect: true, attribute: "auto-grow" }
1144
1160
  };
1145
1161
  static get observedAttributes() {
1146
1162
  return [...super.observedAttributes, "id"];
@@ -1519,6 +1535,13 @@ class ElDmMarkdownInput extends BaseElement {
1519
1535
  #scheduleHighlight() {
1520
1536
  if (this.#highlightTimer !== null)
1521
1537
  clearTimeout(this.#highlightTimer);
1538
+ if (this.autoGrow) {
1539
+ this.#highlightTimer = null;
1540
+ if (this.#renderLayer && this.#textarea) {
1541
+ this.#renderLayer.innerHTML = highlightMarkdown(this.#textarea.value);
1542
+ }
1543
+ return;
1544
+ }
1522
1545
  this.#highlightTimer = setTimeout(() => {
1523
1546
  this.#highlightTimer = null;
1524
1547
  if (this.#renderLayer && this.#textarea) {
@@ -1966,5 +1989,5 @@ if (!customElements.get("el-dm-markdown-input")) {
1966
1989
  customElements.define("el-dm-markdown-input", ElDmMarkdownInput);
1967
1990
  }
1968
1991
 
1969
- //# debugId=782EDA03119743BA64756E2164756E21
1992
+ //# debugId=AFDD8B6E269DFE8164756E2164756E21
1970
1993
  //# sourceMappingURL=register.js.map