Skip to content

Commit

Permalink
Refactor editable condition label styling
Browse files Browse the repository at this point in the history
  • Loading branch information
dontry committed Feb 22, 2024
1 parent 8fcf43b commit dfae645
Showing 1 changed file with 5 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<label
class="condition px-1"
:class="{
editable: editable,
'py-1 px-2 ml-1 cursor-text': editable,
}"
:contenteditable="editable"
@dblclick="handleDblClick"
Expand Down Expand Up @@ -32,7 +32,7 @@ export default {
() => condition?.value?.getFormattedText() ?? "",
);
function toggleEditable(_editable) {
function setEditable(_editable) {
editable.value = _editable;
}
Expand All @@ -44,7 +44,7 @@ export default {
async function handleDblClick(e) {
e.preventDefault();
e.stopPropagation();
toggleEditable(true);
setEditable(true);
await nextTick();
const range = document.createRange();
Expand Down Expand Up @@ -85,7 +85,7 @@ export default {
}
function replaceConditionText(e) {
toggleEditable(false);
setEditable(false);
e.preventDefault();
e.stopPropagation();
Expand Down Expand Up @@ -126,10 +126,4 @@ export default {
};
</script>
<style scoped>
.condition.editable {
padding: 2px 6px;
margin-left: 4px;
cursor: text;
}
</style>
<style scoped></style>

0 comments on commit dfae645

Please sign in to comment.