braid-text 0.5.3 → 0.5.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/server-demo.js +4 -3
- package/server.js +1004 -1050
package/package.json
CHANGED
package/server-demo.js
CHANGED
|
@@ -14,14 +14,15 @@ var server = require("http").createServer(async (req, res) => {
|
|
|
14
14
|
if (req.method === 'OPTIONS') return res.end()
|
|
15
15
|
|
|
16
16
|
var q = req.url.split('?').slice(-1)[0]
|
|
17
|
-
if (q === 'editor' || q === 'markdown-editor') {
|
|
17
|
+
if (q === 'editor' || q === 'markdown-editor' || q === 'yjs-editor' || q === 'demo') {
|
|
18
18
|
res.writeHead(200, { "Content-Type": "text/html", "Cache-Control": "no-cache" })
|
|
19
19
|
require("fs").createReadStream(`./client/${q}.html`).pipe(res)
|
|
20
20
|
return
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
if (req.url === '/simpleton-sync.js' || req.url === '/web-utils.js'
|
|
24
|
-
|| req.url === '/textarea-highlights.js' || req.url === '/cursor-sync.js'
|
|
24
|
+
|| req.url === '/textarea-highlights.js' || req.url === '/cursor-sync.js'
|
|
25
|
+
|| req.url === '/yjs-sync.js') {
|
|
25
26
|
res.writeHead(200, { "Content-Type": "text/javascript", "Cache-Control": "no-cache" })
|
|
26
27
|
require("fs").createReadStream("./client" + req.url).pipe(res)
|
|
27
28
|
return
|
|
@@ -55,7 +56,7 @@ var server = require("http").createServer(async (req, res) => {
|
|
|
55
56
|
// }
|
|
56
57
|
|
|
57
58
|
// Create some initial text for new documents
|
|
58
|
-
if (!(await braid_text.get(req.url, {})).version.length) {
|
|
59
|
+
if (!(await braid_text.get(req.url, {full_response: true})).version.length) {
|
|
59
60
|
await braid_text.put(req.url, {body: 'This is a fresh blank document, ready for you to edit.' })
|
|
60
61
|
}
|
|
61
62
|
|