{{ $.type.name }}
+diff --git a/front/docs/CSS.md b/front/docs/CSS.md index 0901aeb..031f779 100644 --- a/front/docs/CSS.md +++ b/front/docs/CSS.md @@ -1,5 +1,13 @@ # CSS +In this document we take a look at what CSS is and how it can be applied to a publication in **Chatty-pub**. + +- [What is CSS](#css) +- [Rules](#rules) +- [Css in chatty-pub](#chatty-pub) +- [Print settings](#print-settings) +- [Typing Emoji](#emoji) + ## What is CSS? CSS (Cascading Style Sheets) is the language that allows you to style and layout HTML web pages. This article explains what CSS is, with some simple syntax examples, and also covers some key terms about the language. @@ -12,7 +20,7 @@ But what HTML does not do is speficy how these elements should look. That is whe CSS can be used for very basic document text styling — for example changing the color and size of headings and links. It can be used to create layout — for example turning a single column of text into a layout with a main content area and a sidebar for related information. It can even be used for effects such as animation. In Chatty-pub we're mostly interested in the first part. -### Rules +## Rules #### _Elements and Classes_ @@ -22,10 +30,10 @@ CSS is a rule-based language — you define rules specifying groups of styles th The following code shows a very simple CSS rule that would achieve the styling described above: -```lang-css +```css h1 { - color: red; - font-size: 5em; + color: red; + font-size: 20px; } ``` @@ -39,7 +47,7 @@ The example above will style all the `H1` elements on the page. You could also w Take this HTML: -```lang=html +```html
+```
+@keyframes example {
+ from {background-color: red;}
+ to {background-color: yellow;}
+}
+```
+
+
+## Print settings
+
+To set the paper size we can use the special selector `@page`. The following snippet set the page size to A5.
+
+```css
+@page {
+ size: 148mm 210mm;
+}
+```
+
+Regrettably browser support for `@page` is [spotty](https://caniuse.com/css-paged-media). You will get the best results using Google Chrome.
+
+[Pagedmedia.org](https://www.pagedmedia.org/pagedjs-sneak-peeks/) has an excellent explanation on using `@page`. The [Paged media module](https://developer.mozilla.org/en-US/docs/Web/CSS/Paged_Media) at Mozilla also.
+
+It may be necessary to use the methods described under [Advanced CSS](#advanced-css) above to enter these rules.
## List of common and handy CSS properties
-There are hundreds of CSS properties, so I can't list them all here. Below is a small selection of some basic properties grouped by module. Most of them are self explainatory, otherwise I've added a small note.
+There are hundreds of CSS properties. Below is a small selection of some basic properties mostly focussed on layout and type representation, grouped by module.
### Backgrounds and borders
@@ -106,6 +166,11 @@ A colors value can defined in multiple ways:
- By [hex value](http://web.simmons.edu/~grovesd/comm244/notes/week3/css-colors#hex) - `color: #ff0000;` also red.
- Or as a [function](http://web.simmons.edu/~grovesd/comm244/notes/week3/css-colors#rgba), which allows transparency. - `color: rgba(255,0,0,0.5);` red, but 50% transparent.
+### Box model
+
+- [margin](https://developer.mozilla.org/en-US/docs/Web/CSS/margin) - The margin property sets the margin area on all four sides of an element. Margin refers to space between different elements.
+- [padding](https://developer.mozilla.org/en-US/docs/Web/CSS/padding) - The padding property sets the padding area on all four sides of an element at once. Padding refers to the spacing inside the border of an element.
+
### Fonts
- TBD/Todo
diff --git a/front/package-lock.json b/front/package-lock.json
index b3af0ad..39f6db3 100644
--- a/front/package-lock.json
+++ b/front/package-lock.json
@@ -1059,7 +1059,6 @@
"version": "7.14.5",
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.14.5.tgz",
"integrity": "sha512-121rumjddw9c3NCQ55KGkyE1h/nzWhU/owjhw0l4mQrkzz4x9SGS1X8gFLraHwX7td3Yo4QTL+qj0NcIzN87BA==",
- "dev": true,
"requires": {
"regenerator-runtime": "^0.13.4"
}
@@ -4745,6 +4744,19 @@
}
}
},
+ "emoji-datasource": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/emoji-datasource/-/emoji-datasource-4.1.0.tgz",
+ "integrity": "sha1-tEVX94ot+sLzUDkzkbFwpWfsKK0="
+ },
+ "emoji-js": {
+ "version": "3.5.0",
+ "resolved": "https://registry.npmjs.org/emoji-js/-/emoji-js-3.5.0.tgz",
+ "integrity": "sha512-5uaULzdR3g6ALBC8xUzyoxAx6izT1M4+DEsxHLRS2/gaOKC/p62831itMoMsYfUj1fKX3YG01u5YVz2v7qpsWg==",
+ "requires": {
+ "emoji-datasource": "4.1.0"
+ }
+ },
"emoji-regex": {
"version": "8.0.0",
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
@@ -7278,6 +7290,11 @@
"integrity": "sha1-soqmKIorn8ZRA1x3EfZathkDMaY=",
"dev": true
},
+ "lodash.clonedeep": {
+ "version": "4.5.0",
+ "resolved": "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz",
+ "integrity": "sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8="
+ },
"lodash.debounce": {
"version": "4.0.8",
"resolved": "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz",
@@ -7295,6 +7312,11 @@
"resolved": "https://registry.npmjs.org/lodash.flow/-/lodash.flow-3.5.0.tgz",
"integrity": "sha1-h79AKSuM+D5OjOGjrkIJ4gBxZ1o="
},
+ "lodash.isplainobject": {
+ "version": "4.0.6",
+ "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz",
+ "integrity": "sha1-fFJqUtibRcRcxpC4gWO+BJf1UMs="
+ },
"lodash.kebabcase": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/lodash.kebabcase/-/lodash.kebabcase-4.1.1.tgz",
@@ -7319,12 +7341,22 @@
"integrity": "sha1-EjBkIvYzJK7YSD0/ODMrX2cFR6A=",
"dev": true
},
+ "lodash.trim": {
+ "version": "4.5.1",
+ "resolved": "https://registry.npmjs.org/lodash.trim/-/lodash.trim-4.5.1.tgz",
+ "integrity": "sha1-NkJefukL5KpeJ7zruFt9EepHqlc="
+ },
"lodash.uniq": {
"version": "4.5.0",
"resolved": "https://registry.npmjs.org/lodash.uniq/-/lodash.uniq-4.5.0.tgz",
"integrity": "sha1-0CJTc662Uq3BvILklFM5qEJ1R3M=",
"dev": true
},
+ "lodash.without": {
+ "version": "4.4.0",
+ "resolved": "https://registry.npmjs.org/lodash.without/-/lodash.without-4.4.0.tgz",
+ "integrity": "sha1-PNRXSgC2e643OpS3SHcmQFB7eqw="
+ },
"log-symbols": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-2.2.0.tgz",
@@ -9402,6 +9434,44 @@
"integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==",
"dev": true
},
+ "ranges-apply": {
+ "version": "5.1.0",
+ "resolved": "https://registry.npmjs.org/ranges-apply/-/ranges-apply-5.1.0.tgz",
+ "integrity": "sha512-VF3a0XUuYS/BQHv2RaIyX1K7S1hbfrs64hkGKgPVk0Y7p4XFwSucjTTttrBqmkcmB/PZx5ISTZdxErRZi/89aQ==",
+ "requires": {
+ "@babel/runtime": "^7.14.0",
+ "ranges-merge": "^7.1.0"
+ }
+ },
+ "ranges-merge": {
+ "version": "7.1.0",
+ "resolved": "https://registry.npmjs.org/ranges-merge/-/ranges-merge-7.1.0.tgz",
+ "integrity": "sha512-coTHcyAEIhoEdsBs9f5f+q0rmy7UHvS/5nfuXzuj5oLX/l/tbqM5uxRb6eh8WMdetXia3lK67ZO4tarH4ieulQ==",
+ "requires": {
+ "@babel/runtime": "^7.14.0",
+ "ranges-push": "^5.1.0",
+ "ranges-sort": "^4.1.0"
+ }
+ },
+ "ranges-push": {
+ "version": "5.1.0",
+ "resolved": "https://registry.npmjs.org/ranges-push/-/ranges-push-5.1.0.tgz",
+ "integrity": "sha512-vqGcaGq7GWV1zBa9w83E+dzYkOvE9/3pIRUPvLf12c+mGQCf1nesrkBI7Ob8taN2CC9V1HDSJx0KAQl0SgZftA==",
+ "requires": {
+ "@babel/runtime": "^7.14.0",
+ "ranges-merge": "^7.1.0",
+ "string-collapse-leading-whitespace": "^5.1.0",
+ "string-trim-spaces-only": "^3.1.0"
+ }
+ },
+ "ranges-sort": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/ranges-sort/-/ranges-sort-4.1.0.tgz",
+ "integrity": "sha512-GOQgk6UtsrfKFeYa53YLiBVnLINwYmOk5l2QZG1csZpT6GdImUwooh+/cRrp7b+fYawZX/rnyA3Ul+pdgQBIzA==",
+ "requires": {
+ "@babel/runtime": "^7.14.0"
+ }
+ },
"raw-body": {
"version": "2.4.0",
"resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.4.0.tgz",
@@ -9469,8 +9539,7 @@
"regenerator-runtime": {
"version": "0.13.7",
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.7.tgz",
- "integrity": "sha512-a54FxoJDIr27pgf7IgeQGxmqUNYrcV338lf/6gH456HZ/PhX+5BcwHXG9ajESmwe6WRO0tAzRUrRmNONWgkrew==",
- "dev": true
+ "integrity": "sha512-a54FxoJDIr27pgf7IgeQGxmqUNYrcV338lf/6gH456HZ/PhX+5BcwHXG9ajESmwe6WRO0tAzRUrRmNONWgkrew=="
},
"regenerator-transform": {
"version": "0.14.5",
@@ -10418,6 +10487,11 @@
"extend-shallow": "^3.0.0"
}
},
+ "splitpanes": {
+ "version": "3.0.4",
+ "resolved": "https://registry.npmjs.org/splitpanes/-/splitpanes-3.0.4.tgz",
+ "integrity": "sha512-KRaPtMDpu++OfvAzNQYE5U7WT5NoMA6l9B0buC4PhYoDILVLY8zN7Sp9cHXAgLhH59jI3lKzVoNqyf4OGRv7QQ=="
+ },
"sprintf-js": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz",
@@ -10534,12 +10608,60 @@
"integrity": "sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM=",
"dev": true
},
+ "string-collapse-leading-whitespace": {
+ "version": "5.1.0",
+ "resolved": "https://registry.npmjs.org/string-collapse-leading-whitespace/-/string-collapse-leading-whitespace-5.1.0.tgz",
+ "integrity": "sha512-mYz9/Kb5uvRB4DZj46zILwI4y9lD9JsvXG9Xb7zjbwm0I/R40G7oFfMsqJ28l2d7gWMTLJL569NfJQVLQbnHCw==",
+ "requires": {
+ "@babel/runtime": "^7.14.0"
+ }
+ },
"string-hash": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/string-hash/-/string-hash-1.1.3.tgz",
"integrity": "sha1-6Kr8CsGFW0Zmkp7X3RJ1311sgRs=",
"dev": true
},
+ "string-left-right": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/string-left-right/-/string-left-right-4.1.0.tgz",
+ "integrity": "sha512-ic/WvfNVUygWWsgg8akzSzp2NuttfhrdbH7QmSnda5b5RFmT9aCEDiS/M+gmTJwtFy7+b/2AXU4Z6vejcePQqQ==",
+ "requires": {
+ "@babel/runtime": "^7.14.0",
+ "lodash.clonedeep": "^4.5.0",
+ "lodash.isplainobject": "^4.0.6"
+ }
+ },
+ "string-strip-html": {
+ "version": "8.3.0",
+ "resolved": "https://registry.npmjs.org/string-strip-html/-/string-strip-html-8.3.0.tgz",
+ "integrity": "sha512-1+rjTPt0JjpFr1w0bfNL1S6O0I9fJDqM+P3pFTpC6eEEpIXhmBvPLnaQoEuWarswiH219qCefDSxTLxGQyHKUg==",
+ "requires": {
+ "@babel/runtime": "^7.14.0",
+ "html-entities": "^2.3.2",
+ "lodash.isplainobject": "^4.0.6",
+ "lodash.trim": "^4.5.1",
+ "lodash.without": "^4.4.0",
+ "ranges-apply": "^5.1.0",
+ "ranges-push": "^5.1.0",
+ "string-left-right": "^4.1.0"
+ },
+ "dependencies": {
+ "html-entities": {
+ "version": "2.3.2",
+ "resolved": "https://registry.npmjs.org/html-entities/-/html-entities-2.3.2.tgz",
+ "integrity": "sha512-c3Ab/url5ksaT0WyleslpBEthOzWhrjQbg75y7XUsfSzi3Dgzt0l8w5e7DylRn15MTlMMD58dTfzddNS2kcAjQ=="
+ }
+ }
+ },
+ "string-trim-spaces-only": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/string-trim-spaces-only/-/string-trim-spaces-only-3.1.0.tgz",
+ "integrity": "sha512-AW7RSi3+QtE6wR+4m/kmwlyy39neBbCIzrzzu1/RGzNRiPKQOeB3rGzr4ubg4UIQgYtr2w0PrxhKPXgyqJ0vaQ==",
+ "requires": {
+ "@babel/runtime": "^7.14.0"
+ }
+ },
"string-width": {
"version": "4.2.2",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.2.tgz",
diff --git a/front/src/App.vue b/front/src/App.vue
index 7084050..276656f 100644
--- a/front/src/App.vue
+++ b/front/src/App.vue
@@ -47,8 +47,8 @@ export default {
this.getStreams();
this.$router.afterEach((to) => {
- this.$store.commit("setContents", []);
- this.$store.commit("setRules", []);
+ this.$store.commit("setTopics", []);
+ this.$store.commit("setRules", []);
this.$store.commit("setCurStream", to.path.replace("/", ""))
if (this.currentStream != "") {
this.setUpDoc(this.currentStream);
@@ -83,18 +83,18 @@ export default {
api.zulip.addSub(this.zulipClient, this.currentStream)
}
})
-
- api.zulip.getMsgs(this.zulipClient, stream, "content").then((result) => {
+
+ api.zulip.getAllMsgs(this.zulipClient, stream).then((result) => {
for (let m = 0; m < result.messages.length; m++) {
const message = result.messages[m]
- this.$store.commit('addMessage', message)
+ if (message.subject == 'rules') {
+ this.$store.commit('addRule', message)
+ } else {
+ this.$store.commit('addMessage', message)
+ }
}
});
- api.zulip.getMsgs(this.zulipClient, stream, "rules").then((result) => {
- this.$store.commit("setRules", result.messages);
- });
-
},
eventHandler(event) {
diff --git a/front/src/api/zulip/index.js b/front/src/api/zulip/index.js
index 291e31d..82fc02e 100644
--- a/front/src/api/zulip/index.js
+++ b/front/src/api/zulip/index.js
@@ -36,7 +36,7 @@ const
// apply_markdown: false,
narrow: [
{ operator: "stream", operand: stream },
- { operator: "topic", operand: topic },
+ { operator: "topic", operand: topic },
],
})
.then(result => resolve(result))
@@ -44,6 +44,22 @@ const
})
),
+ getAllMsgs = (client, stream, params) => ( new
+ Promise((resolve, reject) => {
+ client
+ .messages
+ .retrieve(params || {
+ anchor: "newest",
+ num_before: 100,
+ num_after: 0,
+ // apply_markdown: false,
+ narrow: [{ operator: "stream", operand: stream }],
+ })
+ .then(result => resolve(result))
+ .catch(error => reject(error))
+ })
+ ),
+
listen = (client, cb) => {
client
.callOnEachEvent(
@@ -100,6 +116,7 @@ export default {
config,
getStreams,
getMsgs,
+ getAllMsgs,
listen,
sendMsg,
getSubs,
diff --git a/front/src/components/Content/Message.vue b/front/src/components/Content/Message.vue
index ac2ff1a..cf45cd7 100644
--- a/front/src/components/Content/Message.vue
+++ b/front/src/components/Content/Message.vue
@@ -27,7 +27,9 @@ export default {
c = c.replaceAll('src="', 'src="' + url);
c = c.replaceAll('href="/', 'href="' + url + "/");
- const referrers = this.$store.state.contents.filter(
+ const referrers = this.$store.state
+ .topics.find(t => t.title == this.message.subject)
+ .messages.filter(
(m) =>
m.responseTo &&
m.responseTo.id == this.message.id &&
diff --git a/front/src/components/Content/index.vue b/front/src/components/Content/index.vue
index 7c6c985..6a01929 100644
--- a/front/src/components/Content/index.vue
+++ b/front/src/components/Content/index.vue
@@ -1,12 +1,13 @@
- {{ $.type.name }}
+