@ember-eui/core 5.16.0 → 5.16.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.
@@ -6,6 +6,7 @@
6
6
  @size={{@textSize}}
7
7
  @textAlign={{@textAlign}}
8
8
  {{did-insert this.setRootNode}}
9
+ {{did-update this.update @value}}
9
10
  ...attributes
10
11
  >
11
12
  {{#each this.result.components as |CompNode|}}
@@ -5,7 +5,7 @@ import {
5
5
  } from '../../utils/markdown/plugins/markdown-default-plugins';
6
6
  import { cached, tracked } from '@glimmer/tracking';
7
7
  import unified, { Processor } from 'unified';
8
- import { toDOM } from '../../utils/markdown/plugins/to-dom';
8
+ import { DynamicComponent, toDOM } from '../../utils/markdown/plugins/to-dom';
9
9
  import type { RehypeNode } from '../../utils/markdown/markdown-types';
10
10
  import type EuiMarkdownEditorComponent from '../eui-markdown-editor';
11
11
 
@@ -18,6 +18,14 @@ export interface EuiMarkdownEditorToolbarArgs {
18
18
 
19
19
  export default class EuiMarkdownEditorToolbarComponent extends Component<EuiMarkdownEditorToolbarArgs> {
20
20
  @tracked rootNode?: HTMLDivElement;
21
+ @tracked result?:
22
+ | {
23
+ element: Node | undefined;
24
+ components: DynamicComponent[];
25
+ }
26
+ | string;
27
+
28
+ _lastValue?: string;
21
29
 
22
30
  get parsingPluginList() {
23
31
  return this.args.parsingPluginList || defaultParsingPlugins;
@@ -29,6 +37,7 @@ export default class EuiMarkdownEditorToolbarComponent extends Component<EuiMark
29
37
 
30
38
  setRootNode = (node: HTMLDivElement) => {
31
39
  this.rootNode = node;
40
+ this.update();
32
41
  };
33
42
 
34
43
  @cached
@@ -47,17 +56,19 @@ export default class EuiMarkdownEditorToolbarComponent extends Component<EuiMark
47
56
  .use(identityCompiler);
48
57
  }
49
58
 
50
- @cached
51
- get result() {
59
+ update = () => {
52
60
  if (this.rootNode) {
61
+ if (this.args.value === this._lastValue) return;
62
+ this._lastValue = this.args.value;
63
+ this.rootNode.innerHTML = '';
53
64
  try {
54
65
  const processed = this.processor.processSync(this.args.value);
55
- return toDOM(processed.result as RehypeNode, this.rootNode);
66
+ this.result = toDOM(processed.result as RehypeNode, this.rootNode);
56
67
  //eslint-disable-next-line
57
68
  } catch (e) {
58
- return this.args.value;
69
+ this.result = this.args.value;
59
70
  }
60
71
  }
61
- return this.args.value;
62
- }
72
+ this.result = this.args.value;
73
+ };
63
74
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ember-eui/core",
3
- "version": "5.16.0",
3
+ "version": "5.16.1",
4
4
  "description": "Ember Components for Elastic UI",
5
5
  "keywords": [
6
6
  "ember-addon",
@@ -186,5 +186,5 @@
186
186
  "volta": {
187
187
  "extends": "../../package.json"
188
188
  },
189
- "gitHead": "935bd04cef925daf9e98960727a40e96ea895d3f"
189
+ "gitHead": "f415ac77a1e3db648b96f9c4f077230c97b84673"
190
190
  }