Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/text with links #847

Merged
merged 3 commits into from
Sep 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ All notable changes to this project will be documented in this file. The format

- Organization, department and product details are now edited from within the
current item's about page.
- Made links clickable in the description of objects, key results and goals.

## [3.9.0] 2023-09-01

Expand Down
6 changes: 6 additions & 0 deletions src/components/HTMLOutput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ export default {
deep: true,
immediate: true,
async handler(html) {
dompurify.addHook('afterSanitizeAttributes', function (node) {
// set all elements owning target to target=_blank
if ('target' in node) {
node.setAttribute('target', '_blank');
}
});
this.sanitizedHtml = await dompurify.sanitize(marked(html));
},
},
Expand Down
7 changes: 6 additions & 1 deletion src/components/KpiDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@
{{ $t('kpi.newValue') }}
</pkt-button>
</div>
<p v-if="kpi.description" class="pkt-txt-14-light">{{ kpi.description }}</p>
<HTML-output
v-if="kpi.description"
class="pkt-txt-14-light"
:html="kpi.description"
/>
</header>

<widget-kpi-progress-graph :kpi="kpi" :progress="progress" :goals="goals" />
Expand Down Expand Up @@ -55,6 +59,7 @@ export default {
components: {
PktButton,
ProgressModal: () => import('@/components/modals/KPIProgressModal.vue'),
HTMLOutput: () => import('@/components/HTMLOutput.vue'),
WidgetKpiProgressGraph,
WidgetKpiProgressHistory,
WidgetKpiProgressStats,
Expand Down
8 changes: 5 additions & 3 deletions src/views/KeyResultHome.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@
/>
</div>
</div>
<p v-if="activeKeyResult.description" class="description">
{{ activeKeyResult.description }}
</p>
<HTML-output
v-if="activeKeyResult.description"
:html="activeKeyResult.description"
/>
</header>

<archived-restore
Expand Down Expand Up @@ -144,6 +145,7 @@ export default {
PktButton,
KeyResultDrawer: () => import('@/components/drawers/EditKeyResult.vue'),
ArchivedRestore: () => import('@/components/ArchivedRestore.vue'),
HTMLOutput: () => import('@/components/HTMLOutput.vue'),
},

beforeRouteUpdate: routerGuard,
Expand Down
9 changes: 6 additions & 3 deletions src/views/ObjectiveHome.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@
</div>
</div>
<div class="objective__description">
<p v-if="activeObjective.description" class="description">
{{ activeObjective.description }}
</p>
<HTML-output
v-if="activeObjective.description"
:html="activeObjective.description"
/>
<div
v-if="hasEditRights && !activeObjective.archived"
data-mode="dark"
Expand Down Expand Up @@ -93,6 +94,7 @@ import WidgetObjectiveDetails from '@/components/widgets/WidgetObjectiveDetails.
import WidgetWeights from '@/components/widgets/WidgetWeights.vue';
import ProgressionChart from '@/components/ProgressionChart.vue';
import { PktButton } from '@oslokommune/punkt-vue2';
import HTMLOutput from '@/components/HTMLOutput.vue';

export default {
name: 'ObjectiveHome',
Expand All @@ -105,6 +107,7 @@ export default {
WidgetObjectiveDetails,
ProgressionChart,
PktButton,
HTMLOutput,
ObjectiveDrawer: () => import('@/components/drawers/EditObjective.vue'),
KeyResultDrawer: () => import('@/components/drawers/EditKeyResult.vue'),
ArchivedRestore: () => import('@/components/ArchivedRestore.vue'),
Expand Down