Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Experimental JS API for getting/setting cell metadata #2612

Merged
merged 1 commit into from
Jul 17, 2023

Conversation

fonsp
Copy link
Owner

@fonsp fonsp commented Jul 17, 2023

We already had epxeirmental JS API for notebook metadata, but now also for cells!

Example notebook:

### A Pluto.jl notebook ###
# v0.19.27

using Markdown
using InteractiveUtils

# ╔═╡ 339c3ba2-95e1-44a2-9601-8382e0cfb9cf
# ╠═╡ number = 0.13315567181932053
html"""
<script>
console.log("before", getCellMetadataExperimental("number"))
await setCellMetadataExperimental("number", Math.random())
	
console.log("after", getCellMetadataExperimental("number"))

// await deleteCellMetadataExperimental("number")
</script>
"""

# ╔═╡ 9f26c140-24b0-11ee-1332-c3ced47002e2
# ╠═╡ aa = 1232
html"""
<script>
await setCellMetadataExperimental("aa", 777, {cell_id: "f8fc0eb8-0ef6-4096-a54f-c04c741f8258"})
console.log(getCellMetadataExperimental("aa", {cell_id: "f8fc0eb8-0ef6-4096-a54f-c04c741f8258"}))
await deleteCellMetadataExperimental("aa", {cell_id: "f8fc0eb8-0ef6-4096-a54f-c04c741f8258"})
</script>
"""

# ╔═╡ f8fc0eb8-0ef6-4096-a54f-c04c741f8258


# ╔═╡ Cell order:
# ╠═339c3ba2-95e1-44a2-9601-8382e0cfb9cf
# ╠═9f26c140-24b0-11ee-1332-c3ced47002e2
# ╠═f8fc0eb8-0ef6-4096-a54f-c04c741f8258

cc @lucaferranti

@fonsp fonsp added the frontend Concerning the HTML editor label Jul 17, 2023
@github-actions
Copy link
Contributor

Try this Pull Request!

Open Julia and type:

julia> import Pkg
julia> Pkg.activate(temp=true)
julia> Pkg.add(url="https://github.com/fonsp/Pluto.jl", rev="secret-JS-API-for-cell-metadata")
julia> using Pluto

@fonsp fonsp merged commit c80464d into main Jul 17, 2023
4 checks passed
@fonsp fonsp deleted the secret-JS-API-for-cell-metadata branch July 17, 2023 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
frontend Concerning the HTML editor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant