@dile/editor 2.4.2 → 2.4.4
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dile/editor",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.4",
|
|
4
4
|
"description": "Webcomponent to create a user editor interface, configured on various ways",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"markdown",
|
|
@@ -41,5 +41,5 @@
|
|
|
41
41
|
"prosemirror-state": "^1.4.2",
|
|
42
42
|
"prosemirror-view": "^1.30.1"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "01f46d3178e1272b079586110ab4bdca749f5710"
|
|
45
45
|
}
|
package/src/DileEditor.js
CHANGED
|
@@ -63,6 +63,7 @@ export class DileEditor extends DileI18nMixin(DileEmmitChange(LitElement)) {
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
.ProseMirror {
|
|
66
|
+
line-height: var(--dile-editor-line-height, 1.3rem);
|
|
66
67
|
position: relative;
|
|
67
68
|
word-wrap: break-word;
|
|
68
69
|
white-space: pre-wrap;
|
|
@@ -72,7 +73,6 @@ export class DileEditor extends DileI18nMixin(DileEmmitChange(LitElement)) {
|
|
|
72
73
|
font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
|
|
73
74
|
outline: none;
|
|
74
75
|
padding: 0 10px;
|
|
75
|
-
|
|
76
76
|
max-width: 100%;
|
|
77
77
|
overflow: auto;
|
|
78
78
|
}
|
|
@@ -112,15 +112,23 @@ export class DileEditor extends DileI18nMixin(DileEmmitChange(LitElement)) {
|
|
|
112
112
|
.ProseMirror img {
|
|
113
113
|
max-width: 100%;
|
|
114
114
|
}
|
|
115
|
+
.ProseMirror pre, .ProseMirror p code {
|
|
116
|
+
background-color: var(--dile-editor-code-bakground-color, #eee);
|
|
117
|
+
font-family: var(--dile-editor-code-font-family, Consolas, Monaco, "Andale Mono", "Ubuntu Mono", monospace);
|
|
118
|
+
font-size: var(--dile-editor-code-font-size, 0.9em);
|
|
119
|
+
color: var(--dile-editor-code-color, #657b83);
|
|
120
|
+
}
|
|
115
121
|
|
|
116
122
|
.ProseMirror pre {
|
|
117
|
-
background-color: #eee;
|
|
118
123
|
padding: 0.4rem;
|
|
124
|
+
overflow-x: auto;
|
|
125
|
+
line-height: 1.5em;
|
|
126
|
+
tab-size: 4;
|
|
127
|
+
hyphens: none;
|
|
119
128
|
}
|
|
120
129
|
|
|
121
130
|
.ProseMirror p code {
|
|
122
|
-
|
|
123
|
-
padding: 1px;
|
|
131
|
+
padding: 2px;
|
|
124
132
|
}
|
|
125
133
|
|
|
126
134
|
dile-tabs {
|
|
@@ -144,6 +152,11 @@ export class DileEditor extends DileI18nMixin(DileEmmitChange(LitElement)) {
|
|
|
144
152
|
display: flex;
|
|
145
153
|
flex-direction: column-reverse;
|
|
146
154
|
}
|
|
155
|
+
|
|
156
|
+
li p {
|
|
157
|
+
margin: 0.25rem 0 !important;
|
|
158
|
+
}
|
|
159
|
+
|
|
147
160
|
`
|
|
148
161
|
];
|
|
149
162
|
|
|
@@ -172,7 +185,7 @@ export class DileEditor extends DileI18nMixin(DileEmmitChange(LitElement)) {
|
|
|
172
185
|
/** Disable toolbar items, string with items separated by tubes like "italic|h4" */
|
|
173
186
|
disableToolbarItems: { type: String },
|
|
174
187
|
|
|
175
|
-
|
|
188
|
+
additionalCommands: { type: Object },
|
|
176
189
|
|
|
177
190
|
/** Menu config */
|
|
178
191
|
_menuConfig: { type: Object },
|
|
@@ -193,7 +206,7 @@ export class DileEditor extends DileI18nMixin(DileEmmitChange(LitElement)) {
|
|
|
193
206
|
this.message = '';
|
|
194
207
|
this.disableToolbarItems = '';
|
|
195
208
|
this._menuConfig = {...defaultToolbarConfig};
|
|
196
|
-
this.
|
|
209
|
+
this.additionalCommands = {};
|
|
197
210
|
this.internals = this.attachInternals();
|
|
198
211
|
}
|
|
199
212
|
|
|
@@ -266,7 +279,7 @@ export class DileEditor extends DileI18nMixin(DileEmmitChange(LitElement)) {
|
|
|
266
279
|
@dile-editor-change=${this.updateValue}
|
|
267
280
|
._menuConfig=${this._menuConfig}
|
|
268
281
|
@dile-editor-markdown-initialized=${this.setInitialized}
|
|
269
|
-
.
|
|
282
|
+
.additionalCommands=${this.additionalCommands}
|
|
270
283
|
language="${this.language}"
|
|
271
284
|
></dile-editor-markdown>
|
|
272
285
|
`
|
|
@@ -30,7 +30,7 @@ export class DileEditorMarkdown extends DileI18nMixin(LitElement) {
|
|
|
30
30
|
static get properties() {
|
|
31
31
|
return {
|
|
32
32
|
_menuConfig: { type: Object },
|
|
33
|
-
|
|
33
|
+
additionalCommands: { type: Object },
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
36
|
constructor() {
|
|
@@ -71,7 +71,7 @@ export class DileEditorMarkdown extends DileI18nMixin(LitElement) {
|
|
|
71
71
|
history(),
|
|
72
72
|
keymap(buildKeymap(schema)),
|
|
73
73
|
keymap(baseKeymap),
|
|
74
|
-
menuPlugin(this._menuConfig, this.
|
|
74
|
+
menuPlugin(this._menuConfig, this.additionalCommands, this.language),
|
|
75
75
|
]
|
|
76
76
|
})
|
|
77
77
|
}
|
|
@@ -51,13 +51,13 @@ export class DileEditorToolbar extends DileI18nMixin(LitElement) {
|
|
|
51
51
|
blockItems: { type: Array },
|
|
52
52
|
undoItems: { type: Array },
|
|
53
53
|
menuConfig: { type: Object },
|
|
54
|
-
|
|
54
|
+
additionalCommands: { type: Object },
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
constructor() {
|
|
59
59
|
super();
|
|
60
|
-
this.
|
|
60
|
+
this.additionalCommands = {}
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
get blockselect() {
|
|
@@ -65,9 +65,9 @@ export class DileEditorToolbar extends DileI18nMixin(LitElement) {
|
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
firstUpdated() {
|
|
68
|
-
this.toolbarItems = getToolbarItems(this.menuConfig, this.
|
|
69
|
-
this.undoItems = getUndoItems(this.menuConfig, this.
|
|
70
|
-
this.blockItems = getBlockItems(this.menuConfig, this.
|
|
68
|
+
this.toolbarItems = getToolbarItems(this.menuConfig, this.additionalCommands.toolbarItems || []);
|
|
69
|
+
this.undoItems = getUndoItems(this.menuConfig, this.additionalCommands.undoItems || []);
|
|
70
|
+
this.blockItems = getBlockItems(this.menuConfig, this.additionalCommands.blockItems || []);
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
render() {
|
|
@@ -2,14 +2,14 @@ import { Plugin } from "prosemirror-state";
|
|
|
2
2
|
|
|
3
3
|
const toolbarElement = 'dile-editor-toolbar';
|
|
4
4
|
|
|
5
|
-
export const menuPlugin = (menuConfig,
|
|
5
|
+
export const menuPlugin = (menuConfig, additionalCommands, language) => new Plugin({
|
|
6
6
|
view(editorView) {
|
|
7
7
|
let toolbar;
|
|
8
8
|
if (!editorView.dom.parentElement.querySelector(toolbarElement)) {
|
|
9
9
|
toolbar = document.createElement(toolbarElement);
|
|
10
10
|
toolbar.menuConfig = menuConfig;
|
|
11
11
|
toolbar.editorView = editorView;
|
|
12
|
-
toolbar.
|
|
12
|
+
toolbar.additionalCommands = additionalCommands;
|
|
13
13
|
toolbar.language = language;
|
|
14
14
|
editorView.dom.parentNode.insertBefore(toolbar, editorView.dom);
|
|
15
15
|
} else {
|