Release of v5.1.3
Stability update addressing a post-release field issue. #1262. Fix a security vulnerability in custom code redirect URL validation. Add an alert to the Compiler view when no Components exist. #1263.
This commit is contained in:
75 files changed
+2696
-1581
No files matched your search
@@ -212,19 +212,38 @@ jQuery(document).ready(function() {
|
||||
var select_a_snippet = '<?php echo Text::_('COM_COMPONENTBUILDER_SELECT_A_SNIPPET'); ?>';
|
||||
var create_a_snippet = '<?php echo Text::_('COM_COMPONENTBUILDER_CREATE_A_SNIPPET'); ?>';
|
||||
|
||||
HTMLElement.prototype.selText = function() {
|
||||
var obj = this;
|
||||
/**
|
||||
* Select all text content within an HTMLElement.
|
||||
*
|
||||
* Adds a convenient `selText()` method to all HTMLElements.
|
||||
* Works across modern browsers and gracefully handles errors.
|
||||
*
|
||||
* @return {HTMLElement} Returns the element itself for chaining.
|
||||
* @since 5.1.3
|
||||
*/
|
||||
HTMLElement.prototype.selText = function () {
|
||||
try {
|
||||
const selection = window.getSelection();
|
||||
if (!selection) {
|
||||
console.warn('selText: window.getSelection() not supported in this environment.');
|
||||
return this;
|
||||
}
|
||||
|
||||
// For modern browsers, handle the selection
|
||||
var selection = window.getSelection();
|
||||
var range = document.createRange();
|
||||
const range = document.createRange();
|
||||
range.selectNodeContents(this);
|
||||
|
||||
// Select the content of the element
|
||||
range.selectNodeContents(obj);
|
||||
selection.removeAllRanges(); // Clear any previous selections
|
||||
selection.addRange(range); // Add the new selection range
|
||||
selection.removeAllRanges(); // clear any prior selections
|
||||
selection.addRange(range); // select the element's text content
|
||||
|
||||
return this;
|
||||
// Optionally bring the element into view if it's outside viewport
|
||||
if (typeof this.scrollIntoView === 'function') {
|
||||
this.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('selText failed:', error);
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
<?php
|
||||
|
||||
Reference in new issue
Block a user