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

@tiptap/extension-text-style

Package Overview
Dependencies
Maintainers
5
Versions
178
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tiptap/extension-text-style - npm Package Compare versions

Comparing version 3.0.0-next.1 to 3.0.0-next.2

8

dist/index.d.ts

@@ -10,2 +10,10 @@ import { Mark } from '@tiptap/core';

HTMLAttributes: Record<string, any>;
/**
* When enabled, merges the styles of nested spans into the child span during HTML parsing.
* This prioritizes the style of the child span.
* Used when parsing content created in other editors.
* (Fix for ProseMirror's default behavior.)
* @default false
*/
mergeNestedSpanStyles: boolean;
}

@@ -12,0 +20,0 @@ declare module '@tiptap/core' {

21

dist/index.js

@@ -7,2 +7,17 @@ // src/text-style.ts

} from "@tiptap/core";
var mergeNestedSpanStyles = (element) => {
if (!element.children.length) {
return;
}
const childSpans = element.querySelectorAll("span");
if (!childSpans) {
return;
}
childSpans.forEach((childSpan) => {
var _a, _b;
const childStyle = childSpan.getAttribute("style");
const closestParentSpanStyleOfChild = (_b = (_a = childSpan.parentElement) == null ? void 0 : _a.closest("span")) == null ? void 0 : _b.getAttribute("style");
childSpan.setAttribute("style", `${closestParentSpanStyleOfChild};${childStyle}`);
});
};
var TextStyle = Mark.create({

@@ -13,3 +28,4 @@ name: "textStyle",

return {
HTMLAttributes: {}
HTMLAttributes: {},
mergeNestedSpanStyles: false
};

@@ -26,2 +42,5 @@ },

}
if (this.options.mergeNestedSpanStyles) {
mergeNestedSpanStyles(element);
}
return {};

@@ -28,0 +47,0 @@ }

4

package.json
{
"name": "@tiptap/extension-text-style",
"description": "text style extension for tiptap",
"version": "3.0.0-next.1",
"version": "3.0.0-next.2",
"homepage": "https://tiptap.dev",

@@ -31,3 +31,3 @@ "keywords": [

"devDependencies": {
"@tiptap/core": "^3.0.0-next.1"
"@tiptap/core": "^3.0.0-next.2"
},

@@ -34,0 +34,0 @@ "peerDependencies": {

@@ -14,2 +14,10 @@ import {

HTMLAttributes: Record<string, any>,
/**
* When enabled, merges the styles of nested spans into the child span during HTML parsing.
* This prioritizes the style of the child span.
* Used when parsing content created in other editors.
* (Fix for ProseMirror's default behavior.)
* @default false
*/
mergeNestedSpanStyles: boolean,
}

@@ -29,2 +37,17 @@

const mergeNestedSpanStyles = (element: HTMLElement) => {
if (!element.children.length) { return }
const childSpans = element.querySelectorAll('span')
if (!childSpans) { return }
childSpans.forEach(childSpan => {
const childStyle = childSpan.getAttribute('style')
const closestParentSpanStyleOfChild = childSpan.parentElement?.closest('span')?.getAttribute('style')
childSpan.setAttribute('style', `${closestParentSpanStyleOfChild};${childStyle}`)
})
}
/**

@@ -43,2 +66,3 @@ * This extension allows you to create text styles. It is required by default

HTMLAttributes: {},
mergeNestedSpanStyles: false,
}

@@ -57,2 +81,3 @@ },

}
if (this.options.mergeNestedSpanStyles) { mergeNestedSpanStyles(element) }

@@ -59,0 +84,0 @@ return {}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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