Skip to content

Commit 15899cf

Browse files
committed
Fix TypeError when setting YAML lineLength
Regression from openhab#2267. Signed-off-by: Florian Hotze <[email protected]>
1 parent 1c03c60 commit 15899cf

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

bundles/org.openhab.ui/web/src/pages/developer/blocks/blocks-edit.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,13 @@
101101
</style>
102102

103103
<script>
104-
import YAML, { Schema } from 'yaml'
104+
import YAML from 'yaml'
105105
106106
import BlocklyEditor from '@/components/config/controls/blockly-editor.vue'
107107
import BlockPreview from './block-preview.vue'
108108
import DirtyMixin from '@/pages/settings/dirty-mixin'
109109
110-
Schema.toStringDefaults.lineWidth = 0
110+
const toStringOptions = { toStringDefaults: { lineWidth: 0 } }
111111
112112
export default {
113113
mixins: [DirtyMixin],
@@ -138,7 +138,7 @@ export default {
138138
blocks () {
139139
try {
140140
if (!this.blocksDefinition) return {}
141-
return YAML.parse(this.blocksDefinition, { prettyErrors: true })
141+
return YAML.parse(this.blocksDefinition, { prettyErrors: true, toStringOptions })
142142
} catch (e) {
143143
return { component: 'Error', config: { error: e.message } }
144144
}
@@ -281,14 +281,14 @@ export default {
281281
}
282282
]
283283
}
284-
})
284+
}, { toStringOptions })
285285
this.$nextTick(() => {
286286
this.loading = false
287287
this.ready = true
288288
})
289289
} else {
290290
this.$oh.api.get('/rest/ui/components/ui:blocks/' + this.uid).then((data) => {
291-
this.$set(this, 'blocksDefinition', YAML.stringify(data))
291+
this.$set(this, 'blocksDefinition', YAML.stringify(data, { toStringOptions }))
292292
this.$nextTick(() => {
293293
this.loading = false
294294
this.ready = true

bundles/org.openhab.ui/web/src/pages/developer/widgets/widget-edit.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,14 +100,14 @@
100100
</style>
101101

102102
<script>
103-
import YAML, { Schema } from 'yaml'
103+
import YAML from 'yaml'
104104
105105
import ConfigSheet from '@/components/config/config-sheet.vue'
106106
import DirtyMixin from '@/pages/settings/dirty-mixin'
107107
108108
import * as StandardListWidgets from '@/components/widgets/standard/list'
109109
110-
Schema.toStringDefaults.lineWidth = 0
110+
const toStringOptions = { toStringDefaults: { lineWidth: 0 } }
111111
112112
export default {
113113
mixins: [DirtyMixin],
@@ -152,7 +152,7 @@ export default {
152152
widget () {
153153
try {
154154
if (!this.widgetDefinition) return {}
155-
return YAML.parse(this.widgetDefinition, { prettyErrors: true })
155+
return YAML.parse(this.widgetDefinition, { prettyErrors: true, toStringOptions })
156156
} catch (e) {
157157
return { component: 'Error', config: { error: e.message } }
158158
}
@@ -235,14 +235,14 @@ export default {
235235
footer: '=props.prop1',
236236
content: '=items[props.item].displayState || items[props.item].state'
237237
}
238-
})
238+
}, { toStringOptions })
239239
this.$nextTick(() => {
240240
this.loading = false
241241
this.ready = true
242242
})
243243
} else {
244244
this.$oh.api.get('/rest/ui/components/ui:widget/' + this.uid).then((data) => {
245-
this.$set(this, 'widgetDefinition', YAML.stringify(data))
245+
this.$set(this, 'widgetDefinition', YAML.stringify(data, { toStringOptions }))
246246
this.$nextTick(() => {
247247
this.loading = false
248248
this.ready = true

0 commit comments

Comments
 (0)