Switching wrappers to beacons, to prevent nodes from being moved around

--HG--
branch : dev
This commit is contained in:
Sebastien Ros
2011-03-11 11:36:38 -08:00
parent 9d97bdb4cf
commit a368d16d57
3 changed files with 8 additions and 21 deletions

View File

@@ -27,10 +27,11 @@
var syncResize = function () {
var _window = $(window);
var containerHeight = shapeTracingContainer.height();
shapeTracingGhost.height(containerHeight);
var windowHeight = _window.height();
var scrollTop = _window.scrollTop();
shapeTracingGhost.height(containerHeight);
shapeTracingContainer.offset({ top: windowHeight - containerHeight + scrollTop, left: 0 });
shapeTracingContainer.width('100%');
};
@@ -69,19 +70,17 @@
shapeTracingWrappers.each(function () {
var _this = $(this);
var shapeId = _this.attr('shape-id');
// assign the shape-id attribute to all children, except wrappers (it would erase their own shape-id)
_this.find(':not(div.shape-tracing-wrapper)').attr('shape-id', shapeId);
// assign the shape-id attribute to all elements, except wrappers themselves (it would erase their own shape-id)
_this.nextUntil('[end-of="' + shapeId + '"]').find(':not(.shape-tracing-wrapper)').andSelf().attr('shape-id', shapeId);
});
// removes all wrappers, by unwrapping the first element of each of them
shapeTracingWrappers.each(function () {
$(this).contents().first().unwrap();
});
shapeTracingWrappers.remove();
// create an overlay on shapes' descendants
//create an overlay on shapes' descendants
$('[shape-id]').hover(
function () {
$('*').removeClass('shape-tracing-overlay');
$('.shape-tracing-overlay').removeClass('shape-tracing-overlay');
$(this).addClass('shape-tracing-overlay');
},
function () {

View File

@@ -29,16 +29,6 @@ namespace Orchard.DesignerTools.Services {
if (context.ShapeType != "Layout"
&& context.ShapeType != "DocumentZone"
&& context.ShapeType != "PlaceChildContent"
&& context.ShapeType != "HeadScripts"
&& context.ShapeType != "FootScripts"
&& context.ShapeType != "HeadLinks"
&& context.ShapeType != "FootLinks"
&& context.ShapeType != "StylesheeLinks"
&& context.ShapeType != "Style"
&& context.ShapeType != "Feed"
&& context.ShapeType != "Resource"
&& context.ShapeType != "Meta"
// && context.ShapeType != "ContentZone"
&& context.ShapeType != "ShapeTracingMeta") {
var shapeMetadata = (ShapeMetadata)context.Shape.Metadata;

View File

@@ -21,8 +21,7 @@
Script.Include("CodeMirror/htmlmixed.js");
}
<div class="shape-tracing-wrapper shapeType-@Model.Metadata.Type shapeId-@Model.GetHashCode()" shape-id="@Model.GetHashCode()" title="@Model.Metadata.Type">
@Display(Model.Metadata.ChildContent)
<script class="shape-tracing-wrapper shapeType-@Model.Metadata.Type shapeId-@Model.GetHashCode()" shape-id="@Model.GetHashCode()" title="@Model.Metadata.Type" ></script>@Display(Model.Metadata.ChildContent)<script class="shape-tracing-wrapper" end-of="@Model.GetHashCode()"></script>
@{
Layout.Zones["Tail"].Add(
New.ShapeTracingMeta(
@@ -40,4 +39,3 @@
ShapeId: Model.GetHashCode()
));
}
</div>