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

@progress/kendo-editor-common

Package Overview
Dependencies
Maintainers
0
Versions
376
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@progress/kendo-editor-common - npm Package Compare versions

Comparing version 1.12.0 to 1.12.1-develop.1

21

dist/es/flatten-spans.js

@@ -55,4 +55,3 @@ import { htmlToFragment, fragmentToHtml } from './source.js';

const isEmptySpan = (fragment) => {
var _a;
return fragment.childNodes.length === 1 && ((_a = fragment.firstChild) === null || _a === void 0 ? void 0 : _a.nodeName) === 'SPAN' && fragment.firstChild.childNodes.length === 0;
return fragment.childNodes.length === 1 && fragment.firstChild.nodeName === 'SPAN' && fragment.firstChild.childNodes.length === 0;
};

@@ -67,3 +66,2 @@ /**

const flattenNestedSpans = (content) => {
var _a, _b, _c;
const dom = htmlToFragment(content);

@@ -78,3 +76,4 @@ let innerSpan = getInnerSpan(dom);

for (let i = 0; i < innerSpan.style.length; i++) {
parentSpan.style[innerSpan.style.item(i)] = innerSpan.style[innerSpan.style.item(i)];
const prop = innerSpan.style.item(i);
parentSpan.style[prop] = innerSpan.style.getPropertyValue(prop);
}

@@ -99,8 +98,12 @@ innerSpan.removeAttribute('style');

}
(_a = innerSpan.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(innerSpan);
if (!isEmptySpan(left)) {
(_b = parentSpan.parentNode) === null || _b === void 0 ? void 0 : _b.insertBefore(left, parentSpan);
if (innerSpan.parentNode) {
innerSpan.parentNode.removeChild(innerSpan);
}
if (!isEmptySpan(right)) {
(_c = parentSpan.parentNode) === null || _c === void 0 ? void 0 : _c.insertBefore(right, parentSpan.nextSibling);
if (parentSpan.parentNode) {
if (!isEmptySpan(left)) {
parentSpan.parentNode.insertBefore(left, parentSpan);
}
if (!isEmptySpan(right)) {
parentSpan.parentNode.insertBefore(right, parentSpan.nextSibling);
}
}

@@ -107,0 +110,0 @@ }

@@ -14,6 +14,3 @@ import { htmlToFragment, fragmentToHtml } from './source.js';

const innerText = (node) => {
let text = node.innerHTML;
text = text.replace(/<!--(.|\s)*?-->/gi, '');
text = text.replace(/<\/?[^>]+?\/?>/gm, '');
return text;
return node.textContent;
};

@@ -72,7 +69,6 @@ const createList = (type, styleType) => {

const listTypes = (p) => {
let html = p.innerHTML;
const html = p.textContent;
const trimStartText = (t) => {
return t.replace(/^(?:&nbsp;|[\u00a0\n\r\s])+/, '');
};
html = html.replace(/<\/?\w+[^>]*>/g, '').replace(/&nbsp;/g, '\u00a0');
if ((/^[\u2022\u00b7\u00a7\u00d8oØüvn][\u00a0 ]+/.test(html))) {

@@ -79,0 +75,0 @@ return {

@@ -1,2 +0,2 @@

export { domToPmDoc, fragmentToHtml, getHtml, hasSameMarkup, htmlToFragment, parseContent, pmDocToFragment, setHtml, trimWhitespace } from './source.js';
export { domToPmDoc, fragmentToHtml, getHtml, hasSameMarkup, htmlToFragment, parseContent, pmDocToFragment, removeComments, setHtml, trimWhitespace } from './source.js';
export { flattenNestedSpans } from './flatten-spans.js';

@@ -20,3 +20,3 @@ export { applyInlineStyle, getInlineStyles, toggleInlineFormat } from './inline-style.js';

export { bold, italic, link, strikethrough, subscript, superscript, underline } from './config/commands.js';
export { pasteCleanup, removeAttribute, removeComments, removeTag, replaceImageSourcesFromRtf, sanitize, sanitizeClassAttr, sanitizeStyleAttr } from './paste.js';
export { pasteCleanup, removeAttribute, removeTag, replaceImageSourcesFromRtf, sanitize, sanitizeClassAttr, sanitizeStyleAttr } from './paste.js';
export { convertMsLists } from './listConvert.js';

@@ -23,0 +23,0 @@ export { find, findAll, findAt, replace, replaceAll } from './find-replace.js';

@@ -13,3 +13,7 @@ import { convertMsLists } from './listConvert.js';

html = html.replace(/<(?:link|meta) [^>]+?>/ig, '');
html = html.replace(/<style[^>]*?>\s*<\/style>/ig, '');
let previousHtml;
do {
previousHtml = html;
html = html.replace(/<style[^>]*?>\s*<\/style>/ig, '');
} while (html !== previousHtml);
html = html.replace(/<\/?st1:.*?>/gi, '');

@@ -23,8 +27,2 @@ html = html.replace(/<a name="[a-zA-Z0-9_]+">/gmi, '');

/**
* Removes comments in HTML.
*/
const removeComments = (html) => {
return html.replace(/<!--[\s\S]+?-->/g, '');
};
/**
* Removes the specified tag(s).

@@ -166,2 +164,2 @@ */

export { pasteCleanup, removeAttribute, removeComments, removeTag, replaceImageSourcesFromRtf, sanitize, sanitizeClassAttr, sanitizeStyleAttr };
export { pasteCleanup, removeAttribute, removeTag, replaceImageSourcesFromRtf, sanitize, sanitizeClassAttr, sanitizeStyleAttr };

@@ -160,3 +160,3 @@ import { DOMParser, Fragment } from 'prosemirror-model';

restoreStyleAttr(template.content);
return template.content;
return template.content.cloneNode(true);
};

@@ -234,3 +234,20 @@ /**

};
/**
* Removes comments in HTML.
*/
const removeComments = (html) => {
const fragment = htmlToFragment(html);
removeCommentsFromDom(fragment);
return fragmentToHtml(fragment);
};
const removeCommentsFromDom = (dom) => {
var _a;
const iterator = dom.ownerDocument.createNodeIterator(dom, NodeFilter.SHOW_COMMENT);
let commentNode = iterator.nextNode();
while (commentNode) {
(_a = commentNode.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(commentNode);
commentNode = iterator.nextNode();
}
};
export { domToPmDoc, fragmentToHtml, getHtml, hasSameMarkup, htmlToFragment, parseContent, pmDocToFragment, setHtml, trimWhitespace };
export { domToPmDoc, fragmentToHtml, getHtml, hasSameMarkup, htmlToFragment, parseContent, pmDocToFragment, removeComments, setHtml, trimWhitespace };

@@ -268,3 +268,3 @@ import { Node } from 'prosemirror-model';

for (const style in styles) {
if (style && typeof element.style[style] !== 'undefined') {
if (style && element.style[style] !== undefined) {
element.style[style] = styles[style];

@@ -271,0 +271,0 @@ }

@@ -55,4 +55,3 @@ import { htmlToFragment, fragmentToHtml } from './source.js';

const isEmptySpan = (fragment) => {
var _a;
return fragment.childNodes.length === 1 && ((_a = fragment.firstChild) === null || _a === void 0 ? void 0 : _a.nodeName) === 'SPAN' && fragment.firstChild.childNodes.length === 0;
return fragment.childNodes.length === 1 && fragment.firstChild.nodeName === 'SPAN' && fragment.firstChild.childNodes.length === 0;
};

@@ -67,3 +66,2 @@ /**

const flattenNestedSpans = (content) => {
var _a, _b, _c;
const dom = htmlToFragment(content);

@@ -78,3 +76,4 @@ let innerSpan = getInnerSpan(dom);

for (let i = 0; i < innerSpan.style.length; i++) {
parentSpan.style[innerSpan.style.item(i)] = innerSpan.style[innerSpan.style.item(i)];
const prop = innerSpan.style.item(i);
parentSpan.style[prop] = innerSpan.style.getPropertyValue(prop);
}

@@ -99,8 +98,12 @@ innerSpan.removeAttribute('style');

}
(_a = innerSpan.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(innerSpan);
if (!isEmptySpan(left)) {
(_b = parentSpan.parentNode) === null || _b === void 0 ? void 0 : _b.insertBefore(left, parentSpan);
if (innerSpan.parentNode) {
innerSpan.parentNode.removeChild(innerSpan);
}
if (!isEmptySpan(right)) {
(_c = parentSpan.parentNode) === null || _c === void 0 ? void 0 : _c.insertBefore(right, parentSpan.nextSibling);
if (parentSpan.parentNode) {
if (!isEmptySpan(left)) {
parentSpan.parentNode.insertBefore(left, parentSpan);
}
if (!isEmptySpan(right)) {
parentSpan.parentNode.insertBefore(right, parentSpan.nextSibling);
}
}

@@ -107,0 +110,0 @@ }

@@ -14,6 +14,3 @@ import { htmlToFragment, fragmentToHtml } from './source.js';

const innerText = (node) => {
let text = node.innerHTML;
text = text.replace(/<!--(.|\s)*?-->/gi, '');
text = text.replace(/<\/?[^>]+?\/?>/gm, '');
return text;
return node.textContent;
};

@@ -72,7 +69,6 @@ const createList = (type, styleType) => {

const listTypes = (p) => {
let html = p.innerHTML;
const html = p.textContent;
const trimStartText = (t) => {
return t.replace(/^(?:&nbsp;|[\u00a0\n\r\s])+/, '');
};
html = html.replace(/<\/?\w+[^>]*>/g, '').replace(/&nbsp;/g, '\u00a0');
if ((/^[\u2022\u00b7\u00a7\u00d8oØüvn][\u00a0 ]+/.test(html))) {

@@ -79,0 +75,0 @@ return {

@@ -1,2 +0,2 @@

export { domToPmDoc, fragmentToHtml, getHtml, hasSameMarkup, htmlToFragment, parseContent, pmDocToFragment, setHtml, trimWhitespace } from './source.js';
export { domToPmDoc, fragmentToHtml, getHtml, hasSameMarkup, htmlToFragment, parseContent, pmDocToFragment, removeComments, setHtml, trimWhitespace } from './source.js';
export { flattenNestedSpans } from './flatten-spans.js';

@@ -20,3 +20,3 @@ export { applyInlineStyle, getInlineStyles, toggleInlineFormat } from './inline-style.js';

export { bold, italic, link, strikethrough, subscript, superscript, underline } from './config/commands.js';
export { pasteCleanup, removeAttribute, removeComments, removeTag, replaceImageSourcesFromRtf, sanitize, sanitizeClassAttr, sanitizeStyleAttr } from './paste.js';
export { pasteCleanup, removeAttribute, removeTag, replaceImageSourcesFromRtf, sanitize, sanitizeClassAttr, sanitizeStyleAttr } from './paste.js';
export { convertMsLists } from './listConvert.js';

@@ -23,0 +23,0 @@ export { find, findAll, findAt, replace, replaceAll } from './find-replace.js';

@@ -13,3 +13,7 @@ import { convertMsLists } from './listConvert.js';

html = html.replace(/<(?:link|meta) [^>]+?>/ig, '');
html = html.replace(/<style[^>]*?>\s*<\/style>/ig, '');
let previousHtml;
do {
previousHtml = html;
html = html.replace(/<style[^>]*?>\s*<\/style>/ig, '');
} while (html !== previousHtml);
html = html.replace(/<\/?st1:.*?>/gi, '');

@@ -23,8 +27,2 @@ html = html.replace(/<a name="[a-zA-Z0-9_]+">/gmi, '');

/**
* Removes comments in HTML.
*/
const removeComments = (html) => {
return html.replace(/<!--[\s\S]+?-->/g, '');
};
/**
* Removes the specified tag(s).

@@ -166,2 +164,2 @@ */

export { pasteCleanup, removeAttribute, removeComments, removeTag, replaceImageSourcesFromRtf, sanitize, sanitizeClassAttr, sanitizeStyleAttr };
export { pasteCleanup, removeAttribute, removeTag, replaceImageSourcesFromRtf, sanitize, sanitizeClassAttr, sanitizeStyleAttr };

@@ -160,3 +160,3 @@ import { DOMParser, Fragment } from 'prosemirror-model';

restoreStyleAttr(template.content);
return template.content;
return template.content.cloneNode(true);
};

@@ -234,3 +234,20 @@ /**

};
/**
* Removes comments in HTML.
*/
const removeComments = (html) => {
const fragment = htmlToFragment(html);
removeCommentsFromDom(fragment);
return fragmentToHtml(fragment);
};
const removeCommentsFromDom = (dom) => {
var _a;
const iterator = dom.ownerDocument.createNodeIterator(dom, NodeFilter.SHOW_COMMENT);
let commentNode = iterator.nextNode();
while (commentNode) {
(_a = commentNode.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(commentNode);
commentNode = iterator.nextNode();
}
};
export { domToPmDoc, fragmentToHtml, getHtml, hasSameMarkup, htmlToFragment, parseContent, pmDocToFragment, setHtml, trimWhitespace };
export { domToPmDoc, fragmentToHtml, getHtml, hasSameMarkup, htmlToFragment, parseContent, pmDocToFragment, removeComments, setHtml, trimWhitespace };

@@ -268,3 +268,3 @@ import { Node } from 'prosemirror-model';

for (const style in styles) {
if (style && typeof element.style[style] !== 'undefined') {
if (style && element.style[style] !== undefined) {
element.style[style] = styles[style];

@@ -271,0 +271,0 @@ }

@@ -57,4 +57,3 @@ 'use strict';

const isEmptySpan = (fragment) => {
var _a;
return fragment.childNodes.length === 1 && ((_a = fragment.firstChild) === null || _a === void 0 ? void 0 : _a.nodeName) === 'SPAN' && fragment.firstChild.childNodes.length === 0;
return fragment.childNodes.length === 1 && fragment.firstChild.nodeName === 'SPAN' && fragment.firstChild.childNodes.length === 0;
};

@@ -69,3 +68,2 @@ /**

const flattenNestedSpans = (content) => {
var _a, _b, _c;
const dom = source.htmlToFragment(content);

@@ -80,3 +78,4 @@ let innerSpan = getInnerSpan(dom);

for (let i = 0; i < innerSpan.style.length; i++) {
parentSpan.style[innerSpan.style.item(i)] = innerSpan.style[innerSpan.style.item(i)];
const prop = innerSpan.style.item(i);
parentSpan.style[prop] = innerSpan.style.getPropertyValue(prop);
}

@@ -101,8 +100,12 @@ innerSpan.removeAttribute('style');

}
(_a = innerSpan.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(innerSpan);
if (!isEmptySpan(left)) {
(_b = parentSpan.parentNode) === null || _b === void 0 ? void 0 : _b.insertBefore(left, parentSpan);
if (innerSpan.parentNode) {
innerSpan.parentNode.removeChild(innerSpan);
}
if (!isEmptySpan(right)) {
(_c = parentSpan.parentNode) === null || _c === void 0 ? void 0 : _c.insertBefore(right, parentSpan.nextSibling);
if (parentSpan.parentNode) {
if (!isEmptySpan(left)) {
parentSpan.parentNode.insertBefore(left, parentSpan);
}
if (!isEmptySpan(right)) {
parentSpan.parentNode.insertBefore(right, parentSpan.nextSibling);
}
}

@@ -109,0 +112,0 @@ }

@@ -16,6 +16,3 @@ 'use strict';

const innerText = (node) => {
let text = node.innerHTML;
text = text.replace(/<!--(.|\s)*?-->/gi, '');
text = text.replace(/<\/?[^>]+?\/?>/gm, '');
return text;
return node.textContent;
};

@@ -74,7 +71,6 @@ const createList = (type, styleType) => {

const listTypes = (p) => {
let html = p.innerHTML;
const html = p.textContent;
const trimStartText = (t) => {
return t.replace(/^(?:&nbsp;|[\u00a0\n\r\s])+/, '');
};
html = html.replace(/<\/?\w+[^>]*>/g, '').replace(/&nbsp;/g, '\u00a0');
if ((/^[\u2022\u00b7\u00a7\u00d8oØüvn][\u00a0 ]+/.test(html))) {

@@ -81,0 +77,0 @@ return {

@@ -1,2 +0,2 @@

export { domToPmDoc, fragmentToHtml, getHtml, hasSameMarkup, htmlToFragment, parseContent, pmDocToFragment, setHtml, trimWhitespace } from './source.js';
export { domToPmDoc, fragmentToHtml, getHtml, hasSameMarkup, htmlToFragment, parseContent, pmDocToFragment, removeComments, setHtml, trimWhitespace } from './source.js';
export { flattenNestedSpans } from './flatten-spans.js';

@@ -22,3 +22,3 @@ export { applyInlineStyle, getInlineStyles, toggleInlineFormat } from './inline-style.js';

export { InlineFormatOptions, bold, italic, link, strikethrough, subscript, superscript, underline } from './config/commands.js';
export { pasteCleanup, removeAttribute, removeComments, removeTag, replaceImageSourcesFromRtf, sanitize, sanitizeClassAttr, sanitizeStyleAttr } from './paste.js';
export { pasteCleanup, removeAttribute, removeTag, replaceImageSourcesFromRtf, sanitize, sanitizeClassAttr, sanitizeStyleAttr } from './paste.js';
export { convertMsLists } from './listConvert.js';

@@ -25,0 +25,0 @@ export { SearchOptions, find, findAll, findAt, replace, replaceAll } from './find-replace.js';

@@ -57,2 +57,3 @@ 'use strict';

exports.pmDocToFragment = source.pmDocToFragment;
exports.removeComments = source.removeComments;
exports.setHtml = source.setHtml;

@@ -127,3 +128,2 @@ exports.trimWhitespace = source.trimWhitespace;

exports.removeAttribute = paste.removeAttribute;
exports.removeComments = paste.removeComments;
exports.removeTag = paste.removeTag;

@@ -130,0 +130,0 @@ exports.replaceImageSourcesFromRtf = paste.replaceImageSourcesFromRtf;

@@ -8,6 +8,2 @@ import { PasteCleanupSettings } from './types/paste-cleanup-settings.js';

/**
* Removes comments in HTML.
*/
declare const removeComments: (html: string) => string;
/**
* Removes the specified tag(s).

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

export { pasteCleanup, removeAttribute, removeComments, removeTag, replaceImageSourcesFromRtf, sanitize, sanitizeClassAttr, sanitizeStyleAttr };
export { pasteCleanup, removeAttribute, removeTag, replaceImageSourcesFromRtf, sanitize, sanitizeClassAttr, sanitizeStyleAttr };

@@ -15,3 +15,7 @@ 'use strict';

html = html.replace(/<(?:link|meta) [^>]+?>/ig, '');
html = html.replace(/<style[^>]*?>\s*<\/style>/ig, '');
let previousHtml;
do {
previousHtml = html;
html = html.replace(/<style[^>]*?>\s*<\/style>/ig, '');
} while (html !== previousHtml);
html = html.replace(/<\/?st1:.*?>/gi, '');

@@ -25,8 +29,2 @@ html = html.replace(/<a name="[a-zA-Z0-9_]+">/gmi, '');

/**
* Removes comments in HTML.
*/
const removeComments = (html) => {
return html.replace(/<!--[\s\S]+?-->/g, '');
};
/**
* Removes the specified tag(s).

@@ -170,3 +168,2 @@ */

exports.removeAttribute = removeAttribute;
exports.removeComments = removeComments;
exports.removeTag = removeTag;

@@ -173,0 +170,0 @@ exports.replaceImageSourcesFromRtf = replaceImageSourcesFromRtf;

@@ -76,3 +76,7 @@ import { Node as Node$1, Schema, ParseOptions } from 'prosemirror-model';

declare const hasSameMarkup: (dom1: string, dom2: string, schema: Schema, parseOptions?: ParseOptions) => boolean;
/**
* Removes comments in HTML.
*/
declare const removeComments: (html: string) => string;
export { domToPmDoc, fragmentToHtml, getHtml, hasSameMarkup, htmlToFragment, parseContent, pmDocToFragment, setHtml, trimWhitespace };
export { domToPmDoc, fragmentToHtml, getHtml, hasSameMarkup, htmlToFragment, parseContent, pmDocToFragment, removeComments, setHtml, trimWhitespace };

@@ -162,3 +162,3 @@ 'use strict';

restoreStyleAttr(template.content);
return template.content;
return template.content.cloneNode(true);
};

@@ -236,2 +236,19 @@ /**

};
/**
* Removes comments in HTML.
*/
const removeComments = (html) => {
const fragment = htmlToFragment(html);
removeCommentsFromDom(fragment);
return fragmentToHtml(fragment);
};
const removeCommentsFromDom = (dom) => {
var _a;
const iterator = dom.ownerDocument.createNodeIterator(dom, NodeFilter.SHOW_COMMENT);
let commentNode = iterator.nextNode();
while (commentNode) {
(_a = commentNode.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(commentNode);
commentNode = iterator.nextNode();
}
};

@@ -245,3 +262,4 @@ exports.domToPmDoc = domToPmDoc;

exports.pmDocToFragment = pmDocToFragment;
exports.removeComments = removeComments;
exports.setHtml = setHtml;
exports.trimWhitespace = trimWhitespace;

@@ -270,3 +270,3 @@ 'use strict';

for (const style in styles) {
if (style && typeof element.style[style] !== 'undefined') {
if (style && element.style[style] !== undefined) {
element.style[style] = styles[style];

@@ -273,0 +273,0 @@ }

{
"name": "@progress/kendo-editor-common",
"description": "Kendo UI TypeScript package exporting functions for Editor component",
"version": "1.12.0",
"version": "1.12.1-develop.1",
"keywords": [

@@ -6,0 +6,0 @@ "Kendo UI"

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

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