isEditable.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.editableInputTypes = void 0;
  6. exports.isEditable = isEditable;
  7. exports.isEditableInput = isEditableInput;
  8. var _isElementType = require("../misc/isElementType");
  9. var _isContentEditable = require("./isContentEditable");
  10. function isEditable(element) {
  11. return isEditableInput(element) || (0, _isElementType.isElementType)(element, 'textarea', {
  12. readOnly: false
  13. }) || (0, _isContentEditable.isContentEditable)(element);
  14. }
  15. let editableInputTypes;
  16. exports.editableInputTypes = editableInputTypes;
  17. (function (editableInputTypes) {
  18. editableInputTypes["text"] = "text";
  19. editableInputTypes["date"] = "date";
  20. editableInputTypes["datetime-local"] = "datetime-local";
  21. editableInputTypes["email"] = "email";
  22. editableInputTypes["month"] = "month";
  23. editableInputTypes["number"] = "number";
  24. editableInputTypes["password"] = "password";
  25. editableInputTypes["search"] = "search";
  26. editableInputTypes["tel"] = "tel";
  27. editableInputTypes["time"] = "time";
  28. editableInputTypes["url"] = "url";
  29. editableInputTypes["week"] = "week";
  30. })(editableInputTypes || (exports.editableInputTypes = editableInputTypes = {}));
  31. function isEditableInput(element) {
  32. return (0, _isElementType.isElementType)(element, 'input', {
  33. readOnly: false
  34. }) && Boolean(editableInputTypes[element.type]);
  35. }