Restored reset of markup content styling in layout editor.

This commit is contained in:
Daniel Stolt
2015-06-20 20:38:42 +03:00
parent b06a4ecb73
commit 220c1b591a
7 changed files with 665 additions and 460 deletions

View File

@@ -8,11 +8,6 @@ using Orchard.Services;
namespace Orchard.Layouts.Drivers {
public class ParagraphElementDriver : ElementDriver<Paragraph> {
private readonly IEnumerable<IHtmlFilter> _htmlFilters;
public ParagraphElementDriver(IEnumerable<IHtmlFilter> htmlFilters) {
_htmlFilters = htmlFilters;
}
protected override EditorResult OnBuildEditor(Paragraph element, ElementEditorContext context) {
var viewModel = new ParagraphEditorViewModel {
Text = element.Content
@@ -26,17 +21,5 @@ namespace Orchard.Layouts.Drivers {
return Editor(context, editor);
}
protected override void OnDisplaying(Paragraph element, ElementDisplayContext context) {
var text = element.Content;
var flavor = "html";
var processedText = ApplyHtmlFilters(text, flavor);
context.ElementShape.ProcessedText = processedText;
}
private string ApplyHtmlFilters(string content, string flavor) {
return _htmlFilters.Aggregate(content, (t, filter) => filter.ProcessContent(t, flavor));
}
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,7 +1,8 @@
@import "Variables.less";
@import "Reset.less";
.layout-editor {
.layout-content {
.layout-content, .layout-html {
min-height: 1em;
> .layout-element-wrapper {
@@ -12,7 +13,7 @@
line-height: normal;
// Reset to HTML5 W3C standard default styling within content.
@import "Reset.less";
.reset();
> *:first-child {
margin-top: 0 !important; // Important because site.css of the admin theme styles heading margins with a very high specificity.

View File

@@ -1,340 +1,339 @@
* {
margin: 0;
padding: 0;
box-sizing: content-box;
}
.reset() {
address, blockquote, center, div, figure, figcaption, footer, form,
header, hr, legend, listing, p, plaintext, pre, xmp {
display: block;
}
blockquote, figure, listing, p, plaintext, pre, xmp {
margin-top: 1em;
margin-bottom: 1em;
}
blockquote, figure {
margin-left: 40px;
margin-right: 40px;
}
address {
font-style: italic;
}
listing, plaintext, pre, xmp {
font-family: monospace;
white-space: pre;
}
cite, dfn, em, i, var {
font-style: italic;
}
b, strong {
font-weight: bolder;
}
code, kbd, samp, tt {
font-family: monospace;
}
big {
font-size: larger;
}
small {
font-size: smaller;
}
sub {
vertical-align: sub;
}
sup {
vertical-align: super;
}
sub, sup {
line-height: normal;
font-size: smaller;
}
ruby {
display: ruby;
}
rb {
display: ruby-base;
white-space: nowrap;
}
rt {
display: ruby-text;
white-space: nowrap;
font-size: 50%;
font-variant-east-asian: ruby;
text-emphasis: none;
}
rbc {
display: ruby-base-container;
}
rtc {
display: ruby-text-container;
}
ruby, rb, rt, rbc, rtc {
unicode-bidi: isolate;
}
:link {
color: #0000EE;
}
:visited {
color: #551A8B;
}
:link, :visited {
text-decoration: underline;
}
a:link[rel~=help], a:visited[rel~=help],
area:link[rel~=help], area:visited[rel~=help] {
cursor: help;
}
:focus {
outline: auto;
}
mark {
background: yellow;
color: black;
}
/* this color is just a suggestion and can be changed based on implementation feedback */
abbr[title], acronym[title] {
text-decoration: dotted underline;
}
ins, u {
text-decoration: underline;
}
del, s, strike {
text-decoration: line-through;
}
blink {
text-decoration: blink;
}
q::before {
content: open-quote;
}
q::after {
content: close-quote;
}
br {
content: '\A';
white-space: pre;
}
/* this also has bidi implications */
nobr {
white-space: nowrap;
}
wbr {
content: '\200B';
}
/* this also has bidi implications */
nobr wbr {
white-space: normal;
}
article, aside, h1, h2, h3, h4, h5, h6, hgroup, nav, section {
display: block;
}
h1 {
margin-top: 0.67em;
margin-bottom: 0.67em;
font-size: 2.00em;
font-weight: bold;
}
h2 {
margin-top: 0.83em;
margin-bottom: 0.83em;
font-size: 1.50em;
font-weight: bold;
}
h3 {
margin-top: 1.00em;
margin-bottom: 1.00em;
font-size: 1.17em;
font-weight: bold;
}
h4 {
margin-top: 1.33em;
margin-bottom: 1.33em;
font-size: 1.00em;
font-weight: bold;
}
h5 {
margin-top: 1.67em;
margin-bottom: 1.67em;
font-size: 0.83em;
font-weight: bold;
}
h6 {
margin-top: 2.33em;
margin-bottom: 2.33em;
font-size: 0.67em;
font-weight: bold;
}
dir, dd, dl, dt, ol, ul {
display: block;
}
li {
display: list-item;
}
dir, dl, ol, ul {
margin-top: 1em;
margin-bottom: 1em;
}
dir dir, dir dl, dir ol, dir ul,
dl dir, dl dl, dl ol, dl ul,
ol dir, ol dl, ol ol, ol ul,
ul dir, ul dl, ul ol, ul ul {
margin-top: 0;
margin-bottom: 0;
* {
margin: 0;
padding: 0;
box-sizing: content-box;
}
dd {
margin-left: 40px;
}
/* LTR-specific: use 'margin-right' for rtl elements */
dir, ol, ul {
padding-left: 40px;
}
/* LTR-specific: use 'padding-right' for rtl elements */
ol {
list-style-type: decimal;
}
dir, ul {
list-style-type: disc;
}
dir dir, dir ul,
ol dir, ol ul,
ul dir, ul ul {
list-style-type: circle;
address, blockquote, center, div, figure, figcaption, footer, form,
header, hr, legend, listing, p, plaintext, pre, xmp {
display: block;
}
dir dir dir, dir dir ul,
dir ol dir, dir ol ul,
dir ul dir, dir ul ul,
ol dir dir, ol dir ul,
ol ol dir, ol ol ul,
ol ul dir, ol ul ul,
ul dir dir, ul dir ul,
ul ol dir, ul ol ul,
ul ul dir, ul ul ul {
list-style-type: square;
blockquote, figure, listing, p, plaintext, pre, xmp {
margin-top: 1em;
margin-bottom: 1em;
}
blockquote, figure {
margin-left: 40px;
margin-right: 40px;
}
address {
font-style: italic;
}
listing, plaintext, pre, xmp {
font-family: monospace;
white-space: pre;
}
cite, dfn, em, i, var {
font-style: italic;
}
b, strong {
font-weight: bolder;
}
code, kbd, samp, tt {
font-family: monospace;
}
big {
font-size: larger;
}
small {
font-size: smaller;
}
sub {
vertical-align: sub;
}
sup {
vertical-align: super;
}
sub, sup {
line-height: normal;
font-size: smaller;
}
ruby {
display: ruby;
}
rb {
display: ruby-base;
white-space: nowrap;
}
rt {
display: ruby-text;
white-space: nowrap;
font-size: 50%;
font-variant-east-asian: ruby;
text-emphasis: none;
}
rbc {
display: ruby-base-container;
}
rtc {
display: ruby-text-container;
}
ruby, rb, rt, rbc, rtc {
unicode-bidi: isolate;
}
:link {
color: #0000EE;
}
:visited {
color: #551A8B;
}
:link, :visited {
text-decoration: underline;
}
a:link[rel~=help], a:visited[rel~=help],
area:link[rel~=help], area:visited[rel~=help] {
cursor: help;
}
:focus {
outline: auto;
}
mark {
background: yellow;
color: black;
}
/* this color is just a suggestion and can be changed based on implementation feedback */
abbr[title], acronym[title] {
text-decoration: dotted underline;
}
ins, u {
text-decoration: underline;
}
del, s, strike {
text-decoration: line-through;
}
blink {
text-decoration: blink;
}
q::before {
content: open-quote;
}
q::after {
content: close-quote;
}
br {
content: '\A';
white-space: pre;
}
/* this also has bidi implications */
nobr {
white-space: nowrap;
}
wbr {
content: '\200B';
}
/* this also has bidi implications */
nobr wbr {
white-space: normal;
}
article, aside, h1, h2, h3, h4, h5, h6, hgroup, nav, section {
display: block;
}
h1 {
margin-top: 0.67em;
margin-bottom: 0.67em;
font-size: 2.00em;
font-weight: bold;
}
h2 {
margin-top: 0.83em;
margin-bottom: 0.83em;
font-size: 1.50em;
font-weight: bold;
}
h3 {
margin-top: 1.00em;
margin-bottom: 1.00em;
font-size: 1.17em;
font-weight: bold;
}
h4 {
margin-top: 1.33em;
margin-bottom: 1.33em;
font-size: 1.00em;
font-weight: bold;
}
h5 {
margin-top: 1.67em;
margin-bottom: 1.67em;
font-size: 0.83em;
font-weight: bold;
}
h6 {
margin-top: 2.33em;
margin-bottom: 2.33em;
font-size: 0.67em;
font-weight: bold;
}
dir, dd, dl, dt, ol, ul {
display: block;
}
li {
display: list-item;
}
dir, dl, ol, ul {
margin-top: 1em;
margin-bottom: 1em;
}
dir dir, dir dl, dir ol, dir ul,
dl dir, dl dl, dl ol, dl ul,
ol dir, ol dl, ol ol, ol ul,
ul dir, ul dl, ul ol, ul ul {
margin-top: 0;
margin-bottom: 0;
}
table {
display: table;
}
caption {
display: table-caption;
}
colgroup, colgroup[hidden] {
display: table-column-group;
}
col, col[hidden] {
display: table-column;
}
thead, thead[hidden] {
display: table-header-group;
}
tbody, tbody[hidden] {
display: table-row-group;
}
tfoot, tfoot[hidden] {
display: table-footer-group;
}
tr, tr[hidden] {
display: table-row;
}
td, th, td[hidden], th[hidden] {
display: table-cell;
}
colgroup[hidden], col[hidden], thead[hidden], tbody[hidden],
tfoot[hidden], tr[hidden], td[hidden], th[hidden] {
visibility: collapse;
dd {
margin-left: 40px;
}
/* LTR-specific: use 'margin-right' for rtl elements */
dir, ol, ul {
padding-left: 40px;
}
/* LTR-specific: use 'padding-right' for rtl elements */
ol {
list-style-type: decimal;
}
table {
box-sizing: border-box;
border-spacing: 2px;
border-collapse: separate;
text-indent: initial;
}
dir, ul {
list-style-type: disc;
}
td, th {
padding: 1px;
}
dir dir, dir ul,
ol dir, ol ul,
ul dir, ul ul {
list-style-type: circle;
}
th {
font-weight: bold;
}
dir dir dir, dir dir ul,
dir ol dir, dir ol ul,
dir ul dir, dir ul ul,
ol dir dir, ol dir ul,
ol ol dir, ol ol ul,
ol ul dir, ol ul ul,
ul dir dir, ul dir ul,
ul ol dir, ul ol ul,
ul ul dir, ul ul ul {
list-style-type: square;
}
thead, tbody, tfoot, table > tr {
vertical-align: middle;
}
table {
display: table;
}
tr, td, th {
vertical-align: inherit;
}
caption {
display: table-caption;
}
table, td, th {
border-color: gray;
}
colgroup, colgroup[hidden] {
display: table-column-group;
}
thead, tbody, tfoot, tr {
border-color: inherit;
}
col, col[hidden] {
display: table-column;
}
/*table[rules=none i], table[rules=groups i], table[rules=rows i],
thead, thead[hidden] {
display: table-header-group;
}
tbody, tbody[hidden] {
display: table-row-group;
}
tfoot, tfoot[hidden] {
display: table-footer-group;
}
tr, tr[hidden] {
display: table-row;
}
td, th, td[hidden], th[hidden] {
display: table-cell;
}
colgroup[hidden], col[hidden], thead[hidden], tbody[hidden],
tfoot[hidden], tr[hidden], td[hidden], th[hidden] {
visibility: collapse;
}
table {
box-sizing: border-box;
border-spacing: 2px;
border-collapse: separate;
text-indent: initial;
}
td, th {
padding: 1px;
}
th {
font-weight: bold;
}
thead, tbody, tfoot, table > tr {
vertical-align: middle;
}
tr, td, th {
vertical-align: inherit;
}
table, td, th {
border-color: gray;
}
thead, tbody, tfoot, tr {
border-color: inherit;
}
/*table[rules=none i], table[rules=groups i], table[rules=rows i],
table[rules=cols i], table[rules=all i], table[frame=void i],
table[frame=above i], table[frame=below i], table[frame=hsides i],
table[frame=lhs i], table[frame=rhs i], table[frame=vsides i],
@@ -361,39 +360,39 @@ table[rules=cols i] > tfoot > tr > td, table[rules=cols i] > tfoot > tr > th,
table[rules=all i] > tfoot > tr > td, table[rules=all i] > tfoot > tr > th {
border-color: black;
}*/
input, select, option, optgroup, button, textarea, keygen {
text-indent: initial;
}
input, select, option, optgroup, button, textarea, keygen {
text-indent: initial;
}
textarea {
white-space: pre-wrap;
}
textarea {
white-space: pre-wrap;
}
input[type="radio"], input[type="checkbox"], input[type="reset"], input[type="button"],
input[type="submit"], select, button {
box-sizing: border-box;
}
input[type="radio"], input[type="checkbox"], input[type="reset"], input[type="button"],
input[type="submit"], select, button {
box-sizing: border-box;
}
input[type="button"], button {
padding: 0.3em 0.5em;
}
input[type="button"], button {
padding: 0.3em 0.5em;
}
hr {
color: gray;
border-style: inset;
border-width: 1px;
margin: 0.5em auto;
}
hr {
color: gray;
border-style: inset;
border-width: 1px;
margin: 0.5em auto;
}
fieldset {
margin-left: 2px;
margin-right: 2px;
border: groove 2px ThreeDFace;
padding: 0.35em 0.625em 0.75em;
}
fieldset {
margin-left: 2px;
margin-right: 2px;
border: groove 2px ThreeDFace;
padding: 0.35em 0.625em 0.75em;
}
legend {
padding-left: 2px;
padding-right: 2px;
legend {
padding-left: 2px;
padding-right: 2px;
}
}

View File

@@ -1 +1 @@
@Html.Raw((string)Model.Element.Content)
<p>@Html.Raw((string)Model.Element.Content)</p>

View File

@@ -1,6 +1 @@
@using Orchard.Layouts.Helpers
@{
var tagBuilder = TagBuilderExtensions.CreateElementTagBuilder(Model, "p");
tagBuilder.InnerHtml = Model.ProcessedText;
}
@tagBuilder.ToHtmlString()
<p>@Html.Raw((string)Model.Element.Content)</p>