Use closest() instead of parents() when looking for richtext container
This commit is contained in:
parent
1adb5caf99
commit
5e35448491
1 changed files with 6 additions and 3 deletions
|
@ -5,15 +5,18 @@ $(document).ready(function () {
|
||||||
* the user next switches to it.
|
* the user next switches to it.
|
||||||
*/
|
*/
|
||||||
$(".richtext_container textarea").change(function () {
|
$(".richtext_container textarea").change(function () {
|
||||||
$(this).parents(".richtext_container").find(".tab-pane[id$='_preview']").empty();
|
var container = $(this).closest(".richtext_container");
|
||||||
|
|
||||||
|
container.find(".tab-pane[id$='_preview']").empty();
|
||||||
});
|
});
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Install a handler to switch to preview mode
|
* Install a handler to switch to preview mode
|
||||||
*/
|
*/
|
||||||
$(".richtext_container button[data-bs-target$='_preview']").on("show.bs.tab", function () {
|
$(".richtext_container button[data-bs-target$='_preview']").on("show.bs.tab", function () {
|
||||||
var editor = $(this).parents(".richtext_container").find("textarea");
|
var container = $(this).closest(".richtext_container");
|
||||||
var preview = $(this).parents(".richtext_container").find(".tab-pane[id$='_preview']");
|
var editor = container.find("textarea");
|
||||||
|
var preview = container.find(".tab-pane[id$='_preview']");
|
||||||
var minHeight = editor.outerHeight() - preview.outerHeight() + preview.height();
|
var minHeight = editor.outerHeight() - preview.outerHeight() + preview.height();
|
||||||
|
|
||||||
if (preview.contents().length === 0) {
|
if (preview.contents().length === 0) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue