mirror of
https://github.com/wekan/wekan.git
synced 2025-12-16 15:30:13 +01:00
When RICHER_CARD_COMMENT_EDITOR=true, use richer editor
also when editing card description. Thanks to xet7 !
This commit is contained in:
parent
ec33cdcb29
commit
4e2d337620
6 changed files with 105 additions and 6 deletions
7
client/components/cards/cardDescription.jade
Normal file
7
client/components/cards/cardDescription.jade
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
|
||||||
|
template(name="descriptionForm")
|
||||||
|
.new-description.js-new-description(
|
||||||
|
class="{{#if descriptionFormIsOpen}}is-open{{/if}}")
|
||||||
|
form.js-new-description-form
|
||||||
|
+editor(class="js-new-description-input" data-meteor-emoji-large="true")
|
||||||
|
| {{getUnsavedValue 'cardDescription' _id getDescription}}
|
||||||
33
client/components/cards/cardDescription.js
Normal file
33
client/components/cards/cardDescription.js
Normal file
|
|
@ -0,0 +1,33 @@
|
||||||
|
const descriptionFormIsOpen = new ReactiveVar(false);
|
||||||
|
|
||||||
|
BlazeComponent.extendComponent({
|
||||||
|
onDestroyed() {
|
||||||
|
descriptionFormIsOpen.set(false);
|
||||||
|
},
|
||||||
|
|
||||||
|
descriptionFormIsOpen() {
|
||||||
|
return descriptionFormIsOpen.get();
|
||||||
|
},
|
||||||
|
|
||||||
|
getInput() {
|
||||||
|
return this.$('.js-new-description-input');
|
||||||
|
},
|
||||||
|
|
||||||
|
events() {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
'submit .js-card-description'(event) {
|
||||||
|
event.preventDefault();
|
||||||
|
const description = this.currentComponent().getValue();
|
||||||
|
this.data().setDescription(description);
|
||||||
|
},
|
||||||
|
// Pressing Ctrl+Enter should submit the form
|
||||||
|
'keydown form textarea'(evt) {
|
||||||
|
if (evt.keyCode === 13 && (evt.metaKey || evt.ctrlKey)) {
|
||||||
|
this.find('button[type=submit]').click();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
];
|
||||||
|
},
|
||||||
|
}).register('descriptionForm');
|
||||||
60
client/components/cards/cardDescription.styl
Normal file
60
client/components/cards/cardDescription.styl
Normal file
|
|
@ -0,0 +1,60 @@
|
||||||
|
@import 'nib'
|
||||||
|
|
||||||
|
.new-description
|
||||||
|
position: relative
|
||||||
|
margin: 0 0 20px 0
|
||||||
|
|
||||||
|
|
||||||
|
&.is-open
|
||||||
|
.helper
|
||||||
|
display: inline-block
|
||||||
|
|
||||||
|
textarea
|
||||||
|
min-height: 100px
|
||||||
|
color: #4d4d4d
|
||||||
|
cursor: auto
|
||||||
|
overflow: hidden
|
||||||
|
word-wrap: break-word
|
||||||
|
|
||||||
|
.too-long
|
||||||
|
margin-top: 8px
|
||||||
|
|
||||||
|
textarea
|
||||||
|
background-color: #fff
|
||||||
|
border: 0
|
||||||
|
box-shadow: 0 1px 2px rgba(0, 0, 0, .23)
|
||||||
|
color: #8c8c8c
|
||||||
|
height: 36px
|
||||||
|
margin: 4px 4px 6px 0
|
||||||
|
padding: 9px 11px
|
||||||
|
width: 100%
|
||||||
|
|
||||||
|
&:hover,
|
||||||
|
&:is-open
|
||||||
|
background-color: #fff
|
||||||
|
box-shadow: 0 1px 3px rgba(0, 0, 0, .33)
|
||||||
|
border: 0
|
||||||
|
cursor: pointer
|
||||||
|
|
||||||
|
&:is-open
|
||||||
|
cursor: auto
|
||||||
|
|
||||||
|
.description-item
|
||||||
|
background-color: #fff
|
||||||
|
border: 0
|
||||||
|
box-shadow: 0 1px 2px rgba(0, 0, 0, .23)
|
||||||
|
color: #8c8c8c
|
||||||
|
height: 36px
|
||||||
|
margin: 4px 4px 6px 0
|
||||||
|
width: 92%
|
||||||
|
|
||||||
|
&:hover
|
||||||
|
background: darken(white, 12%)
|
||||||
|
|
||||||
|
&.add-description
|
||||||
|
display: flex
|
||||||
|
margin: 5px
|
||||||
|
|
||||||
|
a
|
||||||
|
display: block
|
||||||
|
margin: auto
|
||||||
|
|
@ -42,12 +42,12 @@ template(name="cardDetails")
|
||||||
else
|
else
|
||||||
p.warning {{_ 'card-archived'}}
|
p.warning {{_ 'card-archived'}}
|
||||||
|
|
||||||
.card-details-items
|
.card-details-items
|
||||||
if currentBoard.allowsLabels
|
if currentBoard.allowsLabels
|
||||||
.card-details-item.card-details-item-labels
|
.card-details-item.card-details-item-labels
|
||||||
h3.card-details-item-title
|
h3.card-details-item-title
|
||||||
i.fa.fa-tags
|
i.fa.fa-tags
|
||||||
| {{_ 'labels'}}
|
| {{_ 'labels'}}
|
||||||
a(class="{{#if canModifyCard}}js-add-labels{{else}}is-disabled{{/if}}" title="{{_ 'card-labels-title'}}")
|
a(class="{{#if canModifyCard}}js-add-labels{{else}}is-disabled{{/if}}" title="{{_ 'card-labels-title'}}")
|
||||||
each labels
|
each labels
|
||||||
span.card-label(class="card-label-{{color}}" title=name)
|
span.card-label(class="card-label-{{color}}" title=name)
|
||||||
|
|
@ -57,7 +57,7 @@ template(name="cardDetails")
|
||||||
unless currentUser.isWorker
|
unless currentUser.isWorker
|
||||||
a.card-label.add-label.js-add-labels(title="{{_ 'card-labels-title'}}")
|
a.card-label.add-label.js-add-labels(title="{{_ 'card-labels-title'}}")
|
||||||
i.fa.fa-plus
|
i.fa.fa-plus
|
||||||
|
|
||||||
if currentBoard.allowsReceivedDate
|
if currentBoard.allowsReceivedDate
|
||||||
hr
|
hr
|
||||||
.card-details-item.card-details-item-received
|
.card-details-item.card-details-item-received
|
||||||
|
|
@ -245,8 +245,7 @@ template(name="cardDetails")
|
||||||
| {{_ 'description'}}
|
| {{_ 'description'}}
|
||||||
if currentBoard.allowsDescriptionText
|
if currentBoard.allowsDescriptionText
|
||||||
+inlinedCardDescription(classNames="card-description js-card-description")
|
+inlinedCardDescription(classNames="card-description js-card-description")
|
||||||
+editor(autofocus=true)
|
+descriptionForm
|
||||||
| {{getUnsavedValue 'cardDescription' _id getDescription}}
|
|
||||||
.edit-controls.clearfix
|
.edit-controls.clearfix
|
||||||
button.primary(type="submit") {{_ 'save'}}
|
button.primary(type="submit") {{_ 'save'}}
|
||||||
a.fa.fa-times-thin.js-close-inlined-form
|
a.fa.fa-times-thin.js-close-inlined-form
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@ template(name="editor")
|
||||||
dir="auto"
|
dir="auto"
|
||||||
class="{{class}}"
|
class="{{class}}"
|
||||||
id=id
|
id=id
|
||||||
autofocus=autofocus
|
|
||||||
placeholder="{{_ 'comment-placeholder'}}")
|
placeholder="{{_ 'comment-placeholder'}}")
|
||||||
+Template.contentBlock
|
+Template.contentBlock
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -91,6 +91,7 @@ Template.editor.onRendered(() => {
|
||||||
};
|
};
|
||||||
const editor = '.editor';
|
const editor = '.editor';
|
||||||
const selectors = [
|
const selectors = [
|
||||||
|
`.js-new-description-form ${editor}`,
|
||||||
`.js-new-comment-form ${editor}`,
|
`.js-new-comment-form ${editor}`,
|
||||||
`.js-edit-comment ${editor}`,
|
`.js-edit-comment ${editor}`,
|
||||||
].join(','); // only new comment and edit comment
|
].join(','); // only new comment and edit comment
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue