class @Mercury.PageEditor
# options
# saveStyle: 'form', or 'json' (defaults to json)
# saveDataType: 'xml', 'json', 'jsonp', 'script', 'text', 'html' (defaults to json)
# saveMethod: 'POST', or 'PUT', create or update actions on save (defaults to POST)
# visible: boolean, if the interface should start visible or not (defaults to true)
constructor: (@saveUrl = null, @options = {}) ->
throw Mercury.I18n('Mercury.PageEditor can only be instantiated once.') if window.mercuryInstance
@options.visible = true unless (@options.visible == false || @options.visible == 'no')
@visible = @options.visible
window.mercuryInstance = @
@regions = []
@initializeInterface()
Mercury.csrfToken = token if token = jQuery(Mercury.config.csrfSelector).attr('content')
initializeInterface: ->
@focusableElement = jQuery('', {class: 'mercury-focusable', type: 'text'}).appendTo(@options.appendTo ? 'body')
@iframe = jQuery('