<div id="section-editor-{{pageId}}">
    <div class="row">
		<div class="col-8 section-editor">
            {{#if blockMode}}
                <div class="form-group">
                    {{focus-input id="page-id-{{pageId}}" value=pageTitle class=(if hasNameError 'form-control mousetrap form-control-lg edit-title is-invalid' 'form-control form-control-lg edit-title mousetrap') placeholder="Enter name"}}
                </div>
                <div class="form-group">
                    {{textarea id="page-excerpt-{{pageId}}" value=page.excerpt rows="2" class=(if hasDescError 'form-control mousetrap form-control-lg edit-title is-invalid' 'form-control form-control-lg edit-title mousetrap') placeholder="Enter description"}}
                </div>
            {{else}}
                <div class="form-group">
                    {{focus-input type="text" id=pageId value=pageTitle class=(if hasNameError 'form-control mousetrap form-control-lg edit-title is-invalid' 'form-control form-control-lg edit-title mousetrap') placeholder="Enter name"}}
                </div>
            {{/if}}
        </div>
		<div class="col-4">
			<div class="float-right">
				{{#if busy}}
					<img src="/assets/img/busy-gray.gif" class="busy-indicator" />
				{{/if}}

				{{#if contentLinkerButton}}
					<div class="btn btn-primary" id="section-editor-link-button-{{pageId}}" data-toggle="tooltip" data-placement="top" title="Insert link" {{action 'onShowLinkModal'}}>Link</div>
				{{/if}}

				{{#if previewButton}}
                    <div class="btn btn-primary" id="section-editor-preview-button-{{pageId}}" {{action 'onPreview'}}>{{previewText}}</div>
				{{/if}}

				<div class="btn btn-success" {{action 'onAction'}}>Save</div>
				<div class="btn btn-outline-secondary" id="section-editor-cancel-button-{{pageId}}" {{action 'onCancel'}}>Cancel</div>
			</div>
        </div>
    </div>
	<div class="row">
        <div class="col section-editor">
            <div class="canvas rounded mt-5">
                {{yield}}
            </div>
        </div>
	</div>
</div>

<div id={{concat "discard-modal-" page.id}} class="modal" tabindex="-1" role="dialog">
	<div class="modal-dialog" role="document">
		<div class="modal-content">
			<div class="modal-header">Discard Changes</div>
			<div class="modal-body">
				<p>You have made changes to the section - continue editing or discard changes?</p>
			</div>
			<div class="modal-footer">
				<button type="button" class="btn btn-outline-secondary" data-dismiss="modal">Continue editing</button>
				<button type="button" class="btn btn-danger" onclick={{action 'onDiscard'}}>Discard changes</button>
			</div>
		</div>
	</div>
</div>

{{document/content-linker document=document folder=folder page=page showModal=showLinkModal onInsertLink=(action 'onInsertLink')}}
