|
286 | 286 |
|
287 | 287 | <script type="text/javascript">
|
288 | 288 |
|
289 |
| - var $deferred; |
| 289 | + let $deferred; |
290 | 290 |
|
291 | 291 | <c:if test="${not empty param.notySuccess}">
|
292 | 292 | $(document).ready(function(){
|
|
300 | 300 | browseInfo="<%=browseInformation%>" objectId="<%=objectId%>" objectType="<%=objectType%>"
|
301 | 301 | activateWysiwygBackupManager="true" />
|
302 | 302 |
|
303 |
| - if ($.trim($(".wysiwyg-fileStorage").text()).length == 0) { |
| 303 | + if ($.trim($(".wysiwyg-fileStorage").text()).length === 0) { |
304 | 304 | $(".wysiwyg-fileStorage").css("display", "none");
|
305 | 305 | }
|
306 | 306 | };
|
|
330 | 330 | }
|
331 | 331 |
|
332 | 332 | function choixLien() {
|
333 |
| - var index = document.recupHtml.liens.selectedIndex; |
334 |
| - var str = document.recupHtml.liens.options[index].value; |
335 |
| - if (index != 0 && str != null) { |
| 333 | + const index = document.recupHtml.liens.selectedIndex; |
| 334 | + const str = document.recupHtml.liens.options[index].value; |
| 335 | + if (index !== 0 && str != null) { |
336 | 336 | CKEDITOR.instances.editor1.insertHtml('<a href="' + str + '">' +
|
337 | 337 | str.substring(str.lastIndexOf("/") + 1) + "</a>");
|
338 | 338 | }
|
|
413 | 413 |
|
414 | 414 | jQuery(document).ready(function() {
|
415 | 415 | jQuery(document.recupHtml).submit(function() {
|
| 416 | + const wysiwygContent = |
| 417 | + sp.editor.wysiwyg.lastBackupManager.instance.existsUnvalidatedContent() ? |
| 418 | + sp.editor.wysiwyg.lastBackupManager.instance.getUnvalidatedContent() : ''; |
| 419 | + const modifContextEnabled = ${isModificationContextEnabled}; |
| 420 | + const subscriptionHandled = ${isHandledSubscriptionConfirmation}; |
416 | 421 | const contributionId = {
|
417 | 422 | componentInstanceId : '<%=componentId%>',
|
418 | 423 | localId : '<%=objectId%>',
|
419 | 424 | type : '<%=objectType%>'
|
420 | 425 | };
|
421 | 426 | jQuery.contributionModificationContext.validateOnUpdate({
|
422 | 427 | contributionId : contributionId,
|
423 |
| - status : ${silfn:isDefined(wysiwygTextValue) and isModificationContextEnabled |
424 |
| - ? 'undefined' |
425 |
| - : '$.contributionModificationContext.statuses.CREATION'}, |
| 428 | + status : wysiwygContent.length > 0 && modifContextEnabled ? |
| 429 | + undefined : '$.contributionModificationContext.statuses.CREATION', |
426 | 430 | callback : function() {
|
427 |
| - <c:choose> |
428 |
| - <c:when test="${silfn:isDefined(wysiwygTextValue) and isHandledSubscriptionConfirmation}"> |
429 |
| - jQuery.subscription.confirmNotificationSendingOnUpdate({ |
430 |
| - contribution : { |
431 |
| - contributionId : contributionId, |
432 |
| - indexable : <%=indexIt%>, |
433 |
| - locationId : '${handledSubscriptionLocationId}' |
434 |
| - }, |
435 |
| - comment : { |
436 |
| - saveNote : ${silfn:booleanValue(commentActivated)} |
437 |
| - }, |
438 |
| - subscription : { |
439 |
| - componentInstanceId : '<%=componentId%>', |
440 |
| - type : '${handledSubscriptionType}', |
441 |
| - resourceId : '${handledSubscriptionResourceId}' |
442 |
| - }, |
443 |
| - callback : function() { |
444 |
| - commit.call(this, false); |
445 |
| - } |
446 |
| - }); |
447 |
| - </c:when> |
448 |
| - <c:otherwise> |
449 |
| - commit.call(this, ${silfn:isNotDefined(wysiwygTextValue) ? 'true' : 'false'}); |
450 |
| - </c:otherwise> |
451 |
| - </c:choose> |
| 431 | + if (wysiwygContent.length > 0 && subscriptionHandled) { |
| 432 | + jQuery.subscription.confirmNotificationSendingOnUpdate({ |
| 433 | + contribution: { |
| 434 | + contributionId: contributionId, |
| 435 | + indexable: <%=indexIt%>, |
| 436 | + locationId: '${handledSubscriptionLocationId}' |
| 437 | + }, |
| 438 | + comment: { |
| 439 | + saveNote: ${silfn:booleanValue(commentActivated)} |
| 440 | + }, |
| 441 | + subscription: { |
| 442 | + componentInstanceId: '<%=componentId%>', |
| 443 | + type: '${handledSubscriptionType}', |
| 444 | + resourceId: '${handledSubscriptionResourceId}' |
| 445 | + }, |
| 446 | + callback: function () { |
| 447 | + commit.call(this, false); |
| 448 | + } |
| 449 | + }); |
| 450 | + } else { |
| 451 | + commit.call(this, wysiwygContent.length === 0); |
| 452 | + } |
452 | 453 | }});
|
453 | 454 | return false;
|
454 | 455 | });
|
|
0 commit comments