2013-06-26 16:11:41 -07:00
|
|
|
@using Orchard.Environment.Descriptor.Models
|
|
|
|
|
|
|
|
|
|
@{
|
2011-09-27 16:36:48 -07:00
|
|
|
Script.Require("OrchardMarkdown");
|
|
|
|
|
Style.Require("OrchardMarkdown");
|
2013-06-26 16:11:41 -07:00
|
|
|
|
2015-02-19 22:14:55 +01:00
|
|
|
var idPostfix = Html.FieldIdFor(m => m);
|
2013-06-26 16:11:41 -07:00
|
|
|
var shellDescriptor = WorkContext.Resolve<ShellDescriptor>();
|
|
|
|
|
var mediaLibraryEnabled = shellDescriptor.Features.Any(x => x.Name == "Orchard.MediaLibrary");
|
|
|
|
|
|
|
|
|
|
if (mediaLibraryEnabled) {
|
|
|
|
|
Script.Require("jQueryColorBox");
|
|
|
|
|
Script.Require("OrchardMarkdown-MediaLibrary");
|
|
|
|
|
Style.Require("jQueryColorBox");
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
Script.Require("OrchardMarkdown-MediaPicker");
|
|
|
|
|
}
|
|
|
|
|
|
2015-02-19 22:14:55 +01:00
|
|
|
var textAreaAttributes = new Dictionary<string, object> {
|
|
|
|
|
{"id", "wmd-input" + "-" + idPostfix},
|
|
|
|
|
{"class", "wmd-input"},
|
|
|
|
|
{"data-mediapicker-uploadpath", Model.AddMediaPath},
|
2015-09-16 14:47:14 -07:00
|
|
|
{"data-mediapicker-title", T("Insert/Update Media")},
|
|
|
|
|
{"data-manage-media", AuthorizedFor(Orchard.MediaLibrary.Permissions.ManageMediaContent) ? "true" : "false" }
|
2015-02-19 22:14:55 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// The markdown editor itself doesn't seem to (yet) support autofocus, but we'll set it on the textarea nonetheless.
|
|
|
|
|
if (Model.AutoFocus == true) {
|
|
|
|
|
textAreaAttributes["autofocus"] = "autofocus";
|
|
|
|
|
}
|
2011-09-27 16:36:48 -07:00
|
|
|
}
|
2013-06-26 16:11:41 -07:00
|
|
|
|
2013-03-07 00:32:04 -08:00
|
|
|
<div class="wmd-box has-grip">
|
|
|
|
|
<div class="wmd-innerbox">
|
|
|
|
|
<div class="wmd-editor-box">
|
|
|
|
|
<div id="wmd-button-bar-@idPostfix" class="wmd-button-bar"></div>
|
2015-02-19 22:14:55 +01:00
|
|
|
@Html.TextArea("Text", (string)Model.Text, 25, 80, textAreaAttributes)
|
2013-03-07 00:32:04 -08:00
|
|
|
</div>
|
|
|
|
|
<div class="wmd-preview-box">
|
|
|
|
|
<div id="wmd-preview-@idPostfix" class="wmd-panel wmd-preview"></div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|