diff --git a/public/templates/assets/editors/editorhelper.js b/public/templates/assets/editors/editorhelper.js index 5aaa28c0..9a8a7fa4 100644 --- a/public/templates/assets/editors/editorhelper.js +++ b/public/templates/assets/editors/editorhelper.js @@ -60,7 +60,9 @@ EditorHelper.init = function( butter ) { - global.EditorHelper.selectable = function( trackEvent, dragContainer ) { + global.EditorHelper.selectable = function( trackEvent, dragContainer, highlightContainer ) { + + highlightContainer = highlightContainer || dragContainer; var highlight = function() { @@ -83,11 +85,11 @@ if ( "zindex" in manifestOptions ) { var newZIndex = media.maxPluginZIndex - track.order; if ( trackEvent.selected ) { - dragContainer.classList.add( "track-event-selected" ); + highlightContainer.classList.add( "track-event-selected" ); dragContainer.style.zIndex = newZIndex + media.maxPluginZIndex; } else { dragContainer.style.zIndex = newZIndex; - dragContainer.classList.remove( "track-event-selected" ); + highlightContainer.classList.remove( "track-event-selected" ); } } }; diff --git a/public/templates/assets/editors/text/text.js b/public/templates/assets/editors/text/text.js index 1ee2aa4e..61dc40a2 100644 --- a/public/templates/assets/editors/text/text.js +++ b/public/templates/assets/editors/text/text.js @@ -2,6 +2,7 @@ EditorHelper.addPlugin( "text", function( trackEvent ) { var _container, + _selectableContainer = trackEvent.popcornTrackEvent._innerDiv, target; _container = trackEvent.popcornTrackEvent._container; @@ -14,9 +15,11 @@ EditorHelper.addPlugin( "text", function( trackEvent ) { minWidth: 10, handlePositions: "e,w" }); + + _selectableContainer = _container; } - EditorHelper.selectable( trackEvent, _container ); + EditorHelper.selectable( trackEvent, _selectableContainer, _container ); EditorHelper.contentEditable( trackEvent, _container.querySelectorAll( ".popcorn-text div span" ) ); } }); diff --git a/public/templates/assets/plugins/text/popcorn.text.js b/public/templates/assets/plugins/text/popcorn.text.js index 85d9f606..8a054ab6 100644 --- a/public/templates/assets/plugins/text/popcorn.text.js +++ b/public/templates/assets/plugins/text/popcorn.text.js @@ -167,7 +167,7 @@ container = options._container = document.createElement( "div" ), innerContainer = document.createElement( "div" ), innerSpan = document.createElement( "span" ), - innerDiv = document.createElement( "div" ), + innerDiv = options._innerDiv = document.createElement( "div" ), fontSheet, fontDecorations = options.fontDecorations || options._natives.manifest.options.fontDecorations[ "default" ], position = options.position || options._natives.manifest.options.position[ "default" ], @@ -241,11 +241,13 @@ if ( options.width ) { container.style.width = options.width + "%"; } + container.style.zIndex = +options.zindex; } else { container.classList.add( "text-fixed" ); innerContainer.classList.add( position ); innerContainer.classList.add( alignment ); + innerDiv.style.zIndex = +options.zindex; } if ( linkUrl ) { @@ -271,7 +273,6 @@ } }; fontSheet.href = "//fonts.googleapis.com/css?family=" + options.fontFamily.replace( /\s/g, "+" ) + ":400,700"; - container.style.zIndex = +options.zindex; options.toString = function() { // use the default option if it doesn't exist