19501: Markdown editor and preview split vertically instead of horizontally

--HG--
branch : 1.x
This commit is contained in:
Bertrand Le Roy 2013-03-07 00:32:04 -08:00
parent 417d394435
commit d4a25ec097
16 changed files with 295 additions and 46 deletions

View File

@ -65,8 +65,23 @@
</ItemGroup>
<ItemGroup>
<Content Include="Content\Admin\Images\grippie.png" />
<Content Include="Scripts\jquery.textarearesizer.min.js">
<DependentUpon>jquery.textarearesizer.js</DependentUpon>
</Content>
<Content Include="Scripts\Markdown.Converter.min.js">
<DependentUpon>Markdown.Converter.js</DependentUpon>
</Content>
<Content Include="Scripts\Markdown.Editor.min.js">
<DependentUpon>Markdown.Editor.js</DependentUpon>
</Content>
<Content Include="Scripts\Markdown.Sanitizer.min.js">
<DependentUpon>Markdown.Sanitizer.js</DependentUpon>
</Content>
<Content Include="Scripts\orchard-markdown.js" />
<Content Include="Scripts\jquery.textarearesizer.min.js" />
<Content Include="Scripts\jquery.textarearesizer.js" />
<Content Include="Scripts\orchard-markdown.min.js">
<DependentUpon>orchard-markdown.js</DependentUpon>
</Content>
<Content Include="Styles\admin-markdown.css" />
<Content Include="Content\Admin\Images\wmd-buttons.png" />
<Content Include="Module.txt" />
@ -99,6 +114,31 @@
<SubType>Designer</SubType>
</Content>
</ItemGroup>
<ItemGroup>
<Content Include="Scripts\jquery.textarearesizer.min.js.map">
<DependentUpon>jquery.textarearesizer.js</DependentUpon>
</Content>
</ItemGroup>
<ItemGroup>
<Content Include="Scripts\Markdown.Converter.min.js.map">
<DependentUpon>Markdown.Converter.js</DependentUpon>
</Content>
</ItemGroup>
<ItemGroup>
<Content Include="Scripts\Markdown.Editor.min.js.map">
<DependentUpon>Markdown.Editor.js</DependentUpon>
</Content>
</ItemGroup>
<ItemGroup>
<Content Include="Scripts\Markdown.Sanitizer.min.js.map">
<DependentUpon>Markdown.Sanitizer.js</DependentUpon>
</Content>
</ItemGroup>
<ItemGroup>
<Content Include="Scripts\orchard-markdown.min.js.map">
<DependentUpon>orchard-markdown.js</DependentUpon>
</Content>
</ItemGroup>
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>

View File

@ -4,12 +4,12 @@ namespace Markdown {
public class ResourceManifest : IResourceManifestProvider {
public void BuildManifests(ResourceManifestBuilder builder) {
var manifest = builder.Add();
manifest.DefineScript("Markdown_Converter").SetUrl("Markdown.Converter.js");
manifest.DefineScript("Markdown_Sanitizer").SetUrl("Markdown.Sanitizer.js").SetDependencies("Markdown_Converter");
manifest.DefineScript("Markdown_Editor").SetUrl("Markdown.Editor.js").SetDependencies("Markdown_Sanitizer");
manifest.DefineScript("Resizer").SetUrl("jquery.textarearesizer.min.js").SetDependencies("jQuery");
manifest.DefineScript("Markdown_Converter").SetUrl("Markdown.Converter.min.js", "Markdown.Converter.js");
manifest.DefineScript("Markdown_Sanitizer").SetUrl("Markdown.Sanitizer.min.js", "Markdown.Sanitizer.js").SetDependencies("Markdown_Converter");
manifest.DefineScript("Markdown_Editor").SetUrl("Markdown.Editor.min.js", "Markdown.Editor.js").SetDependencies("Markdown_Sanitizer");
manifest.DefineScript("Resizer").SetUrl("jquery.textarearesizer.min.js", "jquery.textarearesizer.js").SetDependencies("jQuery");
manifest.DefineScript("OrchardMarkdown").SetUrl("orchard-markdown.js").SetDependencies("Resizer", "Markdown_Editor");
manifest.DefineScript("OrchardMarkdown").SetUrl("orchard-markdown.min.js", "orchard-markdown.js").SetDependencies("Resizer", "Markdown_Editor");
manifest.DefineStyle("OrchardMarkdown").SetUrl("admin-markdown.css");
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,2 @@
(function(){function i(n){return n.replace(/<[^>]*>?/gi,e)}function e(n){return n.match(r)||n.match(u)||n.match(f)?n:""}function o(n){var i,t;if(n=="")return"";var s=/<\/?\w+[^>]*(\s|$|>)/g,r=n.toLowerCase().match(s),f=(r||[]).length;if(f==0)return n;var e,h,u,o=[],c=[],l=!1;for(t=0;t<f;t++)if(e=r[t].replace(/<\/?(\w+).*/,"$1"),!o[t]&&!("<p><img><br><li><hr>".search("<"+e+">")>-1)){if(h=r[t],u=-1,!/^<\//.test(h))for(i=t+1;i<f;i++)if(!o[i]&&r[i]=="<\/"+e+">"){u=i;break}u==-1?l=c[t]=!0:o[u]=!0}return l?(t=0,n.replace(s,function(n){var i=c[t]?"":n;return t++,i})):n}var n,t;typeof exports=="object"&&typeof require=="function"?(n=exports,t=require("./Markdown.Converter").Converter):(n=window.Markdown,t=n.Converter),n.getSanitizingConverter=function(){var n=new t;return n.hooks.chain("postConversion",i),n.hooks.chain("postConversion",o),n};var r=/^(<\/?(b|blockquote|code|del|dd|dl|dt|em|h1|h2|h3|i|kbd|li|ol|p|pre|s|sup|sub|strong|strike|ul)>|<(br|hr)\s?\/?>)$/i,u=/^(<a\shref="((https?|ftp):\/\/|\/)[-A-Za-z0-9+&@#\/%?=~_|!:,.;\(\)]+"(\stitle="[^"<>]+")?\s?>|<\/a>)$/i,f=/^(<img\ssrc="(https?:\/\/|\/)[-A-Za-z0-9+&@#\/%?=~_|!:,.;\(\)]+"(\swidth="\d{1,3}")?(\sheight="\d{1,3}")?(\salt="[^"<>]*")?(\stitle="[^"<>]*")?\s?\/?>)$/i})();
//@ sourceMappingURL=Markdown.Sanitizer.min.js.map

View File

@ -0,0 +1,8 @@
{
"version":3,
"file":"Markdown.Sanitizer.min.js",
"lineCount":1,
"mappings":"CAAC,QAAS,CAAA,CAAG,CAiBTA,SAASA,CAAY,CAACC,CAAD,CAAO,CACxB,OAAOA,CAAIC,QAAQ,CAAC,YAAY,CAAEC,CAAf,CADK,CAY5BA,SAASA,CAAW,CAACC,CAAD,CAAM,CACtB,OAAIA,CAAGC,MAAM,CAACC,CAAD,CAAsB,EAAGF,CAA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AAb,CAAA,CAAO,CAAE,CAAA,CAnBnB,CAiCR,OAXKe,C,EA3BIT,CAgCA,CAAE,C,CACJV,CAAIC,QAAQ,CAACU,CAAE,CAAE,QAAS,CAACP,CAAD,CAAQ,CACrC,IAAIkB,EAAMJ,CAAU,CAAAR,CAAA,CAAM,CAAE,EAAG,CAAEN,CAAK,CAEtC,OADAM,CAAI,EAAE,CACCY,CAH8B,CAAtB,E,CALRtB,CAnDY,CA3C3B,IAAIuB,EAAQC,CAAS,CACjB,OAAOC,OAAQ,EAAI,QAAS,EAAG,OAAOC,OAAQ,EAAI,UAAtD,EACIH,CAAO,CAAEE,OAAO,CAChBD,CAAU,CAAEE,OAAO,CAAC,sBAAD,CAAwBF,WAF/C,EAIID,CAAO,CAAEI,MAAMC,SAAS,CACxBJ,CAAU,CAAED,CAAMC,W,CAGtBD,CAAMM,uBAAwB,CAAEC,QAAS,CAAA,CAAG,CACxC,IAAIC,EAAY,IAAIP,CAAW,CAG/B,OAFAO,CAASC,MAAMC,MAAM,CAAC,gBAAgB,CAAElC,CAAnB,CAAgC,CACrDgC,CAASC,MAAMC,MAAM,CAAC,gBAAgB,CAAEzB,CAAnB,CAA+B,CAC7CuB,CAJiC,C,CAY5C,IAAI1B,EAAsB,sHAEtBC,EAAU,yGAGVC,EAAY,2JA3BP,EA2GX,CAAA,CAAE",
"sources":["Markdown.Sanitizer.js"],
"names":["sanitizeHtml","html","replace","sanitizeTag","tag","match","basic_tag_whitelist","a_white","img_white","balanceTags","ntag","ctag","re","tags","toLowerCase","tagcount","length","tagname","tagpaired","tagremove","needsRemoval","search","test","res","output","Converter","exports","require","window","Markdown","getSanitizingConverter","output.getSanitizingConverter","converter","hooks","chain"]
}

View File

@ -0,0 +1,124 @@
/*
jQuery TextAreaResizer plugin
Created on 17th January 2008 by Ryan O'Dell
Version 1.0.4
Converted from Drupal -> textarea.js
Found source: http://plugins.jquery.com/misc/textarea.js
$Id: textarea.js,v 1.11.2.1 2007/04/18 02:41:19 drumm Exp $
1.0.1 Updates to missing global 'var', added extra global variables, fixed multiple instances, improved iFrame support
1.0.2 Updates according to textarea.focus
1.0.3 Further updates including removing the textarea.focus and moving private variables to top
1.0.4 Re-instated the blur/focus events, according to information supplied by dec
*/
(function ($) {
/* private variable "oHover" used to determine if you're still hovering over the same element */
var overlay, // very hacky used so it works with iframes
defaults = {
'useParentWidth': false,
'resizeWrapper': false,
'minHeight': 32,
'offsetTop': 0
};
/* TextAreaResizer plugin */
$.fn.TextAreaResizer = function (cb, opts) {
return this.each(function () {
if (cb && typeof cb === 'function') {
opts = opts || {};
opts.callback = cb;
} else if (cb && typeof cb === 'object' && !opts) {
opts = cb;
}
textAreaResizer(this, $.extend({}, defaults, opts || {}));
});
};
function textAreaResizer(target, opts) {
var grippie,
iLastMousePos = 0,
options = opts,
resizable,
wrapper = $(target).addClass('processed');
grippie = $('<div class="grippie"></div>').bind('mousedown', startDrag);
resizable = wrapper.children(':visible');
wrapper.append(grippie);
if (!options.resizeWrapper) {
if (!options.resizeSelector) {
resizable = resizable.first();
} else {
resizable = resizable.filter(options.resizeSelector);
}
}
if (!options.useParentWidth) {
grippie[0].style.marginRight = (grippie[0].offsetWidth - resizable[0].offsetWidth) + 'px';
}
if (options.initCallback && options.callback) {
options.callback(wrapper.height() - grippie.outerHeight(true));
}
function startDrag(e) {
iLastMousePos = mousePosition(e).y;
// hack so it works with iframes
overlay = $("<div id='overlay' style='position: absolute; zindex: 99; background-color: white; opacity:0.01; filter: alpha(opacity = 1); left:0; top:0;'>&nbsp;</div>");
resizable.css('opacity', 0.25);
wrapper.append(overlay[0]);
overlay.width(wrapper.width());
overlay.height(wrapper.height());
$(document).mousemove(performDrag).mouseup(endDrag);
return false;
}
function performDrag(e) {
var iThisMousePos = mousePosition(e).y,
iMousePos = iThisMousePos - wrapper.offset().top,
resizing;
if (iLastMousePos >= iThisMousePos) {
iMousePos -= 5;
}
if (iMousePos <= options.minHeight) {
return false;
}
iLastMousePos = iThisMousePos;
iMousePos = iMousePos;
resizing = options.resizeWrapper ? wrapper : resizable;
resizing.height(iMousePos - options.offsetTop);
overlay.height(wrapper.height());
if (options.callback) {
options.callback(iMousePos - (options.resizeWrapper ? grippie.outerHeight(true) : 0), resizing);
}
return false;
}
function endDrag() {
$(document).unbind('mousemove', performDrag).unbind('mouseup', endDrag);
resizable.css('opacity', 1);
wrapper.focus();
overlay.remove();
iLastMousePos = 0;
}
}
function mousePosition(e) {
return { x: e.clientX + document.documentElement.scrollLeft, y: e.clientY + (document.documentElement.scrollTop || document.body.scrollTop) };
};
})(jQuery);

View File

@ -1 +1,2 @@
(function($){var textarea,staticOffset;var iLastMousePos=0;var iMin=32;var grip;$.fn.TextAreaResizer=function(){return this.each(function(){textarea=$(this).addClass('processed'),staticOffset=null;$(this).wrap('<div class="resizable-textarea"><span></span></div>').parent().append($('<div class="grippie"></div>').bind("mousedown",{el:this},startDrag));var grippie=$('div.grippie',$(this).parent())[0];grippie.style.marginRight=(grippie.offsetWidth-$(this)[0].offsetWidth)+'px'})};function startDrag(e){textarea=$(e.data.el);textarea.blur();iLastMousePos=mousePosition(e).y;staticOffset=textarea.height()-iLastMousePos;textarea.css('opacity',0.25);$(document).mousemove(performDrag).mouseup(endDrag);return false}function performDrag(e){var iThisMousePos=mousePosition(e).y;var iMousePos=staticOffset+iThisMousePos;if(iLastMousePos>=(iThisMousePos)){iMousePos-=5}iLastMousePos=iThisMousePos;iMousePos=Math.max(iMin,iMousePos);textarea.height(iMousePos+'px');if(iMousePos<iMin){endDrag(e)}return false}function endDrag(e){$(document).unbind('mousemove',performDrag).unbind('mouseup',endDrag);textarea.css('opacity',1);textarea.focus();textarea=null;staticOffset=null;iLastMousePos=0}function mousePosition(e){return{x:e.clientX+document.documentElement.scrollLeft,y:e.clientY+document.documentElement.scrollTop}}})(jQuery);
(function(n){function u(r,u){function a(r){return h=i(r).y,t=n("<div id='overlay' style='position: absolute; zindex: 99; background-color: white; opacity:0.01; filter: alpha(opacity = 1); left:0; top:0;'>&nbsp;<\/div>"),o.css("opacity",.25),e.append(t[0]),t.width(e.width()),t.height(e.height()),n(document).mousemove(c).mouseup(l),!1}function c(n){var u=i(n).y,r=u-e.offset().top,c;return(h>=u&&(r-=5),r<=f.minHeight)?!1:(h=u,r=r,c=f.resizeWrapper?e:o,c.height(r-f.offsetTop),t.height(e.height()),f.callback&&f.callback(r-(f.resizeWrapper?s.outerHeight(!0):0),c),!1)}function l(){n(document).unbind("mousemove",c).unbind("mouseup",l),o.css("opacity",1),e.focus(),t.remove(),h=0}var s,h=0,f=u,o,e=n(r).addClass("processed");s=n('<div class="grippie"><\/div>').bind("mousedown",a),o=e.children(":visible"),e.append(s),f.resizeWrapper||(o=f.resizeSelector?o.filter(f.resizeSelector):o.first()),f.useParentWidth||(s[0].style.marginRight=s[0].offsetWidth-o[0].offsetWidth+"px"),f.initCallback&&f.callback&&f.callback(e.height()-s.outerHeight(!0))}function i(n){return{x:n.clientX+document.documentElement.scrollLeft,y:n.clientY+(document.documentElement.scrollTop||document.body.scrollTop)}}var t,r={useParentWidth:!1,resizeWrapper:!1,minHeight:32,offsetTop:0};n.fn.TextAreaResizer=function(t,i){return this.each(function(){t&&typeof t=="function"?(i=i||{},i.callback=t):t&&typeof t=="object"&&!i&&(i=t),u(this,n.extend({},r,i||{}))})}})(jQuery);
//@ sourceMappingURL=jquery.textarearesizer.min.js.map

View File

@ -0,0 +1,8 @@
{
"version":3,
"file":"jquery.textarearesizer.min.js",
"lineCount":1,
"mappings":"CAgBC,QAAS,CAACA,CAAD,CAAI,CAwBVC,SAASA,CAAe,CAACC,CAAM,CAAEC,CAAT,CAAe,CA4BnCC,SAASA,CAAS,CAACC,CAAD,CAAI,CAYlB,OAXAC,CAAc,CAAEC,CAAa,CAACF,CAAD,CAAGG,EAAE,CAElCC,CAAQ,CAAET,CAAC,CAAC,2JAAD,CAA4J,CAEvKU,CAASC,IAAI,CAAC,SAAS,CAAE,GAAZ,CAAiB,CAC9BC,CAAOC,OAAO,CAACJ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QAAS,CAAA,CAAG,CACrBD,CAAG,EAAG,OAAOA,CAAG,EAAI,UAAxB,EACItD,CAAK,CAAEA,CAAK,EAAG,CAAA,CAAE,CACjBA,CAAI2B,SAAU,CAAE2B,EAFpB,CAGWA,CAAG,EAAG,OAAOA,CAAG,EAAI,QAAS,EAAG,CAACtD,C,GACxCA,CAAK,CAAEsD,E,CAGXxD,CAAe,CAAC,IAAI,CAAED,CAAC2D,OAAO,CAAC,CAAA,CAAE,CAAEN,CAAQ,CAAElD,CAAK,EAAG,CAAA,CAAvB,CAAf,CARU,CAAb,CADuB,CAXjC,EA2GZ,CAACyD,MAAD,CAAQ",
"sources":["jquery.textarearesizer.js"],
"names":["$","textAreaResizer","target","opts","startDrag","e","iLastMousePos","mousePosition","y","overlay","resizable","css","wrapper","append","width","height","document","mousemove","performDrag","mouseup","endDrag","iThisMousePos","iMousePos","offset","top","resizing","options","minHeight","resizeWrapper","offsetTop","callback","grippie","outerHeight","unbind","focus","remove","addClass","bind","children","resizeSelector","filter","first","useParentWidth","style","marginRight","offsetWidth","initCallback","clientX","documentElement","scrollLeft","clientY","scrollTop","body","defaults","fn","TextAreaResizer","$.fn.TextAreaResizer","cb","each","extend","jQuery"]
}

View File

@ -1,18 +1,18 @@
(function () {
(function() {
var marker = '<!-- markdown -->';
var converter = Markdown.getSanitizingConverter();
var editors = $('.wmd-input');
editors.each(function () {
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"); }
handler: function() { window.open("http://daringfireball.net/projects/markdown/syntax"); }
});
editor.hooks.set("insertImageDialog", function (callback) {
editor.hooks.set("insertImageDialog", function(callback) {
// see if there's an image selected that they intend on editing
var wmd = $('#wmd-input' + idPostfix);
@ -37,7 +37,7 @@
wmd.trigger("orchard-admin-pickimage-open", {
img: editImage,
uploadMediaPath: wmd.data("mediapicker-uploadpath"),
callback: function (data) {
callback: function(data) {
callback(data.img.src);
}
});
@ -47,7 +47,17 @@
editor.run();
});
var resizableSelector = ".wmd-input,.wmd-preview",
resizeInnerElements = function (el, size) {
if (size > 120) {
el.height(size - 20);
}
};
resizeInnerElements($(resizableSelector), 400);
$('.grippie').TextAreaResizer();
$(".has-grip").TextAreaResizer(function(size, resizing) {
resizing.find(resizableSelector).each(function() { resizeInnerElements($(this), size - 18); });
}, {
resizeWrapper: true
});
})();

View File

@ -0,0 +1,2 @@
(function(){var i=Markdown.getSanitizingConverter(),r=$(".wmd-input"),n,t;r.each(function(){var n=$(this).attr("id").substr("wmd-input".length),t=new Markdown.Editor(i,n,{handler:function(){window.open("http://daringfireball.net/projects/markdown/syntax")}});t.hooks.set("insertImageDialog",function(t){var r=$("#wmd-input"+n),f,u=r.selection?r.selection.createRange().text:null,i;return u&&(u=u.replace(/\<IMG/gi,"<editimg"),i=$(u).filter("editimg"),i.length&&(f={src:i.attr("src"),"class":i.attr("class"),style:i.css("cssText"),alt:i.attr("alt"),width:i.attr("width"),height:i.attr("height"),align:i.attr("align")})),r.trigger("orchard-admin-pickimage-open",{img:f,uploadMediaPath:r.data("mediapicker-uploadpath"),callback:function(n){t(n.img.src)}}),!0}),t.run()}),n=".wmd-input,.wmd-preview",t=function(n,t){t>120&&n.height(t-20)},t($(n),400),$(".has-grip").TextAreaResizer(function(i,r){r.find(n).each(function(){t($(this),i-18)})},{resizeWrapper:!0})})();
//@ sourceMappingURL=orchard-markdown.min.js.map

View File

@ -0,0 +1,8 @@
{
"version":3,
"file":"orchard-markdown.min.js",
"lineCount":1,
"mappings":"CAAC,QAAQ,CAAA,CAAG,CACR,IACIA,EAAYC,QAAQC,uBAAuB,CAAA,EAE3CC,EAAUC,CAAC,CAAC,YAAD,EA6CXC,EACAC,CAjD4B,CAKhCH,CAAOI,KAAK,CAAC,QAAQ,CAAA,CAAG,CAEpB,IAAIC,EAAYJ,CAAC,CAAC,IAAD,CAAMK,KAAK,CAAC,IAAD,CAAMC,OAAO,C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A7B8C,CAAzC,CA8Bd,CAEFrB,CAAMsB,IAAI,CAAA,CAxCU,CAAZ,CAyCV,CAEE7B,CAAkB,CAAE,yB,CACpBC,CAAoB,CAAEA,QAAS,CAAC6B,CAAE,CAAEC,CAAL,CAAW,CAClCA,CAAK,CAAE,G,EACPD,CAAEE,OAAO,CAACD,CAAK,CAAE,EAAR,CAFyB,C,CAK9C9B,CAAmB,CAACF,CAAC,CAACC,CAAD,CAAmB,CAAE,GAAvB,CAA2B,CAE9CD,CAAC,CAAC,WAAD,CAAakC,gBAAgB,CAAC,QAAQ,CAACF,CAAI,CAAEG,CAAP,CAAiB,CACpDA,CAAQC,KAAK,CAACnC,CAAD,CAAmBE,KAAK,CAAC,QAAQ,CAAA,CAAG,CAAED,CAAmB,CAACF,CAAC,CAAC,IAAD,CAAM,CAAEgC,CAAK,CAAE,EAAjB,CAArB,CAAZ,CADe,CAEvD,CAAE,CACC,aAAa,CAAE,CAAA,CADhB,CAF2B,CAzDtB,EA8DV,CAAA,CAAE",
"sources":["orchard-markdown.js"],
"names":["converter","Markdown","getSanitizingConverter","editors","$","resizableSelector","resizeInnerElements","each","idPostfix","attr","substr","length","editor","Editor","handler","window","open","hooks","set","callback","wmd","editImage","content","selection","createRange","text","firstImg","replace","filter","css","trigger","data","img","src","run","el","size","height","TextAreaResizer","resizing","find"]
}

View File

@ -12,7 +12,7 @@
.wmd-button > span {
background-image: url(../Content/Admin/Images/wmd-buttons.png);
background-repeat: no-repeat;
background-position: 0px 0px;
background-position: 0 0;
width: 20px;
height: 20px;
display: inline-block;
@ -21,26 +21,47 @@
.wmd-button-row
{
position: relative;
margin-left: 5px;
margin-right: 5px;
margin-bottom: 5px;
margin-top: 10px;
padding: 0px;
margin: 10px 5px 5px 5px;
padding: 0;
height: 20px;
}
.wmd-input {
font-family: Consolas, Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace, serif;
width: 660px;
padding: 3px;
height: 200px;
line-height: 1.2;
}
.wmd-box {
display: table;
position: relative;
height: 400px;
}
.wmd-innerbox {
height: 100%;
display: table-row;
}
.wmd-editor-box {
width: 49%;
display: table-cell;
height: 100%;
vertical-align: top;
}
.wmd-preview-box {
width: 49%;
display: table-cell;
padding: 0;
height: 100%;
vertical-align: top;
}
.wmd-preview {
border: 2px dotted #CCC;
padding: 3px;
margin-top: 6px;
margin-top: 34px;
height: 80%;
overflow-x: auto;
overflow-y: scroll;
}
.wmd-preview ol {
@ -70,15 +91,15 @@
.wmd-preview pre code {
border: none;
margin-left: 0px;
padding-left: 0px;
margin-left: 0;
padding-left: 0;
}
.wmd-preview p code {
border: none;
margin: 0px;
padding: 0px;
margin: 0;
padding: 0;
}
/* Grippie */
@ -87,15 +108,17 @@ div.grippie {
background:#EEEEEE url(../Content/Admin/Images/grippie.png) no-repeat scroll center 2px;
border-color:#DDDDDD;
border-style:solid;
border-width:0pt 1px 1px;
border-width: 0 1px 1px;
cursor:s-resize;
height:9px;
margin-top: 9px;
overflow:hidden;
}
.resizable-textarea textarea {
#main .wmd-editor-box textarea.wmd-input {
display:block;
margin-bottom:0pt;
width:95%;
height: 20%;
margin-bottom: 0;
width: 97%;
height: 80%;
resize: horizontal;
}

View File

@ -3,19 +3,22 @@
Style.Require("OrchardMarkdown");
string idPostfix = @Html.FieldIdFor(m => m);
}
<fieldset>
<div id="wmd-button-bar-@idPostfix" class="wmd-button-bar"></div>
<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>
@Html.TextArea("Text", (string)Model.Text, 25, 80,
new Dictionary<string, object> {
{"id", "wmd-input" + "-" + idPostfix},
{"class", "wmd-input grippie"},
{"data-mediapicker-uploadpath", Model.AddMediaPath},
{"data-mediapicker-title", T("Insert/Update Media")}
})
</fieldset>
@Html.TextArea("Text", (string)Model.Text, 25, 80,
new Dictionary<string, object> {
{"id", "wmd-input" + "-" + idPostfix},
{"class", "wmd-input"},
{"data-mediapicker-uploadpath", Model.AddMediaPath},
{"data-mediapicker-title", T("Insert/Update Media")}
})
</div>
<fieldset>
<label>@T("Preview")</label>
<div id="wmd-preview-@idPostfix" class="wmd-panel wmd-preview"></div>
</fieldset>
<div class="wmd-preview-box">
<div id="wmd-preview-@idPostfix" class="wmd-panel wmd-preview"></div>
</div>
</div>
</div>