Orchard editor, image picker does not work

504 views Asked by At

I have successfully added to may page a standard HTML editor using tips found at: https://orchard.codeplex.com/discussions/261172

So far my page contains following code:

<fieldset>
    <legend>@T("Message")</legend>
    @Display.Body_Editor(Text: Model.CurrentNewsletter.Body, EditorFlavor: "html")
    @Html.ValidationMessageFor(m => m.CurrentNewsletter.Body)
</fieldset>

The editor shows up and submit works.

The problem is that the image picker does not work.

I can see the icon, but clicking on it does nothing.

If I create a new page, the picker works...

I see no difference between pages and my view... What am I missing?

1

There are 1 answers

1
Mayur Tilva On

Use the below code instead of this code

@{
var shellDescriptor = WorkContext.Resolve<Orchard.Environment.Descriptor.Models.ShellDescriptor>();
Script.Require("OrchardTinyMce");
Script.Require("jQueryColorBox");
Style.Require("jQueryColorBox"); 
}


<script type="text/javascript">
var mediaPickerEnabled = @(shellDescriptor.Features.Any(x => x.Name == "Orchard.MediaPicker") ? "true" : "false");
var mediaLibraryEnabled = @(shellDescriptor.Features.Any(x => x.Name == "Orchard.MediaLibrary") ? "true" : "false");    
</script>



<div class="editor-field">
    @Html.TextAreaFor(model => model.CurriculamVitae, new { @class = "html tinymce" })<br />
@Html.ValidationMessageFor(model => model.CurriculamVitae)
</div>