behavior TabbedEditor(editorId)
on load
set theme to the @data-editor-theme of the body
set editor to ace.edit(editorId)
call editor.setTheme(theme)
end
behavior EditorTab(editorId)
init
if no editorId set editorId to @data-editor-id
end
on load
set :tab to ace.createEditSession(@data-initial or '')
call :tab.setMode(@data-mode or 'ace/mode/plain_text')
if @data-tab is '1'
trigger click on me
end
put ` ${@data-filename}` into me
on click
set editor to ace.edit(editorId)
call editor.setSession(:tab)
remove .active from < [data-tab] />
add .active on me
on mutation of @data-mode
call :tab.setMode(@data-mode)
on mutation of @data-filename
put ` ${@data-filename}` into me
on playground:collectTabs(files)
if @data-tab is not 'exclude'
set file to {content: :tab.getValue(), file_name: @data-filename, highlighter_mode: @data-mode}
append file to files
end
on playground:collectFiles(files)
if @data-tab is not 'exclude'
set file to {content: :tab.getValue(), file_name: @data-filename, highlighter_mode: @data-mode}
append file to files
end
end
behavior SingleEditor
on load
set theme to the @data-editor-theme of the body
set :editor to ace.edit(me.id)
call :editor.setTheme(theme)
call :editor.session.setMode(@data-mode or 'ace/mode/plain_text')
call :editor.session.setValue(@data-initial or '')
on playground:collectCommandEditor(files)
log 'responding to collectCommandEditor'
set file to {content: :editor.getValue(), file_name: @data-filename, highlighter_mode: @data-mode}
append file to files
on playground:collectFiles(files)
set file to {content: :editor.getValue(), file_name: @data-filename, highlighter_mode: @data-mode}
append file to files
end