Real-time collaborative editing for R and Shiny applications, built on Automerge CRDT.
Installation
pak::pak("shikokuchuo/autoedit")Features
| Component | Description | Sync Server |
|---|---|---|
editor() |
CodeMirror 6 code editor with cursor-preserving sync | Required |
kanban_ui() |
Collaborative kanban board with movable items | Not required |
textarea_ui() |
Basic synchronized textarea | Not required |
The editor provides the best experience for collaborative text editing, with proper cursor preservation when remote changes arrive.
The kanban module works well without a sync server because its actions (add, toggle, delete, move) are discrete - there’s no cursor position to preserve.
The textarea syncs correctly but has UX limitations (cursor jumps on remote edits), making it suitable only for simple use cases.
Quick Start
Editor (with sync server)
library(shiny)
library(autoedit)
library(autosync)
library(automerge)
sync_server <- amsync_server()
sync_server$start()
doc_id <- create_document(sync_server)
doc <- get_document(sync_server, doc_id)
am_put(doc, AM_ROOT, "text", am_text("Start typing..."))
am_commit(doc, "init")
ui <- fluidPage(editor_output("editor"))
server <- function(input, output, session) {
output$editor <- editor_render(editor(sync_server$url, doc_id))
}
onStop(function() sync_server$close())
shinyApp(ui, server)Open either app in multiple browser windows for real-time collaboration.