Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@lexical/hashtag

Package Overview
Dependencies
Maintainers
3
Versions
194
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lexical/hashtag - npm Package Compare versions

Comparing version 0.1.16 to 0.1.17

LexicalHashtag.js.flow

4

LexicalHashtag.d.ts

@@ -17,8 +17,6 @@ /**

createDOM<EditorContext>(config: EditorConfig<EditorContext>): HTMLElement;
setTextContent(text: string): TextNode;
canInsertTextBefore(): boolean;
canInsertTextAfter(): boolean;
isTextEntity(): true;
}
export function $toggleHashtag(node: TextNode): TextNode;
export function $createHashtagNode(text?: string): TextNode;
export function $isHashtagNode(node: LexicalNode | null | undefined): boolean;

@@ -39,34 +39,2 @@ /**

setTextContent(text) {
let targetNode = super.setTextContent(text); // Handle hashtags
if (targetNode.getParent() !== null && !targetNode.isComposing()) {
const indexOfHash = text.indexOf('#');
if (indexOfHash === -1 || targetNode.getTextContent() === '#') {
targetNode = $toggleHashtag(targetNode);
} else if (indexOfHash > 0) {
[targetNode] = targetNode.splitText(indexOfHash);
targetNode = $toggleHashtag(targetNode);
} // Check for invalid characters
if (lexical.$isTextNode(targetNode) && targetNode.isAttached()) {
const targetTextContent = targetNode.getTextContent().slice(1);
const indexOfInvalidChar = targetTextContent.search(/[\s.,\\\/#!$%\^&\*;:{}=\-`~()@]/);
if (indexOfInvalidChar === 0) {
targetNode = $toggleHashtag(targetNode);
} else if (indexOfInvalidChar > 0) {
[, targetNode] = targetNode.splitText(indexOfInvalidChar + 1);
targetNode = $toggleHashtag(targetNode);
}
}
return targetNode;
}
return this;
}
canInsertTextBefore() {

@@ -76,3 +44,3 @@ return false;

canInsertTextAfter() {
isTextEntity() {
return true;

@@ -82,8 +50,2 @@ }

}
function $toggleHashtag(node) {
const text = node.getTextContent();
const replacement = !$isHashtagNode(node) ? $createHashtagNode(text) : lexical.$createTextNode(text);
node.replace(replacement);
return replacement;
}
function $createHashtagNode(text = '') {

@@ -98,3 +60,2 @@ return new HashtagNode(text);

exports.$isHashtagNode = $isHashtagNode;
exports.$toggleHashtag = $toggleHashtag;
exports.HashtagNode = HashtagNode;

@@ -7,4 +7,2 @@ /**

*/
var c=require("@lexical/utils"),d=require("lexical");
class e extends d.TextNode{static getType(){return"hashtag"}static clone(b){return new e(b.__text,b.__key)}constructor(b,a){super(b,a)}createDOM(b){const a=super.createDOM(b);c.addClassNamesToElement(a,b.theme.hashtag);return a}setTextContent(b){let a=super.setTextContent(b);return null===a.getParent()||a.isComposing()?this:(b=b.indexOf("#"),-1===b||"#"===a.getTextContent()?a=f(a):0<b&&([a]=a.splitText(b),a=f(a)),d.$isTextNode(a)&&a.isAttached()&&(b=a.getTextContent().slice(1).search(/[\s.,\\\/#!$%\^&\*;:{}=\-`~()@]/),
0===b?a=f(a):0<b&&([,a]=a.splitText(b+1),a=f(a))),a)}canInsertTextBefore(){return!1}canInsertTextAfter(){return!0}}function f(b){var a=b.getTextContent();a=g(b)?d.$createTextNode(a):h(a);b.replace(a);return a}function h(b=""){return new e(b)}function g(b){return b instanceof e}exports.$createHashtagNode=h;exports.$isHashtagNode=g;exports.$toggleHashtag=f;exports.HashtagNode=e;
var b=require("@lexical/utils"),d=require("lexical");class e extends d.TextNode{static getType(){return"hashtag"}static clone(a){return new e(a.__text,a.__key)}constructor(a,c){super(a,c)}createDOM(a){const c=super.createDOM(a);b.addClassNamesToElement(c,a.theme.hashtag);return c}canInsertTextBefore(){return!1}isTextEntity(){return!0}}exports.$createHashtagNode=function(a=""){return new e(a)};exports.$isHashtagNode=function(a){return a instanceof e};exports.HashtagNode=e;
{
"name": "@lexical/hashtag",
"author": {
"name": "Dominic Gannaway",
"email": "dg@domgan.com"
},
"description": "This package contains the functionality for Lexical hashtags.",

@@ -12,13 +8,12 @@ "keywords": [

"rich-text",
"table",
"hashtag"
],
"license": "MIT",
"version": "0.1.16",
"version": "0.1.17",
"main": "LexicalHashtag.js",
"peerDependencies": {
"lexical": "0.1.16"
"lexical": "0.1.17"
},
"dependencies": {
"@lexical/utils": "0.1.16"
"@lexical/utils": "0.1.17"
},

@@ -25,0 +20,0 @@ "repository": {

Sorry, the diff of this file is not supported yet

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