mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-04-05 21:01:35 +08:00
parent
c24ca00de9
commit
54c8c8417e
@ -12,8 +12,8 @@
|
||||
self._wasInvoked = true;
|
||||
};
|
||||
this.getData = function (contentType) {
|
||||
return self._clipboardData[contentType];
|
||||
self._wasInvoked = true;
|
||||
return self._clipboardData[contentType];
|
||||
};
|
||||
this.disable = function() {
|
||||
self._isDisabled = true;
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,13 +1,4 @@
|
||||
(function ($) {
|
||||
var closedDialogs = [];
|
||||
|
||||
var disposeClosedDialogs = function () {
|
||||
$.each(closedDialogs, function () {
|
||||
this.dispose();
|
||||
});
|
||||
|
||||
closedDialogs = [];
|
||||
};
|
||||
|
||||
var Dialog = function (templateElementSelector) {
|
||||
var self = this;
|
||||
@ -20,8 +11,6 @@
|
||||
this.isVisible = false;
|
||||
this._title = this.template.find(".title").html();
|
||||
|
||||
disposeClosedDialogs();
|
||||
|
||||
this.title = function (value) {
|
||||
var titleElement = this.root.find(".title");
|
||||
this._title = value;
|
||||
@ -57,25 +46,7 @@
|
||||
}
|
||||
|
||||
this.close = function () {
|
||||
this.isVisible = false;
|
||||
|
||||
if (this.root) {
|
||||
$(window).off("resize", resizeIFrame);
|
||||
|
||||
// Hiding is tricky - TinyMCE throws an exception in FF when we hide the root element.
|
||||
// To avoid this, move the dialog out of view. The next time a Dialog is instantiated, it will be disposed of.
|
||||
this.overlay.css({
|
||||
position: "absolute",
|
||||
left: "0",
|
||||
top: "0",
|
||||
width: "0",
|
||||
height: "0",
|
||||
overflow: "hidden"
|
||||
});
|
||||
}
|
||||
|
||||
$(document).off("keyup", onKeyUp);
|
||||
closedDialogs.push(self);
|
||||
this.dispose();
|
||||
};
|
||||
|
||||
this.load = function (url, data, method) {
|
||||
@ -85,19 +56,21 @@
|
||||
this.frame.element.show();
|
||||
this.view.hide();
|
||||
|
||||
resizeIFrame();
|
||||
centerPosition();
|
||||
onWindowResize();
|
||||
this.frame.getDocument().on("keyup", onKeyUp);
|
||||
|
||||
$(window).on("resize", function () {
|
||||
resizeIFrame();
|
||||
centerPosition();
|
||||
});
|
||||
$(window).on("resize", onWindowResize);
|
||||
};
|
||||
|
||||
this.dispose = function () {
|
||||
if (this.root)
|
||||
this.isVisible = false;
|
||||
this.frame.element.off();
|
||||
this.frame.getDocument().off("keyup", onKeyUp);
|
||||
$(window).off("resize", onWindowResize);
|
||||
|
||||
if (this.root) {
|
||||
this.root.remove();
|
||||
}
|
||||
};
|
||||
|
||||
this.setHtml = function (html) {
|
||||
@ -129,6 +102,11 @@
|
||||
buttons.toggle(show);
|
||||
};
|
||||
|
||||
var onWindowResize = function () {
|
||||
resizeIFrame();
|
||||
centerPosition();
|
||||
};
|
||||
|
||||
var resizeIFrame = function () {
|
||||
if (self.frame == null)
|
||||
return;
|
||||
@ -147,7 +125,7 @@
|
||||
|
||||
var onKeyUp = function (e) {
|
||||
var esc = 27;
|
||||
if (e.keyCode == esc) {
|
||||
if (e.keyCode === esc) {
|
||||
self.trigger("command", {
|
||||
command: "cancel"
|
||||
});
|
||||
@ -191,10 +169,9 @@
|
||||
};
|
||||
|
||||
var updateDialog = function (scope) {
|
||||
//var document = self.frame.getDocument();
|
||||
var dialogSettings = scope.find(".dialog-settings");
|
||||
var title = dialogSettings.find(".title");
|
||||
var buttons = dialogSettings.find(".buttons");
|
||||
var buttons = $(dialogSettings.find(".buttons")[0].outerHTML);
|
||||
|
||||
if (title.length > 0) self.title(title.html());
|
||||
if (buttons.length > 0) {
|
||||
|
@ -13,21 +13,27 @@
|
||||
var command = (string)ViewBag.Command;
|
||||
var titleFormat = (string)ViewBag.TitleFormat;
|
||||
}
|
||||
@Html.ValidationSummary()
|
||||
@using (Html.BeginFormAntiForgeryPost(Url.Action("Update", "Element", new { session = Model.SessionKey, area = "Orchard.Layouts" }))) {
|
||||
foreach (var tab in Model.Tabs) {
|
||||
var id = String.Format("element-{0}", tab.ToLowerInvariant());
|
||||
<div id="@id" class="tab-view">
|
||||
@foreach (var editor in Model.EditorResult.Editors) {
|
||||
var position = ShapePosition.Parse((String)editor.Metadata.Position);
|
||||
if (position.Name == tab) {
|
||||
@Display(editor)
|
||||
}
|
||||
}
|
||||
</div>
|
||||
}
|
||||
@* Only render the editor shapes if the dialog is not closing. *@
|
||||
@if (Model.Submitted != true) {
|
||||
@Html.ValidationSummary()
|
||||
using (Html.BeginFormAntiForgeryPost(Url.Action("Update", "Element", new {session = Model.SessionKey, area = "Orchard.Layouts"}))) {
|
||||
foreach (var tab in Model.Tabs) {
|
||||
var id = String.Format("element-{0}", tab.ToLowerInvariant());
|
||||
<div id="@id" class="tab-view">
|
||||
@foreach (var editor in Model.EditorResult.Editors) {
|
||||
var position = ShapePosition.Parse((String) editor.Metadata.Position);
|
||||
if (position.Name == tab) {
|
||||
@Display(editor)
|
||||
}
|
||||
}
|
||||
</div>
|
||||
}
|
||||
}
|
||||
}
|
||||
@if (Model.Submitted) {
|
||||
else {
|
||||
// See Layout-Dialog.cshtml for more information.
|
||||
Layout.DialogClosing = true;
|
||||
|
||||
using (Script.Foot()) {
|
||||
<script type="text/javascript">
|
||||
jQuery(function () {
|
||||
|
@ -1,4 +1,5 @@
|
||||
@{
|
||||
@using System.Collections
|
||||
@{
|
||||
SetMeta("X-UA-Compatible", "IE=edge,chrome=1");
|
||||
Style.Include("admin-dialog.css");
|
||||
Script.Require("jQuery").AtFoot();
|
||||
@ -9,7 +10,6 @@
|
||||
Model.Header.Add(Display.Title(Title: Model.Title));
|
||||
}
|
||||
}
|
||||
@Display.TokenHint()
|
||||
<div id="layout-content">
|
||||
<div id="layout-main">
|
||||
<div id="main" role="main">
|
||||
@ -30,4 +30,12 @@
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@*
|
||||
Not rendering the Token Script prevents an issue with Edge when trying to load a resource via AJAX
|
||||
while the window is being destroyed. This causes the JSON object to be undefined, causing jQuery to fail to parse the AJAX response.
|
||||
*@
|
||||
@if (Model.DialogClosing != true) {
|
||||
@Display.TokenHint()
|
||||
}
|
Loading…
Reference in New Issue
Block a user