@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.
- package/.rollup.cache/root/repo/packages/exm-markdown-editor/dist/actions.d.ts +6 -0
- package/.rollup.cache/root/repo/packages/exm-markdown-editor/dist/actions.js +227 -0
- package/.rollup.cache/root/repo/packages/exm-markdown-editor/dist/exm-markdown-editor-base.d.ts +89 -0
- package/.rollup.cache/root/repo/packages/exm-markdown-editor/dist/exm-markdown-editor-base.js +334 -0
- package/.rollup.cache/root/repo/packages/exm-markdown-editor/dist/exm-markdown-editor-toolbar-base.d.ts +12 -0
- package/.rollup.cache/root/repo/packages/exm-markdown-editor/dist/exm-markdown-editor-toolbar-base.js +52 -0
- package/.rollup.cache/root/repo/packages/exm-markdown-editor/dist/exm-markdown-editor-toolbar.d.ts +9 -0
- package/.rollup.cache/root/repo/packages/exm-markdown-editor/dist/exm-markdown-editor-toolbar.js +12 -0
- package/.rollup.cache/root/repo/packages/exm-markdown-editor/dist/exm-markdown-editor.d.ts +76 -0
- package/.rollup.cache/root/repo/packages/exm-markdown-editor/dist/exm-markdown-editor.js +83 -0
- package/.rollup.cache/root/repo/packages/exm-markdown-editor/dist/icons.d.ts +3 -0
- package/.rollup.cache/root/repo/packages/exm-markdown-editor/dist/icons.js +5 -0
- package/.rollup.cache/root/repo/packages/exm-markdown-editor/dist/index.d.ts +6 -0
- package/.rollup.cache/root/repo/packages/exm-markdown-editor/dist/index.js +6 -0
- package/.rollup.cache/root/repo/packages/exm-markdown-editor/dist/styles/exm-markdown-codemirror-css.d.ts +1 -0
- package/.rollup.cache/root/repo/packages/exm-markdown-editor/dist/styles/exm-markdown-codemirror-css.js +491 -0
- package/.rollup.cache/root/repo/packages/exm-markdown-editor/dist/styles/exm-markdown-editor-css.d.ts +1 -0
- package/.rollup.cache/root/repo/packages/exm-markdown-editor/dist/styles/exm-markdown-editor-css.js +210 -0
- package/.rollup.cache/root/repo/packages/exm-markdown-editor/dist/styles/exm-markdown-editor-toolbar-css.d.ts +1 -0
- package/.rollup.cache/root/repo/packages/exm-markdown-editor/dist/styles/exm-markdown-editor-toolbar-css.js +22 -0
- package/.rollup.cache/root/repo/packages/exm-markdown-editor/dist/types.d.ts +13 -0
- package/.rollup.cache/root/repo/packages/exm-markdown-editor/dist/utils/configurations.d.ts +4 -0
- package/.rollup.cache/root/repo/packages/exm-markdown-editor/dist/utils/configurations.js +14 -0
- package/.rollup.cache/root/repo/packages/exm-markdown-editor/dist/validator/exm-markdown-editor-validator.d.ts +23 -0
- package/.rollup.cache/root/repo/packages/exm-markdown-editor/dist/validator/exm-markdown-editor-validator.js +35 -0
- package/dist/actions.js +5 -3
- package/dist/exm-markdown-editor-base.js +11 -8
- package/dist/exm-markdown-editor-toolbar-base.js +6 -3
- package/dist/exm-markdown-editor-toolbar.js +6 -4
- package/dist/exm-markdown-editor.js +7 -5
- package/dist/icons.js +5 -2
- package/dist/index.js +3 -4
- package/dist/styles/exm-markdown-codemirror-css.js +5 -2
- package/dist/styles/exm-markdown-editor-css.js +5 -2
- package/dist/styles/exm-markdown-editor-toolbar-css.js +5 -2
- package/dist/utils/configurations.js +5 -3
- package/dist/validator/exm-markdown-editor-validator.js +6 -3
- package/package.json +2 -2
- /package/{dist → .rollup.cache/root/repo/packages/exm-markdown-editor/dist}/types.js +0 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { HTMLTemplateResult } from 'lit';
|
|
2
|
+
/** Toolbar Types */
|
|
3
|
+
export type ToolbarItem = {
|
|
4
|
+
name: string;
|
|
5
|
+
icon: string;
|
|
6
|
+
};
|
|
7
|
+
export type ToolbarIcons = {
|
|
8
|
+
[k: string]: HTMLTemplateResult;
|
|
9
|
+
};
|
|
10
|
+
/** Editor Types */
|
|
11
|
+
export type MarkdownActions = {
|
|
12
|
+
[key: string]: Function;
|
|
13
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export const defaultConfiguration = {
|
|
2
|
+
mode: 'markdown',
|
|
3
|
+
tabSize: 2,
|
|
4
|
+
indentUnit: 2,
|
|
5
|
+
indentWithTabs: true,
|
|
6
|
+
lineNumbers: false,
|
|
7
|
+
autofocus: false,
|
|
8
|
+
lineWrapping: true,
|
|
9
|
+
};
|
|
10
|
+
export const markedConfiguration = {
|
|
11
|
+
breaks: false,
|
|
12
|
+
pedantic: false,
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=configurations.js.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2023 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { Validator } from '@material/web/labs/behaviors/validators/validator.js';
|
|
7
|
+
export interface MarkdownEditorState {
|
|
8
|
+
/**
|
|
9
|
+
* Whether the checkbox is required.
|
|
10
|
+
*/
|
|
11
|
+
readonly required: boolean;
|
|
12
|
+
readonly value: string;
|
|
13
|
+
readonly internalElement?: HTMLInputElement;
|
|
14
|
+
}
|
|
15
|
+
export declare class MardownEditorValidator extends Validator<MarkdownEditorState> {
|
|
16
|
+
private inputElement?;
|
|
17
|
+
protected computeValidity(state: MarkdownEditorState): {
|
|
18
|
+
validity: ValidityState;
|
|
19
|
+
validationMessage: string;
|
|
20
|
+
};
|
|
21
|
+
protected equals(prevState: MarkdownEditorState, state: MarkdownEditorState): boolean;
|
|
22
|
+
protected copy(state: MarkdownEditorState): MarkdownEditorState;
|
|
23
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2023 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { Validator } from '@material/web/labs/behaviors/validators/validator.js';
|
|
7
|
+
export class MardownEditorValidator extends Validator {
|
|
8
|
+
computeValidity(state) {
|
|
9
|
+
var _a;
|
|
10
|
+
if (!this.inputElement) {
|
|
11
|
+
this.inputElement = state.internalElement;
|
|
12
|
+
}
|
|
13
|
+
if (!this.inputElement) {
|
|
14
|
+
// Lazily create the input element if not existing
|
|
15
|
+
this.inputElement = document.createElement('input');
|
|
16
|
+
this.inputElement.type = 'text';
|
|
17
|
+
}
|
|
18
|
+
// Set values to the input element
|
|
19
|
+
this.inputElement.value = (_a = state.value) !== null && _a !== void 0 ? _a : '';
|
|
20
|
+
this.inputElement.required = state.required;
|
|
21
|
+
return {
|
|
22
|
+
validity: this.inputElement.validity,
|
|
23
|
+
validationMessage: this.inputElement.validationMessage,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
equals(prevState, state) {
|
|
27
|
+
return prevState.value === state.value && prevState.required === state.required;
|
|
28
|
+
}
|
|
29
|
+
copy(state) {
|
|
30
|
+
return {
|
|
31
|
+
...state,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=exm-markdown-editor-validator.js.map
|
package/dist/actions.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
const toolbarActions = [
|
|
2
2
|
{
|
|
3
3
|
name: 'undo',
|
|
4
4
|
icon: 'undo',
|
|
@@ -64,7 +64,7 @@ export const toolbarActions = [
|
|
|
64
64
|
icon: 'table_chart',
|
|
65
65
|
},
|
|
66
66
|
];
|
|
67
|
-
|
|
67
|
+
const markdownActions = {
|
|
68
68
|
undo: (editor) => {
|
|
69
69
|
editor.getDoc().undo();
|
|
70
70
|
editor.focus();
|
|
@@ -224,4 +224,6 @@ const processText = (text, regex, symbol) => {
|
|
|
224
224
|
}
|
|
225
225
|
return text.trim();
|
|
226
226
|
};
|
|
227
|
-
|
|
227
|
+
|
|
228
|
+
export { markdownActions, toolbarActions };
|
|
229
|
+
//# sourceMappingURL=actions.js.map
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import { __decorate } from
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { __decorate } from 'tslib';
|
|
2
|
+
import { nothing, html } from 'lit';
|
|
3
|
+
import { property, query, state } from 'lit/decorators.js';
|
|
4
4
|
import { defaultConfiguration } from './utils/configurations.js';
|
|
5
5
|
import { ExmgElement, observer } from '@exmg/lit-base';
|
|
6
|
-
import {
|
|
6
|
+
import { toolbarActions, markdownActions } from './actions.js';
|
|
7
7
|
import { marked } from 'marked';
|
|
8
8
|
import { mixinElementInternals } from '@material/web/labs/behaviors/element-internals.js';
|
|
9
|
-
import {
|
|
9
|
+
import { mixinFormAssociated, getFormValue } from '@material/web/labs/behaviors/form-associated.js';
|
|
10
10
|
import { toolbarIcons } from './icons.js';
|
|
11
11
|
import { MardownEditorValidator } from './validator/exm-markdown-editor-validator.js';
|
|
12
|
-
import { createValidator, getValidityAnchor
|
|
12
|
+
import { mixinConstraintValidation, createValidator, getValidityAnchor } from '@material/web/labs/behaviors/constraint-validation.js';
|
|
13
13
|
import './exm-markdown-editor-toolbar.js';
|
|
14
14
|
import { classMap } from 'lit/directives/class-map.js';
|
|
15
|
+
|
|
15
16
|
const MarkdownBaseClass = mixinConstraintValidation(mixinFormAssociated(mixinElementInternals(ExmgElement)));
|
|
16
17
|
/**
|
|
17
18
|
* Markdown editor element.
|
|
@@ -44,7 +45,7 @@ const MarkdownBaseClass = mixinConstraintValidation(mixinFormAssociated(mixinEle
|
|
|
44
45
|
* @extends ExmgElement
|
|
45
46
|
* @summary Markdown editor element
|
|
46
47
|
*/
|
|
47
|
-
|
|
48
|
+
class MarkdownEditorElementBase extends MarkdownBaseClass {
|
|
48
49
|
constructor() {
|
|
49
50
|
super(...arguments);
|
|
50
51
|
this.value = '';
|
|
@@ -331,4 +332,6 @@ __decorate([
|
|
|
331
332
|
}
|
|
332
333
|
})
|
|
333
334
|
], MarkdownEditorElementBase.prototype, "preview", void 0);
|
|
334
|
-
|
|
335
|
+
|
|
336
|
+
export { MarkdownEditorElementBase };
|
|
337
|
+
//# sourceMappingURL=exm-markdown-editor-base.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __decorate } from
|
|
1
|
+
import { __decorate } from 'tslib';
|
|
2
2
|
import { html } from 'lit';
|
|
3
3
|
import { toolbarActions } from './actions.js';
|
|
4
4
|
import { toolbarIcons } from './icons.js';
|
|
@@ -6,7 +6,8 @@ import { ExmgElement } from '@exmg/lit-base/index.js';
|
|
|
6
6
|
import { property } from 'lit/decorators.js';
|
|
7
7
|
import '@material/web/iconbutton/icon-button.js';
|
|
8
8
|
import '@material/web/icon/icon.js';
|
|
9
|
-
|
|
9
|
+
|
|
10
|
+
class MarkdownEditorToolbarBase extends ExmgElement {
|
|
10
11
|
constructor() {
|
|
11
12
|
super(...arguments);
|
|
12
13
|
this.upload = false;
|
|
@@ -49,4 +50,6 @@ __decorate([
|
|
|
49
50
|
__decorate([
|
|
50
51
|
property({ type: Object })
|
|
51
52
|
], MarkdownEditorToolbarBase.prototype, "icons", void 0);
|
|
52
|
-
|
|
53
|
+
|
|
54
|
+
export { MarkdownEditorToolbarBase };
|
|
55
|
+
//# sourceMappingURL=exm-markdown-editor-toolbar-base.js.map
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import { __decorate } from
|
|
1
|
+
import { __decorate } from 'tslib';
|
|
2
2
|
import { customElement } from 'lit/decorators.js';
|
|
3
3
|
import { MarkdownEditorToolbarBase } from './exm-markdown-editor-toolbar-base.js';
|
|
4
|
-
import { style
|
|
4
|
+
import { style } from './styles/exm-markdown-editor-toolbar-css.js';
|
|
5
|
+
|
|
5
6
|
let MarkdownEditorToolbar = class MarkdownEditorToolbar extends MarkdownEditorToolbarBase {
|
|
6
7
|
};
|
|
7
|
-
MarkdownEditorToolbar.styles = [
|
|
8
|
+
MarkdownEditorToolbar.styles = [style];
|
|
8
9
|
MarkdownEditorToolbar = __decorate([
|
|
9
10
|
customElement('exm-markdown-editor-toolbar')
|
|
10
11
|
], MarkdownEditorToolbar);
|
|
12
|
+
|
|
11
13
|
export { MarkdownEditorToolbar };
|
|
12
|
-
//# sourceMappingURL=exm-markdown-editor-toolbar.js.map
|
|
14
|
+
//# sourceMappingURL=exm-markdown-editor-toolbar.js.map
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { __decorate } from
|
|
1
|
+
import { __decorate } from 'tslib';
|
|
2
2
|
import { customElement } from 'lit/decorators.js';
|
|
3
3
|
import { MarkdownEditorElementBase } from './exm-markdown-editor-base.js';
|
|
4
|
-
import { style as
|
|
5
|
-
import { style
|
|
4
|
+
import { style as style$1 } from './styles/exm-markdown-codemirror-css.js';
|
|
5
|
+
import { style } from './styles/exm-markdown-editor-css.js';
|
|
6
|
+
|
|
6
7
|
/**
|
|
7
8
|
* Markdown WYSIWYG editor element.
|
|
8
9
|
* This editor element is a wrapper element for the markdown-element which will enable editing
|
|
@@ -75,9 +76,10 @@ let MarkdownEditorElement = class MarkdownEditorElement extends MarkdownEditorEl
|
|
|
75
76
|
return slot ? slot : this.shadowRoot.querySelector('#preview');
|
|
76
77
|
}
|
|
77
78
|
};
|
|
78
|
-
MarkdownEditorElement.styles = [
|
|
79
|
+
MarkdownEditorElement.styles = [style, style$1];
|
|
79
80
|
MarkdownEditorElement = __decorate([
|
|
80
81
|
customElement('exm-markdown-editor')
|
|
81
82
|
], MarkdownEditorElement);
|
|
83
|
+
|
|
82
84
|
export { MarkdownEditorElement };
|
|
83
|
-
//# sourceMappingURL=exm-markdown-editor.js.map
|
|
85
|
+
//# sourceMappingURL=exm-markdown-editor.js.map
|
package/dist/icons.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export { MarkdownEditorElement, MarkdownEditorToolbar };
|
|
1
|
+
export { MarkdownEditorElement } from './exm-markdown-editor.js';
|
|
2
|
+
export { MarkdownEditorToolbar } from './exm-markdown-editor-toolbar.js';
|
|
4
3
|
export { markedConfiguration } from './utils/configurations.js';
|
|
5
4
|
export { markdownActions, toolbarActions } from './actions.js';
|
|
6
|
-
//# sourceMappingURL=index.js.map
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
const style = css `
|
|
3
4
|
.CodeMirror {
|
|
4
5
|
--editor-code-color: var(--exm-markdown-editor-code-color, var(--md-sys-color-on-surface));
|
|
5
6
|
--editor-code-cursor-color: var(--exm-markdown-editor-code-cursor-color, var(--md-sys-color-on-surface));
|
|
@@ -488,4 +489,6 @@ export const style = css `
|
|
|
488
489
|
background: none;
|
|
489
490
|
}
|
|
490
491
|
`;
|
|
491
|
-
|
|
492
|
+
|
|
493
|
+
export { style };
|
|
494
|
+
//# sourceMappingURL=exm-markdown-codemirror-css.js.map
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
const style = css `
|
|
3
4
|
:host {
|
|
4
5
|
display: block;
|
|
5
6
|
overflow: hidden;
|
|
@@ -207,4 +208,6 @@ export const style = css `
|
|
|
207
208
|
padding: 1rem;
|
|
208
209
|
}
|
|
209
210
|
`;
|
|
210
|
-
|
|
211
|
+
|
|
212
|
+
export { style };
|
|
213
|
+
//# sourceMappingURL=exm-markdown-editor-css.js.map
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
const style = css `
|
|
3
4
|
:host {
|
|
4
5
|
display: block;
|
|
5
6
|
border-bottom: 1px solid var(--md-sys-color-surface-variant);
|
|
@@ -19,4 +20,6 @@ export const style = css `
|
|
|
19
20
|
margin: 0 0;
|
|
20
21
|
}
|
|
21
22
|
`;
|
|
22
|
-
|
|
23
|
+
|
|
24
|
+
export { style };
|
|
25
|
+
//# sourceMappingURL=exm-markdown-editor-toolbar-css.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
const defaultConfiguration = {
|
|
2
2
|
mode: 'markdown',
|
|
3
3
|
tabSize: 2,
|
|
4
4
|
indentUnit: 2,
|
|
@@ -7,8 +7,10 @@ export const defaultConfiguration = {
|
|
|
7
7
|
autofocus: false,
|
|
8
8
|
lineWrapping: true,
|
|
9
9
|
};
|
|
10
|
-
|
|
10
|
+
const markedConfiguration = {
|
|
11
11
|
breaks: false,
|
|
12
12
|
pedantic: false,
|
|
13
13
|
};
|
|
14
|
-
|
|
14
|
+
|
|
15
|
+
export { defaultConfiguration, markedConfiguration };
|
|
16
|
+
//# sourceMappingURL=configurations.js.map
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { Validator } from '@material/web/labs/behaviors/validators/validator.js';
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* @license
|
|
3
5
|
* Copyright 2023 Google LLC
|
|
4
6
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
7
|
*/
|
|
6
|
-
|
|
7
|
-
export class MardownEditorValidator extends Validator {
|
|
8
|
+
class MardownEditorValidator extends Validator {
|
|
8
9
|
computeValidity(state) {
|
|
9
10
|
var _a;
|
|
10
11
|
if (!this.inputElement) {
|
|
@@ -32,4 +33,6 @@ export class MardownEditorValidator extends Validator {
|
|
|
32
33
|
};
|
|
33
34
|
}
|
|
34
35
|
}
|
|
35
|
-
|
|
36
|
+
|
|
37
|
+
export { MardownEditorValidator };
|
|
38
|
+
//# sourceMappingURL=exm-markdown-editor-validator.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exmg/exm-markdown-editor",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -52,5 +52,5 @@
|
|
|
52
52
|
"publishConfig": {
|
|
53
53
|
"access": "public"
|
|
54
54
|
},
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "b5f4ed4f41d79e3cce85dc0c44181ef4413d7458"
|
|
56
56
|
}
|
|
File without changes
|