Skip to content

Commit

Permalink
Merge pull request #1427 from FlowFuse/1341-text-truncation
Browse files Browse the repository at this point in the history
Text: Add text truncation/wrap option
  • Loading branch information
Steve-Mcl authored Oct 29, 2024
2 parents 3e6b804 + 5e6695f commit a0ccb04
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
3 changes: 2 additions & 1 deletion nodes/widgets/locales/en-US/ui_text.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"font": "Font",
"textSize": "Text Size",
"textColor": "Text Color",
"enterSampleHere": "Enter Sample Here"
"enterSampleHere": "Enter Sample Here",
"wrapText": "Wrap Text"
}
}
}
5 changes: 5 additions & 0 deletions nodes/widgets/ui_text.html
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
font: { value: 'Helvetica' },
fontSize: { value: 16 },
color: { value: '#717171' },
wrapText: { value: false },
className: { value: '' }
},
inputs: 1,
Expand Down Expand Up @@ -259,6 +260,10 @@
<label for="node-input-format"><i class="fa fa-i-cursor"></i> Value format</label>
<input type="text" id="node-input-format" placeholder="{{msg.payload}}">
</div>-->
<div class="form-row">
<label for="node-input-wrapText"><i class="fa fa-ellipsis-h"></i> <span data-i18n="ui-text.label.wrapText"></label>
<input type="checkbox" id="node-input-wrapText" style="width: auto">
</div>
<div class="form-row">
<label style="vertical-align: top"><i class="fa fa-th-large"></i> <span data-i18n="ui-text.label.layout"></label>
<div style="display:inline-block">
Expand Down
8 changes: 7 additions & 1 deletion ui/src/widgets/ui-text/UIText.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div class="nrdb-ui-text" :class="'nrdb-ui-text--' + layout" :style="style">
<div class="nrdb-ui-text" :class="['nrdb-ui-text--' + layout, wrapText ? 'nrdb-ui-text--wrap' : '']" :style="style">
<!-- eslint-disable-next-line vue/no-v-html -->
<label class="nrdb-ui-text-label" v-html="label" />
<!-- eslint-disable-next-line vue/no-v-html -->
Expand Down Expand Up @@ -36,6 +36,9 @@ export default {
layout () {
return this.getProperty('layout')
},
wrapText () {
return this.getProperty('wrapText')
},
style () {
if (this.props.style) {
return {
Expand Down Expand Up @@ -86,6 +89,9 @@ export default {
text-overflow: ellipsis;
line-height: initial;
}
.nrdb-ui-text.nrdb-ui-text--wrap .nrdb-ui-text-value {
white-space: normal;
}
/* Layouts */
.nrdb-ui-text--row-left {
Expand Down

0 comments on commit a0ccb04

Please sign in to comment.