@ember-eui/core 1.3.3 → 1.5.0
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/CHANGELOG.md +21 -0
- package/addon/components/eui-icon/index.ts +1 -1
- package/addon/components/eui-markdown-editor/index.hbs +1 -0
- package/addon/components/eui-markdown-editor-footer/index.ts +2 -2
- package/addon/components/eui-markdown-editor-toolbar/index.ts +2 -2
- package/addon/components/eui-markdown-format/index.ts +14 -5
- package/addon/utils/markdown/plugins/markdown-default-plugins.ts +1 -24
- package/app/utils/markdown/plugins/markdown-add-components.js +1 -0
- package/app/utils/markdown/plugins/markdown-default-plugins.js +1 -0
- package/docs/editors/markdown-editor/base-editor-demo/demo1.md +34 -0
- package/package.json +4 -17
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,27 @@
|
|
|
2
2
|
|
|
3
3
|
### Master
|
|
4
4
|
|
|
5
|
+
### 1.5.0
|
|
6
|
+
🚀 Enhancements
|
|
7
|
+
`@ember-eui/validated-form`
|
|
8
|
+
- Allow providing an markdown-editor componet for easier composability
|
|
9
|
+
|
|
10
|
+
### 1.4.0
|
|
11
|
+
🚀 Enhancements
|
|
12
|
+
- Easier extending of processing plugins, add demo
|
|
13
|
+
|
|
14
|
+
### 1.3.5
|
|
15
|
+
🐛 Bug / Fixes
|
|
16
|
+
- Urls for markdown editor icons
|
|
17
|
+
|
|
18
|
+
### 1.3.4
|
|
19
|
+
🐛 Bug / Fixes
|
|
20
|
+
- Fix docs related to ember-svg-jar and netlify demo
|
|
21
|
+
|
|
22
|
+
### 1.3.0 - 1.3.3
|
|
23
|
+
🐛 Bug / Fixes
|
|
24
|
+
- Ts bugs
|
|
25
|
+
|
|
5
26
|
### 1.3.0
|
|
6
27
|
🚀 Enhancements
|
|
7
28
|
`@ember-eui/core`
|
|
@@ -29,7 +29,7 @@ type IconColor = string | NamedColor;
|
|
|
29
29
|
|
|
30
30
|
export type IconSize = keyof typeof sizeToClassNameMap;
|
|
31
31
|
|
|
32
|
-
// const SVG_PREI : string | undefined = config['ember-eui'].
|
|
32
|
+
// const SVG_PREI : string | undefined = config['ember-eui'].svgPath || 'svg/assets';
|
|
33
33
|
|
|
34
34
|
export type EuiIconArgs = CommonArgs & {
|
|
35
35
|
/**
|
|
@@ -10,11 +10,11 @@ export default class EuiMarkdownEditorFooterComponent extends Component<EuiMarkd
|
|
|
10
10
|
|
|
11
11
|
get svgPath() {
|
|
12
12
|
const config = getOwner(this).resolveRegistration('config:environment');
|
|
13
|
-
const svgPath = config?.['@ember-eui/core']?.svgPath || 'svg';
|
|
13
|
+
const svgPath = config?.['@ember-eui/core']?.svgPath || 'svg/';
|
|
14
14
|
return svgPath;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
get markdownLogo() {
|
|
18
|
-
return `${this.svgPath}
|
|
18
|
+
return `${this.svgPath}markdown-logo`;
|
|
19
19
|
}
|
|
20
20
|
}
|
|
@@ -31,7 +31,7 @@ export default class EuiMarkdownEditorToolbarComponent extends Component<EuiMark
|
|
|
31
31
|
|
|
32
32
|
get svgPath() {
|
|
33
33
|
const config = getOwner(this).resolveRegistration('config:environment');
|
|
34
|
-
const svgPath = config?.['@ember-eui/core']?.svgPath || 'svg';
|
|
34
|
+
const svgPath = config?.['@ember-eui/core']?.svgPath || 'svg/';
|
|
35
35
|
return svgPath;
|
|
36
36
|
}
|
|
37
37
|
|
|
@@ -55,7 +55,7 @@ export default class EuiMarkdownEditorToolbarComponent extends Component<EuiMark
|
|
|
55
55
|
label: 'Task list',
|
|
56
56
|
name: 'tl',
|
|
57
57
|
useSvg: true,
|
|
58
|
-
iconType: `${this.svgPath}
|
|
58
|
+
iconType: `${this.svgPath}markdown-checkmark`
|
|
59
59
|
}
|
|
60
60
|
];
|
|
61
61
|
}
|
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
import Component from '@glimmer/component';
|
|
2
|
-
import type MarkdownActions from '../../utils/markdown/markdown-actions';
|
|
3
2
|
import {
|
|
4
3
|
defaultParsingPlugins,
|
|
5
4
|
defaultProcessingPlugins
|
|
6
5
|
} from '../../utils/markdown/plugins/markdown-default-plugins';
|
|
7
6
|
import { cached } from '@glimmer/tracking';
|
|
8
|
-
import unified from 'unified';
|
|
7
|
+
import unified, { Processor } from 'unified';
|
|
9
8
|
import { toDOM } from '../../utils/markdown/plugins/to-dom';
|
|
10
9
|
import type { RehypeNode } from '../../utils/markdown/markdown-types';
|
|
10
|
+
import type EuiMarkdownEditorComponent from '../eui-markdown-editor';
|
|
11
11
|
|
|
12
12
|
export interface EuiMarkdownEditorToolbarArgs {
|
|
13
13
|
parsingPluginList?: typeof defaultParsingPlugins;
|
|
14
14
|
processingPluginList?: typeof defaultProcessingPlugins;
|
|
15
|
-
|
|
16
|
-
markdownActions: MarkdownActions;
|
|
15
|
+
replaceNode?: EuiMarkdownEditorComponent['replaceNode'];
|
|
17
16
|
value: string;
|
|
18
17
|
}
|
|
19
18
|
|
|
@@ -28,7 +27,17 @@ export default class EuiMarkdownEditorToolbarComponent extends Component<EuiMark
|
|
|
28
27
|
|
|
29
28
|
@cached
|
|
30
29
|
get processor() {
|
|
31
|
-
|
|
30
|
+
const Compiler = (tree: any) => {
|
|
31
|
+
return tree;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
function identityCompiler(this: Processor) {
|
|
35
|
+
this.Compiler = Compiler;
|
|
36
|
+
}
|
|
37
|
+
return unified()
|
|
38
|
+
.use(this.parsingPluginList)
|
|
39
|
+
.use(this.processingPluginList)
|
|
40
|
+
.use(identityCompiler);
|
|
32
41
|
}
|
|
33
42
|
|
|
34
43
|
@cached
|
|
@@ -34,12 +34,6 @@ import {
|
|
|
34
34
|
Settings
|
|
35
35
|
} from 'unified';
|
|
36
36
|
import remark2Rehype from 'remark-rehype';
|
|
37
|
-
import { RehypeNode } from '../markdown-types';
|
|
38
|
-
// import * as MarkdownTooltip from './markdown_tooltip';
|
|
39
|
-
// import * as MarkdownCheckbox from './markdown_checkbox';
|
|
40
|
-
// import { markdownLinkValidator } from './markdown_link_validator';
|
|
41
|
-
// import { EuiLink } from '../../link';
|
|
42
|
-
// import { EuiCodeBlock, EuiCode } from '../../code';
|
|
43
37
|
import markdown from 'remark-parse';
|
|
44
38
|
import emoji from 'remark-emoji';
|
|
45
39
|
import all from 'mdast-util-to-hast/lib/all';
|
|
@@ -71,29 +65,12 @@ const unknownHandler: Handler = (h, node) => {
|
|
|
71
65
|
|
|
72
66
|
export const defaultParsingPlugins = getDefaultEuiMarkdownParsingPlugins();
|
|
73
67
|
|
|
74
|
-
class Compiler {
|
|
75
|
-
tree: RehypeNode | null = null;
|
|
76
|
-
constructor(tree: RehypeNode) {
|
|
77
|
-
this.tree = tree;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
compile() {
|
|
81
|
-
return this.tree;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
function compiler() {
|
|
86
|
-
//@ts-expect-error
|
|
87
|
-
this.Compiler = Compiler;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
68
|
export const getDefaultEuiMarkdownProcessingPlugins = (): [
|
|
91
69
|
[typeof remark2Rehype, Record<string, unknown>],
|
|
92
70
|
...PluggableList // any additional are generic
|
|
93
71
|
] => [
|
|
94
72
|
[remark2Rehype, { allowDangerousHtml: true, unknownHandler }],
|
|
95
|
-
[MarkdownAddComponents, {}]
|
|
96
|
-
[compiler]
|
|
73
|
+
[MarkdownAddComponents, {}]
|
|
97
74
|
];
|
|
98
75
|
|
|
99
76
|
export const defaultProcessingPlugins =
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@ember-eui/core/utils/markdown/plugins/markdown-add-components';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@ember-eui/core/utils/markdown/plugins/markdown-default-plugins';
|
|
@@ -8,6 +8,7 @@ order: 1
|
|
|
8
8
|
<EuiMarkdownEditor
|
|
9
9
|
@value={{this.value}}
|
|
10
10
|
@onChange={{set this 'value'}}
|
|
11
|
+
@processingPluginList={{this.processingPlugins}}
|
|
11
12
|
/>
|
|
12
13
|
```
|
|
13
14
|
|
|
@@ -15,8 +16,31 @@ order: 1
|
|
|
15
16
|
import Component from '@glimmer/component';
|
|
16
17
|
import { tracked } from '@glimmer/tracking';
|
|
17
18
|
import { action } from '@ember/object';
|
|
19
|
+
import { visit } from '@ember-eui/core/utils/markdown/plugins/markdown-add-components';
|
|
20
|
+
import { defaultProcessingPlugins } from '@ember-eui/core/utils/markdown/plugins/markdown-default-plugins';
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
/*
|
|
24
|
+
Quick example how you can extend plugins, this plugin adds _blank to `a` elements
|
|
25
|
+
*/
|
|
26
|
+
function TargetBlankProcessingPlugin() {
|
|
27
|
+
return (tree) => {
|
|
28
|
+
visit(tree, (node) => {
|
|
29
|
+
if (node.type === 'element' && node.tagName === 'a') {
|
|
30
|
+
node.properties.target = '_blank';
|
|
31
|
+
}
|
|
32
|
+
return node;
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const processingPlugins = [
|
|
38
|
+
...defaultProcessingPlugins,
|
|
39
|
+
[TargetBlankProcessingPlugin, {}]
|
|
40
|
+
];
|
|
18
41
|
|
|
19
42
|
export default class EuiMarkdownEditor1 extends Component {
|
|
43
|
+
processingPlugins = processingPlugins;
|
|
20
44
|
@tracked value = `## 👋 Hello there!
|
|
21
45
|
|
|
22
46
|
I'm a **EuiMarkdownEditor** with:
|
|
@@ -81,6 +105,16 @@ func main() {
|
|
|
81
105
|
|
|
82
106
|
\`\`\`
|
|
83
107
|
|
|
108
|
+
----
|
|
109
|
+
|
|
110
|
+
### You can also add tooltips if you want more explanation!
|
|
111
|
+
|
|
112
|
+
!{tooltip[You can also add tooltips](Some helpful description)}
|
|
113
|
+
|
|
114
|
+
### And links, check the demo source in how to tweak plugins!
|
|
115
|
+
|
|
116
|
+
[Access Google!](https://google.com)
|
|
117
|
+
|
|
84
118
|
`;
|
|
85
119
|
}
|
|
86
120
|
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ember-eui/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"description": "Ember Components for Elastic UI",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ember-addon",
|
|
@@ -77,9 +77,6 @@
|
|
|
77
77
|
"ember-style-modifier": "^0.6.0",
|
|
78
78
|
"ember-svg-jar": "https://github.com/betocantu93/ember-svg-jar.git#add-bundle-flag",
|
|
79
79
|
"ember-truth-helpers": "^2.1.0",
|
|
80
|
-
"resolve": "^1.13.1"
|
|
81
|
-
},
|
|
82
|
-
"peerDependencies": {
|
|
83
80
|
"highlight.js": "^9.18.5",
|
|
84
81
|
"lodash-es": "^4.17.21",
|
|
85
82
|
"mdast-util-to-hast": "^10.0.0",
|
|
@@ -90,6 +87,7 @@
|
|
|
90
87
|
"remark-highlight.js": "^6.0.0",
|
|
91
88
|
"remark-parse": "^8.0.3",
|
|
92
89
|
"remark-rehype": "^8.0.0",
|
|
90
|
+
"resolve": "^1.13.1",
|
|
93
91
|
"tabbable": "^5.1.5",
|
|
94
92
|
"unified": "^9.2.0",
|
|
95
93
|
"vfile": "^4.2.0"
|
|
@@ -133,24 +131,13 @@
|
|
|
133
131
|
"eslint-plugin-ember": "^8.9.1",
|
|
134
132
|
"eslint-plugin-node": "^11.1.0",
|
|
135
133
|
"eslint-plugin-prettier": "^3.3.1",
|
|
136
|
-
"highlight.js": "^9.18.5",
|
|
137
134
|
"loader.js": "^4.7.0",
|
|
138
135
|
"lodash-es": "^4.17.21",
|
|
139
136
|
"mdast-util-to-hast": "^10.0.0",
|
|
140
137
|
"npm-run-all": "^4.1.5",
|
|
141
138
|
"prettier": "^2.2.1",
|
|
142
139
|
"qunit-dom": "^1.2.0",
|
|
143
|
-
"
|
|
144
|
-
"rehype-stringify": "^8.0.0",
|
|
145
|
-
"remark-breaks": "^3.0.2",
|
|
146
|
-
"remark-emoji": "^2.1.0",
|
|
147
|
-
"remark-highlight.js": "^6.0.0",
|
|
148
|
-
"remark-parse": "^8.0.3",
|
|
149
|
-
"remark-rehype": "^8.0.0",
|
|
150
|
-
"tabbable": "^5.1.5",
|
|
151
|
-
"typescript": "^4.0.3",
|
|
152
|
-
"unified": "^9.2.0",
|
|
153
|
-
"vfile": "^4.2.0"
|
|
140
|
+
"typescript": "^4.0.3"
|
|
154
141
|
},
|
|
155
142
|
"publishConfig": {
|
|
156
143
|
"access": "public"
|
|
@@ -167,5 +154,5 @@
|
|
|
167
154
|
"volta": {
|
|
168
155
|
"node": "12.22.1"
|
|
169
156
|
},
|
|
170
|
-
"gitHead": "
|
|
157
|
+
"gitHead": "51aac7b1e346dcd59cf60693be8df778c9020237"
|
|
171
158
|
}
|