mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-14 19:04:51 +08:00
Fixed layout editor javascript issue.
As per the comments in https://github.com/OrchardCMS/Orchard/pull/6159, the issue was that the layout designer host has a dependency on the layout editor object, but the former would be created before the latter. This changeset moves the initialization code together in order to control the order in which what object is created first.
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
(function ($) {
|
||||
var LayoutDesignerHost = function (element) {
|
||||
var LayoutDesignerHost = function (element, layoutEditor) {
|
||||
var self = this;
|
||||
this.element = element;
|
||||
this.element.data("layout-designer-host", this);
|
||||
this.editor = window.layoutEditor;
|
||||
this.editor = layoutEditor;
|
||||
this.isFormSubmitting = false;
|
||||
this.settings = {
|
||||
antiForgeryToken: self.element.data("anti-forgery-token"),
|
||||
@@ -120,20 +120,6 @@
|
||||
// Export types.
|
||||
window.Orchard = window.Orchard || {};
|
||||
window.Orchard.Layouts = window.Orchard.Layouts || {};
|
||||
window.Orchard.Layouts.LayoutEditorHost = window.Orchard.Layouts.LayoutEditorHost || {};
|
||||
window.Orchard.Layouts.LayoutDesignerHost = LayoutDesignerHost;
|
||||
|
||||
$(function () {
|
||||
var host = new LayoutDesignerHost($(".layout-designer"));
|
||||
$(".layout-designer").each(function (e) {
|
||||
var designer = $(this);
|
||||
var dialog = designer.find(".layout-editor-help-dialog");
|
||||
designer.find(".layout-editor-help-link").click(function (e) {
|
||||
dialog.dialog({
|
||||
modal: true,
|
||||
width: 840
|
||||
});
|
||||
e.preventDefault();
|
||||
});
|
||||
});
|
||||
});
|
||||
})(jQuery);
|
@@ -42,8 +42,20 @@
|
||||
jQuery(function () {
|
||||
var editorConfig = JSON.parse(LayoutEditor.decode("@Html.Raw(Url.Encode(Model.ConfigurationData))"));
|
||||
var editorCanvasData = JSON.parse(LayoutEditor.decode("@Html.Raw(Url.Encode(Model.Data))"));
|
||||
var layoutEditor = window.layoutEditor = new LayoutEditor.Editor(editorConfig, editorCanvasData);
|
||||
|
||||
window.layoutEditor = new LayoutEditor.Editor(editorConfig, editorCanvasData);
|
||||
var host = new window.Orchard.Layouts.LayoutDesignerHost($(".layout-designer"), layoutEditor);
|
||||
$(".layout-designer").each(function (e) {
|
||||
var designer = $(this);
|
||||
var dialog = designer.find(".layout-editor-help-dialog");
|
||||
designer.find(".layout-editor-help-link").click(function (e) {
|
||||
dialog.dialog({
|
||||
modal: true,
|
||||
width: 840
|
||||
});
|
||||
e.preventDefault();
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
}
|
||||
|
Reference in New Issue
Block a user