@dile/editor 2.3.2 → 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,7 +193,8 @@ 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) {
|
|
@@ -194,6 +203,7 @@ export class DileEditor extends DileI18nMixin(DileEmmitChange(LitElement)) {
|
|
|
194
203
|
}
|
|
195
204
|
if(changedProperties.has('value')) {
|
|
196
205
|
this.emmitChange();
|
|
206
|
+
this.internals.setFormValue(this.value);
|
|
197
207
|
}
|
|
198
208
|
}
|
|
199
209
|
|
|
@@ -221,7 +231,7 @@ export class DileEditor extends DileI18nMixin(DileEmmitChange(LitElement)) {
|
|
|
221
231
|
}
|
|
222
232
|
<main>
|
|
223
233
|
${this.label
|
|
224
|
-
? html`<label for="textField">${this.label}</label>`
|
|
234
|
+
? html`<label for="textField" @click=${this.focus}>${this.label}</label>`
|
|
225
235
|
: ""
|
|
226
236
|
}
|
|
227
237
|
<section class="for-input ${this.errored ? 'errored' : ''}">
|
|
@@ -257,8 +267,6 @@ export class DileEditor extends DileI18nMixin(DileEmmitChange(LitElement)) {
|
|
|
257
267
|
</section>
|
|
258
268
|
</main>
|
|
259
269
|
</div>
|
|
260
|
-
|
|
261
|
-
|
|
262
270
|
`;
|
|
263
271
|
}
|
|
264
272
|
|
|
@@ -307,4 +315,12 @@ export class DileEditor extends DileI18nMixin(DileEmmitChange(LitElement)) {
|
|
|
307
315
|
setInitialized() {
|
|
308
316
|
this.initialized = true;
|
|
309
317
|
}
|
|
318
|
+
|
|
319
|
+
focus() {
|
|
320
|
+
if(this.viewSelected == 'design') {
|
|
321
|
+
console.log(this.editor);
|
|
322
|
+
this.editor.focus();
|
|
323
|
+
}
|
|
324
|
+
this.textarea.focus();
|
|
325
|
+
}
|
|
310
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);
|