Printing improvements
This commit is contained in:
parent
d6ce199bb9
commit
071a88dc47
4 changed files with 35 additions and 38 deletions
|
|
@ -10,7 +10,7 @@
|
|||
</span>
|
||||
</div>
|
||||
|
||||
<div style="float: none"><div style="page-break-after: always"></div></div>
|
||||
<!-- <div style="float: none"><div style="page-break-after: always"></div></div> -->
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
|
@ -23,15 +23,13 @@ export default {
|
|||
Message,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
}
|
||||
return {};
|
||||
},
|
||||
props: ["topic", "show_message_data"],
|
||||
computed: {
|
||||
messagesToShow() {
|
||||
return this.topic.messages
|
||||
.filter(m => !m.responseTo)
|
||||
}
|
||||
return this.topic.messages.filter((m) => !m.responseTo);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -1,11 +1,8 @@
|
|||
<template>
|
||||
<section>
|
||||
<h1 class="title">{{ title }}</h1>
|
||||
<ul>
|
||||
<li
|
||||
v-for="topic in sortedTopics"
|
||||
:key="topic.title"
|
||||
>
|
||||
<ul class="index">
|
||||
<li v-for="topic in sortedTopics" :key="topic.title">
|
||||
<router-link
|
||||
:to="`#${toValidID(topic.title)}`"
|
||||
@click.stop="goTo(`#${toValidID(topic.title)}`)"
|
||||
|
|
@ -14,7 +11,7 @@
|
|||
</router-link>
|
||||
</li>
|
||||
</ul>
|
||||
<div style="float: none"><div style="page-break-after: always"></div></div>
|
||||
<!-- <div style="float: none"><div style="page-break-after: always"></div></div> -->
|
||||
<Chapter
|
||||
v-for="topic in sortedTopics"
|
||||
:key="topic.title"
|
||||
|
|
@ -40,24 +37,22 @@ export default {
|
|||
...mapState(["currentStream", "streams"]),
|
||||
...mapGetters(["sortedTopics"]),
|
||||
title() {
|
||||
return this.streams.find(s => s.name == this.currentStream) ?
|
||||
this.currentStream.replace("pub-", "") : 'Stream does not exist.'
|
||||
}
|
||||
|
||||
return this.streams.find((s) => s.name == this.currentStream)
|
||||
? this.currentStream.replace("pub-", "")
|
||||
: "Stream does not exist.";
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
toValidID(string) { return (
|
||||
encodeURIComponent('ch-' + string)
|
||||
.toLowerCase()
|
||||
.replace(/\.|%[0-9a-z]{2}/gi, '')
|
||||
)},
|
||||
toValidID(string) {
|
||||
return encodeURIComponent("ch-" + string)
|
||||
.toLowerCase()
|
||||
.replace(/\.|%[0-9a-z]{2}/gi, "");
|
||||
},
|
||||
goTo(id) {
|
||||
document
|
||||
.querySelector(`.${this.currentStream} ${id}`)
|
||||
.scrollIntoView({
|
||||
behavior: 'smooth'
|
||||
})
|
||||
}
|
||||
document.querySelector(`.${this.currentStream} ${id}`).scrollIntoView({
|
||||
behavior: "smooth",
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
|
@ -68,4 +63,8 @@ export default {
|
|||
/* display: none; */
|
||||
}
|
||||
}
|
||||
|
||||
.index {
|
||||
page-break-after: always;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -9,6 +9,8 @@ import { stripHtml } from "string-strip-html"
|
|||
var EmojiConvertor = require('emoji-js');
|
||||
var emojiConv = new EmojiConvertor();
|
||||
|
||||
// let emojis = require('emojis');
|
||||
|
||||
let toCSS = (message, currentStream) => {
|
||||
let content = stripHtml(message.content).result;
|
||||
let className = "",
|
||||
|
|
@ -25,14 +27,16 @@ let toCSS = (message, currentStream) => {
|
|||
let regex = /\s?(?<selector>.+)\s*\n?{\n?(?<props>(.*;\n?)+)}/gm
|
||||
let results = content.matchAll(regex);
|
||||
results = Array.from(results);
|
||||
|
||||
if (is_font) { // font
|
||||
let re_path = /\/user_uploads(\/.*?\.(?:ttf|otf|woff))/gm;
|
||||
// content = message.content.matchAll(re_path);
|
||||
content = re_path.exec(message.content)[1];
|
||||
// console.log(message.content, content)
|
||||
return { className: '', emoji_code: '', rules: [], parentClassName: '', id: id, content: font(content), type: type }
|
||||
} else if (is_codeblock) {
|
||||
return { className: '', emoji_code: '', rules: [], parentClassName: '', id: id, content: content, type: type }
|
||||
} else if (results.length > 0) { // rule and raw
|
||||
className = emojiConv.replace_colons(results[0]['groups']['selector']);
|
||||
|
||||
if (emoji.methods.containsEmoji(className)) {
|
||||
emoji_code = emoji.methods.toEmojiCode(className);
|
||||
}
|
||||
|
|
@ -40,6 +44,7 @@ let toCSS = (message, currentStream) => {
|
|||
rules = rules.filter((rule) => validateRule(rule))
|
||||
return { className, emoji_code, rules, parentClassName, id, content, type };
|
||||
}
|
||||
console.log("rejected rule", message)
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -134,6 +134,7 @@ export default {
|
|||
width: 100%;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.controls-pane {
|
||||
background-color: #aaa;
|
||||
}
|
||||
|
|
@ -174,20 +175,14 @@ export default {
|
|||
display: block !important;
|
||||
}
|
||||
|
||||
.print .body {
|
||||
.body {
|
||||
page-break-after: always;
|
||||
/* border-bottom: 3px dotted green; */
|
||||
}
|
||||
|
||||
.body img {
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
/* .print .body:first-of-type {
|
||||
page-break-after: always;
|
||||
border-bottom: 3px dotted yellow;
|
||||
} */
|
||||
|
||||
.float-btn {
|
||||
position: fixed;
|
||||
z-index: 1000;
|
||||
|
|
|
|||
Loading…
Reference in a new issue