Title: | The 'Ace' Editor as a HTML Widget |
---|---|
Description: | Wraps the 'Ace' editor in a HTML widget. The 'Ace' editor has support for many languages. It can be opened in the viewer pane of 'RStudio', and this provides a second source editor. |
Authors: | Stéphane Laurent [aut, cre], James Hrisho [ctb, cph] ('react-ace' library), James Long and contributors [ctb, cph] ('Prettier' library), Zeb Zhao [ctb, cph] ('indent.js' library), jQuery contributors [ctb, cph] ('jQuery' library), Tristan Edwards [ctb, cph] ('sweetalert2' library), Limon Monte [ctb, cph] ('sweetalert2' library) |
Maintainer: | Stéphane Laurent <[email protected]> |
License: | GPL-3 |
Version: | 1.0.1 |
Built: | 2024-10-31 18:37:41 UTC |
Source: | https://github.com/stla/aceeditor |
Open the Ace diff editor.
aceDiffEditor( file1, file2, mode = NULL, theme = NULL, fontSize = 14, tabSize = NULL, autoCompletion = TRUE, snippets = FALSE, width = NULL, height = NULL, elementId = NULL )
aceDiffEditor( file1, file2, mode = NULL, theme = NULL, fontSize = 14, tabSize = NULL, autoCompletion = TRUE, snippets = FALSE, width = NULL, height = NULL, elementId = NULL )
file1 , file2
|
paths to files |
mode |
the language of the files; if |
theme |
the theme of the editor; if |
fontSize |
font size |
tabSize |
number of spaces for the indentation (usually |
autoCompletion |
logical, whether to enable the auto completion |
snippets |
logical, whether to enable the snippets (for example, there
is a snippet for |
width , height
|
dimensions; the default values are nice for usage in the RStudio viewer pane |
elementId |
a HTML id for the container; this is useless for common usage |
The diff editor does not correctly reacts when one resizes the RStudio viewer pane. You have to resize it before opening the diff editor.
file <- system.file("htmlwidgets", "aceEditor.css", package = "aceEditor") aceDiffEditor(file, file)
file <- system.file("htmlwidgets", "aceEditor.css", package = "aceEditor") aceDiffEditor(file, file)
Open the Ace editor.
aceEditor( contents, mode = NULL, theme = NULL, fontSize = 14, tabSize = NULL, autoCompletion = TRUE, snippets = FALSE, width = NULL, height = NULL, elementId = NULL )
aceEditor( contents, mode = NULL, theme = NULL, fontSize = 14, tabSize = NULL, autoCompletion = TRUE, snippets = FALSE, width = NULL, height = NULL, elementId = NULL )
contents |
this can be the path to a file, |
mode |
the language of the contents; if |
theme |
the theme of the editor; if |
fontSize |
font size |
tabSize |
number of spaces for the indentation (usually |
autoCompletion |
logical, whether to enable the auto completion |
snippets |
logical, whether to enable the snippets (for example, there
is a snippet for |
width , height
|
dimensions; the default values are nice for usage in the RStudio viewer pane |
elementId |
a HTML id for the container; this is useless for common usage |
# in RStudio, `aceEditor()` opens the current file: aceEditor() # opens a new JavaScript file: aceEditor(NULL, mode = "javascript") # opens an existing file: aceEditor(system.file("htmlwidgets", "aceEditor.css", package = "aceEditor")) # two editors side-by-side: library(aceEditor) library(htmltools) ed1 <- aceEditor( width = "100%", height = "calc(100vh - 10px)" ) ed2 <- aceEditor( width = "100%", height = "calc(100vh - 10px)" ) if(interactive()){ browsable( div( div(ed1, style="position: fixed; left: 1vw; right: 51vw;"), div(ed2, style="position: fixed; left: 51vw; right: 1vw;") ) ) } # two stacked editors: library(aceEditor) library(htmltools) ed1 <- aceEditor( height = "calc(50vh - 10px)", width = "100%" ) ed2 <- aceEditor( height = "calc(50vh - 10px)", width = "100%" ) if(interactive()){ browsable( tagList( tags$style(HTML( ".editor {", " position: fixed;", " left: 1vw;", " width: 98vw;", "}" )), div( div(ed1, class = "editor", style = "bottom: calc(50vh - 25px);"), div(ed2, class = "editor", style = "top: calc(50vh);") ) ) ) }
# in RStudio, `aceEditor()` opens the current file: aceEditor() # opens a new JavaScript file: aceEditor(NULL, mode = "javascript") # opens an existing file: aceEditor(system.file("htmlwidgets", "aceEditor.css", package = "aceEditor")) # two editors side-by-side: library(aceEditor) library(htmltools) ed1 <- aceEditor( width = "100%", height = "calc(100vh - 10px)" ) ed2 <- aceEditor( width = "100%", height = "calc(100vh - 10px)" ) if(interactive()){ browsable( div( div(ed1, style="position: fixed; left: 1vw; right: 51vw;"), div(ed2, style="position: fixed; left: 51vw; right: 1vw;") ) ) } # two stacked editors: library(aceEditor) library(htmltools) ed1 <- aceEditor( height = "calc(50vh - 10px)", width = "100%" ) ed2 <- aceEditor( height = "calc(50vh - 10px)", width = "100%" ) if(interactive()){ browsable( tagList( tags$style(HTML( ".editor {", " position: fixed;", " left: 1vw;", " width: 98vw;", "}" )), div( div(ed1, class = "editor", style = "bottom: calc(50vh - 25px);"), div(ed2, class = "editor", style = "top: calc(50vh);") ) ) ) }