Skip to content

Commit

Permalink
create caption input for maps and charts
Browse files Browse the repository at this point in the history
  • Loading branch information
IshavSohal committed Nov 26, 2024
1 parent 6ab1b8b commit a0aed09
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 1 deletion.
4 changes: 4 additions & 0 deletions StorylinesSchema.json
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,10 @@
"title": {
"type": "string",
"description": "A title that is displayed centered above this map."
},
"caption": {
"type": "string",
"description": "Supporting text content for the map."
}
},
"required": ["config", "type"]
Expand Down
8 changes: 8 additions & 0 deletions public/StorylinesSlideSchema.json
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,10 @@
"type": "string",
"description": "A title that is displayed centered above this map."
},
"caption": {
"type": "string",
"description": "Supporting text content for the map."
},
"timeSlider": {
"type": "object",
"description": "Configuration for a time slider on the map.",
Expand Down Expand Up @@ -256,6 +260,10 @@
"customStyles": {
"type": "string",
"description": "Additional CSS styles to apply to the panel."
},
"caption": {
"type": "string",
"description": "Supporting text content for the chart."
}
},
"additionalProperties": false,
Expand Down
2 changes: 2 additions & 0 deletions src/components/chart-editor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,10 @@
:configFileStructure="configFileStructure"
:sourceCounts="sourceCounts"
:lang="lang"
:index="index"
@edit="editChart"
@delete="$vfm.open(`${element.name}-${index}`)"
@captionEdit="onChartsEdited"
></ChartPreview>
</template>
</draggable>
Expand Down
14 changes: 14 additions & 0 deletions src/components/helpers/chart-preview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,19 @@
</div>
</button>
</div>
<div class="flex items-center mt-2">
<label :for="'chartPreviewCaption' + index" class="font-bold"
>{{ $t('editor.image.label.caption') }}:
</label>
<input
:id="'chartPreviewCaption' + index"
class="editor-input w-2/5 ml-2"
type="text"
v-model="chart.caption"
placeholder="Add a caption"
@input="$emit('captionEdit')"
/>
</div>
</li>
</template>

Expand Down Expand Up @@ -92,6 +105,7 @@ export default class ChartPreviewV extends Vue {
@Prop() configFileStructure!: ConfigFileStructure;
@Prop() sourceCounts!: SourceCounts;
@Prop() lang!: string;
@Prop() index!: number;
loading = true;
chartIdx = 0;
Expand Down
15 changes: 14 additions & 1 deletion src/components/map-editor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,19 @@

<div class="mb-4" v-if="usingTimeSlider"></div>

<div class="flex items-center w-full text-left mt-2">
<label class="editor-label text-label" for="rampMapCaption">
{{ $t('editor.image.label.caption') }}:</label
>
<input
id="rampMapCaption"
class="editor-input w-2/5"
type="text"
v-model="panel.caption"
placeholder="Add a caption"
/>
</div>

<div class="ramp-editor mt-5" ref="editor" style="width: 70vw; height: 80vh"></div>
</div>
<vue-final-modal
Expand All @@ -44,7 +57,7 @@
:disabled="timeSliderError"
@click="saveTimeSlider"
>
Done
{{ $t('editor.modal.done') }}
</button>
</div>
</vue-final-modal>
Expand Down
3 changes: 3 additions & 0 deletions src/definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ export interface MapPanel extends BasePanel {
title: string;
scrollguard: boolean;
customStyles?: string;
caption?: string;
}
export interface TimeSliderConfig {
range: number[];
Expand Down Expand Up @@ -252,6 +253,7 @@ export interface ChartPanel extends BasePanel {
name?: string;
options?: DQVOptions;
customStyles?: string;
caption?: string;
}

export interface ChartConfig {
Expand All @@ -260,6 +262,7 @@ export interface ChartConfig {
config?: any;
name?: string;
options?: DQVOptions;
caption?: string;
}

export interface ImageFile {
Expand Down

0 comments on commit a0aed09

Please sign in to comment.