Skip to content

Commit

Permalink
Wysiwyg - Counter limit (fix counter limit in Textfield) (#459)
Browse files Browse the repository at this point in the history
* Wysiwyg - Make sure CSS in Wysiwyg do not interefer with the CSS of the TextField

* Fix Wysiwyg counter position
  • Loading branch information
mrdoinel authored and ifox committed Nov 19, 2019
1 parent 9a87a2b commit 01151e5
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions frontend/js/components/Wysiwyg.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<template v-if="editSource">
<div class="wysiwyg" :class="textfieldClasses" v-show="!activeSource">
<div class="wysiwyg__editor" ref="editor"></div>
<span v-if="shouldShowCounter" class="input__limit f--tiny" :class="limitClasses">{{ counter }}</span>
<span v-if="shouldShowCounter" class="wysiwyg__limit f--tiny" :class="limitClasses">{{ counter }}</span>
</div>
<div class="form__field form__field--textarea" v-show="activeSource">
<textarea :placeholder="placeholder" :autofocus="autofocus" v-model="value" :style="textareaHeight"></textarea>
Expand All @@ -15,7 +15,7 @@
<template v-else>
<div class="wysiwyg" :class="textfieldClasses">
<div class="wysiwyg__editor" ref="editor"></div>
<span v-if="shouldShowCounter" class="input__limit f--tiny" :class="limitClasses">{{ counter }}</span>
<span v-if="shouldShowCounter" class="wysiwyg__limit f--tiny" :class="limitClasses">{{ counter }}</span>
</div>
</template>
</div>
Expand Down Expand Up @@ -97,7 +97,7 @@
},
limitClasses: function () {
return {
'input__limit--red': this.counter < 10
'wysiwyg__limit--red': this.counter < 10
}
},
...mapState({
Expand Down Expand Up @@ -270,30 +270,31 @@
</script>

<style lang="scss" scoped>
@import '~styles/setup/_mixins-colors-vars.scss';
.wysiwyg__button {
margin-top:20px;
}
</style>
<style lang="scss">
/* Not scoped style here because we want to overwrite default style of the wysiwig */
@import '~styles/setup/_mixins-colors-vars.scss';
$height_input: 45px;
.input__limit {
.wysiwyg__limit {
height:$height_input - 2px;
line-height:$height_input - 2px;
color:$color__text--light;
user-select: none;
user-select:none;
pointer-events:none;
position:absolute;
right:15px;
bottom: 55px;
bottom:0;
}
.input__limit--red {
.wysiwyg__limit--red {
color:red;
}
</style>
<style lang="scss">
/* Not scoped style here because we want to overwrite default style of the wysiwig */
@import '~styles/setup/_mixins-colors-vars.scss';
.a17 {
.ql-toolbar.ql-snow {
Expand Down

0 comments on commit 01151e5

Please sign in to comment.