New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

textarea-caret-ts

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

textarea-caret-ts - npm Package Compare versions

Comparing version 4.0.4 to 4.1.0

10

index.d.ts

@@ -22,7 +22,7 @@ export declare namespace Caret {

/**
* left postition.
* left position.
*/
left: number;
/**
* top postition.
* top position.
*/

@@ -56,8 +56,8 @@ top: number;

/**
* set the top and left css stlye of the element based on the absolute posiotion of the caretElements caret,
* @param offset offsets the postion.
* sets the top and left css style of the element based on the absolute position of the caretElements caret,
* @param offset offsets the position.
* @param detectBoundary offsets the position if the position would be outside the window.
* @param returnOnly if true the element position wont be set.
*/
function setElementPositionBasedOnCaret(element: HTMLElement, caretElement: HTMLInputElement | HTMLTextAreaElement, offset?: Point, detectBoundary?: boolean, returnOnly?: boolean): Point;
function setElementPositionBasedOnCaret(element: HTMLElement, caretElement: HTMLInputElement | HTMLTextAreaElement, offset?: Point, margin?: number, detectBoundary?: boolean, returnOnly?: boolean): Point;
}

@@ -64,0 +64,0 @@ /**

@@ -78,3 +78,3 @@ "use strict";

}
// The mirror div will replicate the textarea's style
// The mirror div will replicate the textareas style
var div = document.createElement('div');

@@ -142,3 +142,3 @@ div.id = 'input-textarea-caret-position-mirror-div';

// The *only* reliable way to do that is to copy the *entire* rest of the
// textarea's content into the <span> created at the caret position.
// textareas content into the <span> created at the caret position.
// For inputs, just '.' would be enough, but no need to bother.

@@ -166,9 +166,10 @@ span.textContent = element.value.substring(position) || '.'; // || because a completely empty faux span doesn't render at all

/**
* set the top and left css stlye of the element based on the absolute posiotion of the caretElements caret,
* @param offset offsets the postion.
* sets the top and left css style of the element based on the absolute position of the caretElements caret,
* @param offset offsets the position.
* @param detectBoundary offsets the position if the position would be outside the window.
* @param returnOnly if true the element position wont be set.
*/
function setElementPositionBasedOnCaret(element, caretElement, offset, detectBoundary, returnOnly) {
function setElementPositionBasedOnCaret(element, caretElement, offset, margin, detectBoundary, returnOnly) {
if (offset === void 0) { offset = { top: 0, left: 0 }; }
if (margin === void 0) { margin = 2; }
if (detectBoundary === void 0) { detectBoundary = true; }

@@ -179,8 +180,8 @@ if (returnOnly === void 0) { returnOnly = false; }

pos.left =
pos.left + element.clientWidth + offset.left > window.scrollX + window.innerWidth
? (pos.left = window.scrollX + window.innerWidth - element.clientWidth)
pos.left + (element.clientWidth + margin) + offset.left > window.scrollX + window.innerWidth
? (pos.left = window.scrollX + window.innerWidth - (element.clientWidth + margin))
: (pos.left += offset.left);
pos.top =
pos.top + element.clientHeight + offset.top > window.scrollY + window.innerHeight
? (pos.top -= element.clientHeight)
pos.top + (element.clientWidth + margin) + offset.top > window.scrollY + window.innerHeight
? (pos.top -= element.clientWidth + margin)
: (pos.top += offset.top);

@@ -187,0 +188,0 @@ }

{
"name": "textarea-caret-ts",
"repository": "theRealSyler/textarea-caret-position",
"version": "4.0.4",
"version": "4.1.0",
"authors": "Dan Dascalescu (@dandv), Jonathan Ong <me@jongleberry.com> (http://jongleberry.com), Leonard Grosoli <hileo77@gmail.com>",
"description": "a fork of the textarea-caret package",
"description": "fork of the textarea-caret package",
"files": [

@@ -11,2 +11,5 @@ "index.js",

],
"scripts": {
"prepack": "tsc -b"
},
"main": "index.js",

@@ -13,0 +16,0 @@ "types": "index.d.ts",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc