diff --git a/.storybook/preview.js b/.storybook/preview.js index 546954d93..9906c7c7c 100644 --- a/.storybook/preview.js +++ b/.storybook/preview.js @@ -22,6 +22,9 @@ import Tab from '@/components/Tabs/Tab.vue'; import Tabs from '@/components/Tabs/Tabs.vue'; import FloatingVue from 'floating-vue'; +// Directives +import {allowedHtmlDirective} from '@/directive/allowedHtml.js'; + import PkpDialog from '@/components/Modal/Dialog.vue'; import VueScrollTo from 'vue-scrollto'; @@ -51,6 +54,10 @@ initialize({ setup((app) => { app.use(pinia); + + // directives + app.directive('pkp-allowed-html', allowedHtmlDirective); + app.mixin(GlobalMixins); app.use(FloatingVue, { diff --git a/package-lock.json b/package-lock.json index 3054a4bfe..32aa09a24 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,6 +16,7 @@ "chart.js": "^4.3.3", "clone-deep": "^4.0.1", "debounce": "^1.2.0", + "dompurify": "^3.0.8", "dropzone-vue3": "^1.0.2", "element-resize-event": "^3.0.6", "floating-vue": "^2.0.0-beta.24", @@ -8428,6 +8429,11 @@ "integrity": "sha512-6QvTW9mrGeIegrFXdtQi9pk7O/nSK6lSdXW2eqUspN5LWD7UTji2Fqw5V2YLjBpHEoU9Xl/eUWNpDeZvoyOv2w==", "dev": true }, + "node_modules/dompurify": { + "version": "3.0.8", + "resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.0.8.tgz", + "integrity": "sha512-b7uwreMYL2eZhrSCRC4ahLTeZcPZxSmYfmcQGXGkXiZSNW1X85v+SDM5KsWcpivIiUBH47Ji7NtyUdpLeF5JZQ==" + }, "node_modules/dotenv": { "version": "16.4.1", "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.1.tgz", diff --git a/package.json b/package.json index 85dad536f..8fb75b46a 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@ "chart.js": "^4.3.3", "clone-deep": "^4.0.1", "debounce": "^1.2.0", + "dompurify": "^3.0.8", "dropzone-vue3": "^1.0.2", "element-resize-event": "^3.0.6", "floating-vue": "^2.0.0-beta.24", diff --git a/public/globals.js b/public/globals.js index 8e46982f9..3cd33d973 100644 --- a/public/globals.js +++ b/public/globals.js @@ -3,6 +3,11 @@ * are not part of the UI Library's responsibilities */ window.pkp = { + serverContext: { + configAllowedHtml: + 'a[href|target|title],em,strong,cite,code,ul,ol,li[class],dl,dt,dd,b,i,u,img[src|alt],sup,sub,br,p', + apiBaseUrl: 'https://mock/index.php/publicknowledge/api/v1/', + }, /** * Event bus. This will be a Vue instance but must be registered in main.js * where Vue can be imported diff --git a/src/components/Container/SubmissionWizardPage.stories.js b/src/components/Container/SubmissionWizardPage.stories.js index ecad4d142..c8eff906a 100644 --- a/src/components/Container/SubmissionWizardPage.stories.js +++ b/src/components/Container/SubmissionWizardPage.stories.js @@ -86,7 +86,7 @@ const SubmissionWizardPageWithDataAndTemplate = {
@@ -262,7 +262,7 @@ const SubmissionWizardPageWithDataAndTemplate = {
{{ dateRangeLabel }} - +
diff --git a/src/components/FileAttacher/FileAttacher.vue b/src/components/FileAttacher/FileAttacher.vue index d085b0ab0..aa98e67a5 100644 --- a/src/components/FileAttacher/FileAttacher.vue +++ b/src/components/FileAttacher/FileAttacher.vue @@ -6,7 +6,7 @@ :key="key" >

{{ attacher.label }}

-

+

diff --git a/src/components/Form/FormGroup.vue b/src/components/Form/FormGroup.vue index 5528f30e8..8e8f50f45 100644 --- a/src/components/Form/FormGroup.vue +++ b/src/components/Form/FormGroup.vue @@ -4,8 +4,8 @@ {{ label }}

diff --git a/src/components/Form/fields/FieldArchivingPn.vue b/src/components/Form/fields/FieldArchivingPn.vue index 8066b9e0b..4662db2fe 100644 --- a/src/components/Form/fields/FieldArchivingPn.vue +++ b/src/components/Form/fields/FieldArchivingPn.vue @@ -19,8 +19,8 @@
diff --git a/src/components/Form/fields/FieldMetadataSetting.vue b/src/components/Form/fields/FieldMetadataSetting.vue index d8e76c4cd..ede2e8d06 100644 --- a/src/components/Form/fields/FieldMetadataSetting.vue +++ b/src/components/Form/fields/FieldMetadataSetting.vue @@ -6,8 +6,8 @@ diff --git a/src/components/Form/fields/FieldOptions.vue b/src/components/Form/fields/FieldOptions.vue index d60a3cb7e..8c991492f 100644 --- a/src/components/Form/fields/FieldOptions.vue +++ b/src/components/Form/fields/FieldOptions.vue @@ -21,8 +21,8 @@
- +
@@ -53,10 +53,10 @@