mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
#18589: Fixing multiple TextFields with MarkDown flavor
Work Item: 18589 --HG-- branch : 1.x
This commit is contained in:
@@ -1,13 +1,20 @@
|
||||
(function () {
|
||||
var marker = '<!-- markdown -->';
|
||||
var converter = Markdown.getSanitizingConverter();
|
||||
var editor = new Markdown.Editor(converter, "", {
|
||||
|
||||
var editors = $('.wmd-input');
|
||||
|
||||
editors.each(function () {
|
||||
|
||||
var idPostfix = $(this).attr('id').substr('wmd-input'.length);
|
||||
|
||||
var editor = new Markdown.Editor(converter, idPostfix, {
|
||||
handler: function () { window.open("http://daringfireball.net/projects/markdown/syntax"); }
|
||||
});
|
||||
|
||||
editor.hooks.set("insertImageDialog", function (callback) {
|
||||
// see if there's an image selected that they intend on editing
|
||||
var wmd = $('#wmd-input');
|
||||
var wmd = $('#wmd-input' + idPostfix);
|
||||
|
||||
var editImage, content = wmd.selection ? wmd.selection.createRange().text : null;
|
||||
if (content) {
|
||||
@@ -38,6 +45,9 @@
|
||||
});
|
||||
|
||||
editor.run();
|
||||
});
|
||||
|
||||
|
||||
|
||||
$('.grippie').TextAreaResizer();
|
||||
})();
|
||||
|
@@ -1,13 +1,14 @@
|
||||
@{
|
||||
Script.Require("OrchardMarkdown");
|
||||
Style.Require("OrchardMarkdown");
|
||||
string idPostfix = @Html.FieldIdFor(m => m);
|
||||
}
|
||||
<fieldset>
|
||||
<div id="wmd-button-bar" class="wmd-button-bar"></div>
|
||||
<div id="wmd-button-bar-@idPostfix" class="wmd-button-bar"></div>
|
||||
|
||||
@Html.TextArea("Text", (string)Model.Text, 25, 80,
|
||||
new Dictionary<string, object> {
|
||||
{"id", "wmd-input"},
|
||||
{"id", "wmd-input" + "-" + idPostfix},
|
||||
{"class", "wmd-input grippie"},
|
||||
{"data-mediapicker-uploadpath", Model.AddMediaPath},
|
||||
{"data-mediapicker-title", T("Insert/Update Media")}
|
||||
@@ -16,5 +17,5 @@
|
||||
|
||||
<fieldset>
|
||||
<label>@T("Preview")</label>
|
||||
<div id="wmd-preview" class="wmd-panel wmd-preview"></div>
|
||||
<div id="wmd-preview-@idPostfix" class="wmd-panel wmd-preview"></div>
|
||||
</fieldset>
|
||||
|
Reference in New Issue
Block a user