Skip to content

Commit

Permalink
Merge pull request rancher#12800 from rak-phillip/bugfix/11226-yaml-e…
Browse files Browse the repository at this point in the history
…ditor-comments

Remove `onChanges()` method in `ResourceYaml.vue`
  • Loading branch information
rak-phillip authored Dec 5, 2024
2 parents c137a33 + b9909b8 commit 56fe8bf
Showing 1 changed file with 0 additions and 53 deletions.
53 changes: 0 additions & 53 deletions shell/components/ResourceYaml.vue
Original file line number Diff line number Diff line change
Expand Up @@ -205,58 +205,6 @@ export default {
cm.getMode().fold = saved;
},
onChanges(cm, changes) {
if ( changes.length !== 1 ) {
return;
}
const change = changes[0];
if ( change.from.line !== change.to.line ) {
return;
}
let line = change.from.line;
let str = cm.getLine(line);
let maxIndent = indentChars(str);
if ( maxIndent === null ) {
return;
}
cm.replaceRange('', { line, ch: 0 }, { line, ch: 1 }, '+input');
while ( line > 0 ) {
line--;
str = cm.getLine(line);
const indent = indentChars(str);
if ( indent === null ) {
break;
}
if ( indent < maxIndent ) {
cm.replaceRange('', { line, ch: 0 }, { line, ch: 1 }, '+input');
if ( indent === 0 ) {
break;
}
maxIndent = indent;
}
}
function indentChars(str) {
const match = str.match(/^#(\s+)/);
if ( match ) {
return match[1].length;
}
return null;
}
},
updateValue(value) {
this.$refs.yamleditor.updateValue(value);
},
Expand Down Expand Up @@ -354,7 +302,6 @@ export default {
class="yaml-editor flex-content"
:editor-mode="editorMode"
@onReady="onReady"
@onChanges="onChanges"
/>
<slot
name="yamlFooter"
Expand Down

0 comments on commit 56fe8bf

Please sign in to comment.