Commit 14c198fe authored by schneider210's avatar schneider210
Browse files

(re)implement support styles for the text part

parent 98d1882a
Pipeline #132281 passed with stages
in 7 minutes and 47 seconds
<template>
<div v-html="content"></div>
<div :id="nodeid" v-html="content"></div>
</template>
<script>
......@@ -7,13 +7,30 @@ export default {
name: 'Content',
props: {
itemurl: String,
manifests: Array,
request: Function,
},
data() {
return {
content: '',
nodeid: '__text',
};
},
methods: {
getSupport(obj) {
if (obj.type === 'css') {
this.request(obj.url, 'text')
.then((data) => {
const styleElement = document.createElement('style');
styleElement.innerText = data.replace(
/^|}|,/gm, (x) => x.concat('#', this.nodeid, ' '),
);
document.head.appendChild(styleElement);
});
}
},
},
created() {
this.request(this.itemurl)
.then((data) => {
......@@ -25,6 +42,8 @@ export default {
.catch(() => {
// nested async request. promise is pending, so JSON_parse fails
});
// this.manifests[index].support.map(this.getSupport);
},
};
</script>
......
......@@ -21,6 +21,7 @@
<Content
:key="itemurl"
:itemurl="itemurl"
:manifests="manifests"
:request="request"
>
</Content>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment