Skip to content

Commit

Permalink
pkp/pkp-lib#9840 Remove vue3-highlightjs and from highlight.js use on…
Browse files Browse the repository at this point in the history
…ly XML language
  • Loading branch information
defstat committed May 18, 2024
1 parent 3390d3d commit 8d7f904
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions src/pages/workflow/PublicationSectionJats.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<div v-if="this.workingJatsProps['loadingContentError']">
{{ this.workingJatsProps['loadingContentError'] }}
</div>
<pre v-else v-highlightjs="workingJatsContent"><code class="xml"></code></pre>
<pre><code ref="highlightedCode" class="xml">{{ workingJatsContent }}</code></pre>
</div>
<div v-if="this.workingJatsProps['loadingContentError'] == null">
<div v-if="isDefaultContent" class="filePanel__hasData">
Expand Down Expand Up @@ -82,6 +82,12 @@ import ajaxError from '@/mixins/ajaxError';
import dialog from '@/mixins/dialog.js';
import FileUploader from '@/components/FileUploader/FileUploader.vue';
import hljs from 'highlight.js/lib/core';
import xml from 'highlight.js/lib/languages/xml';
// Register the XML language with Highlight.js
hljs.registerLanguage('xml', xml);
export default {
components: {
FileUploader,
Expand Down Expand Up @@ -287,6 +293,14 @@ export default {
document.body.removeChild(link);
}
},
highlightCode() {
this.$nextTick(() => {
const codeElement = this.$refs.highlightedCode;
if (codeElement) {
hljs.highlightElement(codeElement);
}
});
},
},
watch: {
newJatsFiles(newValue, oldValue) {
Expand All @@ -305,7 +319,12 @@ export default {
if (newValue != null) {
this.fetchWorkingJatsFile();
}
}
},
hasLoadedContent(newVal) {
if (newVal) {
this.highlightCode();
}
},
}
};
</script>
Expand Down

0 comments on commit 8d7f904

Please sign in to comment.