Skip to content

Commit

Permalink
#9421 replace v-html with v-strip-unsave-html (#9702)
Browse files Browse the repository at this point in the history
  • Loading branch information
jardakotesovec authored Feb 9, 2024
1 parent 42de372 commit fa3c7bf
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 7 deletions.
5 changes: 4 additions & 1 deletion js/load.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ import VueScrollTo from 'vue-scrollto';
import dialog from '@/mixins/dialog.js';
import localizeMoment from '@/mixins/localizeMoment.js';

// Directives
import {stripUnsafeHtml} from '@/directives/stripUnsafeHtml';

// Global components of UI Library
import Badge from '@/components/Badge/Badge.vue';
import Dropdown from '@/components/Dropdown/Dropdown.vue';
Expand Down Expand Up @@ -101,7 +104,7 @@ Vue.use(VModal, {
Vue.use(VTooltip, {defaultTrigger: 'click'});
Vue.use(VueScrollTo);
Vue.mixin(GlobalMixins);

Vue.directive('strip-unsafe-html', stripUnsafeHtml);
// Register global components
Vue.component('Badge', Badge);
Vue.component('PkpBadge', Badge);
Expand Down
2 changes: 1 addition & 1 deletion templates/submission/review-editors.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
<div
v-if="submission.commentsForTheEditors"
class="submissionWizard__reviewPanel__item__value"
v-html="submission.commentsForTheEditors"
v-strip-unsafe-html="submission.commentsForTheEditors"
></div>
<div v-else class="submissionWizard__reviewPanel__item__value">
{translate key="common.none"}
Expand Down
4 changes: 2 additions & 2 deletions templates/submission/review-publication-field.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<div
class="submissionWizard__reviewPanel__item__value"
{if $type === 'html'}
v-html="publication.{$localizedProp|escape}
v-strip-unsafe-html="publication.{$localizedProp|escape}
? publication.{$localizedProp|escape}
: '{translate key="common.noneProvided"}'"
{/if}
Expand All @@ -54,7 +54,7 @@
{translate key="common.noneProvided"}
</template>
{elseif $type === 'html'}
{* empty. see v-html above *}
{* empty. see v-strip-unsafe-html above *}
{else}
<template v-if="publication.{$localizedProp|escape}">
{{ publication.{$localizedProp|escape} }}
Expand Down
4 changes: 2 additions & 2 deletions templates/submission/wizard.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
</template>
<template v-if="localize(publication.title)">
<span class="app__breadcrumbsSeparator" aria-hidden="true">/</span>
<span v-html="localize(publication.title)">
<span v-strip-unsafe-html="localize(publication.title)">
</template>
</div>
<h1 class="app__pageHeading" ref="pageTitle">
Expand Down Expand Up @@ -74,7 +74,7 @@
<panel-section v-for="section in step.sections" :key="section.id">
<template slot="header">
<h2>{{ section.name }}</h2>
<div v-html="section.description" />
<div v-strip-unsafe-html="section.description" />
</template>
<pkp-form
v-if="section.type === 'form'"
Expand Down
2 changes: 1 addition & 1 deletion templates/workflow/submissionIdentification.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@

<span
class="pkpWorkflow__identificationTitle"
v-html="localizeSubmission(currentPublication.fullTitle, currentPublication.locale)"
v-strip-unsafe-html="localizeSubmission(currentPublication.fullTitle, currentPublication.locale)"
>
</span>

0 comments on commit fa3c7bf

Please sign in to comment.