Hello world

First open source release of Campfire 🎉
This commit is contained in:
Kevin McConnell
2025-08-15 11:02:42 +01:00
commit df76a227dc
664 changed files with 36235 additions and 0 deletions
@@ -0,0 +1,5 @@
import SuggestionSelectElement from "lib/autocomplete/custom_elements/suggestion_select"
import SuggestionOptionElement from "lib/autocomplete/custom_elements/suggestion_option"
customElements.define("suggestion-select", SuggestionSelectElement)
customElements.define("suggestion-option", SuggestionOptionElement)
+23
View File
@@ -0,0 +1,23 @@
class Current {
get user() {
const currentUserId = this.#extractContentFromMetaTag("current-user-id")
if (currentUserId) {
return { id: parseInt(currentUserId), name: this.#extractContentFromMetaTag("current-user-name") }
}
}
get room() {
const currentRoomId = this.#extractContentFromMetaTag("current-room-id")
if (currentRoomId) {
return { id: parseInt(currentRoomId) }
}
}
#extractContentFromMetaTag(name) {
return document.head.querySelector(`meta[name="${name}"]`)?.getAttribute("content")
}
}
window.Current = new Current()
+29
View File
@@ -0,0 +1,29 @@
import hljs from "highlight.js"
import bash from "languages/bash"
import css from "languages/css"
import diff from "languages/diff"
import go from "languages/go"
import java from "languages/java"
import javascript from "languages/javascript"
import json from "languages/json"
import python from "languages/python"
import ruby from "languages/ruby"
import rust from "languages/rust"
import sql from "languages/sql"
import xml from "languages/xml"
hljs.registerLanguage("bash", bash)
hljs.registerLanguage("css", css)
hljs.registerLanguage("diff", diff)
hljs.registerLanguage("go", go)
hljs.registerLanguage("java", java)
hljs.registerLanguage("javascript", javascript)
hljs.registerLanguage("json", json)
hljs.registerLanguage("python", python)
hljs.registerLanguage("ruby", ruby)
hljs.registerLanguage("rust", rust)
hljs.registerLanguage("sql", sql)
hljs.registerLanguage("xml", xml)
window.hljs = hljs
+4
View File
@@ -0,0 +1,4 @@
import "initializers/autocomplete"
import "initializers/current"
import "initializers/rich_text"
import "initializers/highlight"
+10
View File
@@ -0,0 +1,10 @@
import Unfurler from "lib/rich_text/unfurl/unfurler"
// Support a `cite` block for attribution links
Trix.config.blockAttributes.cite = {
tagName: "cite",
inheritable: false,
}
const unfurler = new Unfurler()
unfurler.install()