@rails/ujs
Advanced tools
Comparing version 7.0.4-2 to 7.0.4-3
@@ -76,2 +76,18 @@ /* | ||
Rails.isContentEditable = function(element) { | ||
var isEditable; | ||
isEditable = false; | ||
while (true) { | ||
if (element.isContentEditable) { | ||
isEditable = true; | ||
break; | ||
} | ||
element = element.parentElement; | ||
if (!element) { | ||
break; | ||
} | ||
} | ||
return isEditable; | ||
}; | ||
Rails.$ = function(selector) { | ||
@@ -399,5 +415,5 @@ return Array.prototype.slice.call(document.querySelectorAll(selector)); | ||
(function() { | ||
var disableFormElement, disableFormElements, disableLinkElement, enableFormElement, enableFormElements, enableLinkElement, formElements, getData, isXhrRedirect, matches, setData, stopEverything; | ||
var disableFormElement, disableFormElements, disableLinkElement, enableFormElement, enableFormElements, enableLinkElement, formElements, getData, isContentEditable, isXhrRedirect, matches, setData, stopEverything; | ||
matches = Rails.matches, getData = Rails.getData, setData = Rails.setData, stopEverything = Rails.stopEverything, formElements = Rails.formElements; | ||
matches = Rails.matches, getData = Rails.getData, setData = Rails.setData, stopEverything = Rails.stopEverything, formElements = Rails.formElements, isContentEditable = Rails.isContentEditable; | ||
@@ -422,2 +438,5 @@ Rails.handleDisabledElement = function(e) { | ||
} | ||
if (isContentEditable(element)) { | ||
return; | ||
} | ||
if (matches(element, Rails.linkDisableSelector)) { | ||
@@ -435,2 +454,5 @@ return enableLinkElement(element); | ||
element = e instanceof Event ? e.target : e; | ||
if (isContentEditable(element)) { | ||
return; | ||
} | ||
if (matches(element, Rails.linkDisableSelector)) { | ||
@@ -520,6 +542,8 @@ return disableLinkElement(element); | ||
(function() { | ||
var stopEverything; | ||
var isContentEditable, stopEverything; | ||
stopEverything = Rails.stopEverything; | ||
isContentEditable = Rails.isContentEditable; | ||
Rails.handleMethod = function(e) { | ||
@@ -532,2 +556,5 @@ var csrfParam, csrfToken, form, formContent, href, link, method; | ||
} | ||
if (isContentEditable(this)) { | ||
return; | ||
} | ||
href = Rails.href(link); | ||
@@ -554,6 +581,6 @@ csrfToken = Rails.csrfToken(); | ||
(function() { | ||
var ajax, fire, getData, isCrossDomain, isRemote, matches, serializeElement, setData, stopEverything, | ||
var ajax, fire, getData, isContentEditable, isCrossDomain, isRemote, matches, serializeElement, setData, stopEverything, | ||
slice = [].slice; | ||
matches = Rails.matches, getData = Rails.getData, setData = Rails.setData, fire = Rails.fire, stopEverything = Rails.stopEverything, ajax = Rails.ajax, isCrossDomain = Rails.isCrossDomain, serializeElement = Rails.serializeElement; | ||
matches = Rails.matches, getData = Rails.getData, setData = Rails.setData, fire = Rails.fire, stopEverything = Rails.stopEverything, ajax = Rails.ajax, isCrossDomain = Rails.isCrossDomain, serializeElement = Rails.serializeElement, isContentEditable = Rails.isContentEditable; | ||
@@ -576,2 +603,6 @@ isRemote = function(element) { | ||
} | ||
if (isContentEditable(element)) { | ||
fire(element, 'ajax:stopped'); | ||
return false; | ||
} | ||
withCredentials = element.getAttribute('data-with-credentials'); | ||
@@ -578,0 +609,0 @@ dataType = element.getAttribute('data-type') || 'script'; |
{ | ||
"name": "@rails/ujs", | ||
"version": "7.0.4-2", | ||
"version": "7.0.4-3", | ||
"description": "Ruby on Rails unobtrusive scripting adapter", | ||
@@ -5,0 +5,0 @@ "main": "lib/assets/compiled/rails-ujs.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
31310
702