Skip to content

Commit

Permalink
added ability to add custom CSS to panel cell & component for tempora…
Browse files Browse the repository at this point in the history
…ry uses
  • Loading branch information
markentingh committed Jun 12, 2017
1 parent ba0ab1f commit 851cb8b
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion App/CSS/editor.less
Expand Up @@ -165,7 +165,7 @@
/* component specific */
.component.c-textbox{word-break: break-word;
.placeholder-area{padding:20px 20px; text-align:center; border:4px solid;
&.is-body-area{padding:300px 20px;}
&.is-body-area{padding:300px 20px; height:100%; box-sizing:border-box;}
}
}
.text-toolbar{position:absolute; z-index:3001;
Expand Down
2 changes: 1 addition & 1 deletion App/Core/Component.cs
Expand Up @@ -352,7 +352,7 @@ public string Render()
}

//add compiled CSS to renderer
S.css.Add("block_" + blockId, css.ToString());
S.css.Add("block_" + blockId, css.ToString() + (this.css != "" ? "#c" + id + "{" + this.css + "}" : ""));

//add component reference (with instance-specific resource references) to page
js.Append("S.components.add('" + id + "', '" + Name + "', [");
Expand Down
7 changes: 7 additions & 0 deletions App/Core/Page.cs
Expand Up @@ -514,7 +514,13 @@ private string renderLayout()
{
//replace panel content with placeholder content
panel.cells[0].components.Clear();
var cell = panel.cells[0];
var text = (Components.Textbox)createNewComponent("Textbox", panel.id, panel.cells[0].id, block.id);
if (block.name == "Page Body")
{
cell.css += "height:100%;";
text.css = "height:100%;";
}
text.text = "<div class=\"placeholder-area" +
(block.name.ToLower() == "page body" ? " is-body-area" : "") +
"\"><h4>Shadow Template - Page Block: " + block.name.Replace("Page ","") + "</h4>" +
Expand All @@ -527,6 +533,7 @@ private string renderLayout()
text.position[4] = pos;
text.isTemporary = true;
panel.isDisabled = true;
panel.cells[0] = cell;
}
htm.Append(panel.Render());
}
Expand Down
1 change: 1 addition & 0 deletions App/Core/Panel.cs
Expand Up @@ -152,6 +152,7 @@ public string Render()
var divcell = new Utility.DOM.Element("div");
divcell.Classes.Add("is-cell");
if (isDisabled) { divcell.Classes.Add("is-disabled"); }
if(cell.css != "") { divcell.Attributes.Add("style",cell.css); }
divcell.id = "cell_" + cell.id.Replace("-", "_").Replace(" ","_");
divcell.innerHTML = cell.head + comps.ToString() + cell.foot;
htm.Append(divcell.Render());
Expand Down

0 comments on commit 851cb8b

Please sign in to comment.