mirror of
https://github.com/basecamp/once-campfire.git
synced 2026-09-15 21:12:04 +09:00
Hello world
First open source release of Campfire 🎉
This commit is contained in:
@@ -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)
|
||||
@@ -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()
|
||||
@@ -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
|
||||
@@ -0,0 +1,4 @@
|
||||
import "initializers/autocomplete"
|
||||
import "initializers/current"
|
||||
import "initializers/rich_text"
|
||||
import "initializers/highlight"
|
||||
@@ -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()
|
||||
Reference in New Issue
Block a user