Skip to content

Commit

Permalink
Fixed with incorrect value cm toggle on refresh (#1689)
Browse files Browse the repository at this point in the history
* added a checkbox to switch between codeMirror and plain text editor

* fix incorrect value of CM checkbox on refresh

---------

Co-authored-by: Ashish Jhanwar <[email protected]>
  • Loading branch information
ashishjh-bst and ashishjh-bst committed Jun 27, 2024
1 parent cd13c54 commit 013e5aa
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion customcommands/assets/customcommands-editcmd.html
Original file line number Diff line number Diff line change
Expand Up @@ -553,10 +553,10 @@ <h2 class="card-title">Custom Command Information</h2>

$(function () {
triggerTypeChanged();

updateCCLength();
updateTriggerLength();
updateNameLength();
setCMCheckbox();
});

var intervalTriggerEls = ['#interval-cc-run-now', '#cc-time-trigger-details'];
Expand All @@ -579,6 +579,14 @@ <h2 class="card-title">Custom Command Information</h2>
none: ['#trigger-desc-none'],
};

function setCMCheckbox() {
if(localStorage.getItem('cm-editor') === 'false'){
$("#toggle-code-mirror").prop( "checked", false );
} else {
$("#toggle-code-mirror").prop( "checked", true );
}
}

function triggerTypeChanged() {
const curTriggerType = $('#trigger-type-dropdown').val();

Expand Down Expand Up @@ -744,6 +752,7 @@ <h2 class="card-title">Custom Command Information</h2>
}
</style>
<script type="text/javascript">

function setupCodeMirrorEditor(textArea) {
var isCMEditor = localStorage.getItem('cm-editor')
if(isCMEditor === 'false') return
Expand Down

0 comments on commit 013e5aa

Please sign in to comment.