simplemodal 与 jhtmlarea 冲突
每当我关闭简单模式对话框时,jHtmlArea 就会停止工作。 我的代码很简单 $.modal.close();
即使我单击 simplemodal 对话框上的关闭按钮,也会发生这种情况。
感谢您的任何帮助。
编辑 我的应用程序使用 ASP.NET MVC3 和通过单击按钮加载的对话框的 html。这意味着我将在每次单击按钮时重新创建对话框。也许我不应该这样做。您能否建议一个更好的工作流程(也许检索原始 Json)。
我尝试过 Eric 的建议,从 onShow 调用 richtexteditor (jhtmlarea),但结果相同。 我也用另一个富文本编辑器(ckeditor)尝试过,但结果仍然相同。
完整代码如下
$(function () {
console.log("beginning ready() for issuesModal");
console.debug("calling tipTip() from ready()..");
$(".tip").tipTip({ maxWidth: "auto", edgeOffset: 10 });
var issuesModal = {
_targetLink: null,
_descriptionElem: null,
_modal: null,
_modalContainer: $('#basic-modal-content'),
init: function () {
console.debug("issuesModal.init()..");
$("form.edit-issue-form, form.add-issue-form")
.submit(function (evt) {
evt.preventDefault();
hijackForm(this, issuesModal.formLoaded, "html");
});
},
formLoaded: function (data) {
console.debug("issuesModal.formLoaded()..");
issuesModal._modalContainer.html(data);
issuesModal.doModal(issuesModal._modalContainer);
},
doModal: function (elem) {
console.debug("issuesModal.doModal()..");
if (issuesModal._modal !== null) {
$.modal.close();
issuesModal._modal = null;
}
this._modal = $(elem).modal({
onShow: function (dialog) {
console.debug("modal form showing..");
this._descriptionElem = $("#Description");
issuesModal.doWysiwyg(this._descriptionElem);
},
onClose: function (dialog) {
console.debug("modal form closing..");
$.modal.close();
}
});
},
updateUI: function () {
console.debug("issuesModal.updateUI()..");
$(":input[type=submit],[type=reset]").button();
//$("#issue-name-dropdown").css({ width: 400 }).selectmenu().next().css({ height: 50 })
$(":input[type=reset]")
.unbind('click')
.click(
function (evt) {
console.debug("modal form close button clicked..");
evt.preventDefault();
$.modal.close();
}
);
},
doWysiwyg: function (elem) {
console.debug("issuesModal.doWysiwyg()..");
$(elem).htmlarea();
}
};
issuesModal.init();
issuesModal.updateUI();
});
whenever I close my simplemodal dialog, jHtmlArea stops working.
My code is very simple$.modal.close();
This happens even if I click the close button on simplemodal dialog.
Thanks for any help.
Edit
My app is using ASP.NET MVC3 and the html for the dialog loaded from a button click. This means that I'm re-creating the dialog on each button click. Maybe I shouldn't do this. Can you suggest a better workflow (maybe retrieve raw Json).
I've tried Eric's suggestion to call the richtexteditor (jhtmlarea) from onShow but same results.
I've also tried this with another rich text editor (ckeditor) and still same results.
full code below
$(function () {
console.log("beginning ready() for issuesModal");
console.debug("calling tipTip() from ready()..");
$(".tip").tipTip({ maxWidth: "auto", edgeOffset: 10 });
var issuesModal = {
_targetLink: null,
_descriptionElem: null,
_modal: null,
_modalContainer: $('#basic-modal-content'),
init: function () {
console.debug("issuesModal.init()..");
$("form.edit-issue-form, form.add-issue-form")
.submit(function (evt) {
evt.preventDefault();
hijackForm(this, issuesModal.formLoaded, "html");
});
},
formLoaded: function (data) {
console.debug("issuesModal.formLoaded()..");
issuesModal._modalContainer.html(data);
issuesModal.doModal(issuesModal._modalContainer);
},
doModal: function (elem) {
console.debug("issuesModal.doModal()..");
if (issuesModal._modal !== null) {
$.modal.close();
issuesModal._modal = null;
}
this._modal = $(elem).modal({
onShow: function (dialog) {
console.debug("modal form showing..");
this._descriptionElem = $("#Description");
issuesModal.doWysiwyg(this._descriptionElem);
},
onClose: function (dialog) {
console.debug("modal form closing..");
$.modal.close();
}
});
},
updateUI: function () {
console.debug("issuesModal.updateUI()..");
$(":input[type=submit],[type=reset]").button();
//$("#issue-name-dropdown").css({ width: 400 }).selectmenu().next().css({ height: 50 })
$(":input[type=reset]")
.unbind('click')
.click(
function (evt) {
console.debug("modal form close button clicked..");
evt.preventDefault();
$.modal.close();
}
);
},
doWysiwyg: function (elem) {
console.debug("issuesModal.doWysiwyg()..");
$(elem).htmlarea();
}
};
issuesModal.init();
issuesModal.updateUI();
});
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您没有提供任何代码,所以我只能猜测解决方案...
根据 SimpleModal 的工作方式,我建议在 onShow 回调中初始化任何第三方库。
华泰
You didn't provide any code, so I can only take a guess at the solution...
With the way SimpleModal works, I suggest initializing any 3rd party libraries in the onShow callback.
HTH