@dile/editor 2.3.1 → 2.4.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dile/editor",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0",
|
|
4
4
|
"description": "Webcomponent to create a user editor interface, configured on various ways",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"markdown",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@dile/icons": "^2.1.0",
|
|
33
|
-
"@dile/ui": "^2.
|
|
33
|
+
"@dile/ui": "^2.4.0",
|
|
34
34
|
"lit": "^2.7.0 || ^3.0.0",
|
|
35
35
|
"prosemirror-commands": "^1.5.0",
|
|
36
36
|
"prosemirror-example-setup": "^1.2.1",
|
|
@@ -41,5 +41,5 @@
|
|
|
41
41
|
"prosemirror-state": "^1.4.2",
|
|
42
42
|
"prosemirror-view": "^1.30.1"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "9514bd93f87c3237a41056fb6bb59025088f230e"
|
|
45
45
|
}
|
package/src/DileEditor.js
CHANGED
|
@@ -113,11 +113,16 @@ export class DileEditor extends DileI18nMixin(DileEmmitChange(LitElement)) {
|
|
|
113
113
|
max-width: 100%;
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
.ProseMirror
|
|
116
|
+
.ProseMirror pre {
|
|
117
117
|
background-color: #eee;
|
|
118
118
|
padding: 0.4rem;
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
+
.ProseMirror p code {
|
|
122
|
+
background-color: #eee;
|
|
123
|
+
padding: 1px;
|
|
124
|
+
}
|
|
125
|
+
|
|
121
126
|
dile-tabs {
|
|
122
127
|
margin-bottom: 0.3rem;
|
|
123
128
|
}
|
|
@@ -172,10 +177,13 @@ export class DileEditor extends DileI18nMixin(DileEmmitChange(LitElement)) {
|
|
|
172
177
|
/** Menu config */
|
|
173
178
|
_menuConfig: { type: Object },
|
|
174
179
|
|
|
175
|
-
/** Language config */
|
|
176
180
|
};
|
|
177
181
|
}
|
|
178
182
|
|
|
183
|
+
static get formAssociated() {
|
|
184
|
+
return true;
|
|
185
|
+
}
|
|
186
|
+
|
|
179
187
|
constructor() {
|
|
180
188
|
super();
|
|
181
189
|
this.initialized = false;
|
|
@@ -185,13 +193,18 @@ export class DileEditor extends DileI18nMixin(DileEmmitChange(LitElement)) {
|
|
|
185
193
|
this.message = '';
|
|
186
194
|
this.disableToolbarItems = '';
|
|
187
195
|
this._menuConfig = {...defaultToolbarConfig};
|
|
188
|
-
this.addicionalCommands = {}
|
|
196
|
+
this.addicionalCommands = {};
|
|
197
|
+
this.internals = this.attachInternals();
|
|
189
198
|
}
|
|
190
199
|
|
|
191
200
|
updated(changedProperties) {
|
|
192
201
|
if(changedProperties.has('value') && this.isValueExternalyUpdated) {
|
|
193
202
|
this.updateEditorContent(this.value);
|
|
194
203
|
}
|
|
204
|
+
if(changedProperties.has('value')) {
|
|
205
|
+
this.emmitChange();
|
|
206
|
+
this.internals.setFormValue(this.value);
|
|
207
|
+
}
|
|
195
208
|
}
|
|
196
209
|
|
|
197
210
|
firstUpdated() {
|
|
@@ -218,7 +231,7 @@ export class DileEditor extends DileI18nMixin(DileEmmitChange(LitElement)) {
|
|
|
218
231
|
}
|
|
219
232
|
<main>
|
|
220
233
|
${this.label
|
|
221
|
-
? html`<label for="textField">${this.label}</label>`
|
|
234
|
+
? html`<label for="textField" @click=${this.focus}>${this.label}</label>`
|
|
222
235
|
: ""
|
|
223
236
|
}
|
|
224
237
|
<section class="for-input ${this.errored ? 'errored' : ''}">
|
|
@@ -254,8 +267,6 @@ export class DileEditor extends DileI18nMixin(DileEmmitChange(LitElement)) {
|
|
|
254
267
|
</section>
|
|
255
268
|
</main>
|
|
256
269
|
</div>
|
|
257
|
-
|
|
258
|
-
|
|
259
270
|
`;
|
|
260
271
|
}
|
|
261
272
|
|
|
@@ -304,4 +315,12 @@ export class DileEditor extends DileI18nMixin(DileEmmitChange(LitElement)) {
|
|
|
304
315
|
setInitialized() {
|
|
305
316
|
this.initialized = true;
|
|
306
317
|
}
|
|
318
|
+
|
|
319
|
+
focus() {
|
|
320
|
+
if(this.viewSelected == 'design') {
|
|
321
|
+
console.log(this.editor);
|
|
322
|
+
this.editor.focus();
|
|
323
|
+
}
|
|
324
|
+
this.textarea.focus();
|
|
325
|
+
}
|
|
307
326
|
}
|
|
@@ -91,5 +91,9 @@ export class DileEditorMarkdown extends DileI18nMixin(LitElement) {
|
|
|
91
91
|
get markdownCode() {
|
|
92
92
|
return defaultMarkdownSerializer.serialize(this.view.state.doc);
|
|
93
93
|
}
|
|
94
|
+
|
|
95
|
+
focus() {
|
|
96
|
+
this.view.focus();
|
|
97
|
+
}
|
|
94
98
|
}
|
|
95
99
|
customElements.define('dile-editor-markdown', DileEditorMarkdown);
|
|
@@ -173,6 +173,7 @@ export class DileEditorToolbar extends DileI18nMixin(LitElement) {
|
|
|
173
173
|
}
|
|
174
174
|
|
|
175
175
|
blockElementChanged(e) {
|
|
176
|
+
e.stopPropagation();
|
|
176
177
|
let commandName = e.detail.value;
|
|
177
178
|
let commandElement = this.blockItems.find(item => item.commandName == commandName);
|
|
178
179
|
commandElement.command(this.editorView.state, this.editorView.dispatch);
|