@exmg/exm-markdown-editor 1.1.36 → 1.2.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.
Files changed (39) hide show
  1. package/.rollup.cache/root/repo/packages/exm-markdown-editor/dist/actions.d.ts +6 -0
  2. package/.rollup.cache/root/repo/packages/exm-markdown-editor/dist/actions.js +227 -0
  3. package/.rollup.cache/root/repo/packages/exm-markdown-editor/dist/exm-markdown-editor-base.d.ts +89 -0
  4. package/.rollup.cache/root/repo/packages/exm-markdown-editor/dist/exm-markdown-editor-base.js +334 -0
  5. package/.rollup.cache/root/repo/packages/exm-markdown-editor/dist/exm-markdown-editor-toolbar-base.d.ts +12 -0
  6. package/.rollup.cache/root/repo/packages/exm-markdown-editor/dist/exm-markdown-editor-toolbar-base.js +52 -0
  7. package/.rollup.cache/root/repo/packages/exm-markdown-editor/dist/exm-markdown-editor-toolbar.d.ts +9 -0
  8. package/.rollup.cache/root/repo/packages/exm-markdown-editor/dist/exm-markdown-editor-toolbar.js +12 -0
  9. package/.rollup.cache/root/repo/packages/exm-markdown-editor/dist/exm-markdown-editor.d.ts +76 -0
  10. package/.rollup.cache/root/repo/packages/exm-markdown-editor/dist/exm-markdown-editor.js +83 -0
  11. package/.rollup.cache/root/repo/packages/exm-markdown-editor/dist/icons.d.ts +3 -0
  12. package/.rollup.cache/root/repo/packages/exm-markdown-editor/dist/icons.js +5 -0
  13. package/.rollup.cache/root/repo/packages/exm-markdown-editor/dist/index.d.ts +6 -0
  14. package/.rollup.cache/root/repo/packages/exm-markdown-editor/dist/index.js +6 -0
  15. package/.rollup.cache/root/repo/packages/exm-markdown-editor/dist/styles/exm-markdown-codemirror-css.d.ts +1 -0
  16. package/.rollup.cache/root/repo/packages/exm-markdown-editor/dist/styles/exm-markdown-codemirror-css.js +491 -0
  17. package/.rollup.cache/root/repo/packages/exm-markdown-editor/dist/styles/exm-markdown-editor-css.d.ts +1 -0
  18. package/.rollup.cache/root/repo/packages/exm-markdown-editor/dist/styles/exm-markdown-editor-css.js +210 -0
  19. package/.rollup.cache/root/repo/packages/exm-markdown-editor/dist/styles/exm-markdown-editor-toolbar-css.d.ts +1 -0
  20. package/.rollup.cache/root/repo/packages/exm-markdown-editor/dist/styles/exm-markdown-editor-toolbar-css.js +22 -0
  21. package/.rollup.cache/root/repo/packages/exm-markdown-editor/dist/types.d.ts +13 -0
  22. package/.rollup.cache/root/repo/packages/exm-markdown-editor/dist/utils/configurations.d.ts +4 -0
  23. package/.rollup.cache/root/repo/packages/exm-markdown-editor/dist/utils/configurations.js +14 -0
  24. package/.rollup.cache/root/repo/packages/exm-markdown-editor/dist/validator/exm-markdown-editor-validator.d.ts +23 -0
  25. package/.rollup.cache/root/repo/packages/exm-markdown-editor/dist/validator/exm-markdown-editor-validator.js +35 -0
  26. package/dist/actions.js +5 -3
  27. package/dist/exm-markdown-editor-base.js +11 -8
  28. package/dist/exm-markdown-editor-toolbar-base.js +6 -3
  29. package/dist/exm-markdown-editor-toolbar.js +6 -4
  30. package/dist/exm-markdown-editor.js +7 -5
  31. package/dist/icons.js +5 -2
  32. package/dist/index.js +3 -4
  33. package/dist/styles/exm-markdown-codemirror-css.js +5 -2
  34. package/dist/styles/exm-markdown-editor-css.js +5 -2
  35. package/dist/styles/exm-markdown-editor-toolbar-css.js +5 -2
  36. package/dist/utils/configurations.js +5 -3
  37. package/dist/validator/exm-markdown-editor-validator.js +6 -3
  38. package/package.json +2 -2
  39. /package/{dist → .rollup.cache/root/repo/packages/exm-markdown-editor/dist}/types.js +0 -0
@@ -0,0 +1,52 @@
1
+ import { __decorate } from "tslib";
2
+ import { html } from 'lit';
3
+ import { toolbarActions } from './actions.js';
4
+ import { toolbarIcons } from './icons.js';
5
+ import { ExmgElement } from '@exmg/lit-base/index.js';
6
+ import { property } from 'lit/decorators.js';
7
+ import '@material/web/iconbutton/icon-button.js';
8
+ import '@material/web/icon/icon.js';
9
+ export class MarkdownEditorToolbarBase extends ExmgElement {
10
+ constructor() {
11
+ super(...arguments);
12
+ this.upload = false;
13
+ this.actions = toolbarActions;
14
+ this.icons = toolbarIcons;
15
+ }
16
+ renderActionButtons() {
17
+ const buttons = this.actions.map((button) => {
18
+ const displayedName = button.name.replace('_', '').toLocaleUpperCase();
19
+ return html ` <md-icon-button
20
+ aria-label=${displayedName}
21
+ title=${displayedName}
22
+ @click=${(e) => {
23
+ e.preventDefault();
24
+ this.action(button.name);
25
+ }}
26
+ >
27
+ <md-icon> ${this.icons[button.icon] ? this.icons[button.icon] : button.icon} </md-icon>
28
+ </md-icon-button>`;
29
+ });
30
+ return buttons;
31
+ }
32
+ action(action) {
33
+ if (action === 'image' && this.upload) {
34
+ this.fire('insert-image', undefined, true);
35
+ return;
36
+ }
37
+ this.fire('action', action, true);
38
+ }
39
+ render() {
40
+ return html ` <div class="toolbar-container">${this.renderActionButtons()}</div> `;
41
+ }
42
+ }
43
+ __decorate([
44
+ property({ type: Boolean })
45
+ ], MarkdownEditorToolbarBase.prototype, "upload", void 0);
46
+ __decorate([
47
+ property({ type: Array })
48
+ ], MarkdownEditorToolbarBase.prototype, "actions", void 0);
49
+ __decorate([
50
+ property({ type: Object })
51
+ ], MarkdownEditorToolbarBase.prototype, "icons", void 0);
52
+ //# sourceMappingURL=exm-markdown-editor-toolbar-base.js.map
@@ -0,0 +1,9 @@
1
+ import { MarkdownEditorToolbarBase } from './exm-markdown-editor-toolbar-base.js';
2
+ export declare class MarkdownEditorToolbar extends MarkdownEditorToolbarBase {
3
+ static styles: import("lit").CSSResult[];
4
+ }
5
+ declare global {
6
+ interface HTMLElementTagNameMap {
7
+ 'exm-markdown-editor-toolbar': MarkdownEditorToolbar;
8
+ }
9
+ }
@@ -0,0 +1,12 @@
1
+ import { __decorate } from "tslib";
2
+ import { customElement } from 'lit/decorators.js';
3
+ import { MarkdownEditorToolbarBase } from './exm-markdown-editor-toolbar-base.js';
4
+ import { style as toolbarStyles } from './styles/exm-markdown-editor-toolbar-css.js';
5
+ let MarkdownEditorToolbar = class MarkdownEditorToolbar extends MarkdownEditorToolbarBase {
6
+ };
7
+ MarkdownEditorToolbar.styles = [toolbarStyles];
8
+ MarkdownEditorToolbar = __decorate([
9
+ customElement('exm-markdown-editor-toolbar')
10
+ ], MarkdownEditorToolbar);
11
+ export { MarkdownEditorToolbar };
12
+ //# sourceMappingURL=exm-markdown-editor-toolbar.js.map
@@ -0,0 +1,76 @@
1
+ import { MarkdownEditorElementBase } from './exm-markdown-editor-base.js';
2
+ /**
3
+ * Markdown WYSIWYG editor element.
4
+ * This editor element is a wrapper element for the markdown-element which will enable editing
5
+ * the markdown data. See [marked-element](https://www.webcomponents.org/element/PolymerElements/marked-element/)
6
+ * for more details on how to use this element.
7
+ *
8
+ * ```
9
+ * <exm-markdown-editor markdown="# Header 1"></exm-markdown-editor>
10
+ * ```
11
+ *
12
+ * ## Custom Toolbar
13
+ * Add attribute toolbar-buttons to adjust the toolbar buttons. The array values should match
14
+ * the _toolbarButtons item name values.
15
+ *
16
+ * ```html
17
+ * <exm-markdown-editor toolbar-buttons='["strong","italic","strikethrough","|","quote","hr","table"]'></exm-markdown-editor>
18
+ * ```
19
+ *
20
+ * ### Styling
21
+ *
22
+ * The preview panel markdown output can be styled from outside th element. See the demo/styling.html example
23
+ * on how to do this. In this demo the github-markdown-css project is used for styling the html output.
24
+ *
25
+ * The HTML output will we inserted into the element slot and will have a container div arround it
26
+ * with the class preview-html:
27
+ *
28
+ * ```
29
+ * <exm-markdown-editor markdown="# Header 1">
30
+ * <div class="preview-body"><h1>Header 1</h1></div>
31
+ * </exm-markdown-editor>
32
+ * ```
33
+ *
34
+ * `<exm-markdown-editor>` provides the following custom properties and mixins
35
+ * for styling:
36
+ *
37
+ * Custom property | Description | Default
38
+ * ----------------|-------------|----------
39
+ * `--exm-markdown-editor-border` | Border Color | `#ddd`
40
+ * `--exm-markdown-editor-background-color` | Editor Background Color | `white`
41
+ * `--exm-markdown-editor-fullscreen-top-offset` | Top offset in fullscreen mode | `0px`
42
+ * `--exm-markdown-editor-toolbar-background` | Toolbar background color | `#fafafa`
43
+ * `--exm-markdown-editor-toolbar-label-background` | Toolbar label background color | `#fafafa`
44
+ * `--exm-markdown-editor-label-color` | Toolbar text color | `54% black`
45
+ * `--exm-markdown-editor-toolbar-color` | Toolbar text color | `87% black`
46
+ * `--exm-markdown-editor-toolbar-color-disabled` | Toolbar text color disabled | `54% black`
47
+ * `--exm-markdown-editor-preview-background` | Preview background color | `white`
48
+ * `--exm-markdown-editor-toolbar-button-background-hover` | Toolbar icon border color | `#fafafa`
49
+ * `--exm-markdown-editor-toolbar-seperator-color` | Toolbar seperator color | `#ddd`
50
+ * `--exm-markdown-editor-code-hover` | Editor code part hover background color | `white`
51
+ * `--exm-markdown-editor-code-color` | Editor code color | `black`
52
+ * `--exm-markdown-editor-code-background` | Editor code background | `white`
53
+ *
54
+ * # Events:
55
+ * - value-change - where detail is current markdown value
56
+ * - exm-markdown-editor-fullscreen where detail is boolean with current fullscreen state
57
+ * - exm-markdown-editor-paste-table thrown when app should display a dialog to paste Excel Table
58
+ * - exm-markdown-editor-image-open when image-ext button is clicked. Can be used to insert external images
59
+ *
60
+ * @customElement
61
+ * @group Exmg Core Elements
62
+ * @element exm-markdown-editor
63
+ * @demo demo/index.html
64
+ * @memberof Exmg
65
+ * @extends ExmgElement
66
+ * @summary Markdown editor element
67
+ */
68
+ export declare class MarkdownEditorElement extends MarkdownEditorElementBase {
69
+ static styles: import("lit").CSSResult[];
70
+ getPreviewElement(): Element | null;
71
+ }
72
+ declare global {
73
+ interface HTMLElementTagNameMap {
74
+ 'exm-markdown-editor': MarkdownEditorElement;
75
+ }
76
+ }
@@ -0,0 +1,83 @@
1
+ import { __decorate } from "tslib";
2
+ import { customElement } from 'lit/decorators.js';
3
+ import { MarkdownEditorElementBase } from './exm-markdown-editor-base.js';
4
+ import { style as codeMirrorStyles } from './styles/exm-markdown-codemirror-css.js';
5
+ import { style as markdownEditorStyles } from './styles/exm-markdown-editor-css.js';
6
+ /**
7
+ * Markdown WYSIWYG editor element.
8
+ * This editor element is a wrapper element for the markdown-element which will enable editing
9
+ * the markdown data. See [marked-element](https://www.webcomponents.org/element/PolymerElements/marked-element/)
10
+ * for more details on how to use this element.
11
+ *
12
+ * ```
13
+ * <exm-markdown-editor markdown="# Header 1"></exm-markdown-editor>
14
+ * ```
15
+ *
16
+ * ## Custom Toolbar
17
+ * Add attribute toolbar-buttons to adjust the toolbar buttons. The array values should match
18
+ * the _toolbarButtons item name values.
19
+ *
20
+ * ```html
21
+ * <exm-markdown-editor toolbar-buttons='["strong","italic","strikethrough","|","quote","hr","table"]'></exm-markdown-editor>
22
+ * ```
23
+ *
24
+ * ### Styling
25
+ *
26
+ * The preview panel markdown output can be styled from outside th element. See the demo/styling.html example
27
+ * on how to do this. In this demo the github-markdown-css project is used for styling the html output.
28
+ *
29
+ * The HTML output will we inserted into the element slot and will have a container div arround it
30
+ * with the class preview-html:
31
+ *
32
+ * ```
33
+ * <exm-markdown-editor markdown="# Header 1">
34
+ * <div class="preview-body"><h1>Header 1</h1></div>
35
+ * </exm-markdown-editor>
36
+ * ```
37
+ *
38
+ * `<exm-markdown-editor>` provides the following custom properties and mixins
39
+ * for styling:
40
+ *
41
+ * Custom property | Description | Default
42
+ * ----------------|-------------|----------
43
+ * `--exm-markdown-editor-border` | Border Color | `#ddd`
44
+ * `--exm-markdown-editor-background-color` | Editor Background Color | `white`
45
+ * `--exm-markdown-editor-fullscreen-top-offset` | Top offset in fullscreen mode | `0px`
46
+ * `--exm-markdown-editor-toolbar-background` | Toolbar background color | `#fafafa`
47
+ * `--exm-markdown-editor-toolbar-label-background` | Toolbar label background color | `#fafafa`
48
+ * `--exm-markdown-editor-label-color` | Toolbar text color | `54% black`
49
+ * `--exm-markdown-editor-toolbar-color` | Toolbar text color | `87% black`
50
+ * `--exm-markdown-editor-toolbar-color-disabled` | Toolbar text color disabled | `54% black`
51
+ * `--exm-markdown-editor-preview-background` | Preview background color | `white`
52
+ * `--exm-markdown-editor-toolbar-button-background-hover` | Toolbar icon border color | `#fafafa`
53
+ * `--exm-markdown-editor-toolbar-seperator-color` | Toolbar seperator color | `#ddd`
54
+ * `--exm-markdown-editor-code-hover` | Editor code part hover background color | `white`
55
+ * `--exm-markdown-editor-code-color` | Editor code color | `black`
56
+ * `--exm-markdown-editor-code-background` | Editor code background | `white`
57
+ *
58
+ * # Events:
59
+ * - value-change - where detail is current markdown value
60
+ * - exm-markdown-editor-fullscreen where detail is boolean with current fullscreen state
61
+ * - exm-markdown-editor-paste-table thrown when app should display a dialog to paste Excel Table
62
+ * - exm-markdown-editor-image-open when image-ext button is clicked. Can be used to insert external images
63
+ *
64
+ * @customElement
65
+ * @group Exmg Core Elements
66
+ * @element exm-markdown-editor
67
+ * @demo demo/index.html
68
+ * @memberof Exmg
69
+ * @extends ExmgElement
70
+ * @summary Markdown editor element
71
+ */
72
+ let MarkdownEditorElement = class MarkdownEditorElement extends MarkdownEditorElementBase {
73
+ getPreviewElement() {
74
+ const slot = this.querySelector('*[slot=preview]');
75
+ return slot ? slot : this.shadowRoot.querySelector('#preview');
76
+ }
77
+ };
78
+ MarkdownEditorElement.styles = [markdownEditorStyles, codeMirrorStyles];
79
+ MarkdownEditorElement = __decorate([
80
+ customElement('exm-markdown-editor')
81
+ ], MarkdownEditorElement);
82
+ export { MarkdownEditorElement };
83
+ //# sourceMappingURL=exm-markdown-editor.js.map
@@ -0,0 +1,3 @@
1
+ export declare const toolbarIcons: {
2
+ example_icon: import("lit-html").TemplateResult<1>;
3
+ };
@@ -0,0 +1,5 @@
1
+ import { html } from 'lit';
2
+ export const toolbarIcons = {
3
+ example_icon: html `Some svg here`,
4
+ };
5
+ //# sourceMappingURL=icons.js.map
@@ -0,0 +1,6 @@
1
+ import { MarkdownEditorElement } from './exm-markdown-editor.js';
2
+ import { MarkdownEditorToolbar } from './exm-markdown-editor-toolbar.js';
3
+ import { ToolbarItem, ToolbarIcons, MarkdownActions } from './types.js';
4
+ export { MarkdownEditorElement, MarkdownEditorToolbar, ToolbarItem, ToolbarIcons, MarkdownActions };
5
+ export { markedConfiguration } from './utils/configurations.js';
6
+ export { markdownActions, toolbarActions } from './actions.js';
@@ -0,0 +1,6 @@
1
+ import { MarkdownEditorElement } from './exm-markdown-editor.js';
2
+ import { MarkdownEditorToolbar } from './exm-markdown-editor-toolbar.js';
3
+ export { MarkdownEditorElement, MarkdownEditorToolbar };
4
+ export { markedConfiguration } from './utils/configurations.js';
5
+ export { markdownActions, toolbarActions } from './actions.js';
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ export declare const style: import("lit").CSSResult;