Skip to content

Commit

Permalink
Fix Lints
Browse files Browse the repository at this point in the history
  • Loading branch information
ingalls committed Nov 27, 2024
1 parent 9ab65d1 commit c245b13
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
9 changes: 6 additions & 3 deletions api/web/src/components/CloudTAK/CoTView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -348,13 +348,16 @@
@attachment='addAttachment($event)'
/>

<div class='col-12 py-2'>
<div
v-if='cot.properties.remarks'
class='col-12 py-2'
>
<label class='subheader mx-2'>Remarks</label>
<CopyField
v-model='cot.properties.remarks'
:rows='10'
:edit='isEditable'
:hover='isEditable'
v-model='cot.properties.remarks'
class='mx-1'
/>
</div>
Expand Down Expand Up @@ -594,7 +597,7 @@
<CopyField
mode='pre'
style='height: calc(100vh - 225px)'
:modelValue='JSON.stringify(cot.as_feature(), null, 4)'
:model-value='JSON.stringify(cot.as_feature(), null, 4)'
/>
</div>
</template>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
</div>
<CopyField
v-if='protocols.rtsp'
:modelValue='protocols.rtsp.url.replace(/.*\//, "")'
:model-value='protocols.rtsp.url.replace(/.*\//, "")'
/>
</div>
</div>
Expand Down
15 changes: 9 additions & 6 deletions api/web/src/components/CloudTAK/util/CopyField.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
class='position-relative rounded-top'
>
<TablerInput
:rows='rows'
v-model='text'
:rows='rows'
:autofocus='true'
label=''
@change='emit("update:modelValue", text)'
@blur='editing = false'
@submit='rows > 1 ? undefined : editing = false'
label=''
/>

<TablerIconButton
Expand Down Expand Up @@ -95,7 +95,7 @@
</template>

<script setup lang='ts'>
import { ref, watch, computed, useTemplateRef, onMounted } from 'vue';
import { ref, watch, computed, useTemplateRef } from 'vue';
import CopyButton from './CopyButton.vue';
import {
TablerInput,
Expand Down Expand Up @@ -145,10 +145,10 @@ const props = defineProps({
const editing = ref(false);
const text = ref(props.modelValue);
const infoboxRef = useTemplateRef('infobox');
const infoboxRef = useTemplateRef<HTMLElement>('infobox');
const markdown = computed(() => {
return (props.modelValue || '')
return String(props.modelValue || '')
.replace(/\n/g, '</br>')
.replace(/(http(s)?:\/\/.*?(\s|$))/g, '[$1]($1) ')
.trim()
Expand All @@ -158,7 +158,10 @@ watch(infoboxRef, () => {
if (infoboxRef.value) {
infoboxRef.value.addEventListener('click', (event: MouseEvent) => {
if (!props.edit) return;
if (['A'].includes(event.target.tagName)) return;
if (event.target) {
const target = event.target as HTMLElement;
if (['A'].includes(target.tagName)) return;
}
editing.value = true;
});
}
Expand Down

0 comments on commit c245b13

Please sign in to comment.