Änderungen von Dokument Script
Zuletzt geändert von Daniel Herrmann am 2026/02/07 23:23
Von Version
4.1
bearbeitet von Daniel Herrmann
am 2026/02/04 20:22
am 2026/02/04 20:22
Änderungskommentar:
Install extension [org.xwiki.platform:xwiki-platform-annotation-ui/17.10.3]
Auf Version
2.1
bearbeitet von Daniel Herrmann
am 2025/07/19 16:47
am 2025/07/19 16:47
Änderungskommentar:
Install extension [org.xwiki.platform:xwiki-platform-annotation-ui/17.5.0]
Zusammenfassung
Details
- XWiki.JavaScriptExtension[1]
-
- Code
-
... ... @@ -766,7 +766,7 @@ 766 766 } else { 767 767 // Show the bubble and fetch the annotation display in it. 768 768 var bubble = this.displayLoadingBubble(event.element().cumulativeOffset().top, 769 - event.element().cumulativeOffset().left , true);769 + event.element().cumulativeOffset().left); 770 770 bubble.writeAttribute('id', bubbleId); 771 771 this.fetchAndShowAnnotationDetails(id, bubble); 772 772 } ... ... @@ -799,36 +799,22 @@ 799 799 }.bind(this)); 800 800 }, 801 801 802 - displayLoadingBubble : function( verticalCoordinate,horizontalCoordinate, hasMarker) {803 - // create a bubbleelement wrappingthe form802 + displayLoadingBubble : function(top, left) { 803 + // create an element with the form 804 804 var bubble = new Element('div', {'class' : 'annotation-bubble'}); 805 - // Adda nice loading panel inside805 + // and a nice loading panel inside 806 806 bubble.insert({top : new Element('div', {'class' : 'loading'})}); 807 - // Position it off-screen at first, before we measure it and compute its final position 808 - bubble.style.top = verticalCoordinate + 'px'; 809 - bubble.style.left = '-100%'; 810 - // and insert the bubble in the content 807 + // and put it in the content 811 811 document.body.insert({bottom : bubble}); 809 + // make it hidden for the moment 810 + bubble.toggleClassName('hidden'); 811 + // position it 812 + bubble.style.left = left + 'px'; 813 + bubble.style.top = top + 'px'; 814 + // make it visible 815 + bubble.toggleClassName('hidden'); 812 812 // put this bubble in the bubbles stack 813 813 this.bubbles.push(bubble); 814 - // position the bubble 815 - // By default, we position it to the right and under the coordinates 816 - // Position it horizontally. 817 - let bubbleStyles = getComputedStyle(bubble); 818 - // The width in pixels of the annotation marker added in the text. 819 - const markerWidth = 10; 820 - let markerOffset = hasMarker ? -markerWidth : 0; 821 - let bubbleWidth = bubble.offsetWidth 822 - + parseInt(bubbleStyles.marginLeft) 823 - + parseInt(bubbleStyles.marginRight); 824 - if (horizontalCoordinate < bubbleWidth 825 - || horizontalCoordinate + markerOffset + bubbleWidth < window.innerWidth) { 826 - bubble.style.left = horizontalCoordinate + 'px'; 827 - } else { 828 - // There isn't enough space on the right of the window to fit the modal, and there is enough on the left. 829 - bubble.style.left = (horizontalCoordinate + markerOffset - bubbleWidth) + 'px'; 830 - bubble.toggleClassName('annotation-bubble-position-left'); 831 - } 832 832 833 833 return bubble; 834 834 }, ... ... @@ -1152,7 +1152,7 @@ 1152 1152 this.selectionService.highlightSelection('#FFEE99'); 1153 1153 // get the position and build the loading bubble 1154 1154 var position = this.selectionService.getPositionNextToSelection(); 1155 - this.createPanel = this.displayLoadingBubble(position.top, position.left , false);1141 + this.createPanel = this.displayLoadingBubble(position.top, position.left); 1156 1156 // remove the ctrl + M listeners, so that only one dialog is displayed at one moment 1157 1157 this.unregisterAddAnnotationShortcut(); 1158 1158 }, ... ... @@ -1245,6 +1245,16 @@ 1245 1245 } 1246 1246 }) 1247 1247 1234 +define('node-module', ['jquery'], function($) { 1235 + return { 1236 + load: function(name, req, onLoad, config) { 1237 + $.get(req.toUrl(name + '.js'), function(text) { 1238 + onLoad.fromText(`define(function(require, exports, module) {${text}});`); 1239 + }, 'text'); 1240 + } 1241 + } 1242 +}); 1243 + 1248 1248 define('xwiki-text-offset-updater', ['jquery', 'node-module!fast-diff'], function($, diff) { 1249 1249 /** 1250 1250 * Compute the changes between different versions of a text.