Changes for page InplaceEditing
From version 3.1
edited by Nazzareno Pompei
on 22/12/2021 09:31
on 22/12/2021 09:31
Change comment:
Install extension [org.xwiki.platform:xwiki-platform-edit-ui/13.10.1]
To version 4.1
edited by Nazzareno Pompei
on 28/10/2022 08:43
on 28/10/2022 08:43
Change comment:
Install extension [org.xwiki.platform:xwiki-platform-edit-ui/14.9]
Summary
-
Objects (2 modified, 0 added, 0 removed)
Details
- XWiki.JavaScriptExtension[0]
-
- Code
-
... ... @@ -87,26 +87,24 @@ 87 87 timestamp: new Date().getTime() 88 88 }; 89 89 if (!forView) { 90 - // We need the annotated XHTML when editing in order to be able to protect the rendering transformations and to90 + // We need the annotated HTML when editing in order to be able to protect the rendering transformations and to 91 91 // be able to recreate the wiki syntax. 92 - queryString.outputSyntax = 'annotatedxhtml'; 92 + queryString.outputSyntax = 'annotatedhtml'; 93 + queryString.outputSyntaxVersion = '5.0' 93 93 // Currently, only the macro transformations are protected and thus can be edited. 94 94 // See XRENDERING-78: Add markers to modified XDOM by Transformations/Macros 95 95 queryString.transformations = 'macro'; 96 96 } 97 - var thisXWikiDocument = this; 98 - return $.get(this.getURL('view'), queryString).fail(function() { 99 - new XWiki.widgets.Notification(l10n['edit.inplace.page.renderFailed'], 'error'); 100 - }).then(function(html) { 98 + return Promise.resolve($.get(this.getURL('view'), queryString)).then(html => { 101 101 // Render succeeded. 102 102 var container = $('<div/>').html(html); 103 - return $.extend(this XWikiDocument, {101 + return $.extend(this, { 104 104 renderedTitle: container.find('#document-title h1').html(), 105 105 renderedContent: container.find('#xwikicontent').html() 106 106 }); 107 - } , function() {108 - //Renderfailed.109 - return thisXWikiDocument;105 + }).catch(() => { 106 + new XWiki.widgets.Notification(l10n['edit.inplace.page.renderFailed'], 'error'); 107 + return Promise.reject(this); 110 110 }); 111 111 }, 112 112 ... ... @@ -116,20 +116,19 @@ 116 116 * @return a promise that resolves to this document instance if the reload request succeeds 117 117 */ 118 118 reload: function() { 119 - var thisXWikiDocument = this; 120 - return $.getJSON(this.getRestURL(), { 117 + return Promise.resolve($.getJSON(this.getRestURL(), { 121 121 // Make sure the response is not retrieved from cache (IE11 doesn't obey the caching HTTP headers). 122 122 timestamp: new Date().getTime() 123 - }).then( function(newXWikiDocument){120 + })).then(newXWikiDocument => { 124 124 // Reload succeeded. 125 125 // Resolve the document reference. 126 - this XWikiDocument.documentReference = XWiki.Model.resolve(newXWikiDocument.id, XWiki.EntityType.DOCUMENT);123 + this.documentReference = XWiki.Model.resolve(newXWikiDocument.id, XWiki.EntityType.DOCUMENT); 127 127 // We were able to load the document so it's not new. 128 - this XWikiDocument.isNew = false;129 - return $.extend(this XWikiDocument, newXWikiDocument);130 - } , function() {125 + this.isNew = false; 126 + return $.extend(this, newXWikiDocument); 127 + }).catch(() => { 131 131 // Reload failed. 132 - return thisXWikiDocument;129 + return Promise.reject(this); 133 133 }); 134 134 }, 135 135 ... ... @@ -140,9 +140,8 @@ 140 140 * @return a promise that resolves to this document instance if the lock request succeeds 141 141 */ 142 142 lock: function(action, force) { 143 - var thisXWikiDocument = this; 144 144 action = action || 'edit'; 145 - return $.getJSON(this.getURL('get'), { 141 + return Promise.resolve($.getJSON(this.getURL('get'), { 146 146 sheet: 'XWiki.InplaceEditing', 147 147 action: 'lock', 148 148 lockAction: action, ... ... @@ -151,20 +151,20 @@ 151 151 outputSyntax: 'plain', 152 152 // Make sure the response is not retrieved from cache (IE11 doesn't obey the caching HTTP headers). 153 153 timestamp: new Date().getTime() 154 - }).then( function() {150 + })).then(() => { 155 155 // Lock succeeded. 156 - this XWikiDocument.locked = action;157 - return this XWikiDocument;158 - } , function(response){152 + this.locked = action; 153 + return this; 154 + }).catch(response => { 159 159 // Lock failed. 160 - delete this XWikiDocument.locked;156 + delete this.locked; 161 161 // Check if the user can force the lock. 162 162 var lockConfirmation = response.responseJSON; 163 163 if (response.status === 423 && lockConfirmation) { 164 164 // The user can force the lock, but needs confirmation. 165 - this XWikiDocument.lockConfirmation = lockConfirmation;161 + this.lockConfirmation = lockConfirmation; 166 166 } 167 - return thisXWikiDocument;163 + return Promise.reject(this); 168 168 }); 169 169 }, 170 170 ... ... @@ -259,7 +259,7 @@ 259 259 $('#xwikicontent').removeAttr('tabindex'); 260 260 if (sectionId) { 261 261 // Select the heading of the specified section. 262 - $('#xwikicontent > #' + escapeSelector(sectionId)).each(function() { 258 + $('#xwikicontent > #' + $.escapeSelector(sectionId)).each(function() { 263 263 selectText(this); 264 264 }); 265 265 } ... ... @@ -267,22 +267,6 @@ 267 267 }); 268 268 }; 269 269 270 - var escapeSelector = function(selector) { 271 - if (window.CSS && typeof CSS.escape === 'function') { 272 - // Not supported by Internet Explorer. 273 - return CSS.escape(selector); 274 - } else if (typeof $.escapeSelector === 'function') { 275 - // Added in jQuery 3.0 276 - return $.escapeSelector(selector); 277 - } else if (typeof selector === 'string') { 278 - // Simple implementation. 279 - // See https://learn.jquery.com/using-jquery-core/faq/how-do-i-select-an-element-by-an-id-that-has-characters-used-in-css-notation/ 280 - return selector.replace(/(:|\.|\[|\]|,|=|@)/g, '\\$1'); 281 - } else { 282 - return selector; 283 - } 284 - }; 285 - 286 286 // We preserve the document data between edits in order to be able to know which document translation should be edited 287 287 // (e.g. when the document translation is missing and we create it, the next edit session should target the created 288 288 // translation). ... ... @@ -290,6 +290,11 @@ 290 290 language: xcontext.locale 291 291 }, xwikiDocumentAPI); 292 292 273 + var setCurrentXWikiDocument = function(xwikiDocument) { 274 + currentXWikiDocument = xwikiDocument; 275 + return Promise.resolve(xwikiDocument); 276 + }; 277 + 293 293 var editInPlace = function(options) { 294 294 options = $.extend({ 295 295 afterEdit: function() {}, ... ... @@ -297,11 +297,16 @@ 297 297 }, options); 298 298 $('#xwikicontent').addClass('loading'); 299 299 // Lock the document first. 300 - return lock(currentXWikiDocument) .fail(options.lockFailed)285 + return lock(currentXWikiDocument) 301 301 // Then load the document only if we managed to lock it. 302 - .then(load) 287 + .then(load, xwikiDocument => { 288 + options.lockFailed(xwikiDocument); 289 + return Promise.reject(xwikiDocument); 303 303 // Then load the editors only if we managed to load the document. 304 - .then(edit).done(options.afterEdit).always(function() { 291 + }).then(edit).then(xwikiDocument => { 292 + options.afterEdit(xwikiDocument); 293 + return xwikiDocument; 294 + }).finally(() => { 305 305 $('#xwikicontent').removeClass('loading'); 306 306 // Then wait for an action (save, cancel, reload) only if the editors were loaded successfuly. 307 307 }).then(maybeSave) ... ... @@ -309,34 +309,39 @@ 309 309 .then(unlock, unlock) 310 310 // Finally view the document both when the edit ended with success and with a failure. 311 311 .then(view, view) 312 - .always(function(xwikiDocument) { 313 - // Update the current document for the next edit session. 314 - currentXWikiDocument = xwikiDocument; 315 - }); 302 + // Update the current document for the next edit session. 303 + .then(setCurrentXWikiDocument, setCurrentXWikiDocument); 316 316 }; 317 317 318 318 var lock = function(xwikiDocument) { 319 - return xwikiDocument.lock().th en(null,function(xwikiDocument) {307 + return xwikiDocument.lock().catch(function(xwikiDocument) { 320 320 // If the document was already locked then we need to ask the user if they want to force the lock. 321 321 if (xwikiDocument.lockConfirmation) { 322 322 var confirmation = xwikiDocument.lockConfirmation; 323 323 delete xwikiDocument.lockConfirmation; 324 - return maybeForceLock(confirmation).then( $.proxy(xwikiDocument, 'lock', 'edit', true), function() {312 + return maybeForceLock(confirmation).then(xwikiDocument.lock.bind(xwikiDocument, 'edit', true), function() { 325 325 // Cancel the edit action. 326 - return xwikiDocument; 314 + return Promise.reject(xwikiDocument); 327 327 }); 328 328 } else { 329 329 new XWiki.widgets.Notification(l10n['edit.inplace.page.lockFailed'], 'error'); 330 - return xwikiDocument; 318 + return Promise.reject(xwikiDocument); 331 331 } 332 332 }); 333 333 }; 334 334 335 335 var maybeForceLock = function(confirmation) { 336 - var deferred = $.Deferred(); 324 + var deferred, promise = new Promise((resolve, reject) => { 325 + deferred = {resolve, reject}; 326 + }); 327 + // We need the catch() to prevent the "Uncaught (in promise)" error log in the console. 328 + promise.catch(() => {}).finally(() => { 329 + // This flag is used by the Force Lock modal to know whether the promise is settled when the modal is closing. 330 + deferred.settled = true; 331 + }); 337 337 // Reuse the confirmation modal once it is created. 338 338 var modal = $('.force-edit-lock-modal'); 339 - if (modal.length === 0) {334 + if (!modal.length) { 340 340 modal = createForceLockModal(); 341 341 } 342 342 // Update the deferred that needs to be resolved or rejected. ... ... @@ -352,7 +352,7 @@ 352 352 } 353 353 // Show the confirmation modal. 354 354 modal.modal('show'); 355 - return deferred.promise();350 + return promise; 356 356 }; 357 357 358 358 var createForceLockModal = function() { ... ... @@ -376,16 +376,16 @@ 376 376 '</div>' 377 377 ].join('')); 378 378 modal.find('.close').attr('aria-label', l10n['edit.inplace.close']); 379 - modal.find('.modal-footer .btn-warning').click (function() {374 + modal.find('.modal-footer .btn-warning').on('click', function() { 380 380 // The user has confirmed they want to force the lock. 381 381 modal.data('deferred').resolve(); 382 382 modal.modal('hide'); 383 383 }); 384 384 modal.on('hide.bs.modal', function() { 385 - // If the lock promise is not yet resolved when the modal is closing then it means the modal was canceled,380 + // If the lock promise is not yet settled when the modal is closing then it means the modal was canceled, 386 386 // i.e. the user doesn't want to force the lock. 387 387 var deferred = modal.data('deferred'); 388 - if (deferred.st ate() === 'pending') {383 + if (!deferred.settled) { 389 389 deferred.reject(); 390 390 } 391 391 }); ... ... @@ -393,17 +393,19 @@ 393 393 }; 394 394 395 395 var load = function(xwikiDocument) { 396 - return xwikiDocument.reload(). done(function(xwikiDocument){391 + return xwikiDocument.reload().then(xwikiDocument => { 397 397 // Clone the current document version and keep a reference to it in order to be able to restore it on cancel. 398 398 xwikiDocument.originalDocument = $.extend(true, { 399 399 renderedTitle: $('#document-title h1').html(), 400 400 renderedContent: $('#xwikicontent').html() 401 401 }, xwikiDocument); 402 - }).fail(function() { 397 + return xwikiDocument; 398 + }).catch(xwikiDocument => { 403 403 new XWiki.widgets.Notification(l10n['edit.inplace.page.loadFailed'], 'error'); 400 + return Promise.reject(xwikiDocument); 404 404 // Render the document for edit, in order to have the annotated content HTML. The annotations are used to protect 405 405 // the rendering transformations (e.g. macros) when editing the content. 406 - }).then( $.proxy(render,null, false));403 + }).then(render.bind(null, false)); 407 407 }; 408 408 409 409 /** ... ... @@ -416,7 +416,7 @@ 416 416 }; 417 417 418 418 var maybeSave = function(xwikiDocument) { 419 - return waitForAction(xwikiDocument).then( function(action){416 + return waitForAction(xwikiDocument).then(action => { 420 420 switch(action.name) { 421 421 case 'save': return save({ 422 422 document: action.document, ... ... @@ -429,29 +429,29 @@ 429 429 }; 430 430 431 431 var waitForAction = function(xwikiDocument) { 432 - var deferred = $.Deferred(); 433 - // We wait for the first save, reload or cancel event, whichever is triggered first. Note that the event listeners 434 - // that are not executed first will remain registered but that doesn't cause any problems because the state of a 435 - // deferred object (promise) cannot change once it was resolved. So the first event that fires will resolve the 436 - // promise and the remaining events won't be able to change that. The remaining event listeners could be called 437 - // later but they won't have any effect on the deferred object. 438 - $(document).one([ 439 - 'xwiki:actions:save', 440 - 'xwiki:actions:reload', 441 - 'xwiki:actions:cancel', 442 - ].join(' '), '.xcontent.form', function(event, data) { 443 - deferred.resolve({ 444 - name: event.type.substring('xwiki:actions:'.length), 445 - document: xwikiDocument, 446 - data: data 429 + return new Promise((resolve, reject) => { 430 + // We wait for the first save, reload or cancel event, whichever is triggered first. Note that the event listeners 431 + // that are not executed first will remain registered but that doesn't cause any problems because the state of a 432 + // deferred object (promise) cannot change once it was resolved. So the first event that fires will resolve the 433 + // promise and the remaining events won't be able to change that. The remaining event listeners could be called 434 + // later but they won't have any effect on the deferred object. 435 + $(document).one([ 436 + 'xwiki:actions:save', 437 + 'xwiki:actions:reload', 438 + 'xwiki:actions:cancel', 439 + ].join(' '), '.xcontent.form', function(event, data) { 440 + resolve({ 441 + name: event.type.substring('xwiki:actions:'.length), 442 + document: xwikiDocument, 443 + data: data 444 + }); 447 447 }); 448 448 }); 449 - return deferred.promise(); 450 450 }; 451 451 452 452 var save = function(data) { 453 453 // Push the changes to the server. 454 - return push(data.document).then( function(xwikiDocument){451 + return push(data.document).then(xwikiDocument => { 455 455 // Save succeeded. 456 456 return shouldReload(xwikiDocument).then( 457 457 // The document was saved with merge and thus if we want to continue eding we need to reload the editor (because ... ... @@ -458,7 +458,7 @@ 458 458 // its content doesn't match the saved content). 459 459 reload, 460 460 // No need to reload the editor because either the action was Save & View or there was no merge on save. 461 - $.proxy(maybeContinueEditing,null, data['continue'])458 + maybeContinueEditing.bind(null, data['continue']) 462 462 ); 463 463 // Save failed. Continue editing because we may have unsaved content. 464 464 }, maybeSave); ... ... @@ -466,15 +466,15 @@ 466 466 467 467 var push = function(xwikiDocument) { 468 468 // Let actionButtons.js do the push. We just catch the result. 469 - vardeferred= $.Deferred();470 - // We wait for the save request to either succeed or fail. Note that one of the event listeners will remain 471 - // registered but that doesn't cause any problems because the state of a deferred object (promise) cannot change 472 - // once it was resolved or rejected. So the first event that fires will resolve/reject the promise and the remaining473 - // event won't be able to change that. The remaining event listener could be called later but it won't have any474 - // effect. 475 - $(document).one('xwiki:document:saved', '.xcontent.form', $.proxy(deferred, 'resolve', xwikiDocument));476 - $(document).one('xwiki:document:saveFailed', '.xcontent.form', $.proxy(deferred, 'reject', xwikiDocument));477 - return deferred.promise();466 + return new Promise((resolve, reject) => { 467 + // We wait for the save request to either succeed or fail. Note that one of the event listeners will remain 468 + // registered but that doesn't cause any problems because the state of a deferred object (promise) cannot change 469 + // once it was resolved or rejected. So the first event that fires will resolve/reject the promise and the 470 + // remaining event won't be able to change that. The remaining event listener could be called later but it won't 471 + // have any effect. 472 + $(document).one('xwiki:document:saved', '.xcontent.form', resolve.bind(null, xwikiDocument)); 473 + $(document).one('xwiki:document:saveFailed', '.xcontent.form', reject.bind(null, xwikiDocument)); 474 + }); 478 478 }; 479 479 480 480 var maybeContinueEditing = function(continueEditing, xwikiDocument) { ... ... @@ -495,9 +495,9 @@ 495 495 496 496 // Reload the document JSON data (to have the new version) and render the document for view. We need the view HTML 497 497 // both if we stop editing now and if we continue but cancel the edit later. 498 - return xwikiDocument.reload().then( $.proxy(render,null, true)).then(499 - $.proxy(afterReloadAndRender,null, /* success: */ true),500 - $.proxy(afterReloadAndRender,null, /* success: */ false)495 + return xwikiDocument.reload().then(render.bind(null, true)).then( 496 + afterReloadAndRender.bind(null, /* success: */ true), 497 + afterReloadAndRender.bind(null, /* success: */ false) 501 501 ); 502 502 }; 503 503 ... ... @@ -516,7 +516,7 @@ 516 516 }; 517 517 518 518 // Make sure we unlock the document when the user navigates to another page. 519 - $(window).on('unload pagehide', $.proxy(unlock,null, currentXWikiDocument));516 + $(window).on('unload pagehide', unlock.bind(null, currentXWikiDocument)); 520 520 521 521 var shouldReload = function(xwikiDocument) { 522 522 var reloadEventFired = false; ... ... @@ -523,18 +523,18 @@ 523 523 $(document).one('xwiki:actions:reload.maybe', '.xcontent.form', function() { 524 524 reloadEventFired = true; 525 525 }); 526 - vardeferred= $.Deferred();527 - // Wait a bit to see if the reload event is fired. 528 - setTimeout(function() { 529 - // Remove the listener in case the reload event wasn't fired. 530 - $(document).off('xwiki:actions:reload.maybe'); 531 - if (reloadEventFired) { 532 - deferred.resolve(xwikiDocument);533 - } else { 534 - deferred.reject(xwikiDocument);535 - } 536 - }, 0); 537 - return deferred.promise();523 + return new Promise((resolve, reject) => { 524 + // Wait a bit to see if the reload event is fired. 525 + setTimeout(function() { 526 + // Remove the listener in case the reload event wasn't fired. 527 + $(document).off('xwiki:actions:reload.maybe'); 528 + if (reloadEventFired) { 529 + resolve(xwikiDocument); 530 + } else { 531 + reject(xwikiDocument); 532 + } 533 + }, 0); 534 + }); 538 538 }; 539 539 540 540 var reload = function(xwikiDocument) { ... ... @@ -561,7 +561,7 @@ 561 561 if (window.location.hash === '#edit' || window.location.hash === '#translate') { 562 562 history.replaceState(null, null, '#'); 563 563 } 564 - return $.Deferred().resolve(xwikiDocument).promise();561 + return Promise.resolve(xwikiDocument); 565 565 }; 566 566 567 567 var edit = function(xwikiDocument) { ... ... @@ -606,7 +606,7 @@ 606 606 // action buttons so we need to re-enable them each time we enter the edit mode. 607 607 fakeForm.enable(); 608 608 } 609 - return $.Deferred().resolve(xwikiDocument).promise();606 + return Promise.resolve(xwikiDocument); 610 610 } 611 611 }; 612 612 ... ... @@ -667,9 +667,9 @@ 667 667 .parent().removeClass('hidden'); 668 668 } 669 669 }); 670 - return $.get(XWiki.currentDocument.getURL('get'), { 667 + return Promise.resolve($.get(XWiki.currentDocument.getURL('get'), { 671 671 xpage: 'editactions' 672 - }).then( function(html){669 + })).then(html => { 673 673 actionButtons.html(html); 674 674 // Fix the name of the Save & View action. 675 675 actionButtons.find('.btn-primary').first().attr('name', 'action_save'); ... ... @@ -679,21 +679,21 @@ 679 679 actionButtons.append('<div class="hidden extra"/>'); 680 680 // Let the others know that the DOM has been updated, in order to enhance it. 681 681 $(document).trigger('xwiki:dom:updated', {'elements': actionButtons.toArray()}); 682 - var deferred = $.Deferred(); 683 - require(['xwiki-actionButtons', 'xwiki-diff', 'xwiki-autoSave'], function() { 684 - overrideEditActions(); 685 - overrideAjaxSaveAndContinue(); 686 - // Activate the auto-save feature passing our fake edit form. Note that autosave.js also creates an instance of 687 - // AutoSave but it doesn't do anything because it doesn't find a real edit form in the page. This is why we have 688 - // to create our own instance of AutoSave passing the right (fake) form. 689 - new XWiki.editors.AutoSave({form: fakeForm}); 690 - var xwikiDocument = actionButtons.data('xwikiDocument'); 691 - // Enable the action buttons (and their shortcut keys) only if we're editing a document. 692 - actionButtons.find(':input').prop('disabled', !xwikiDocument); 693 - deferred.resolve(xwikiDocument); 679 + return new Promise((resolve, reject) => { 680 + require(['xwiki-actionButtons', 'xwiki-diff', 'xwiki-autoSave'], function() { 681 + overrideEditActions(); 682 + overrideAjaxSaveAndContinue(); 683 + // Activate the auto-save feature passing our fake edit form. Note that autosave.js also creates an instance of 684 + // AutoSave but it doesn't do anything because it doesn't find a real edit form in the page. This is why we have 685 + // to create our own instance of AutoSave passing the right (fake) form. 686 + new XWiki.editors.AutoSave({form: fakeForm}); 687 + var xwikiDocument = actionButtons.data('xwikiDocument'); 688 + // Enable the action buttons (and their shortcut keys) only if we're editing a document. 689 + actionButtons.find(':input').prop('disabled', !xwikiDocument); 690 + resolve(xwikiDocument); 691 + }); 694 694 }); 695 - return deferred.promise(); 696 - }, function() { 693 + }).catch(() => { 697 697 new XWiki.widgets.Notification(l10n['edit.inplace.actionButtons.loadFailed'], 'error'); 698 698 }); 699 699 }; ... ... @@ -734,6 +734,13 @@ 734 734 extra[entry.name] = value; 735 735 return extra; 736 736 }, {}); 734 + // retrieve all input fields listing the temporary uploaded files. 735 + var uploadedFiles = $('#xwikicontent').nextAll('input[name="uploadedFiles"]').serializeArray().reduce(function(extra, entry) { 736 + var value = extra[entry.name] || []; 737 + value.push(entry.value); 738 + extra[entry.name] = value; 739 + return extra; 740 + }, {}); 737 737 var xwikiDocument = this._getActionButtons().data('xwikiDocument'); 738 738 var formData = { 739 739 title: xwikiDocument.rawTitle, ... ... @@ -751,6 +751,8 @@ 751 751 content_syntax: xwikiDocument.syntax 752 752 }); 753 753 } 758 + // Add the temporary uploaded files to the form. 759 + $.extend(formData, uploadedFiles); 754 754 // Check for merge conflicts only if the document is not new and we know the current version. 755 755 if (!xwikiDocument.isNew && xwikiDocument.version) { 756 756 formData.previousVersion = xwikiDocument.version; ... ... @@ -839,7 +839,7 @@ 839 839 deferred: $.Deferred() 840 840 }); 841 841 editContent.trigger('xwiki:actions:edit', data); 842 - return data.deferred. done(function() {848 + return data.deferred.promise().then(() => { 843 843 editContent.show(); 844 844 viewContent.remove(); 845 845 if (withFocus) { ... ... @@ -850,7 +850,8 @@ 850 850 editContent[0].focus({preventScroll: true}); 851 851 }, 0); 852 852 } 853 - }).promise(); 859 + return xwikiDocument; 860 + }); 854 854 }; 855 855 856 856 var startRealTimeEditingSession = function(xwikiDocument) { ... ... @@ -915,7 +915,7 @@ 915 915 require(['editInPlace', wysiwygEditorModule], function(editInPlace) { 916 916 // Re-enable the translate button because it can be used while editing to create the missing translation. 917 917 translateButton.removeClass('disabled'); 918 - handler.edit(editInPlace, data).al ways(function() {925 + handler.edit(editInPlace, data).finally(function() { 919 919 // Restore only the edit button at the end because: 920 920 // * the translate button is restored (if needed) by the editInPlace module 921 921 // * the section edit links are restored when the document is rendered for view ... ... @@ -922,7 +922,7 @@ 922 922 editButton.removeClass('disabled'); 923 923 }); 924 924 // Fallback on the standalone edit mode if we fail to load the required modules. 925 - }, $.proxy(disableInPlaceEditing,event.target));932 + }, disableInPlaceEditing.bind(event.target)); 926 926 }; 927 927 928 928 var disableInPlaceEditing = function() {
- XWiki.UIExtensionClass[0]
-
- Executed Content
-
... ... @@ -48,7 +48,6 @@ 48 48 'editButtonSelector': '#tmEdit > a', 49 49 'translateButtonSelector': '#tmTranslate > a', 50 50 'enableSourceMode': true, 51 - 'enableOfficeImport': $services.officemanager.isConnected(), 52 52 'paths': { 53 53 'js': { 54 54 'xwiki-actionButtons': "#getSkinFileWithParams('js/xwiki/actionbuttons/actionButtons.js' $jsParams)",