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

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/esm/index.js CHANGED
@@ -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) {
@@ -1991,5 +2014,5 @@ export {
1991
2014
  register
1992
2015
  };
1993
2016
 
1994
- //# debugId=F0BCA812942DFCED64756E2164756E21
2017
+ //# debugId=52B13EF249AEDC5264756E2164756E21
1995
2018
  //# sourceMappingURL=index.js.map