mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-26 17:51:13 +08:00
Allow multiline in checklist items [SCI-7008]
This commit is contained in:
parent
6f72777acd
commit
70fe27f31b
3 changed files with 12 additions and 8 deletions
|
@ -28,6 +28,7 @@
|
|||
|
||||
.sci-inline-edit__view {
|
||||
cursor: pointer;
|
||||
white-space: pre-wrap;
|
||||
width: 100%;
|
||||
|
||||
&.blank {
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
:multilinePaste="true"
|
||||
:editOnload="checklistItem.attributes.isNew"
|
||||
:smartAnnotation="true"
|
||||
:saveOnEnter="false"
|
||||
:allowNewLine="true"
|
||||
@editingEnabled="enableTextEdit"
|
||||
@editingDisabled="disableTextEdit"
|
||||
@update="updateText"
|
||||
|
|
|
@ -40,6 +40,8 @@
|
|||
characterLimit: { type: Number },
|
||||
placeholder: { type: String },
|
||||
autofocus: { type: Boolean, default: false },
|
||||
saveOnEnter: { type: Boolean, default: true },
|
||||
allowNewLine: { type: Boolean, default: false },
|
||||
multilinePaste: { type: Boolean, default: false },
|
||||
smartAnnotation: { type: Boolean, default: false },
|
||||
editOnload: { type: Boolean, default: false }
|
||||
|
@ -134,17 +136,16 @@
|
|||
}
|
||||
},
|
||||
handleInput() {
|
||||
this.newValue = this.newValue.replace(/^[\n\r]+|[\n\r]+$/g, '');
|
||||
if (!this.allowNewLine) {
|
||||
this.newValue = this.newValue.replace(/^[\n\r]+|[\n\r]+$/g, '');
|
||||
}
|
||||
this.$nextTick(this.resize);
|
||||
},
|
||||
handleKeypress(e) {
|
||||
switch(e.key) {
|
||||
case 'Escape':
|
||||
this.cancelEdit();
|
||||
break;
|
||||
case 'Enter':
|
||||
this.update();
|
||||
break;
|
||||
if (e.key == 'Escape') {
|
||||
this.cancelEdit();
|
||||
} else if (e.key == 'Enter' && this.saveOnEnter) {
|
||||
this.update();
|
||||
}
|
||||
},
|
||||
resize() {
|
||||
|
|
Loading…
Reference in a new issue