diff --git a/src/pluto/js.cljs b/src/pluto/js.cljs index 1fa0c26..ba3ac53 100644 --- a/src/pluto/js.cljs +++ b/src/pluto/js.cljs @@ -9,5 +9,16 @@ (defn ^:export from-clj [o] (clj->js o)) -(defn ^:export parse [opts m] - (reader/parse (js->clj opts) (:data m))) \ No newline at end of file +(def ctx + {:capacities {:components {'text :text 'view :div 'status/token-selector :div 'status/asset-selector :div} + :hooks {:commands {:properties {:scope #{:personal-chats :public-chats} + :description :string + :short-preview :view + :preview :view + :parameters [{:id :keyword + :type {:one-of #{:text :phone :password :number}} + :placeholder :string + :suggestions? :component}]}}}}}) + +(defn ^:export parse [m] + (reader/parse ctx (:data m))) \ No newline at end of file diff --git a/website/pages/try.html b/website/pages/try.html index 1eb6a82..b94482a 100644 --- a/website/pages/try.html +++ b/website/pages/try.html @@ -23,9 +23,9 @@ ipfs.once("ready", async () => { const content = await load(); - cm.setValue(content); - cm.markText({line: 10, ch:0}, {line: 12, ch: 20}, {classname: "test2"}); - cm.addLineClass(4, "", "test") + codeMirror.setValue(content); + codeMirror.markText({line: 10, ch:0}, {line: 12, ch: 20}, {classname: "test2"}); + codeMirror.addLineClass(4, "", "test") }) function extensionLink(hash) { @@ -37,34 +37,38 @@ } async function publish() { - const content = cm.getValue(); + const content = codeMirror.getValue(); const filesAdded = await uploadIPFS(ipfs, content); - qr(document.getElementById('qr'), extensionLink(filesAdded[0].hash)); + displayQR(extensionLink(filesAdded[0].hash)); } function clearErrors() { - const el = document.getElementById("errors"); - el.innerHTML = ''; - el.className = ""; + const elErrors = document.getElementById("errors"); + elErrors.innerHTML = ''; + elErrors.className = ""; } function displayErrors(errors) { - const el = document.getElementById("errors"); + const elErrors = document.getElementById("errors"); if (errors == null) { - el.innerHTML = '
No errors
'; - el.classList.add("ok"); + elErrors.innerHTML = '
No errors
'; + elErrors.classList.add("ok"); } else { - el.classList.add("errors"); + elErrors.classList.add("errors"); let names = errors.map( (error, i) => { return [error.type, error.value] }) var s = '
Errors
") - el.innerHTML = s; + elErrors.innerHTML = s; } } @@ -73,9 +77,11 @@ content: ipfs.types.Buffer.from(s, 'utf8')}) } - function qr(el, s) { + function displayQR(s) { + const qel = document.getElementById("qr-wrapper"); + qel.innerHTML = 'Universal link'; new QRious({ - element: el, + element: document.getElementById('qr'), value: s, size: 250 }); @@ -90,25 +96,23 @@

A playground to experiment with extensions and easily publish them on IPFS.
Go ahead, modify the default extension on the left side!

Find more details about building your own extension in this tutorial

- +
diff --git a/website/static/css/custom.css b/website/static/css/custom.css index 648895a..ef8e13a 100644 --- a/website/static/css/custom.css +++ b/website/static/css/custom.css @@ -144,4 +144,10 @@ main { #qr { z-index: -1; +} + +#qr-wrapper { + display: flex; + flex-direction: column; + align-items: center; } \ No newline at end of file